[geos-commits] r3288 - trunk/tests/unit/algorithm/CGAlgorithms
svn_geos at osgeo.org
svn_geos at osgeo.org
Tue Apr 19 03:57:14 EDT 2011
Author: strk
Date: 2011-04-19 00:57:14 -0700 (Tue, 19 Apr 2011)
New Revision: 3288
Modified:
trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp
Log:
Add test for IsCCW against the two almost-collapsed rings resulting by GEOS or JTS during execution of the union described in ticket #398. This is done after confirmation of same results in JTS (1 bit makes the difference between CCW and CW orientation).
Modified: trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp 2011-04-18 21:45:20 UTC (rev 3287)
+++ trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp 2011-04-19 07:57:14 UTC (rev 3288)
@@ -12,10 +12,12 @@
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/Coordinate.h>
#include <geos/io/WKTReader.h>
+#include <geos/io/WKBReader.h>
// std
#include <string>
#include <memory>
#include <cassert>
+#include <sstream>
using namespace geos::algorithm;
@@ -31,6 +33,7 @@
geos::geom::CoordinateSequence* cs_;
geos::io::WKTReader reader_;
+ geos::io::WKBReader breader_;
test_isccw_data()
: cs_(0)
@@ -96,5 +99,33 @@
ensure_equals( true, isCCW );
}
+ // 4 - Test orientation the narrow (almost collapsed) ring
+ // resulting in GEOS during execution of the union described
+ // in http://trac.osgeo.org/geos/ticket/398
+ template<>
+ template<>
+ void object::test<4>()
+ {
+ std::istringstream wkt("0102000000040000000000000000000000841D588465963540F56BFB214F0341408F26B714B2971B40F66BFB214F0341408C26B714B2971B400000000000000000841D588465963540");
+ GeometryPtr geom(breader_.readHEX(wkt));
+ cs_ = geom->getCoordinates();
+ bool isCCW = CGAlgorithms::isCCW(cs_);
+ ensure_equals( isCCW, false );
+ }
+
+ // 5 - Test orientation the narrow (almost collapsed) ring
+ // resulting in JTS during execution of the union described
+ // in http://trac.osgeo.org/geos/ticket/398
+ template<>
+ template<>
+ void object::test<5>()
+ {
+ std::istringstream wkt("0102000000040000000000000000000000841D588465963540F56BFB214F0341408F26B714B2971B40F66BFB214F0341408E26B714B2971B400000000000000000841D588465963540");
+ GeometryPtr geom(breader_.readHEX(wkt));
+ cs_ = geom->getCoordinates();
+ bool isCCW = CGAlgorithms::isCCW(cs_);
+ ensure_equals( isCCW, true );
+ }
+
} // namespace tut
More information about the geos-commits
mailing list