PolygonNoder.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2023 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/algorithm/LineIntersector.h>
// #include <geos/geom/Coordinate.h>
//#include <geos/geom/CoordinateSequence.h>
#include <geos/export.h>
#include <geos/triangulate/tri/Tri.h>
#include <map>
#include <memory>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class CoordinateSequence;
}
namespace noding {
class NodedSegmentString;
}
namespace algorithm {
class LineIntersector;
}
}
namespace geos {
namespace triangulate {
namespace polygon {
class GEOS_DLL PolygonNoder {
using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
using NodedSegmentString = geos::noding::NodedSegmentString;
using LineIntersector = geos::algorithm::LineIntersector;
using Tri = geos::triangulate::tri::Tri;
template<typename TriType>
using TriList = geos::triangulate::tri::TriList<TriType>;
public:
PolygonNoder(
std::unique_ptr<CoordinateSequence>& shellRing,
std::vector<std::unique_ptr<CoordinateSequence>>& holeRings);
void node();
bool isShellNoded();
bool isHoleNoded(std::size_t i);
std::unique_ptr<CoordinateSequence> getNodedShell();
std::unique_ptr<CoordinateSequence> getNodedHole(std::size_t i);
std::vector<bool>& getHolesTouching();
private:
// Members
std::vector<bool> isHoleTouching;
std::map<NodedSegmentString*, std::size_t> nodedRingIndexes;
std::vector<std::unique_ptr<NodedSegmentString>> nodedRings;
// Classes
class NodeAdder;
friend class PolygonNoder::NodeAdder;
// Methods
NodedSegmentString*
createNodedSegString(std::unique_ptr<CoordinateSequence>& ringPts, std::size_t i);
void createNodedSegmentStrings(
std::unique_ptr<CoordinateSequence>& shellRing,
std::vector<std::unique_ptr<CoordinateSequence>>& holeRings);
/* Turn off copy constructors for MSVC */
PolygonNoder(const PolygonNoder&) = delete;
PolygonNoder& operator=(const PolygonNoder&) = delete;
};
} // namespace geos.triangulate.polygon
} // namespace geos.triangulate
} // namespace geos
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:53
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::noding::NodedSegmentString
Represents a list of contiguous line segments, and supports noding the segments.
Definition NodedSegmentString.h:58
geos::triangulate::tri::TriList
Definition TriList.h:50
geos::triangulate::tri::Tri
Definition Tri.h:45
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos::noding
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition CoverageCleaner.h:42
geos::triangulate
Classes to compute Delaunay triangulations.
Definition ConcaveHull.h:32
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38