[geos-commits] r2301 - trunk/capi
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Mar 23 20:30:58 EDT 2009
Author: mloskot
Date: 2009-03-23 20:30:58 -0400 (Mon, 23 Mar 2009)
New Revision: 2301
Modified:
trunk/capi/geos_c.cpp
trunk/capi/geos_c.h.in
trunk/capi/geos_ts_c.cpp
Log:
REVERTED r2299: Fixed GEOSSetSRID_r missing, GEOSSetSRID duplicated (Ticket #242). A little of refactoring.
Modified: trunk/capi/geos_c.cpp
===================================================================
--- trunk/capi/geos_c.cpp 2009-03-24 00:19:33 UTC (rev 2300)
+++ trunk/capi/geos_c.cpp 2009-03-24 00:30:58 UTC (rev 2301)
@@ -455,17 +455,11 @@
}
int
-GEOSGetSRID(const Geometry *g)
+GEOSGetSRID(const Geometry *g1)
{
- return GEOSGetSRID_r( handle, g );
+ return GEOSGetSRID_r( handle, g1 );
}
-void
-GEOSSetSRID(Geometry *g, int srid)
-{
- GEOSSetSRID_r( handle, g, srid );
-}
-
char
GEOSHasZ(const Geometry *g)
{
Modified: trunk/capi/geos_c.h.in
===================================================================
--- trunk/capi/geos_c.h.in 2009-03-24 00:19:33 UTC (rev 2300)
+++ trunk/capi/geos_c.h.in 2009-03-24 00:30:58 UTC (rev 2301)
@@ -591,14 +591,13 @@
/* Return 0 on exception */
extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g1);
+extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
+
extern int GEOS_DLL GEOSGetSRID_r(GEOSContextHandle_t handle,
const GEOSGeometry* g1);
-extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int srid);
+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
* GeometryCollections or Multi* geometries here, and are likely to crash
Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp 2009-03-24 00:19:33 UTC (rev 2300)
+++ trunk/capi/geos_ts_c.cpp 2009-03-24 00:30:58 UTC (rev 2301)
@@ -1578,6 +1578,17 @@
}
}
+void
+GEOSSetSRID(Geometry *g, int SRID)
+{
+ assert(0 != g);
+ if (0 != g)
+ {
+ g->setSRID(SRID);
+ }
+}
+
+
int
GEOSGetNumCoordinates_r(GEOSContextHandle_t extHandle, const Geometry *g1)
{
@@ -2114,7 +2125,7 @@
#endif
std::vector<Geometry *>*geoms = new std::vector<Geometry *>(lines->size());
- for (std::size_t i = 0; i < lines->size(); ++i)
+ for (int i = 0; i < lines->size(); ++i)
{
(*geoms)[i] = (*lines)[i];
}
@@ -2140,10 +2151,8 @@
}
int
-GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry *g)
+GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry *g1)
{
- assert(0 != g);
-
if ( 0 == extHandle )
{
return 0;
@@ -2158,7 +2167,7 @@
try
{
- return g->getSRID();
+ return g1->getSRID();
}
catch (const std::exception &e)
{
@@ -2172,35 +2181,6 @@
return 0;
}
-void
-GEOSSetSRID_r(GEOSContextHandle_t extHandle, Geometry *g, int srid)
-{
- assert(0 != g);
-
- if ( 0 == extHandle )
- {
- return;
- }
-
- GEOSContextHandleInternal_t *handle = 0;
- handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
- if ( 0 != handle->initialized && 0 != g)
- {
- try
- {
- g->setSRID(srid);
- }
- catch (const std::exception &e)
- {
- handle->ERROR_MESSAGE("%s", e.what());
- }
- catch (...)
- {
- handle->ERROR_MESSAGE("Unknown exception thrown");
- }
- }
-}
-
const char* GEOSversion()
{
return GEOS_CAPI_VERSION;
More information about the geos-commits
mailing list