[geos-commits] r3701 - in trunk: include/geos/triangulate src/triangulate
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed Jun 27 03:43:19 PDT 2012
Author: strk
Date: 2012-06-27 03:43:19 -0700 (Wed, 27 Jun 2012)
New Revision: 3701
Modified:
trunk/include/geos/triangulate/DelaunayTriangulationBuilder.h
trunk/src/triangulate/DelaunayTriangulationBuilder.cpp
Log:
Const-correct getTriangles / getEdges and move to proper namespace
Modified: trunk/include/geos/triangulate/DelaunayTriangulationBuilder.h
===================================================================
--- trunk/include/geos/triangulate/DelaunayTriangulationBuilder.h 2012-06-27 10:43:07 UTC (rev 3700)
+++ trunk/include/geos/triangulate/DelaunayTriangulationBuilder.h 2012-06-27 10:43:19 UTC (rev 3701)
@@ -23,18 +23,23 @@
namespace geos {
-namespace geom{
- class CoordinateSequence;
- class Geometry;
- class MultiLineString;
- class GeometryCollection;
- class GeometryFactory;
+ namespace geom{
+ class CoordinateSequence;
+ class Geometry;
+ class MultiLineString;
+ class GeometryCollection;
+ class GeometryFactory;
+ }
+ namespace triangulate {
+ namespace quadedge {
+ class QuadEdgeSubdivision;
+ }
+ }
}
+namespace geos {
namespace triangulate { //geos.triangulate
-namespace quadedge { //geos.triangulate.quadedge
-class QuadEdgeSubdivision;
/**
* A utility class which creates Delaunay Triangulations
@@ -67,7 +72,7 @@
private:
geom::CoordinateSequence* siteCoords;
double tolerance;
- QuadEdgeSubdivision *subdiv;
+ quadedge::QuadEdgeSubdivision *subdiv;
public:
/**
@@ -111,11 +116,11 @@
public:
/**
- * Gets the {@link QuadEdgeSubdivision} which models the computed triangulation.
+ * Gets the {@link quadedge::QuadEdgeSubdivision} which models the computed triangulation.
*
* @return the subdivision containing the triangulation
*/
- QuadEdgeSubdivision& getSubdivision();
+ quadedge::QuadEdgeSubdivision& getSubdivision();
/**
* Gets the edges of the computed triangulation as a {@link MultiLineString}.
@@ -123,7 +128,7 @@
* @param geomFact the geometry factory to use to create the output
* @return the edges of the triangulation. The caller takes ownership of the returned object.
*/
- std::auto_ptr<geom::MultiLineString> getEdges(geom::GeometryFactory &geomFact);
+ std::auto_ptr<geom::MultiLineString> getEdges(const geom::GeometryFactory &geomFact);
/**
* Gets the faces of the computed triangulation as a {@link GeometryCollection}
@@ -132,11 +137,10 @@
* @param geomFact the geometry factory to use to create the output
* @return the faces of the triangulation. The caller takes ownership of the returned object.
*/
- std::auto_ptr<geom::GeometryCollection> getTriangles(geom::GeometryFactory& geomFact);
+ std::auto_ptr<geom::GeometryCollection> getTriangles(const geom::GeometryFactory& geomFact);
};
-}//namespace geos.triangulate.quadedge
} //namespace geos.triangulate
} //namespace goes
Modified: trunk/src/triangulate/DelaunayTriangulationBuilder.cpp
===================================================================
--- trunk/src/triangulate/DelaunayTriangulationBuilder.cpp 2012-06-27 10:43:07 UTC (rev 3700)
+++ trunk/src/triangulate/DelaunayTriangulationBuilder.cpp 2012-06-27 10:43:19 UTC (rev 3701)
@@ -28,11 +28,11 @@
namespace geos {
namespace triangulate { //geos.triangulate
-namespace quadedge { //geos.triangulate.quadedge
using namespace geos::geom;
-CoordinateSequence* DelaunayTriangulationBuilder::extractUniqueCoordinates(
+CoordinateSequence*
+DelaunayTriangulationBuilder::extractUniqueCoordinates(
const Geometry& geom)
{
geom::CoordinateSequence *coords = geom.getCoordinates();
@@ -40,7 +40,8 @@
return coords;
}
-void DelaunayTriangulationBuilder::unique(CoordinateSequence& coords)
+void
+DelaunayTriangulationBuilder::unique(CoordinateSequence& coords)
{
std::vector<Coordinate> coordVector;
coords.toVector(coordVector);
@@ -49,7 +50,8 @@
coords.removeRepeatedPoints();
}
-IncrementalDelaunayTriangulator::VertexList* DelaunayTriangulationBuilder::toVertices(
+IncrementalDelaunayTriangulator::VertexList*
+DelaunayTriangulationBuilder::toVertices(
const CoordinateSequence &coords)
{
IncrementalDelaunayTriangulator::VertexList* vertexList =
@@ -57,7 +59,7 @@
for(size_t iter=0; iter < coords.size(); ++iter)
{
- vertexList->push_back(Vertex(coords.getAt(iter)));
+ vertexList->push_back(quadedge::Vertex(coords.getAt(iter)));
}
return vertexList;
}
@@ -75,7 +77,8 @@
delete subdiv;
}
-void DelaunayTriangulationBuilder::setSites(const Geometry& geom)
+void
+DelaunayTriangulationBuilder::setSites(const Geometry& geom)
{
if(siteCoords)
delete siteCoords;
@@ -83,7 +86,8 @@
siteCoords = extractUniqueCoordinates(geom);
}
-void DelaunayTriangulationBuilder::setSites(const CoordinateSequence& coords)
+void
+DelaunayTriangulationBuilder::setSites(const CoordinateSequence& coords)
{
if(siteCoords)
delete siteCoords;
@@ -92,7 +96,8 @@
unique(*siteCoords);
}
-void DelaunayTriangulationBuilder::create()
+void
+DelaunayTriangulationBuilder::create()
{
if(subdiv != NULL || siteCoords == NULL)
return;
@@ -100,33 +105,35 @@
Envelope siteEnv;
siteCoords ->expandEnvelope(siteEnv);
IncrementalDelaunayTriangulator::VertexList* vertices = toVertices(*siteCoords);
- subdiv = new QuadEdgeSubdivision(siteEnv, tolerance);
+ subdiv = new quadedge::QuadEdgeSubdivision(siteEnv, tolerance);
IncrementalDelaunayTriangulator triangulator = IncrementalDelaunayTriangulator(subdiv);
triangulator.insertSites(*vertices);
delete vertices;
}
-QuadEdgeSubdivision& DelaunayTriangulationBuilder::getSubdivision()
+quadedge::QuadEdgeSubdivision&
+DelaunayTriangulationBuilder::getSubdivision()
{
create();
return *subdiv;
}
-std::auto_ptr<MultiLineString> DelaunayTriangulationBuilder::getEdges(
- GeometryFactory& geomFact)
+std::auto_ptr<MultiLineString>
+DelaunayTriangulationBuilder::getEdges(
+ const GeometryFactory& geomFact)
{
create();
return subdiv->getEdges(geomFact);
}
-std::auto_ptr<geom::GeometryCollection> DelaunayTriangulationBuilder::getTriangles(
- geom::GeometryFactory& geomFact)
+std::auto_ptr<geom::GeometryCollection>
+DelaunayTriangulationBuilder::getTriangles(
+ const geom::GeometryFactory& geomFact)
{
create();
return subdiv->getTriangles(geomFact);
}
-}//namespace geos.triangulate.quadedge
} //namespace geos.triangulate
} //namespace goes
More information about the geos-commits
mailing list