From 45466da4c847a2e4e52eeb81732b26986645730b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 7 Feb 2024 01:05:59 +0100 Subject: [PATCH] CoverageSimplifier: make input coverage vector const (fixing a TODO) (#1041) --- include/geos/coverage/CoverageRingEdges.h | 6 +++--- include/geos/coverage/CoverageSimplifier.h | 4 ++-- include/geos/coverage/VertexRingCounter.h | 2 +- src/coverage/CoverageRingEdges.cpp | 2 +- src/coverage/CoverageSimplifier.cpp | 2 +- src/coverage/VertexRingCounter.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/geos/coverage/CoverageRingEdges.h b/include/geos/coverage/CoverageRingEdges.h index d43279310a..d6014c2d39 100644 --- a/include/geos/coverage/CoverageRingEdges.h +++ b/include/geos/coverage/CoverageRingEdges.h @@ -61,7 +61,7 @@ class GEOS_DLL CoverageRingEdges { private: // Members - std::vector& m_coverage; + const std::vector& m_coverage; std::map> m_ringEdgesMap; std::vector m_edges; std::vector> m_edgeStore; @@ -72,7 +72,7 @@ class GEOS_DLL CoverageRingEdges { public: - CoverageRingEdges(std::vector& coverage) + CoverageRingEdges(const std::vector& coverage) : m_coverage(coverage) { build(); @@ -140,7 +140,7 @@ class GEOS_DLL CoverageRingEdges { const CoordinateSequence& ring); Coordinate::UnorderedSet findMultiRingNodes( - std::vector& coverage); + const std::vector& coverage); Coordinate::UnorderedSet findBoundaryNodes( LineSegment::UnorderedSet& lineSegments); diff --git a/include/geos/coverage/CoverageSimplifier.h b/include/geos/coverage/CoverageSimplifier.h index 11e8fa3d10..5e23028d38 100644 --- a/include/geos/coverage/CoverageSimplifier.h +++ b/include/geos/coverage/CoverageSimplifier.h @@ -83,7 +83,7 @@ class GEOS_DLL CoverageSimplifier { * * @param coverage a set of polygonal geometries forming a coverage */ - CoverageSimplifier(std::vector& coverage); + CoverageSimplifier(const std::vector& coverage); /** * Simplifies the boundaries of a set of polygonal geometries forming a coverage, @@ -142,7 +142,7 @@ class GEOS_DLL CoverageSimplifier { private: // Members - std::vector& m_input; // TODO? make this const + const std::vector& m_input; const GeometryFactory* m_geomFactory; // Methods diff --git a/include/geos/coverage/VertexRingCounter.h b/include/geos/coverage/VertexRingCounter.h index 3d1151cd4e..a8899ae91a 100644 --- a/include/geos/coverage/VertexRingCounter.h +++ b/include/geos/coverage/VertexRingCounter.h @@ -56,7 +56,7 @@ class VertexRingCounter : public CoordinateSequenceFilter void filter_ro(const CoordinateSequence& seq, std::size_t i) override; static void count( - std::vector& geoms, + const std::vector& geoms, std::map& counts); private: diff --git a/src/coverage/CoverageRingEdges.cpp b/src/coverage/CoverageRingEdges.cpp index c334e47f59..bc6c34e9b9 100644 --- a/src/coverage/CoverageRingEdges.cpp +++ b/src/coverage/CoverageRingEdges.cpp @@ -252,7 +252,7 @@ CoverageRingEdges::next(std::size_t index, const CoordinateSequence& ring) /* private */ Coordinate::UnorderedSet -CoverageRingEdges::findMultiRingNodes(std::vector& coverage) +CoverageRingEdges::findMultiRingNodes(const std::vector& coverage) { std::map vertexRingCount; VertexRingCounter::count(coverage, vertexRingCount); diff --git a/src/coverage/CoverageSimplifier.cpp b/src/coverage/CoverageSimplifier.cpp index 335b107597..93d31d2ef7 100644 --- a/src/coverage/CoverageSimplifier.cpp +++ b/src/coverage/CoverageSimplifier.cpp @@ -81,7 +81,7 @@ CoverageSimplifier::simplifyInner( /* public */ -CoverageSimplifier::CoverageSimplifier(std::vector& coverage) +CoverageSimplifier::CoverageSimplifier(const std::vector& coverage) : m_input(coverage) , m_geomFactory(coverage.empty() ? nullptr : coverage[0]->getFactory()) { diff --git a/src/coverage/VertexRingCounter.cpp b/src/coverage/VertexRingCounter.cpp index c0d79cab9b..fe742889f6 100644 --- a/src/coverage/VertexRingCounter.cpp +++ b/src/coverage/VertexRingCounter.cpp @@ -33,7 +33,7 @@ namespace coverage { // geos.coverage /* public static */ void VertexRingCounter::count( - std::vector& geoms, + const std::vector& geoms, std::map& counts) { VertexRingCounter vertextCounter(counts);