[geos-commits] r2923 - in trunk: .
include/geos/operation/polygonize src/operation/polygonize
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Feb 22 16:51:22 EST 2010
Author: strk
Date: 2010-02-22 16:51:22 -0500 (Mon, 22 Feb 2010)
New Revision: 2923
Modified:
trunk/NEWS
trunk/include/geos/operation/polygonize/Polygonizer.h
trunk/src/operation/polygonize/Polygonizer.cpp
Log:
Drop HEAP allocation for dangles vector too, and document all these API changes
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2010-02-22 21:41:13 UTC (rev 2922)
+++ trunk/NEWS 2010-02-22 21:51:22 UTC (rev 2923)
@@ -7,6 +7,9 @@
GEOSGeom_createEmptyPolygon_r, GEOSGeom_createEmptyCollection_r
- CAPI: GEOSGeom_extractUniquePoints_r
- CAPI: GEOSGetGeometryN support for single geometries
+- C++ API changes:
+ - Polygonizer::getCutEdges returns a const reference
+ - Polygonizer::getDangles returns a const reference
Changes in 3.2.0
Modified: trunk/include/geos/operation/polygonize/Polygonizer.h
===================================================================
--- trunk/include/geos/operation/polygonize/Polygonizer.h 2010-02-22 21:41:13 UTC (rev 2922)
+++ trunk/include/geos/operation/polygonize/Polygonizer.h 2010-02-22 21:51:22 UTC (rev 2923)
@@ -113,7 +113,7 @@
PolygonizeGraph *graph;
// initialize with empty collections, in case nothing is computed
- std::vector<const geom::LineString*> *dangles;
+ std::vector<const geom::LineString*> dangles;
std::vector<const geom::LineString*> cutEdges;
std::vector<geom::LineString*> *invalidRingLines;
@@ -183,24 +183,19 @@
/** \brief
* Get the list of dangling lines found during polygonization.
*
- * @return a collection of the input LineStrings which are dangles.
- * ownership of vector is retained by this object while
- * elements will be pointers to inside the input.
+ * @return a (possibly empty) collection of pointers to
+ * the input LineStrings which are dangles.
*
- * TODO: return by const vector reference instead !
*/
- std::vector<const geom::LineString*>* getDangles();
+ const std::vector<const geom::LineString*>& getDangles();
/** \brief
* Get the list of cut edges found during polygonization.
*
- * @return a (possibly empty) reference to collection of the input
- * LineStrings which are cut edges. Ownership of vector
- * retained by this object while elements will be pointers
- * to inside the input.
+ * @return a (possibly empty) collection of pointers to
+ * the input LineStrings which are cut edges.
*
- * TODO: return by const vector reference instead !
*/
const std::vector<const geom::LineString*>& getCutEdges();
Modified: trunk/src/operation/polygonize/Polygonizer.cpp
===================================================================
--- trunk/src/operation/polygonize/Polygonizer.cpp 2010-02-22 21:41:13 UTC (rev 2922)
+++ trunk/src/operation/polygonize/Polygonizer.cpp 2010-02-22 21:51:22 UTC (rev 2923)
@@ -62,7 +62,7 @@
Polygonizer::Polygonizer():
lineStringAdder(new Polygonizer::LineStringAdder(this)),
graph(NULL),
- dangles(NULL),
+ dangles(),
cutEdges(),
invalidRingLines(NULL),
holeList(NULL),
@@ -74,7 +74,6 @@
Polygonizer::~Polygonizer()
{
delete lineStringAdder;
- delete dangles;
delete graph;
delete holeList;
@@ -184,21 +183,15 @@
return ret;
}
-/*
- * Get the list of dangling lines found during polygonization.
- * @return a collection of dangles LineStrings from input.
- */
-vector<const LineString*>*
+/* public */
+const vector<const LineString*>&
Polygonizer::getDangles()
{
polygonize();
return dangles;
}
-/*
- * Get the list of cut edges found during polygonization.
- * @return a collection of the input {@LineStrings} which are cut edges
- */
+/* public */
const vector<const LineString*>&
Polygonizer::getCutEdges()
{
@@ -219,9 +212,7 @@
return ret;
}
-/*
- * Perform the polygonization, if it has not already been carried out.
- */
+/* public */
void
Polygonizer::polygonize()
{
@@ -233,9 +224,7 @@
// if no geometries were supplied it's possible graph could be null
if (graph==NULL) return;
- // TODO: drop this heap allocation
- dangles = new std::vector<const LineString*>();
- graph->deleteDangles(*dangles);
+ graph->deleteDangles(dangles);
graph->deleteCutEdges(cutEdges);
More information about the geos-commits
mailing list