Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoverageSimplifier: make input coverage vector const (fixing a TODO) #1041

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/geos/coverage/CoverageRingEdges.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GEOS_DLL CoverageRingEdges {
private:

// Members
std::vector<const Geometry*>& m_coverage;
const std::vector<const Geometry*>& m_coverage;
std::map<const LinearRing*, std::vector<CoverageEdge*>> m_ringEdgesMap;
std::vector<CoverageEdge*> m_edges;
std::vector<std::unique_ptr<CoverageEdge>> m_edgeStore;
Expand All @@ -72,7 +72,7 @@ class GEOS_DLL CoverageRingEdges {

public:

CoverageRingEdges(std::vector<const Geometry*>& coverage)
CoverageRingEdges(const std::vector<const Geometry*>& coverage)
: m_coverage(coverage)
{
build();
Expand Down Expand Up @@ -140,7 +140,7 @@ class GEOS_DLL CoverageRingEdges {
const CoordinateSequence& ring);

Coordinate::UnorderedSet findMultiRingNodes(
std::vector<const Geometry*>& coverage);
const std::vector<const Geometry*>& coverage);

Coordinate::UnorderedSet findBoundaryNodes(
LineSegment::UnorderedSet& lineSegments);
Expand Down
4 changes: 2 additions & 2 deletions include/geos/coverage/CoverageSimplifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class GEOS_DLL CoverageSimplifier {
*
* @param coverage a set of polygonal geometries forming a coverage
*/
CoverageSimplifier(std::vector<const Geometry*>& coverage);
CoverageSimplifier(const std::vector<const Geometry*>& coverage);

/**
* Simplifies the boundaries of a set of polygonal geometries forming a coverage,
Expand Down Expand Up @@ -142,7 +142,7 @@ class GEOS_DLL CoverageSimplifier {
private:

// Members
std::vector<const Geometry*>& m_input; // TODO? make this const
const std::vector<const Geometry*>& m_input;
const GeometryFactory* m_geomFactory;

// Methods
Expand Down
2 changes: 1 addition & 1 deletion include/geos/coverage/VertexRingCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VertexRingCounter : public CoordinateSequenceFilter
void filter_ro(const CoordinateSequence& seq, std::size_t i) override;

static void count(
std::vector<const Geometry*>& geoms,
const std::vector<const Geometry*>& geoms,
std::map<Coordinate, std::size_t>& counts);

private:
Expand Down
2 changes: 1 addition & 1 deletion src/coverage/CoverageRingEdges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ CoverageRingEdges::next(std::size_t index, const CoordinateSequence& ring)

/* private */
Coordinate::UnorderedSet
CoverageRingEdges::findMultiRingNodes(std::vector<const Geometry*>& coverage)
CoverageRingEdges::findMultiRingNodes(const std::vector<const Geometry*>& coverage)
{
std::map<Coordinate, std::size_t> vertexRingCount;
VertexRingCounter::count(coverage, vertexRingCount);
Expand Down
2 changes: 1 addition & 1 deletion src/coverage/CoverageSimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CoverageSimplifier::simplifyInner(


/* public */
CoverageSimplifier::CoverageSimplifier(std::vector<const Geometry*>& coverage)
CoverageSimplifier::CoverageSimplifier(const std::vector<const Geometry*>& coverage)
: m_input(coverage)
, m_geomFactory(coverage.empty() ? nullptr : coverage[0]->getFactory())
{
Expand Down
2 changes: 1 addition & 1 deletion src/coverage/VertexRingCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace coverage { // geos.coverage
/* public static */
void
VertexRingCounter::count(
std::vector<const Geometry*>& geoms,
const std::vector<const Geometry*>& geoms,
std::map<Coordinate, std::size_t>& counts)
{
VertexRingCounter vertextCounter(counts);
Expand Down
Loading