Skip to content

Commit

Permalink
Merge branch 'master' of https://git.osgeo.org/gitea/geos/geos
Browse files Browse the repository at this point in the history
  • Loading branch information
robe2 committed Aug 18, 2018
2 parents 195dba5 + 1e66be5 commit 3db733d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
13 changes: 5 additions & 8 deletions include/geos/algorithm/PointLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
**********************************************************************
*
* Last port: algorithm/PointLocator.java r320 (JTS-1.12)
* Last port: algorithm/PointLocator.java 95fbe34b (JTS-1.15.2-SNAPSHOT)
*
**********************************************************************/

Expand Down Expand Up @@ -51,9 +51,8 @@ namespace algorithm { // geos::algorithm
* Notes:
* - instances of this class are not reentrant.
* - LinearRing objects do not enclose any area
* points inside the ring are still in the EXTERIOR of the ring.
* (points inside the ring are still in the EXTERIOR of the ring.)
*
* Last port: algorithm/PointLocator.java rev. 1.26 (JTS-1.7+)
*/
class GEOS_DLL PointLocator {
public:
Expand All @@ -62,11 +61,9 @@ class GEOS_DLL PointLocator {

/**
* Computes the topological relationship (Location) of a single point
* to a Geometry.
* It handles both single-element
* and multi-element Geometries.
* The algorithm for multi-part Geometries
* takes into account the boundaryDetermination rule.
* to a Geometry. It handles both single-element and multi-element Geometries.
* The algorithm for multi-part Geometriestakes into account the SFS
* Boundary Determination rule.
*
* @return the Location of the point relative to the input Geometry
*/
Expand Down
9 changes: 7 additions & 2 deletions src/algorithm/PointLocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
**********************************************************************
*
* Last port: algorithm/PointLocator.java r320 (JTS-1.12)
* Last port: algorithm/PointLocator.java 95fbe34b (JTS-1.15.2-SNAPSHOT)
*
**********************************************************************/

Expand Down Expand Up @@ -128,6 +128,9 @@ PointLocator::locate(const Coordinate& p, const Point *pt)
int
PointLocator::locate(const Coordinate& p, const LineString *l)
{
if (!l->getEnvelopeInternal()->intersects(p))
return Location::EXTERIOR;

const CoordinateSequence* pt=l->getCoordinatesRO();
if (! l->isClosed()) {
if ((p==pt->getAt(0)) || (p==pt->getAt(pt->getSize()-1))) {
Expand All @@ -143,7 +146,9 @@ PointLocator::locate(const Coordinate& p, const LineString *l)
int
PointLocator::locateInPolygonRing(const Coordinate& p, const LinearRing *ring)
{
// can this test be folded into isPointInRing ?
if (!ring->getEnvelopeInternal()->intersects(p)) {
return Location::EXTERIOR;
}

const CoordinateSequence *cl = ring->getCoordinatesRO();

Expand Down
13 changes: 13 additions & 0 deletions tests/unit/capi/GEOSIntersectsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,18 @@ namespace tut

}

// Test for #782 (collection with empty components)
template<>
template<>
void object::test<6>()
{
geom1_ = GEOSGeomFromWKT("LINESTRING(10 0, 0 0, 0 10)");
geom2_ = GEOSGeomFromWKT("MULTILINESTRING((10 -1,-1 10),EMPTY)");

char r1 = GEOSIntersects(geom1_, geom2_);

ensure_equals(r1, 1);
}

} // namespace tut

0 comments on commit 3db733d

Please sign in to comment.