GEOS 3.11.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
geos::operation::overlay::OverlayOp Class Reference

Computes the geometric overlay of two Geometry. More...

#include <OverlayOp.h>

Inheritance diagram for geos::operation::overlay::OverlayOp:
geos::operation::GeometryGraphOperation

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...
 
geom::GeometrygetResultGeometry (OpCode overlayOpCode)
 Gets the result of the overlay for a given overlay operation. More...
 
geomgraph::PlanarGraphgetGraph ()
 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...
 
- Public Member Functions inherited from geos::operation::GeometryGraphOperation
 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)
 
const geom::GeometrygetArgGeometry (unsigned int i) const
 

Static Public Member Functions

static geom::GeometryoverlayOp (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::GeometrycreateEmptyResult (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...
 
- Protected Member Functions inherited from geos::operation::GeometryGraphOperation
void setComputationPrecision (const geom::PrecisionModel *pm)
 

Additional Inherited Members

- Protected Attributes inherited from geos::operation::GeometryGraphOperation
algorithm::LineIntersector li
 
const geom::PrecisionModelresultPrecisionModel
 
std::vector< geomgraph::GeometryGraph * > arg
 The operation args into an array so they can be accessed by index.
 

Detailed Description

Computes the geometric overlay of two Geometry.

The overlay can be used to determine any boolean combination of the geometries.

Member Enumeration Documentation

◆ OpCode

The spatial functions supported by this class.

These operations implement various boolean combinations of the resultants of the overlay.

Enumerator
opINTERSECTION 

The code for the Intersection overlay operation.

opUNION 

The code for the Union overlay operation.

opDIFFERENCE 

The code for the Difference overlay operation.

opSYMDIFFERENCE 

The code for the Symmetric Difference overlay operation.

Constructor & Destructor Documentation

◆ OverlayOp()

geos::operation::overlay::OverlayOp::OverlayOp ( const geom::Geometry g0,
const geom::Geometry g1 
)

Construct an OverlayOp with the given Geometry args.

Ownership of passed args will remain to caller, and the OverlayOp won't change them in any way.

Member Function Documentation

◆ createEmptyResult()

static std::unique_ptr< geom::Geometry > geos::operation::overlay::OverlayOp::createEmptyResult ( OverlayOp::OpCode  overlayOpCode,
const geom::Geometry a,
const geom::Geometry b,
const geom::GeometryFactory geomFact 
)
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:

  • opINTERSECTION result has the dimension of the lowest input dimension
  • opUNION - result has the dimension of the highest input dimension
  • opDIFFERENCE - result has the dimension of the left-hand input
  • opSYMDIFFERENCE - result has the dimension of the highest input dimension

◆ getGraph()

geomgraph::PlanarGraph & geos::operation::overlay::OverlayOp::getGraph ( )
inline

Gets the graph constructed to compute the overlay.

Returns
the overlay graph

◆ getResultGeometry()

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.

Parameters
overlayOpCodethe overlay operation to perform
Returns
the compute result geometry
Exceptions
TopologyExceptionif a robustness problem is encountered

◆ insertUniqueEdge()

void geos::operation::overlay::OverlayOp::insertUniqueEdge ( geomgraph::Edge e)
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.

◆ isCoveredByA()

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.

Returns
true if the coord point is covered by a result Area geometry

◆ isCoveredByLA()

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.

Returns
true if the coord point is covered by a result Line or Area geometry

◆ isResultOfOp() [1/2]

static bool geos::operation::overlay::OverlayOp::isResultOfOp ( const geomgraph::Label label,
OpCode  opCode 
)
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

Parameters
labelthe topological label of the point
opCodethe code for the overlay operation to test
Returns
true if the label locations correspond to the overlayOpCode

◆ isResultOfOp() [2/2]

static bool geos::operation::overlay::OverlayOp::isResultOfOp ( geom::Location  loc0,
geom::Location  loc1,
OpCode  opCode 
)
static

This method will handle arguments of Location.NULL correctly.

Returns
true if the locations correspond to the opCode

◆ overlayOp()

static geom::Geometry * geos::operation::overlay::OverlayOp::overlayOp ( const geom::Geometry geom0,
const geom::Geometry geom1,
OpCode  opCode 
)
static

Computes an overlay operation for the given geometry arguments.

Parameters
geom0the first geometry argument
geom1the second geometry argument
opCodethe code for the desired overlay operation
Returns
the result of the overlay operation
Exceptions
TopologyExceptionif a robustness problem is encountered

The documentation for this class was generated from the following file: