[geos-commits] [SCM] GEOS branch master updated. 16a39b0b1a79cfd4c7e2da5c14999a766432acae
git at osgeo.org
git at osgeo.org
Fri Dec 28 15:53:13 PST 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, master has been updated
via 16a39b0b1a79cfd4c7e2da5c14999a766432acae (commit)
via fb560254745b7a2c58bf962db998bbf8b93b8bf2 (commit)
via d75a294d03e9ad0aa7775f893ca5ce7c5bfec142 (commit)
via 3adc5c7c3468b99aa0db5d194713043ea10fb5bc (commit)
via db5723b7f40d9889fb5f4f667eba4ffaa3749cfa (commit)
via 9aeb40139866204de271e7f1b8dfd644e0ebc402 (commit)
via 893b84b6d57e0f4d7d20ee10a8646cab558eeba2 (commit)
via a0606354a78b20c70c3063b7bd7a3542a77e294e (commit)
via f00b4508ebcdc3e19bd63a295f862c5bbc9f3aa0 (commit)
via 915775053b6e5cabe6ddf6d4b34da4e8ddc4e2fc (commit)
from b1e74bf7b5caae6030619f206fd102068ab86c5c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 16a39b0b1a79cfd4c7e2da5c14999a766432acae
Author: Daniel Baston <dbaston at gmail.com>
Date: Fri Dec 28 18:52:42 2018 -0500
Complete tuple->struct transition
diff --git a/src/operation/overlay/PolygonBuilder.cpp b/src/operation/overlay/PolygonBuilder.cpp
index 016dc3f..9f1b95b 100644
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ b/src/operation/overlay/PolygonBuilder.cpp
@@ -345,7 +345,7 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
for(auto const& tryShell: newShellList)
{
- LinearRing *tryShellRing= get<0>(tryShell)->getLinearRing();
+ LinearRing *tryShellRing = tryShell.edgeRing->getLinearRing();
const Envelope *tryShellEnv=tryShellRing->getEnvelopeInternal();
// the hole envelope cannot equal the shell envelope
// (also guards against testing rings against themselves)
commit fb560254745b7a2c58bf962db998bbf8b93b8bf2
Merge: d75a294 b1e74bf
Author: Daniel Baston <dbaston at gmail.com>
Date: Fri Dec 28 18:18:04 2018 -0500
Merge branch 'master' into st_intersection_improvement
commit d75a294d03e9ad0aa7775f893ca5ce7c5bfec142
Author: doskabouter <paul.doskabouter at gmail.com>
Date: Fri Dec 28 20:42:42 2018 +0100
unified whitespace
diff --git a/src/operation/overlay/PolygonBuilder.cpp b/src/operation/overlay/PolygonBuilder.cpp
index cc87804..016dc3f 100644
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ b/src/operation/overlay/PolygonBuilder.cpp
@@ -103,30 +103,30 @@ PolygonBuilder::add(PlanarGraph *graph)
void
PolygonBuilder::add(const vector<DirectedEdge*> *dirEdges,
const vector<Node*> *nodes)
- //throw(TopologyException *)
+ //throw(TopologyException *)
{
PlanarGraph::linkResultDirectedEdges(nodes->begin(), nodes->end());
- vector<MaximalEdgeRing*> maxEdgeRings;
- buildMaximalEdgeRings(dirEdges, maxEdgeRings);
+ vector<MaximalEdgeRing*> maxEdgeRings;
+ buildMaximalEdgeRings(dirEdges, maxEdgeRings);
- vector<EdgeRing*> freeHoleList;
- vector<MaximalEdgeRing*> edgeRings;
- buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList, edgeRings);
+ vector<EdgeRing*> freeHoleList;
+ vector<MaximalEdgeRing*> edgeRings;
+ buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList, edgeRings);
- sortShellsAndHoles(edgeRings, shellList, freeHoleList);
+ sortShellsAndHoles(edgeRings, shellList, freeHoleList);
- vector<FastPIPRing> indexedshellist;
- for (auto const& shell : shellList)
- {
- FastPIPRing pipRing { shell,new geos::algorithm::locate::IndexedPointInAreaLocator(*shell->getLinearRing()) };
- indexedshellist.push_back(pipRing);
- }
- placeFreeHoles(indexedshellist, freeHoleList);
+ vector<FastPIPRing> indexedshellist;
+ for (auto const& shell : shellList)
+ {
+ FastPIPRing pipRing { shell,new geos::algorithm::locate::IndexedPointInAreaLocator(*shell->getLinearRing()) };
+ indexedshellist.push_back(pipRing);
+ }
+ placeFreeHoles(indexedshellist, freeHoleList);
//Assert: every hole on freeHoleList has a shell assigned to it
- for (auto const& shell : indexedshellist)
- delete shell.pipLocator;
+ for (auto const& shell : indexedshellist)
+ delete shell.pipLocator;
}
/*public*/
@@ -155,9 +155,9 @@ PolygonBuilder::buildMaximalEdgeRings(const vector<DirectedEdge*> *dirEdges,
DirectedEdge *de=(*dirEdges)[i];
#if GEOS_DEBUG
cerr << " dirEdge " << i << endl
- << de->printEdge() << endl
- << " inResult:" << de->isInResult() << endl
- << " isArea:" << de->getLabel().isArea() << endl;
+ << de->printEdge() << endl
+ << " inResult:" << de->isInResult() << endl
+ << " isArea:" << de->getLabel().isArea() << endl;
#endif
if (de->isInResult() && de->getLabel().isArea())
{
@@ -314,14 +314,14 @@ PolygonBuilder::placeFreeHoles(vector<FastPIPRing>& newShellList,
{
geom = (*rIt)->toPolygon(geometryFactory);
std::cerr << "INSERT INTO shells VALUES ('"
- << *geom
- << "');" << std::endl;
+ << *geom
+ << "');" << std::endl;
delete geom;
}
geom = hole->toPolygon(geometryFactory);
std::cerr << "INSERT INTO hole VALUES ('"
- << *geom
- << "');" << std::endl;
+ << *geom
+ << "');" << std::endl;
delete geom;
#endif
//assert(shell!=NULL); // unable to assign hole to a shell
@@ -336,7 +336,7 @@ PolygonBuilder::placeFreeHoles(vector<FastPIPRing>& newShellList,
/*private*/
EdgeRing*
PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
- vector<FastPIPRing>& newShellList)
+ vector<FastPIPRing>& newShellList)
{
LinearRing *testRing=testEr->getLinearRing();
const Envelope *testEnv=testRing->getEnvelopeInternal();
@@ -357,7 +357,7 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
Coordinate testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs);
bool isContained=false;
- if (tryShell.pipLocator->locate(&testPt) != Location::EXTERIOR)
+ if (tryShell.pipLocator->locate(&testPt) != Location::EXTERIOR)
isContained=true;
// check if this new containing ring is smaller than
commit 3adc5c7c3468b99aa0db5d194713043ea10fb5bc
Author: doskabouter <paul.doskabouter at gmail.com>
Date: Fri Dec 28 20:41:21 2018 +0100
use struct instead of tuple
diff --git a/include/geos/operation/overlay/PolygonBuilder.h b/include/geos/operation/overlay/PolygonBuilder.h
index 30151b1..c790c0f 100644
--- a/include/geos/operation/overlay/PolygonBuilder.h
+++ b/include/geos/operation/overlay/PolygonBuilder.h
@@ -153,7 +153,10 @@ private:
std::vector<geomgraph::EdgeRing*> &newShellList,
std::vector<geomgraph::EdgeRing*> &freeHoleList);
- using FastPIPRing = std::tuple<geomgraph::EdgeRing*, algorithm::locate::IndexedPointInAreaLocator*>;
+ struct FastPIPRing {
+ geomgraph::EdgeRing* edgeRing;
+ algorithm::locate::IndexedPointInAreaLocator* pipLocator;
+ };
/** \brief
* This method determines finds a containing shell for all holes
diff --git a/src/operation/overlay/PolygonBuilder.cpp b/src/operation/overlay/PolygonBuilder.cpp
index 727bc1b..cc87804 100644
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ b/src/operation/overlay/PolygonBuilder.cpp
@@ -118,12 +118,15 @@ PolygonBuilder::add(const vector<DirectedEdge*> *dirEdges,
vector<FastPIPRing> indexedshellist;
for (auto const& shell : shellList)
- indexedshellist.push_back(FastPIPRing(shell, new geos::algorithm::locate::IndexedPointInAreaLocator(*shell->getLinearRing())));
- placeFreeHoles(indexedshellist, freeHoleList);
+ {
+ FastPIPRing pipRing { shell,new geos::algorithm::locate::IndexedPointInAreaLocator(*shell->getLinearRing()) };
+ indexedshellist.push_back(pipRing);
+ }
+ placeFreeHoles(indexedshellist, freeHoleList);
//Assert: every hole on freeHoleList has a shell assigned to it
for (auto const& shell : indexedshellist)
- delete get<1>(shell);
+ delete shell.pipLocator;
}
/*public*/
@@ -354,16 +357,15 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
Coordinate testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs);
bool isContained=false;
- if (get<1>(tryShell)->locate(&testPt) != Location::EXTERIOR) {
- isContained = true;
- }
+ if (tryShell.pipLocator->locate(&testPt) != Location::EXTERIOR)
+ isContained=true;
// check if this new containing ring is smaller than
// the current minimum ring
if (isContained) {
if (minShell==nullptr
|| minShellEnv->contains(tryShellEnv)) {
- minShell= get<0>(tryShell);
+ minShell= tryShell.edgeRing;
minShellEnv=minShell->getLinearRing()->getEnvelopeInternal();
}
}
commit db5723b7f40d9889fb5f4f667eba4ffaa3749cfa
Author: doskabouter <paul.doskabouter at gmail.com>
Date: Fri Dec 28 16:30:02 2018 +0100
fixed styling
diff --git a/src/operation/overlay/PolygonBuilder.cpp b/src/operation/overlay/PolygonBuilder.cpp
index 58fdce3..727bc1b 100644
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ b/src/operation/overlay/PolygonBuilder.cpp
@@ -342,7 +342,6 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
for(auto const& tryShell: newShellList)
{
- ;
LinearRing *tryShellRing= get<0>(tryShell)->getLinearRing();
const Envelope *tryShellEnv=tryShellRing->getEnvelopeInternal();
// the hole envelope cannot equal the shell envelope
@@ -355,8 +354,9 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
Coordinate testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs);
bool isContained=false;
- if (get<1>(tryShell)->locate(&testPt) != Location::EXTERIOR)
- isContained=true;
+ if (get<1>(tryShell)->locate(&testPt) != Location::EXTERIOR) {
+ isContained = true;
+ }
// check if this new containing ring is smaller than
// the current minimum ring
commit 9aeb40139866204de271e7f1b8dfd644e0ebc402
Author: Daniel Baston <dbaston at gmail.com>
Date: Thu Dec 27 15:18:39 2018 -0500
Update PR to incorporate master branch refactoring
diff --git a/include/geos/algorithm/locate/IndexedPointInAreaLocator.h b/include/geos/algorithm/locate/IndexedPointInAreaLocator.h
index 03bff38..591241c 100644
--- a/include/geos/algorithm/locate/IndexedPointInAreaLocator.h
+++ b/include/geos/algorithm/locate/IndexedPointInAreaLocator.h
@@ -17,6 +17,7 @@
#ifndef GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
#define GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
+#include <geos/geom/LineSegment.h>
#include <geos/algorithm/locate/PointOnGeometryLocator.h> // inherited
#include <geos/index/ItemVisitor.h> // inherited
#include <geos/index/intervalrtree/SortedPackedIntervalRTree.h> // inherited
@@ -32,7 +33,6 @@ namespace geom {
class Geometry;
class Coordinate;
class CoordinateSequence;
-class LineSegment;
}
}
diff --git a/include/geos/operation/overlay/PolygonBuilder.h b/include/geos/operation/overlay/PolygonBuilder.h
index 9c49591..30151b1 100644
--- a/include/geos/operation/overlay/PolygonBuilder.h
+++ b/include/geos/operation/overlay/PolygonBuilder.h
@@ -20,6 +20,7 @@
#define GEOS_OP_OVERLAY_POLYGONBUILDER_H
#include <geos/export.h>
+#include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
#include <vector>
@@ -152,7 +153,7 @@ private:
std::vector<geomgraph::EdgeRing*> &newShellList,
std::vector<geomgraph::EdgeRing*> &freeHoleList);
- using FastPIPRing = tuple<EdgeRing*, algorithm::locate::IndexedPointInAreaLocator*>;
+ using FastPIPRing = std::tuple<geomgraph::EdgeRing*, algorithm::locate::IndexedPointInAreaLocator*>;
/** \brief
* This method determines finds a containing shell for all holes
@@ -168,7 +169,7 @@ private:
*
* @throws TopologyException if a hole cannot be assigned to a shell
*/
- void placeFreeHoles(vector<FastPIPRing>& newShellList,
+ void placeFreeHoles(std::vector<FastPIPRing>& newShellList,
std::vector<geomgraph::EdgeRing*>& freeHoleList);
// throw(const TopologyException&)
@@ -191,7 +192,7 @@ private:
* @return NULL if no containing geomgraph::EdgeRing is found
*/
geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr,
- vector<FastPIPRing>& newShellList);
+ std::vector<FastPIPRing>& newShellList);
std::vector<geom::Geometry*>* computePolygons(
std::vector<geomgraph::EdgeRing*>& newShellList);
diff --git a/src/algorithm/locate/SimplePointInAreaLocator.cpp b/src/algorithm/locate/SimplePointInAreaLocator.cpp
index 1e13943..00ab1e3 100644
--- a/src/algorithm/locate/SimplePointInAreaLocator.cpp
+++ b/src/algorithm/locate/SimplePointInAreaLocator.cpp
@@ -14,6 +14,7 @@
**********************************************************************/
#include <geos/algorithm/PointLocation.h>
+#include <geos/algorithm/RayCrossingCounter.h>
#include <geos/algorithm/locate/SimplePointInAreaLocator.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/Polygon.h>
@@ -86,7 +87,7 @@ SimplePointInAreaLocator::locatePointInPolygon(const Coordinate& p, const Polygo
if (hole->getEnvelopeInternal()->contains(p))
{
cl = hole->getCoordinatesRO();
- int holeLoc = CGAlgorithms::locatePointInRing(p,*cl);
+ int holeLoc = RayCrossingCounter::locatePointInRing(p,*cl);
if (holeLoc == Location::BOUNDARY)
return Location::BOUNDARY;
if (holeLoc == Location::INTERIOR)
commit 893b84b6d57e0f4d7d20ee10a8646cab558eeba2
Merge: b0504db a060635
Author: Daniel Baston <dbaston at gmail.com>
Date: Thu Dec 27 14:59:03 2018 -0500
Merge branch 'st_intersection_improvement' of https://github.com/doskabouter/geos into doskabouter-st_intersection_improvement
commit a0606354a78b20c70c3063b7bd7a3542a77e294e
Merge: f00b450 0724955
Author: doskabouter <doskabouter at users.noreply.github.com>
Date: Wed Dec 19 22:32:27 2018 +0100
Merge branch 'master' into st_intersection_improvement
diff --cc src/operation/overlay/PolygonBuilder.cpp
index f8956d9,f3ea383..58fdce3
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ b/src/operation/overlay/PolygonBuilder.cpp
@@@ -355,7 -348,7 +355,7 @@@ PolygonBuilder::findEdgeRingContaining(
Coordinate testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs);
bool isContained=false;
- if (get<1>(tryShell)->locate(&testPt) != Location::EXTERIOR)
- if(PointLocation::isInRing(testPt, tsrcs))
++ if (get<1>(tryShell)->locate(&testPt) != Location::EXTERIOR)
isContained=true;
// check if this new containing ring is smaller than
commit f00b4508ebcdc3e19bd63a295f862c5bbc9f3aa0
Author: doskabouter <paul.doskabouter at gmail.com>
Date: Wed Dec 19 22:20:36 2018 +0100
Use IndexedPointInAreaLocator for placeFreeHoles
# Conflicts:
# src/operation/overlay/PolygonBuilder.cpp
diff --git a/include/geos/operation/overlay/PolygonBuilder.h b/include/geos/operation/overlay/PolygonBuilder.h
index b4450d1..9c49591 100644
--- a/include/geos/operation/overlay/PolygonBuilder.h
+++ b/include/geos/operation/overlay/PolygonBuilder.h
@@ -152,6 +152,8 @@ private:
std::vector<geomgraph::EdgeRing*> &newShellList,
std::vector<geomgraph::EdgeRing*> &freeHoleList);
+ using FastPIPRing = tuple<EdgeRing*, algorithm::locate::IndexedPointInAreaLocator*>;
+
/** \brief
* This method determines finds a containing shell for all holes
* which have not yet been assigned to a shell.
@@ -166,7 +168,7 @@ private:
*
* @throws TopologyException if a hole cannot be assigned to a shell
*/
- void placeFreeHoles(std::vector<geomgraph::EdgeRing*>& newShellList,
+ void placeFreeHoles(vector<FastPIPRing>& newShellList,
std::vector<geomgraph::EdgeRing*>& freeHoleList);
// throw(const TopologyException&)
@@ -189,7 +191,7 @@ private:
* @return NULL if no containing geomgraph::EdgeRing is found
*/
geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr,
- std::vector<geomgraph::EdgeRing*>& newShellList);
+ vector<FastPIPRing>& newShellList);
std::vector<geom::Geometry*>* computePolygons(
std::vector<geomgraph::EdgeRing*>& newShellList);
diff --git a/src/operation/overlay/PolygonBuilder.cpp b/src/operation/overlay/PolygonBuilder.cpp
index f46bd52..f8956d9 100644
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ b/src/operation/overlay/PolygonBuilder.cpp
@@ -103,21 +103,27 @@ PolygonBuilder::add(PlanarGraph *graph)
void
PolygonBuilder::add(const vector<DirectedEdge*> *dirEdges,
const vector<Node*> *nodes)
- //throw(TopologyException *)
+ //throw(TopologyException *)
{
PlanarGraph::linkResultDirectedEdges(nodes->begin(), nodes->end());
- vector<MaximalEdgeRing*> maxEdgeRings;
- buildMaximalEdgeRings(dirEdges, maxEdgeRings);
+ vector<MaximalEdgeRing*> maxEdgeRings;
+ buildMaximalEdgeRings(dirEdges, maxEdgeRings);
- vector<EdgeRing*> freeHoleList;
- vector<MaximalEdgeRing*> edgeRings;
- buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList, edgeRings);
+ vector<EdgeRing*> freeHoleList;
+ vector<MaximalEdgeRing*> edgeRings;
+ buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList, edgeRings);
- sortShellsAndHoles(edgeRings, shellList, freeHoleList);
+ sortShellsAndHoles(edgeRings, shellList, freeHoleList);
- placeFreeHoles(shellList, freeHoleList);
+ vector<FastPIPRing> indexedshellist;
+ for (auto const& shell : shellList)
+ indexedshellist.push_back(FastPIPRing(shell, new geos::algorithm::locate::IndexedPointInAreaLocator(*shell->getLinearRing())));
+ placeFreeHoles(indexedshellist, freeHoleList);
//Assert: every hole on freeHoleList has a shell assigned to it
+
+ for (auto const& shell : indexedshellist)
+ delete get<1>(shell);
}
/*public*/
@@ -282,7 +288,7 @@ PolygonBuilder::sortShellsAndHoles(vector<MaximalEdgeRing*> &edgeRings,
/*private*/
void
-PolygonBuilder::placeFreeHoles(std::vector<EdgeRing*>& newShellList,
+PolygonBuilder::placeFreeHoles(vector<FastPIPRing>& newShellList,
std::vector<EdgeRing*>& freeHoleList)
{
for(std::vector<EdgeRing*>::iterator
@@ -327,7 +333,7 @@ PolygonBuilder::placeFreeHoles(std::vector<EdgeRing*>& newShellList,
/*private*/
EdgeRing*
PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
- vector<EdgeRing*>& newShellList)
+ vector<FastPIPRing>& newShellList)
{
LinearRing *testRing=testEr->getLinearRing();
const Envelope *testEnv=testRing->getEnvelopeInternal();
@@ -336,7 +342,8 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
for(auto const& tryShell: newShellList)
{
- LinearRing *tryShellRing=tryShell->getLinearRing();
+ ;
+ LinearRing *tryShellRing= get<0>(tryShell)->getLinearRing();
const Envelope *tryShellEnv=tryShellRing->getEnvelopeInternal();
// the hole envelope cannot equal the shell envelope
// (also guards against testing rings against themselves)
@@ -348,7 +355,7 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
Coordinate testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs);
bool isContained=false;
- if(CGAlgorithms::isPointInRing(testPt, tsrcs))
+ if (get<1>(tryShell)->locate(&testPt) != Location::EXTERIOR)
isContained=true;
// check if this new containing ring is smaller than
@@ -356,7 +363,7 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing *testEr,
if (isContained) {
if (minShell==nullptr
|| minShellEnv->contains(tryShellEnv)) {
- minShell=tryShell;
+ minShell= get<0>(tryShell);
minShellEnv=minShell->getLinearRing()->getEnvelopeInternal();
}
}
commit 915775053b6e5cabe6ddf6d4b34da4e8ddc4e2fc
Author: doskabouter <paul.doskabouter at gmail.com>
Date: Sun Dec 9 17:00:56 2018 +0100
Performance improvement: First check envelope before calling CGAlgorithms::isPointInRing
diff --git a/src/algorithm/locate/SimplePointInAreaLocator.cpp b/src/algorithm/locate/SimplePointInAreaLocator.cpp
index b20ef58..1a6e597 100644
--- a/src/algorithm/locate/SimplePointInAreaLocator.cpp
+++ b/src/algorithm/locate/SimplePointInAreaLocator.cpp
@@ -53,6 +53,7 @@ SimplePointInAreaLocator::locateInGeometry(const Coordinate& p,const Geometry *g
return locatePointInPolygon(p, poly);
}
+ if (!geom->getEnvelopeInternal()->contains(p)) return Location::EXTERIOR;
if (const GeometryCollection *col = dynamic_cast<const GeometryCollection*>(geom))
{
for (auto g2: *col)
@@ -70,6 +71,7 @@ int
SimplePointInAreaLocator::locatePointInPolygon(const Coordinate& p, const Polygon *poly)
{
if (poly->isEmpty()) return Location::EXTERIOR;
+ if (!poly->getEnvelopeInternal()->contains(p)) return Location::EXTERIOR;
const LineString *shell=poly->getExteriorRing();
const CoordinateSequence *cl;
cl = shell->getCoordinatesRO();
@@ -81,13 +83,16 @@ SimplePointInAreaLocator::locatePointInPolygon(const Coordinate& p, const Polygo
for(size_t i=0, n=poly->getNumInteriorRing(); i<n; i++)
{
const LineString *hole = poly->getInteriorRingN(i);
- cl = hole->getCoordinatesRO();
- int holeLoc = CGAlgorithms::locatePointInRing(p,*cl);
- if (holeLoc == Location::BOUNDARY)
- return Location::BOUNDARY;
- if (holeLoc == Location::INTERIOR)
- return Location::EXTERIOR;
- // if in EXTERIOR of this hole, keep checking other holes
+ if (hole->getEnvelopeInternal()->contains(p))
+ {
+ cl = hole->getCoordinatesRO();
+ int holeLoc = CGAlgorithms::locatePointInRing(p,*cl);
+ if (holeLoc == Location::BOUNDARY)
+ return Location::BOUNDARY;
+ if (holeLoc == Location::INTERIOR)
+ return Location::EXTERIOR;
+ // if in EXTERIOR of this hole, keep checking other holes
+ }
}
return Location::INTERIOR;
}
-----------------------------------------------------------------------
Summary of changes:
.../algorithm/locate/IndexedPointInAreaLocator.h | 2 +-
include/geos/operation/overlay/PolygonBuilder.h | 10 ++++--
src/algorithm/locate/SimplePointInAreaLocator.cpp | 20 ++++++++----
src/operation/overlay/PolygonBuilder.cpp | 37 ++++++++++++++--------
4 files changed, 45 insertions(+), 24 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list