From svn_geos at osgeo.org Thu Feb 4 23:59:36 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Thu, 4 Feb 2016 23:59:36 -0800 Subject: [geos-commits] r4142 - trunk/src/io Message-ID: <20160205075936.A632D390138@trac.osgeo.org> Author: strk Date: 2016-02-04 23:59:36 -0800 (Thu, 04 Feb 2016) New Revision: 4142 Modified: trunk/src/io/StringTokenizer.cpp Log: Include in StringTokenizer Patch by Jeff Mckenna See #766 Modified: trunk/src/io/StringTokenizer.cpp =================================================================== --- trunk/src/io/StringTokenizer.cpp 2016-01-20 00:03:10 UTC (rev 4141) +++ trunk/src/io/StringTokenizer.cpp 2016-02-05 07:59:36 UTC (rev 4142) @@ -21,6 +21,7 @@ #include #include +#include using namespace std; From svn_geos at osgeo.org Fri Feb 5 00:00:41 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Fri, 5 Feb 2016 00:00:41 -0800 Subject: [geos-commits] r4143 - in branches/3.5: . src/io Message-ID: <20160205080041.072EF390138@trac.osgeo.org> Author: strk Date: 2016-02-05 00:00:40 -0800 (Fri, 05 Feb 2016) New Revision: 4143 Modified: branches/3.5/NEWS branches/3.5/src/io/StringTokenizer.cpp Log: Include in StringTokenizer Patch by Jeff Mckenna Closes #766 Modified: branches/3.5/NEWS =================================================================== --- branches/3.5/NEWS 2016-02-05 07:59:36 UTC (rev 4142) +++ branches/3.5/NEWS 2016-02-05 08:00:40 UTC (rev 4143) @@ -7,6 +7,7 @@ - Fix GeometryEditor to correctly update factory of empty geometries (#749) - Fix snapping of last segment of a closed linestring (#758) - Fix memory exhaustion case in isvalid (#757) + - Fix Windows build with Visual Studio 2008 (#766) Changes in 3.5.0 2015-08-15 Modified: branches/3.5/src/io/StringTokenizer.cpp =================================================================== --- branches/3.5/src/io/StringTokenizer.cpp 2016-02-05 07:59:36 UTC (rev 4142) +++ branches/3.5/src/io/StringTokenizer.cpp 2016-02-05 08:00:40 UTC (rev 4143) @@ -21,6 +21,7 @@ #include #include +#include using namespace std; From svn_geos at osgeo.org Wed Feb 17 02:52:55 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Wed, 17 Feb 2016 02:52:55 -0800 Subject: [geos-commits] r4144 - trunk/tests/unit/capi Message-ID: <20160217105255.41FCA39037E@trac.osgeo.org> Author: mloskot Date: 2016-02-17 02:52:55 -0800 (Wed, 17 Feb 2016) New Revision: 4144 Added: trunk/tests/unit/capi/GEOSGeom_createCollection.cpp Log: Add test for GEOSGeom_createCollection function Added: trunk/tests/unit/capi/GEOSGeom_createCollection.cpp =================================================================== --- trunk/tests/unit/capi/GEOSGeom_createCollection.cpp (rev 0) +++ trunk/tests/unit/capi/GEOSGeom_createCollection.cpp 2016-02-17 10:52:55 UTC (rev 4144) @@ -0,0 +1,110 @@ +// +// Test Suite for C-API GEOSGeom_createCollection + +#include +// geos +#include +// std +#include +#include +#include +#include +#include +#include +#include + +namespace tut +{ + // + // Test Group + // + + // Common data used in test cases. + struct test_capigeosgeom_createcollection_data + { + GEOSContextHandle_t handle_; + GEOSGeom geom_; // collection result + enum { geom_size = 3 }; + + static void notice(const char *fmt, ...) + { + std::fprintf( stdout, "NOTICE: "); + + va_list ap; + va_start(ap, fmt); + std::vfprintf(stdout, fmt, ap); + va_end(ap); + + std::fprintf(stdout, "\n"); + } + + test_capigeosgeom_createcollection_data() + : geom_(0), handle_(initGEOS_r(notice, notice)) + { + } + + ~test_capigeosgeom_createcollection_data() + { + GEOSGeom_destroy(geom_); geom_ = 0; + finishGEOS_r(handle_); + } + }; + + typedef test_group group; + typedef group::object object; + + group test_capigeosgeom_createcollection_group("capi::GEOSGeom_createCollection"); + + // + // Test Cases + // + + // Create collection from constant length C-array + template<> + template<> + void object::test<1>() + { + GEOSGeom geoms[geom_size]; + geoms[0] = GEOSGeom_createEmptyPoint_r(handle_); + geoms[1] = GEOSGeom_createEmptyPoint_r(handle_); + geoms[2] = GEOSGeom_createEmptyPoint_r(handle_); + // takes ownership of individual geometries + geom_ = GEOSGeom_createCollection_r(handle_, GEOS_MULTIPOINT, geoms, geom_size); + ensure_equals(GEOSGetNumGeometries_r(handle_, geom_), geom_size); + } + + // Create collection from constant length std::array + template<> + template<> + void object::test<2>() + { + std::array geoms = { + GEOSGeom_createEmptyPoint_r(handle_), + GEOSGeom_createEmptyPoint_r(handle_), + GEOSGeom_createEmptyPoint_r(handle_) + }; + // takes ownership of individual geometries + geom_ = GEOSGeom_createCollection_r(handle_, GEOS_MULTIPOINT, + geoms.data(), static_cast(geoms.size())); + ensure_equals(GEOSGetNumGeometries_r(handle_, geom_), geom_size); + } + + // Create collection from dynamic length std::vector of geometries + template<> + template<> + void object::test<3>() + { + std::vector geoms; + geoms.push_back(GEOSGeom_createEmptyPoint_r(handle_)); + geoms.push_back(GEOSGeom_createEmptyPoint_r(handle_)); + geoms.push_back(GEOSGeom_createEmptyPoint_r(handle_)); + geoms.push_back(GEOSGeom_createEmptyPoint_r(handle_)); + geoms.push_back(GEOSGeom_createEmptyPoint_r(handle_)); + // takes ownership of individual geometries + geom_ = GEOSGeom_createCollection_r(handle_, GEOS_MULTIPOINT, + geoms.data(), static_cast(geoms.size())); + ensure_equals(GEOSGetNumGeometries_r(handle_, geom_), geoms.size()); + } + +} // namespace tut + From svn_geos at osgeo.org Wed Feb 17 03:15:50 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Wed, 17 Feb 2016 03:15:50 -0800 Subject: [geos-commits] r4145 - trunk/tests/unit/capi Message-ID: <20160217111550.9305239033E@trac.osgeo.org> Author: mloskot Date: 2016-02-17 03:15:50 -0800 (Wed, 17 Feb 2016) New Revision: 4145 Modified: trunk/tests/unit/capi/GEOSGeom_createCollection.cpp Log: Enable test case using std::array only if C++0x is available. Modified: trunk/tests/unit/capi/GEOSGeom_createCollection.cpp =================================================================== --- trunk/tests/unit/capi/GEOSGeom_createCollection.cpp 2016-02-17 10:52:55 UTC (rev 4144) +++ trunk/tests/unit/capi/GEOSGeom_createCollection.cpp 2016-02-17 11:15:50 UTC (rev 4145) @@ -73,6 +73,7 @@ ensure_equals(GEOSGetNumGeometries_r(handle_, geom_), geom_size); } +#if (defined(_MSC_VER) && _MSC_VER >= 1600) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__) // Create collection from constant length std::array template<> template<> @@ -88,6 +89,7 @@ geoms.data(), static_cast(geoms.size())); ensure_equals(GEOSGetNumGeometries_r(handle_, geom_), geom_size); } +#endif // Create collection from dynamic length std::vector of geometries template<> From svn_geos at osgeo.org Wed Feb 17 03:40:35 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Wed, 17 Feb 2016 03:40:35 -0800 Subject: [geos-commits] r4146 - trunk/tests/unit/capi Message-ID: <20160217114036.045CC39033E@trac.osgeo.org> Author: mloskot Date: 2016-02-17 03:40:35 -0800 (Wed, 17 Feb 2016) New Revision: 4146 Modified: trunk/tests/unit/capi/GEOSGeom_createCollection.cpp Log: #include only if C++0x is available (refines r4145) Modified: trunk/tests/unit/capi/GEOSGeom_createCollection.cpp =================================================================== --- trunk/tests/unit/capi/GEOSGeom_createCollection.cpp 2016-02-17 11:15:50 UTC (rev 4145) +++ trunk/tests/unit/capi/GEOSGeom_createCollection.cpp 2016-02-17 11:40:35 UTC (rev 4146) @@ -5,7 +5,9 @@ // geos #include // std +#if (defined(_MSC_VER) && _MSC_VER >= 1600) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__) #include +#endif #include #include #include From svn_geos at osgeo.org Mon Feb 22 09:06:00 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Mon, 22 Feb 2016 09:06:00 -0800 Subject: [geos-commits] r4147 - trunk/src/algorithm Message-ID: <20160222170600.BB9D63901D9@trac.osgeo.org> Author: strk Date: 2016-02-22 09:06:00 -0800 (Mon, 22 Feb 2016) New Revision: 4147 Modified: trunk/src/algorithm/RobustDeterminant.cpp Log: ! FINITE already includes NAN, duplicate test unneeded Modified: trunk/src/algorithm/RobustDeterminant.cpp =================================================================== --- trunk/src/algorithm/RobustDeterminant.cpp 2016-02-17 11:40:35 UTC (rev 4146) +++ trunk/src/algorithm/RobustDeterminant.cpp 2016-02-22 17:06:00 UTC (rev 4147) @@ -59,8 +59,7 @@ double k; // Protect against non-finite numbers - if ( ISNAN(x1) || ISNAN(y1) || ISNAN(x2) || ISNAN(y2) || - !FINITE(x1) || !FINITE(y1) || !FINITE(x2) || !FINITE(y2) ) + if ( !FINITE(x1) || !FINITE(y1) || !FINITE(x2) || !FINITE(y2) ) { throw util::IllegalArgumentException("RobustDeterminant encountered non-finite numbers "); } From svn_geos at osgeo.org Mon Feb 22 09:24:16 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Mon, 22 Feb 2016 09:24:16 -0800 Subject: [geos-commits] r4148 - branches/3.4/tests/unit/capi Message-ID: <20160222172416.266AA3901D9@trac.osgeo.org> Author: strk Date: 2016-02-22 09:24:16 -0800 (Mon, 22 Feb 2016) New Revision: 4148 Modified: branches/3.4/tests/unit/capi/GEOSPreparedGeometryTest.cpp Log: Fix expected test result to match the one in trunk. Closes #751 Modified: branches/3.4/tests/unit/capi/GEOSPreparedGeometryTest.cpp =================================================================== --- branches/3.4/tests/unit/capi/GEOSPreparedGeometryTest.cpp 2016-02-22 17:06:00 UTC (rev 4147) +++ branches/3.4/tests/unit/capi/GEOSPreparedGeometryTest.cpp 2016-02-22 17:24:16 UTC (rev 4148) @@ -186,7 +186,7 @@ ensure(0 != prepGeom1_); int ret = GEOSPreparedIntersects(prepGeom1_, geom2_); - ensure_equals(ret, 1); + ensure_equals(ret, 0); } // Test PreparedIntersects: point on vertex From svn_geos at osgeo.org Wed Feb 24 03:39:07 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Wed, 24 Feb 2016 03:39:07 -0800 Subject: [geos-commits] r4149 - in trunk: include/geos/algorithm src/algorithm src/geom/prep tests/unit/algorithm Message-ID: <20160224113907.4ACC03901D9@trac.osgeo.org> Author: strk Date: 2016-02-24 03:39:07 -0800 (Wed, 24 Feb 2016) New Revision: 4149 Modified: trunk/include/geos/algorithm/PointLocator.h trunk/src/algorithm/PointLocator.cpp trunk/src/geom/prep/PreparedPoint.cpp trunk/tests/unit/algorithm/PointLocatorTest.cpp Log: Fix incorrect return from PreparedPoint::intersects Includes unit test Patch by Daniel Baston via https://github.com/libgeos/libgeos/pull/60 See #764 Reverts r4081 Modified: trunk/include/geos/algorithm/PointLocator.h =================================================================== --- trunk/include/geos/algorithm/PointLocator.h 2016-02-22 17:24:16 UTC (rev 4148) +++ trunk/include/geos/algorithm/PointLocator.h 2016-02-24 11:39:07 UTC (rev 4149) @@ -31,6 +31,7 @@ class LinearRing; class LineString; class Polygon; + class Point; } } @@ -93,6 +94,8 @@ void updateLocationInfo(int loc); + int locate(const geom::Coordinate& p, const geom::Point *pt); + int locate(const geom::Coordinate& p, const geom::LineString *l); int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring); Modified: trunk/src/algorithm/PointLocator.cpp =================================================================== --- trunk/src/algorithm/PointLocator.cpp 2016-02-22 17:24:16 UTC (rev 4148) +++ trunk/src/algorithm/PointLocator.cpp 2016-02-24 11:39:07 UTC (rev 4149) @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -61,9 +62,12 @@ void PointLocator::computeLocation(const Coordinate& p, const Geometry *geom) { - - if (const LineString *ls=dynamic_cast(geom)) + if (const Point *pt=dynamic_cast(geom)) { + updateLocationInfo(locate(p, pt)); + } + else if (const LineString *ls=dynamic_cast(geom)) + { updateLocationInfo(locate(p, ls)); } else if (const Polygon *po=dynamic_cast(geom)) @@ -111,6 +115,17 @@ /* private */ int +PointLocator::locate(const Coordinate& p, const Point *pt) +{ + // no point in doing envelope test, since equality test is just as fast + const Coordinate *ptCoord = pt->getCoordinate(); + if (ptCoord->equals2D(p)) + return Location::INTERIOR; + return Location::EXTERIOR; +} + +/* private */ +int PointLocator::locate(const Coordinate& p, const LineString *l) { const CoordinateSequence* pt=l->getCoordinatesRO(); Modified: trunk/src/geom/prep/PreparedPoint.cpp =================================================================== --- trunk/src/geom/prep/PreparedPoint.cpp 2016-02-22 17:24:16 UTC (rev 4148) +++ trunk/src/geom/prep/PreparedPoint.cpp 2016-02-24 11:39:07 UTC (rev 4149) @@ -18,7 +18,6 @@ #include -#include namespace geos { namespace geom { // geos.geom @@ -29,10 +28,6 @@ { if (! envelopesIntersect( g)) return false; - const Point *pt_geom = dynamic_cast(g); - if (pt_geom) - return getGeometry().equals(g); - // This avoids computing topology for the test geometry return isAnyTargetComponentInTest( g); } Modified: trunk/tests/unit/algorithm/PointLocatorTest.cpp =================================================================== --- trunk/tests/unit/algorithm/PointLocatorTest.cpp 2016-02-22 17:24:16 UTC (rev 4148) +++ trunk/tests/unit/algorithm/PointLocatorTest.cpp 2016-02-24 11:39:07 UTC (rev 4149) @@ -96,8 +96,15 @@ runPtLocator(Location::EXTERIOR, Coordinate(11, 11), "LINEARRING(10 10, 10 20, 20 10, 10 10)"); } - + // 5 - TestPointLocator Point inside MultiPoint + template<> + template<> + void object::test<5>() + { + runPtLocator(Location::INTERIOR, Coordinate(0, 0), + "MULTIPOINT ((1 1), (0 0))"); + } } // namespace tut From svn_geos at osgeo.org Wed Feb 24 03:50:47 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Wed, 24 Feb 2016 03:50:47 -0800 Subject: [geos-commits] r4150 - in branches/3.5: . include/geos/algorithm src/algorithm src/geom/prep tests/unit/algorithm Message-ID: <20160224115047.A2EAC3901D9@trac.osgeo.org> Author: strk Date: 2016-02-24 03:50:47 -0800 (Wed, 24 Feb 2016) New Revision: 4150 Modified: branches/3.5/NEWS branches/3.5/include/geos/algorithm/PointLocator.h branches/3.5/src/algorithm/PointLocator.cpp branches/3.5/src/geom/prep/PreparedPoint.cpp branches/3.5/tests/unit/algorithm/PointLocatorTest.cpp Log: Fix incorrect return from PreparedPoint::intersects Includes unit test Patch by Daniel Baston via https://github.com/libgeos/libgeos/pull/60 See #764 (for 3.5 branch) Reverts r4081 Modified: branches/3.5/NEWS =================================================================== --- branches/3.5/NEWS 2016-02-24 11:39:07 UTC (rev 4149) +++ branches/3.5/NEWS 2016-02-24 11:50:47 UTC (rev 4150) @@ -8,6 +8,7 @@ - Fix snapping of last segment of a closed linestring (#758) - Fix memory exhaustion case in isvalid (#757) - Fix Windows build with Visual Studio 2008 (#766) + - Fix incorrect return from prepared multipoint intersects (#764) Changes in 3.5.0 2015-08-15 Modified: branches/3.5/include/geos/algorithm/PointLocator.h =================================================================== --- branches/3.5/include/geos/algorithm/PointLocator.h 2016-02-24 11:39:07 UTC (rev 4149) +++ branches/3.5/include/geos/algorithm/PointLocator.h 2016-02-24 11:50:47 UTC (rev 4150) @@ -31,6 +31,7 @@ class LinearRing; class LineString; class Polygon; + class Point; } } @@ -93,6 +94,8 @@ void updateLocationInfo(int loc); + int locate(const geom::Coordinate& p, const geom::Point *pt); + int locate(const geom::Coordinate& p, const geom::LineString *l); int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring); Modified: branches/3.5/src/algorithm/PointLocator.cpp =================================================================== --- branches/3.5/src/algorithm/PointLocator.cpp 2016-02-24 11:39:07 UTC (rev 4149) +++ branches/3.5/src/algorithm/PointLocator.cpp 2016-02-24 11:50:47 UTC (rev 4150) @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -61,9 +62,12 @@ void PointLocator::computeLocation(const Coordinate& p, const Geometry *geom) { - - if (const LineString *ls=dynamic_cast(geom)) + if (const Point *pt=dynamic_cast(geom)) { + updateLocationInfo(locate(p, pt)); + } + else if (const LineString *ls=dynamic_cast(geom)) + { updateLocationInfo(locate(p, ls)); } else if (const Polygon *po=dynamic_cast(geom)) @@ -111,6 +115,17 @@ /* private */ int +PointLocator::locate(const Coordinate& p, const Point *pt) +{ + // no point in doing envelope test, since equality test is just as fast + const Coordinate *ptCoord = pt->getCoordinate(); + if (ptCoord->equals2D(p)) + return Location::INTERIOR; + return Location::EXTERIOR; +} + +/* private */ +int PointLocator::locate(const Coordinate& p, const LineString *l) { const CoordinateSequence* pt=l->getCoordinatesRO(); Modified: branches/3.5/src/geom/prep/PreparedPoint.cpp =================================================================== --- branches/3.5/src/geom/prep/PreparedPoint.cpp 2016-02-24 11:39:07 UTC (rev 4149) +++ branches/3.5/src/geom/prep/PreparedPoint.cpp 2016-02-24 11:50:47 UTC (rev 4150) @@ -18,7 +18,6 @@ #include -#include namespace geos { namespace geom { // geos.geom @@ -29,10 +28,6 @@ { if (! envelopesIntersect( g)) return false; - const Point *pt_geom = dynamic_cast(g); - if (pt_geom) - return getGeometry().equals(g); - // This avoids computing topology for the test geometry return isAnyTargetComponentInTest( g); } Modified: branches/3.5/tests/unit/algorithm/PointLocatorTest.cpp =================================================================== --- branches/3.5/tests/unit/algorithm/PointLocatorTest.cpp 2016-02-24 11:39:07 UTC (rev 4149) +++ branches/3.5/tests/unit/algorithm/PointLocatorTest.cpp 2016-02-24 11:50:47 UTC (rev 4150) @@ -96,8 +96,15 @@ runPtLocator(Location::EXTERIOR, Coordinate(11, 11), "LINEARRING(10 10, 10 20, 20 10, 10 10)"); } - + // 5 - TestPointLocator Point inside MultiPoint + template<> + template<> + void object::test<5>() + { + runPtLocator(Location::INTERIOR, Coordinate(0, 0), + "MULTIPOINT ((1 1), (0 0))"); + } } // namespace tut From svn_geos at osgeo.org Wed Feb 24 03:51:00 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Wed, 24 Feb 2016 03:51:00 -0800 Subject: [geos-commits] r4151 - in branches/3.4: . include/geos/algorithm src/algorithm src/geom/prep tests/unit/algorithm Message-ID: <20160224115100.58C853901D9@trac.osgeo.org> Author: strk Date: 2016-02-24 03:51:00 -0800 (Wed, 24 Feb 2016) New Revision: 4151 Modified: branches/3.4/NEWS branches/3.4/include/geos/algorithm/PointLocator.h branches/3.4/src/algorithm/PointLocator.cpp branches/3.4/src/geom/prep/PreparedPoint.cpp branches/3.4/tests/unit/algorithm/PointLocatorTest.cpp Log: Fix incorrect return from PreparedPoint::intersects Includes unit test Patch by Daniel Baston via https://github.com/libgeos/libgeos/pull/60 Closes #764 (3.4 branch) Reverts r4132 Modified: branches/3.4/NEWS =================================================================== --- branches/3.4/NEWS 2016-02-24 11:50:47 UTC (rev 4150) +++ branches/3.4/NEWS 2016-02-24 11:51:00 UTC (rev 4151) @@ -18,6 +18,7 @@ - Update for Microsoft NMAKE (r4063) - Fix compilation issues while building with Visual C++ (#701) - Fix support of PHP bindings for version < 5.4.0 (#709) + - Fix incorrect return from prepared multipoint intersects (#764) Changes in 3.4.2 2013-08-25 Modified: branches/3.4/include/geos/algorithm/PointLocator.h =================================================================== --- branches/3.4/include/geos/algorithm/PointLocator.h 2016-02-24 11:50:47 UTC (rev 4150) +++ branches/3.4/include/geos/algorithm/PointLocator.h 2016-02-24 11:51:00 UTC (rev 4151) @@ -31,6 +31,7 @@ class LinearRing; class LineString; class Polygon; + class Point; } } @@ -93,6 +94,8 @@ void updateLocationInfo(int loc); + int locate(const geom::Coordinate& p, const geom::Point *pt); + int locate(const geom::Coordinate& p, const geom::LineString *l); int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring); Modified: branches/3.4/src/algorithm/PointLocator.cpp =================================================================== --- branches/3.4/src/algorithm/PointLocator.cpp 2016-02-24 11:50:47 UTC (rev 4150) +++ branches/3.4/src/algorithm/PointLocator.cpp 2016-02-24 11:51:00 UTC (rev 4151) @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -61,9 +62,12 @@ void PointLocator::computeLocation(const Coordinate& p, const Geometry *geom) { - - if (const LineString *ls=dynamic_cast(geom)) + if (const Point *pt=dynamic_cast(geom)) { + updateLocationInfo(locate(p, pt)); + } + else if (const LineString *ls=dynamic_cast(geom)) + { updateLocationInfo(locate(p, ls)); } else if (const Polygon *po=dynamic_cast(geom)) @@ -111,6 +115,17 @@ /* private */ int +PointLocator::locate(const Coordinate& p, const Point *pt) +{ + // no point in doing envelope test, since equality test is just as fast + const Coordinate *ptCoord = pt->getCoordinate(); + if (ptCoord->equals2D(p)) + return Location::INTERIOR; + return Location::EXTERIOR; +} + +/* private */ +int PointLocator::locate(const Coordinate& p, const LineString *l) { const CoordinateSequence* pt=l->getCoordinatesRO(); Modified: branches/3.4/src/geom/prep/PreparedPoint.cpp =================================================================== --- branches/3.4/src/geom/prep/PreparedPoint.cpp 2016-02-24 11:50:47 UTC (rev 4150) +++ branches/3.4/src/geom/prep/PreparedPoint.cpp 2016-02-24 11:51:00 UTC (rev 4151) @@ -18,7 +18,6 @@ #include -#include namespace geos { namespace geom { // geos.geom @@ -29,10 +28,6 @@ { if (! envelopesIntersect( g)) return false; - const Point *pt_geom = dynamic_cast(g); - if (pt_geom) - return getGeometry().equals(g); - // This avoids computing topology for the test geometry return isAnyTargetComponentInTest( g); } Modified: branches/3.4/tests/unit/algorithm/PointLocatorTest.cpp =================================================================== --- branches/3.4/tests/unit/algorithm/PointLocatorTest.cpp 2016-02-24 11:50:47 UTC (rev 4150) +++ branches/3.4/tests/unit/algorithm/PointLocatorTest.cpp 2016-02-24 11:51:00 UTC (rev 4151) @@ -96,8 +96,15 @@ runPtLocator(Location::EXTERIOR, Coordinate(11, 11), "LINEARRING(10 10, 10 20, 20 10, 10 10)"); } - + // 5 - TestPointLocator Point inside MultiPoint + template<> + template<> + void object::test<5>() + { + runPtLocator(Location::INTERIOR, Coordinate(0, 0), + "MULTIPOINT ((1 1), (0 0))"); + } } // namespace tut From svn_geos at osgeo.org Mon Feb 29 08:20:44 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Mon, 29 Feb 2016 08:20:44 -0800 Subject: [geos-commits] r4152 - in trunk: capi src/operation/intersection src/operation/overlay Message-ID: <20160229162044.90E00390216@trac.osgeo.org> Author: mloskot Date: 2016-02-29 08:20:44 -0800 (Mon, 29 Feb 2016) New Revision: 4152 Modified: trunk/capi/geos_ts_c.cpp trunk/src/operation/intersection/RectangleIntersectionBuilder.cpp trunk/src/operation/overlay/PolygonBuilder.cpp Log: Fix build with preprocessor symbol GEOS_DEBUG defined. Modified: trunk/capi/geos_ts_c.cpp =================================================================== --- trunk/capi/geos_ts_c.cpp 2016-02-24 11:51:00 UTC (rev 4151) +++ trunk/capi/geos_ts_c.cpp 2016-02-29 16:20:44 UTC (rev 4152) @@ -3134,8 +3134,7 @@ #ifdef GEOS_DEBUG char buf[256]; - sprintf(buf, "createCollection: requested type %d, ngeoms: %d", - type, ngeoms); + sprintf(buf, "createCollection: requested type %d", type); handle->NOTICE_MESSAGE("%s", buf);// TODO: Can handle->NOTICE_MESSAGE format that directly? #endif Modified: trunk/src/operation/intersection/RectangleIntersectionBuilder.cpp =================================================================== --- trunk/src/operation/intersection/RectangleIntersectionBuilder.cpp 2016-02-24 11:51:00 UTC (rev 4151) +++ trunk/src/operation/intersection/RectangleIntersectionBuilder.cpp 2016-02-29 16:20:44 UTC (rev 4152) @@ -509,9 +509,6 @@ delete ol; } lines = new_lines; -#if GEOS_DEBUG - std::cout << "After lines reverse, parts are " << *this << std::endl; -#endif } Modified: trunk/src/operation/overlay/PolygonBuilder.cpp =================================================================== --- trunk/src/operation/overlay/PolygonBuilder.cpp 2016-02-24 11:51:00 UTC (rev 4151) +++ trunk/src/operation/overlay/PolygonBuilder.cpp 2016-02-29 16:20:44 UTC (rev 4152) @@ -148,7 +148,7 @@ cerr << " dirEdge " << i << endl << de->printEdge() << endl << " inResult:" << de->isInResult() << endl - << " isArea:" << de->getLabel()->isArea() << endl; + << " isArea:" << de->getLabel().isArea() << endl; #endif if (de->isInResult() && de->getLabel().isArea()) { From svn_geos at osgeo.org Mon Feb 29 09:59:06 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Mon, 29 Feb 2016 09:59:06 -0800 Subject: [geos-commits] r4153 - trunk/tests/unit/operation/overlay Message-ID: <20160229175906.84457390216@trac.osgeo.org> Author: mloskot Date: 2016-02-29 09:59:06 -0800 (Mon, 29 Feb 2016) New Revision: 4153 Added: trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp Log: Add basic test for geos::operation::OverlayOp with UNION. Test union of four segments (linestrings) of a suqare. Added: trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp =================================================================== --- trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp (rev 0) +++ trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp 2016-02-29 17:59:06 UTC (rev 4153) @@ -0,0 +1,64 @@ +// +// Test Suite for geos::operation::OverlayOp class for UNION + +#include +// geos +#include +#include +#include +#include +#include +#include +// std +#include +#include + +using namespace geos::geom; +using namespace geos::operation; + +namespace tut +{ + // + // Test Group + // + + struct test_overlayopunion_data + { + typedef geos::geom::Geometry::AutoPtr GeometryPtr; + typedef geos::geom::GeometryFactory GeometryFactory; + typedef geos::geom::GeometryFactory::unique_ptr GeometryFactoryPtr; + }; + + typedef test_group group; + typedef group::object object; + + group test_issimpleop_group("geos::operation::OverlayOp::UNION"); + + // + // Test Cases + // + + // 1 - Union four segments of a square + template<> + template<> + void object::test<1>() + { + // Arrange + geos::geom::PrecisionModel pm(1e+13); + GeometryFactoryPtr factory = geos::geom::GeometryFactory::create(&pm); + geos::io::WKTReader reader(*factory); + GeometryPtr line1(reader.read("LINESTRING(0 0, 0 5)")); + GeometryPtr line2(reader.read("LINESTRING(0 5, 5 5)")); + GeometryPtr line3(reader.read("LINESTRING(5 5, 5 0)")); + GeometryPtr line4(reader.read("LINESTRING(5 0, 0 0)")); + + // Act: union segments incrementally + GeometryPtr lines12(line1->Union(line2.get())); + GeometryPtr lines123(lines12->Union(line3.get())); + GeometryPtr lines1234(lines123->Union(line4.get())); + + // Assert + ensure_equals(lines1234->getGeometryTypeId(), geos::geom::GEOS_MULTILINESTRING); + } + +} // namespace tut From svn_geos at osgeo.org Mon Feb 29 12:43:50 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Mon, 29 Feb 2016 12:43:50 -0800 Subject: [geos-commits] r4154 - trunk/tests/unit/operation/overlay Message-ID: <20160229204350.76F87390216@trac.osgeo.org> Author: mloskot Date: 2016-02-29 12:43:50 -0800 (Mon, 29 Feb 2016) New Revision: 4154 Modified: trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp Log: Add clean-up missing from r4153. It should fix the failing build on Travis SI. Modified: trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp =================================================================== --- trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp 2016-02-29 17:59:06 UTC (rev 4153) +++ trunk/tests/unit/operation/overlay/OverlayOpUnionTest.cpp 2016-02-29 20:43:50 UTC (rev 4154) @@ -32,7 +32,7 @@ typedef test_group group; typedef group::object object; - group test_issimpleop_group("geos::operation::OverlayOp::UNION"); + group test_overlayopunion_group("geos::operation::OverlayOp::UNION"); // // Test Cases From svn_geos at osgeo.org Mon Feb 29 12:45:01 2016 From: svn_geos at osgeo.org (svn_geos at osgeo.org) Date: Mon, 29 Feb 2016 12:45:01 -0800 Subject: [geos-commits] r4155 - trunk/tests/unit Message-ID: <20160229204501.49EC9390216@trac.osgeo.org> Author: mloskot Date: 2016-02-29 12:45:01 -0800 (Mon, 29 Feb 2016) New Revision: 4155 Modified: trunk/tests/unit/Makefile.am Log: Add OverlayOpUnionTest.cpp to Makefile.am Modified: trunk/tests/unit/Makefile.am =================================================================== --- trunk/tests/unit/Makefile.am 2016-02-29 20:43:50 UTC (rev 4154) +++ trunk/tests/unit/Makefile.am 2016-02-29 20:45:01 UTC (rev 4155) @@ -94,6 +94,7 @@ operation/IsSimpleOpTest.cpp \ operation/linemerge/LineMergerTest.cpp \ operation/linemerge/LineSequencerTest.cpp \ + operation/overlay/OverlayOpUnionTest.cpp \ operation/overlay/validate/FuzzyPointLocatorTest.cpp \ operation/overlay/validate/OffsetPointGeneratorTest.cpp \ operation/overlay/validate/OverlayResultValidatorTest.cpp \