CoverageRing.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2022 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/noding/BasicSegmentString.h>
#include <deque>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class CoordinateSequence;
class Geometry;
class GeometryFactory;
class LineString;
class LinearRing;
class Polygon;
}
}
namespace geos { // geos.
namespace coverage { // geos.coverage
class GEOS_DLL CoverageRing : public noding::BasicSegmentString {
using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
using Geometry = geos::geom::Geometry;
using GeometryFactory = geos::geom::GeometryFactory;
using Polygon = geos::geom::Polygon;
using LineString = geos::geom::LineString;
using LinearRing = geos::geom::LinearRing;
private:
// Members
bool m_isInteriorOnRight;
std::vector<bool> m_isInvalid;
std::vector<bool> m_isMatched;
std::size_t findInvalidStart(std::size_t index);
std::size_t findInvalidEnd(std::size_t index);
std::size_t nextMarkIndex(std::size_t index);
std::unique_ptr<LineString> createLine(
std::size_t startIndex,
std::size_t endIndex,
const GeometryFactory* geomFactory);
std::unique_ptr<CoordinateSequence> extractSection(
std::size_t startIndex, std::size_t endIndex);
std::unique_ptr<CoordinateSequence> extractSectionWrap(
std::size_t startIndex, std::size_t endIndex);
public:
CoverageRing(CoordinateSequence* pts, bool interiorOnRight);
CoverageRing(const LinearRing* ring, bool isShell);
geom::Envelope getEnvelope(std::size_t start, std::size_t end);
static bool isKnown(std::vector<CoverageRing*>& rings);
bool isInteriorOnRight() const;
void markInvalid(std::size_t index);
void markMatched(std::size_t index);
bool isKnown() const;
bool isInvalid(std::size_t i) const;
bool isInvalid() const;
bool hasInvalid() const;
bool isKnown(std::size_t i) const;
const Coordinate& findVertexPrev(std::size_t index, const Coordinate& pt) const;
const Coordinate& findVertexNext(std::size_t index, const Coordinate& pt) const;
std::size_t prev(std::size_t index) const;
std::size_t next(std::size_t index) const;
void createInvalidLines(
const GeometryFactory* geomFactory,
std::vector<std::unique_ptr<LineString>>& lines);
};
} // namespace geos.coverage
} // namespace geos
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::LineString
Definition LineString.h:66
geos::geom::LinearRing
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::geom
Definition Angle.h:26
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38