GEOS
3.9.1dev
|
Computes the geometric overlay of two Geometry. More...
#include <OverlayOp.h>
Public Types | |
enum | OpCode { opINTERSECTION = 1, opUNION = 2, opDIFFERENCE = 3, opSYMDIFFERENCE = 4 } |
The spatial functions supported by this class. More... | |
Public Member Functions | |
OverlayOp (const geom::Geometry *g0, const geom::Geometry *g1) | |
Construct an OverlayOp with the given Geometry args. More... | |
~OverlayOp () override | |
geom::Geometry * | getResultGeometry (OpCode overlayOpCode) |
Gets the result of the overlay for a given overlay operation. More... | |
geomgraph::PlanarGraph & | getGraph () |
Gets the graph constructed to compute the overlay. More... | |
bool | isCoveredByLA (const geom::Coordinate &coord) |
This method is used to decide if a point node should be included in the result or not. More... | |
bool | isCoveredByA (const geom::Coordinate &coord) |
This method is used to decide if an L edge should be included in the result or not. More... | |
![]() | |
GeometryGraphOperation (const geom::Geometry *g0, const geom::Geometry *g1) | |
GeometryGraphOperation (const geom::Geometry *g0, const geom::Geometry *g1, const algorithm::BoundaryNodeRule &boundaryNodeRule) | |
GeometryGraphOperation (const geom::Geometry *g0) | |
virtual | ~GeometryGraphOperation () |
const geom::Geometry * | getArgGeometry (unsigned int i) const |
Static Public Member Functions | |
static geom::Geometry * | overlayOp (const geom::Geometry *geom0, const geom::Geometry *geom1, OpCode opCode) |
Computes an overlay operation for the given geometry arguments. More... | |
static bool | isResultOfOp (const geomgraph::Label &label, OpCode opCode) |
Tests whether a point with a given topological Label relative to two geometries is contained in the result of overlaying the geometries using a given overlay operation. More... | |
static bool | isResultOfOp (geom::Location loc0, geom::Location loc1, OpCode opCode) |
This method will handle arguments of Location.NULL correctly. More... | |
static std::unique_ptr< geom::Geometry > | createEmptyResult (OverlayOp::OpCode overlayOpCode, const geom::Geometry *a, const geom::Geometry *b, const geom::GeometryFactory *geomFact) |
Protected Member Functions | |
void | insertUniqueEdge (geomgraph::Edge *e) |
Insert an edge from one of the noded input graphs. More... | |
![]() | |
void | setComputationPrecision (const geom::PrecisionModel *pm) |
Private Member Functions | |
void | computeOverlay (OpCode opCode) |
void | insertUniqueEdges (std::vector< geomgraph::Edge * > *edges, const geom::Envelope *env=nullptr) |
void | computeLabelsFromDepths () |
Update the labels for edges according to their depths. More... | |
void | replaceCollapsedEdges () |
If edges which have undergone dimensional collapse are found, replace them with a new edge which is a L edge. More... | |
void | copyPoints (int argIndex, const geom::Envelope *env=nullptr) |
Copy all nodes from an arg geometry into this graph. More... | |
void | computeLabelling () |
Compute initial labelling for all DirectedEdges at each node. More... | |
void | mergeSymLabels () |
void | updateNodeLabelling () |
void | labelIncompleteNodes () |
void | labelIncompleteNode (geomgraph::Node *n, int targetIndex) |
Label an isolated node with its relationship to the target geometry. More... | |
void | findResultAreaEdges (OpCode opCode) |
Find all edges whose label indicates that they are in the result area(s), according to the operation being performed. More... | |
void | cancelDuplicateResultEdges () |
bool | isCovered (const geom::Coordinate &coord, std::vector< geom::Geometry * > *geomList) |
bool | isCovered (const geom::Coordinate &coord, std::vector< geom::Polygon * > *geomList) |
bool | isCovered (const geom::Coordinate &coord, std::vector< geom::LineString * > *geomList) |
geom::Geometry * | computeGeometry (std::vector< geom::Point * > *nResultPointList, std::vector< geom::LineString * > *nResultLineList, std::vector< geom::Polygon * > *nResultPolyList, OverlayOp::OpCode opCode) |
int | mergeZ (geomgraph::Node *n, const geom::Polygon *poly) const |
Merge Z values of node with those of the segment or vertex in the given Polygon it is on. More... | |
int | mergeZ (geomgraph::Node *n, const geom::LineString *line) const |
double | getAverageZ (int targetIndex) |
void | checkObviouslyWrongResult (OpCode opCode) |
Static Private Member Functions | |
static geom::Dimension::DimensionType | resultDimension (OverlayOp::OpCode overlayOpCode, const geom::Geometry *g0, const geom::Geometry *g1) |
static double | getAverageZ (const geom::Polygon *poly) |
Private Attributes | |
algorithm::PointLocator | ptLocator |
const geom::GeometryFactory * | geomFact |
geom::Geometry * | resultGeom |
geomgraph::PlanarGraph | graph |
geomgraph::EdgeList | edgeList |
std::vector< geom::Polygon * > * | resultPolyList |
std::vector< geom::LineString * > * | resultLineList |
std::vector< geom::Point * > * | resultPointList |
std::vector< geomgraph::Edge * > | dupEdges |
Caches for memory management. More... | |
double | avgz [2] |
bool | avgzcomputed [2] |
ElevationMatrix * | elevationMatrix |
Additional Inherited Members | |
![]() | |
algorithm::LineIntersector | li |
const geom::PrecisionModel * | resultPrecisionModel |
std::vector< geomgraph::GeometryGraph * > | arg |
The operation args into an array so they can be accessed by index. More... | |
Computes the geometric overlay of two Geometry.
The overlay can be used to determine any boolean combination of the geometries.
Definition at line 70 of file OverlayOp.h.
The spatial functions supported by this class.
These operations implement various boolean combinations of the resultants of the overlay.
Definition at line 79 of file OverlayOp.h.
geos::operation::overlay::OverlayOp::OverlayOp | ( | const geom::Geometry * | g0, |
const geom::Geometry * | g1 | ||
) |
|
override |
|
private |
If both a dirEdge and its sym are marked as being in the result, cancel them out.
|
private |
Throw TopologyException if an obviously wrong result has been computed.
|
private |
Build a Geometry containing all Geometries in the given vectors. Takes element's ownership, vector control is left to caller.
|
private |
Compute initial labelling for all DirectedEdges at each node.
In this step, DirectedEdges will acquire a complete labelling (i.e. one with labels for both Geometries) only if they are incident on a node which has edges for both Geometries
|
private |
Update the labels for edges according to their depths.
For each edge, the depths are first normalized. Then, if the depths for the edge are equal, this edge must have collapsed into a line edge. If the depths are not equal, update the label with the locations corresponding to the depths (i.e. a depth of 0 corresponds to a Location of EXTERIOR, a depth of 1 corresponds to INTERIOR)
|
private |
|
private |
Copy all nodes from an arg geometry into this graph.
The node label in the arg geometry overrides any previously computed label for that argIndex. (E.g. a node may be an intersection node with a previously computed label of BOUNDARY, but in the original arg Geometry it is actually in the interior due to the Boundary Determination Rule)
|
static |
Creates an empty result geometry of the appropriate dimension, based on the given overlay operation and the dimensions of the inputs. The created geometry is always an atomic geometry, not a collection.
The empty result is constructed using the following rules:
|
private |
Find all edges whose label indicates that they are in the result area(s), according to the operation being performed.
Since we want polygon shells to be oriented CW, choose dirEdges with the interior of the result on the RHS. Mark them as being in the result. Interior Area edges are the result of dimensional collapses. They do not form part of the result area boundary.
|
private |
|
staticprivate |
|
inline |
Gets the graph constructed to compute the overlay.
Definition at line 151 of file OverlayOp.h.
geom::Geometry* geos::operation::overlay::OverlayOp::getResultGeometry | ( | OpCode | overlayOpCode | ) |
Gets the result of the overlay for a given overlay operation.
Note: this method can be called once only.
overlayOpCode | the overlay operation to perform |
TopologyException | if a robustness problem is encountered |
|
protected |
Insert an edge from one of the noded input graphs.
Checks edges that are inserted to see if an identical edge already exists. If so, the edge is not inserted, but its label is merged with the existing edge.
|
private |
|
private |
|
private |
|
private |
bool geos::operation::overlay::OverlayOp::isCoveredByA | ( | const geom::Coordinate & | coord | ) |
This method is used to decide if an L edge should be included in the result or not.
true
if the coord point is covered by a result Area geometry bool geos::operation::overlay::OverlayOp::isCoveredByLA | ( | const geom::Coordinate & | coord | ) |
This method is used to decide if a point node should be included in the result or not.
true
if the coord point is covered by a result Line or Area geometry
|
static |
Tests whether a point with a given topological Label relative to two geometries is contained in the result of overlaying the geometries using a given overlay operation.
The method handles arguments of Location::NONE correctly
label | the topological label of the point |
opCode | the code for the overlay operation to test |
|
static |
This method will handle arguments of Location.NULL correctly.
|
private |
Label an isolated node with its relationship to the target geometry.
|
private |
Incomplete nodes are nodes whose labels are incomplete.
(e.g. the location for one Geometry is NULL). These are either isolated nodes, or nodes which have edges from only a single Geometry incident on them.
Isolated nodes are found because nodes in one graph which don't intersect nodes in the other are not completely labelled by the initial process of adding nodes to the nodeList. To complete the labelling we need to check for nodes that lie in the interior of edges, and in the interior of areas.
When each node labelling is completed, the labelling of the incident edges is updated, to complete their labelling as well.
|
private |
For nodes which have edges from only one Geometry incident on them, the previous step will have left their dirEdges with no labelling for the other Geometry. However, the sym dirEdge may have a labelling for the other Geometry, so merge the two labels.
|
private |
Merge Z values of node with those of the segment or vertex in the given Polygon it is on.
|
private |
Merge Z values of node with those of the segment or vertex in the given LineString it is on.
|
static |
Computes an overlay operation for the given geometry arguments.
geom0 | the first geometry argument |
geom1 | the second geometry argument |
opCode | the code for the desired overlay operation |
TopologyException | if a robustness problem is encountered |
|
private |
If edges which have undergone dimensional collapse are found, replace them with a new edge which is a L edge.
|
staticprivate |
For empty result, what is the correct geometry type to apply to the empty?
|
private |
|
private |
Average Z of input geometries
Definition at line 389 of file OverlayOp.h.
|
private |
Definition at line 390 of file OverlayOp.h.
|
private |
Caches for memory management.
Definition at line 371 of file OverlayOp.h.
|
private |
Definition at line 217 of file OverlayOp.h.
|
private |
Definition at line 395 of file OverlayOp.h.
|
private |
Definition at line 211 of file OverlayOp.h.
|
private |
Definition at line 215 of file OverlayOp.h.
|
private |
Definition at line 209 of file OverlayOp.h.
|
private |
Definition at line 213 of file OverlayOp.h.
|
private |
Definition at line 221 of file OverlayOp.h.
|
private |
Definition at line 223 of file OverlayOp.h.
|
private |
Definition at line 219 of file OverlayOp.h.