overlayng/MaximalEdgeRing.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 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/operation/overlayng/OverlayEdgeRing.h>
#include <vector>
#include <memory>
#include <geos/export.h>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class GeometryFactory;
}
namespace operation {
namespace overlayng {
class OverlayEdge;
class EdgeRing;
}
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng
class GEOS_DLL MaximalEdgeRing {
using Coordinate = geos::geom::Coordinate;
using GeometryFactory = geos::geom::GeometryFactory;
private:
// Constants
static constexpr int STATE_FIND_INCOMING = 1;
static constexpr int STATE_LINK_OUTGOING = 2;
// Members
OverlayEdge* startEdge;
// Methods
void attachEdges(OverlayEdge* startEdge);
void linkMinimalRings();
static void linkMinRingEdgesAtNode(OverlayEdge* nodeEdge, MaximalEdgeRing* maxRing);
static bool isAlreadyLinked(OverlayEdge* edge, MaximalEdgeRing* maxRing);
static OverlayEdge* selectMaxOutEdge(OverlayEdge* currOut, MaximalEdgeRing* maxEdgeRing);
static OverlayEdge* linkMaxInEdge(OverlayEdge* currOut, OverlayEdge* currMaxRingOut, MaximalEdgeRing* maxEdgeRing);
public:
MaximalEdgeRing(OverlayEdge* e)
: startEdge(e)
{
attachEdges(e);
};
std::vector<std::unique_ptr<OverlayEdgeRing>> buildMinimalRings(const GeometryFactory* geometryFactory);
static void linkResultAreaMaxRingAtNode(OverlayEdge* nodeEdge);
friend std::ostream& operator<<(std::ostream& os, const MaximalEdgeRing& mer);
};
} // namespace geos.operation.overlayng
} // namespace geos.operation
} // namespace geos
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::operation::overlayng::OverlayEdge
Definition OverlayEdge.h:47
geos::geom
Definition Angle.h:26
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38