[geos-commits] [SCM] GEOS branch main updated. beb9207f650abeff96e9872903cf2a20b8011654
git at osgeo.org
git at osgeo.org
Tue Sep 28 14:35:05 PDT 2021
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, main has been updated
via beb9207f650abeff96e9872903cf2a20b8011654 (commit)
from 87f56eacce1f40ffb730dc8152aa9038b59873f2 (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 beb9207f650abeff96e9872903cf2a20b8011654
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Sep 28 14:35:01 2021 -0700
Attempt to address performance in triangulating large multipolygons, by creating a separate TriList for each incoming Polygon
diff --git a/include/geos/triangulate/tri/TriList.h b/include/geos/triangulate/tri/TriList.h
index 64777e3..e311c93 100644
--- a/include/geos/triangulate/tri/TriList.h
+++ b/include/geos/triangulate/tri/TriList.h
@@ -68,7 +68,12 @@ public:
add(corner[0], corner[1], corner[2]);
}
- std::unique_ptr<Geometry> toGeometry(const GeometryFactory* geomFact) const;
+ std::unique_ptr<Geometry> toGeometry(
+ const GeometryFactory* geomFact) const;
+
+ static std::unique_ptr<Geometry> toGeometry(
+ const geom::GeometryFactory* geomFact,
+ const std::vector<std::unique_ptr<TriList>>& allTriLists);
friend std::ostream& operator << (std::ostream& os, TriList& te);
diff --git a/src/triangulate/polygon/ConstrainedDelaunayTriangulator.cpp b/src/triangulate/polygon/ConstrainedDelaunayTriangulator.cpp
index 0d42754..2e709e3 100644
--- a/src/triangulate/polygon/ConstrainedDelaunayTriangulator.cpp
+++ b/src/triangulate/polygon/ConstrainedDelaunayTriangulator.cpp
@@ -50,14 +50,16 @@ ConstrainedDelaunayTriangulator::compute()
std::vector<const Polygon*> polys;
geom::util::PolygonExtracter::getPolygons(*inputGeom, polys);
- TriList triList;
+ std::vector<std::unique_ptr<TriList>> allTriLists;
for (const Polygon* poly : polys) {
+ std::unique_ptr<TriList> triList(new TriList());
// Skip empty component polygons
if (poly->isEmpty())
continue;
- triangulatePolygon(poly, triList);
+ triangulatePolygon(poly, *triList);
+ allTriLists.emplace_back(triList.release());
}
- return triList.toGeometry(geomFact);
+ return TriList::toGeometry(geomFact, allTriLists);
}
diff --git a/src/triangulate/tri/TriList.cpp b/src/triangulate/tri/TriList.cpp
index 40f4081..80099b5 100644
--- a/src/triangulate/tri/TriList.cpp
+++ b/src/triangulate/tri/TriList.cpp
@@ -55,6 +55,21 @@ TriList::toGeometry(const geom::GeometryFactory* geomFact) const
return geomFact->createGeometryCollection(std::move(geoms));
}
+/* public static */
+std::unique_ptr<Geometry>
+TriList::toGeometry(
+ const geom::GeometryFactory* geomFact,
+ const std::vector<std::unique_ptr<TriList>>& allTriLists)
+{
+ std::vector<std::unique_ptr<Geometry>> geoms;
+ for (const std::unique_ptr<TriList>& triList: allTriLists) {
+ for (const Tri* tri: *triList) {
+ std::unique_ptr<Geometry> geom = tri->toPolygon(geomFact);
+ geoms.emplace_back(geom.release());
+ }
+ }
+ return geomFact->createGeometryCollection(std::move(geoms));
+}
std::ostream&
operator<<(std::ostream& os, TriList& triList)
-----------------------------------------------------------------------
Summary of changes:
include/geos/triangulate/tri/TriList.h | 7 ++++++-
.../polygon/ConstrainedDelaunayTriangulator.cpp | 8 +++++---
src/triangulate/tri/TriList.cpp | 15 +++++++++++++++
3 files changed, 26 insertions(+), 4 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list