[geos-commits] r3015 - trunk/capi
svn_geos at osgeo.org
svn_geos at osgeo.org
Sat Jun 19 07:25:02 EDT 2010
Author: strk
Date: 2010-06-19 11:25:02 +0000 (Sat, 19 Jun 2010)
New Revision: 3015
Modified:
trunk/capi/geos_ts_c.cpp
Log:
Handle exceptions from LenghtIndexedLine::project
Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp 2010-06-19 11:23:44 UTC (rev 3014)
+++ trunk/capi/geos_ts_c.cpp 2010-06-19 11:25:02 UTC (rev 3015)
@@ -5111,24 +5111,32 @@
const Geometry *g,
const Geometry *p)
{
+ if ( 0 == extHandle )
+ {
+ return -1.0;
+ }
+ GEOSContextHandleInternal_t *handle =
+ reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
+ if ( handle->initialized == 0 ) return -1.0;
+
const geos::geom::Point* point = dynamic_cast<const geos::geom::Point*>(p);
if (!point) {
- if ( 0 == extHandle )
- {
- return -1.0;
- }
- GEOSContextHandleInternal_t *handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
- if ( 0 == handle->initialized )
- {
- return -1.0;
- }
-
handle->ERROR_MESSAGE("third argument of GEOSProject_r must be Point*");
return -1.0;
}
+
const geos::geom::Coordinate* inputPt = p->getCoordinate();
- return geos::linearref::LengthIndexedLine(g).project(*inputPt);
+
+ try {
+ return geos::linearref::LengthIndexedLine(g).project(*inputPt);
+ } catch (const std::exception &e) {
+ handle->ERROR_MESSAGE("%s", e.what());
+ return -1.0;
+ } catch (...) {
+ handle->ERROR_MESSAGE("Unknown exception thrown");
+ return -1.0;
+ }
}
More information about the geos-commits
mailing list