[geos-commits] r3060 - in trunk: php src/geom

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Jun 21 10:31:41 EDT 2010


Author: strk
Date: 2010-06-21 14:31:41 +0000 (Mon, 21 Jun 2010)
New Revision: 3060

Modified:
   trunk/php/TODO
   trunk/php/geos.c
   trunk/src/geom/GeometryCollection.cpp
   trunk/src/geom/LineString.cpp
   trunk/src/geom/Polygon.cpp
Log:
Switch back to unchecked getGeometryN, getPointN and getInteriorRingN, check them at the PHP level, for performance sake in C-land.


Modified: trunk/php/TODO
===================================================================
--- trunk/php/TODO	2010-06-21 10:30:48 UTC (rev 3059)
+++ trunk/php/TODO	2010-06-21 14:31:41 UTC (rev 3060)
@@ -1,6 +1,5 @@
 In order of priority
 
-- Add GEOSGeometry::Normalize (make non-mutating !)
 - Implement serialization/deserialization for Geometry
 - Documentation !! (doxygen-based?)
 - Find a way to have GEOSGeometry contents shown on var_dump

Modified: trunk/php/geos.c
===================================================================
--- trunk/php/geos.c	2010-06-21 10:30:48 UTC (rev 3059)
+++ trunk/php/geos.c	2010-06-21 14:31:41 UTC (rev 3060)
@@ -1269,6 +1269,7 @@
         RETURN_NULL();
     }
 
+    if ( num >= GEOSGetNumGeometries(geom) ) RETURN_NULL(); 
     c = GEOSGetGeometryN(geom, num);
     if ( ! c ) RETURN_NULL(); /* should get an exception first */
     cc = GEOSGeom_clone(c);
@@ -1361,6 +1362,7 @@
         RETURN_NULL();
     }
 
+    if ( num >= GEOSGetNumInteriorRings(geom) ) RETURN_NULL(); 
     c = GEOSGetInteriorRingN(geom, num);
     if ( ! c ) RETURN_NULL(); /* should get an exception first */
     cc = GEOSGeom_clone(c);
@@ -1455,6 +1457,7 @@
         RETURN_NULL();
     }
 
+    if ( num >= GEOSGeomGetNumPoints(geom) ) RETURN_NULL(); 
     c = GEOSGeomGetPointN(geom, num);
     if ( ! c ) RETURN_NULL(); /* should get an exception first */
 

Modified: trunk/src/geom/GeometryCollection.cpp
===================================================================
--- trunk/src/geom/GeometryCollection.cpp	2010-06-21 10:30:48 UTC (rev 3059)
+++ trunk/src/geom/GeometryCollection.cpp	2010-06-21 14:31:41 UTC (rev 3060)
@@ -148,7 +148,6 @@
 const Geometry*
 GeometryCollection::getGeometryN(size_t n) const
 {
-	if ( n >= geometries->size() ) return 0;
 	return (*geometries)[n];
 }
 

Modified: trunk/src/geom/LineString.cpp
===================================================================
--- trunk/src/geom/LineString.cpp	2010-06-21 10:30:48 UTC (rev 3059)
+++ trunk/src/geom/LineString.cpp	2010-06-21 14:31:41 UTC (rev 3060)
@@ -169,7 +169,6 @@
 {
 	assert(getFactory());
 	assert(points.get());
-	if ( n >= points->size() ) return 0;
 	return getFactory()->createPoint(points->getAt(n));
 }
 

Modified: trunk/src/geom/Polygon.cpp
===================================================================
--- trunk/src/geom/Polygon.cpp	2010-06-21 10:30:48 UTC (rev 3059)
+++ trunk/src/geom/Polygon.cpp	2010-06-21 14:31:41 UTC (rev 3060)
@@ -194,7 +194,6 @@
 const LineString*
 Polygon::getInteriorRingN(size_t n) const
 {
-	if ( n >= holes->size() ) return 0;
 	return (LineString *) (*holes)[n];
 }
 



More information about the geos-commits mailing list