[geos-commits] r3613 - in branches/3.3: . src/geomgraph
tests/unit/capi
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu Apr 12 05:05:59 EDT 2012
Author: strk
Date: 2012-04-12 02:05:59 -0700 (Thu, 12 Apr 2012)
New Revision: 3613
Modified:
branches/3.3/NEWS
branches/3.3/src/geomgraph/Node.cpp
branches/3.3/tests/unit/capi/GEOSUnaryUnionTest.cpp
Log:
Throw an exception rather than aborting on NaN overlay input (#530)
Modified: branches/3.3/NEWS
===================================================================
--- branches/3.3/NEWS 2012-04-10 17:01:58 UTC (rev 3612)
+++ branches/3.3/NEWS 2012-04-12 09:05:59 UTC (rev 3613)
@@ -2,6 +2,7 @@
2012-??-??
- Bug fixes / improvements
+ - Do not abort on NaN overlay input (#530)
- Reduce CommonBitsRemover harmful effects during overlay op (#527)
Changes in 3.3.3
Modified: branches/3.3/src/geomgraph/Node.cpp
===================================================================
--- branches/3.3/src/geomgraph/Node.cpp 2012-04-10 17:01:58 UTC (rev 3612)
+++ branches/3.3/src/geomgraph/Node.cpp 2012-04-12 09:05:59 UTC (rev 3613)
@@ -26,6 +26,7 @@
#include <geos/geomgraph/Label.h>
#include <geos/geomgraph/DirectedEdge.h>
#include <geos/geom/Location.h>
+#include <geos/util/IllegalArgumentException.h>
#include <cmath>
#include <string>
@@ -139,7 +140,12 @@
cerr<<"["<<this<<"] Node::add("<<e->print()<<")"<<endl;
#endif
// Assert: start pt of e is equal to node point
- assert(e->getCoordinate().equals2D(coord));
+ if ( ! e->getCoordinate().equals2D(coord) ) {
+ std::stringstream ss;
+ ss << "EdgeEnd with coordinate " << e->getCoordinate()
+ << " invalid for node " << coord;
+ throw util::IllegalArgumentException(ss.str());
+ }
// It seems it's legal for edges to be NULL
// we'd not be honouring the promise of adding
Modified: branches/3.3/tests/unit/capi/GEOSUnaryUnionTest.cpp
===================================================================
--- branches/3.3/tests/unit/capi/GEOSUnaryUnionTest.cpp 2012-04-10 17:01:58 UTC (rev 3612)
+++ branches/3.3/tests/unit/capi/GEOSUnaryUnionTest.cpp 2012-04-12 09:05:59 UTC (rev 3613)
@@ -193,5 +193,20 @@
));
}
+ // Self-union a geometry with NaN coordinates
+ // See http://trac.osgeo.org/geos/ticket/530
+ template<>
+ template<>
+ void object::test<9>()
+ {
+ const char* hexwkb = "010200000002000000000000000000F8FF000000000000F8FF0000000000000000000000000000F03F";
+ geom1_ = GEOSGeomFromHEX_buf((const unsigned char*)hexwkb, std::strlen(hexwkb));
+ ensure( 0 != geom1_ );
+
+ geom2_ = GEOSUnaryUnion(geom1_);
+ ensure( 0 == geom2_ );
+
+ }
+
} // namespace tut
More information about the geos-commits
mailing list