[geos-commits] r2491 - trunk/capi
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu May 7 12:15:42 EDT 2009
Author: strk
Date: 2009-05-07 12:15:42 -0400 (Thu, 07 May 2009)
New Revision: 2491
Modified:
trunk/capi/geos_c.cpp
trunk/capi/geos_c.h.in
trunk/capi/geos_ts_c.cpp
Log:
Add "thread-safe" version of GEOSGeom_setSRID. Closes bug #242.
Modified: trunk/capi/geos_c.cpp
===================================================================
--- trunk/capi/geos_c.cpp 2009-05-07 16:00:46 UTC (rev 2490)
+++ trunk/capi/geos_c.cpp 2009-05-07 16:15:42 UTC (rev 2491)
@@ -460,6 +460,12 @@
return GEOSGetSRID_r( handle, g );
}
+void
+GEOSSetSRID(Geometry *g, int srid)
+{
+ return GEOSSetSRID_r( handle, g, srid );
+}
+
char
GEOSHasZ(const Geometry *g)
{
Modified: trunk/capi/geos_c.h.in
===================================================================
--- trunk/capi/geos_c.h.in 2009-05-07 16:00:46 UTC (rev 2490)
+++ trunk/capi/geos_c.h.in 2009-05-07 16:15:42 UTC (rev 2491)
@@ -593,13 +593,12 @@
/* Return 0 on exception */
extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g);
-
-extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
-
extern int GEOS_DLL GEOSGetSRID_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
+extern void GEOS_DLL GEOSSetSRID_r(GEOSContextHandle_t handle,
+ GEOSGeometry* g, int SRID);
/* May be called on all geometries in GEOS 3.x, returns -1 on error and 1
* for non-multi geometries. Older GEOS versions only accept
Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp 2009-05-07 16:00:46 UTC (rev 2490)
+++ trunk/capi/geos_ts_c.cpp 2009-05-07 16:15:42 UTC (rev 2491)
@@ -1579,13 +1579,23 @@
}
void
-GEOSSetSRID(Geometry *g, int srid)
+GEOSSetSRID_r(GEOSContextHandle_t extHandle, Geometry *g, int srid)
{
assert(0 != g);
- if (0 != g)
+
+ if ( 0 == extHandle )
{
- g->setSRID(srid);
+ return;
}
+
+ GEOSContextHandleInternal_t *handle = 0;
+ handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
+ if ( 0 == handle->initialized )
+ {
+ return;
+ }
+
+ g->setSRID(srid);
}
More information about the geos-commits
mailing list