[geos-commits] r3188 - trunk/src/operation/union

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Feb 7 12:00:45 EST 2011


Author: strk
Date: 2011-02-07 09:00:45 -0800 (Mon, 07 Feb 2011)
New Revision: 3188

Modified:
   trunk/src/operation/union/PointGeometryUnion.cpp
Log:
Fix casts

Modified: trunk/src/operation/union/PointGeometryUnion.cpp
===================================================================
--- trunk/src/operation/union/PointGeometryUnion.cpp	2011-02-07 15:41:32 UTC (rev 3187)
+++ trunk/src/operation/union/PointGeometryUnion.cpp	2011-02-07 17:00:45 UTC (rev 3188)
@@ -18,6 +18,7 @@
  **********************************************************************/
 
 #include <memory> // for auto_ptr
+#include <cassert> // for assert
 #include <algorithm> // for copy
 #include <geos/operation/union/PointGeometryUnion.h> 
 #include <geos/geom/Coordinate.h> 
@@ -47,9 +48,9 @@
   std::set<Coordinate> exteriorCoords;
 
   for (std::size_t i=0, n=pointGeom.getNumGeometries(); i<n; ++i) {
-      assert(dynamic_cast<const Point*>(pointGeom.getGeometryN(i)));
-      const Point& point = *(static_cast<const Point*>(pointGeom.getGeometryN(i)));
-      const Coordinate* coord = point.getCoordinate();
+      const Point* point = dynamic_cast<const Point*>(pointGeom.getGeometryN(i));
+      assert(point);
+      const Coordinate* coord = point->getCoordinate();
       int loc = locater.locate(*coord, &otherGeom);
       if (loc == Location::EXTERIOR)
               exteriorCoords.insert(*coord);



More information about the geos-commits mailing list