GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
geos::operation::overlayng::OverlayNG Class Reference

#include <OverlayNG.h>

Collaboration diagram for geos::operation::overlayng::OverlayNG:
[legend]

Public Member Functions

 OverlayNG (const geom::Geometry *geom0, const geom::Geometry *geom1, const geom::GeometryFactory *p_geomFact, int p_opCode)
 
 OverlayNG (const geom::Geometry *geom0, const geom::Geometry *geom1, const geom::PrecisionModel *p_pm, int p_opCode)
 
 OverlayNG (const geom::Geometry *geom0, const geom::Geometry *geom1, int p_opCode)
 
 OverlayNG (const geom::Geometry *geom0, const geom::PrecisionModel *p_pm)
 
void setOptimized (bool p_isOptimized)
 
void setStrictMode (bool p_isStrictMode)
 
void setAreaResultOnly (bool p_areaResultOnly)
 
void setOutputEdges (bool p_isOutputEdges)
 
void setOutputResultEdges (bool p_isOutputResultEdges)
 
void setNoder (noding::Noder *p_noder)
 
void setOutputNodedEdges (bool p_isOutputNodedEdges)
 
std::unique_ptr< GeometrygetResult ()
 

Static Public Member Functions

static bool isResultOfOpPoint (const OverlayLabel *label, int opCode)
 
static bool isResultOfOp (int overlayOpCode, Location loc0, Location loc1)
 
static std::unique_ptr< Geometryoverlay (const Geometry *geom0, const Geometry *geom1, int opCode, const PrecisionModel *pm)
 
static std::unique_ptr< Geometryoverlay (const Geometry *geom0, const Geometry *geom1, int opCode, const PrecisionModel *pm, noding::Noder *noder)
 
static std::unique_ptr< Geometryoverlay (const Geometry *geom0, const Geometry *geom1, int opCode, noding::Noder *noder)
 
static std::unique_ptr< Geometryoverlay (const Geometry *geom0, const Geometry *geom1, int opCode)
 
static std::unique_ptr< Geometrygeomunion (const Geometry *geom, const PrecisionModel *pm)
 
static std::unique_ptr< Geometrygeomunion (const Geometry *geom, const PrecisionModel *pm, noding::Noder *noder)
 

Static Public Attributes

static constexpr bool STRICT_MODE_DEFAULT = false
 
static constexpr int INTERSECTION = overlay::OverlayOp::opINTERSECTION
 
static constexpr int UNION = overlay::OverlayOp::opUNION
 
static constexpr int DIFFERENCE = overlay::OverlayOp::opDIFFERENCE
 
static constexpr int SYMDIFFERENCE = overlay::OverlayOp::opSYMDIFFERENCE
 

Private Member Functions

std::unique_ptr< geom::GeometrycomputeEdgeOverlay ()
 
void labelGraph (OverlayGraph *graph)
 
std::unique_ptr< geom::GeometryextractResult (int opCode, OverlayGraph *graph)
 
std::unique_ptr< geom::GeometrycreateEmptyResult ()
 

Private Attributes

const geom::PrecisionModelpm
 
InputGeometry inputGeom
 
const geom::GeometryFactorygeomFact
 
int opCode
 
noding::Nodernoder
 
bool isStrictMode
 
bool isOptimized
 
bool isAreaResultOnly
 
bool isOutputEdges
 
bool isOutputResultEdges
 
bool isOutputNodedEdges
 

Detailed Description

Computes the geometric overlay of two geom::Geometrys, using an explicit precision model to allow robust computation. The overlay can be used to determine any of the following set-theoretic operations (boolean combinations) of the geometries:

Input geometries may have different dimension. Input collections must be homogeneous (all elements must have the same dimension).

The precision model used for the computation can be supplied independent of the precision model of the input geometry. The main use for this is to allow using a fixed precision for geometry with a floating precision model. This does two things: ensures robust computation; and forces the output to be validly rounded to the precision model.

For fixed precision models noding is performed using a noding::snapround::SnapRoundingNoder. This provides robust computation (as long as precision is limited to around 13 decimal digits).

For floating precision an noding::MCIndexNoder is used. This is not fully robust, so can sometimes result in util::TopologyExceptions being thrown. For robust full-precision overlay see OverlayNGRobust.

Note: If a noding::snap::SnappingNoder is used it is best to specify a fairly small snap tolerance, since the intersection clipping optimization can interact with the snapping to alter the result.

TOptionally the overlay computation can process using strict mode (via setStrictMode(boolean). In strict mode result semantics are:

Strict mode has the following benefits:

The original JTS overlay semantics correspond to non-strict mode.

If a robustness error occurs, a TopologyException is thrown. These are usually caused by numerical rounding causing the noding output to not be fully noded. For robust computation with full-precision OverlayNGRobust can be used.

Author
mdavis
See also
OverlayNGRobust

Definition at line 115 of file OverlayNG.h.

Constructor & Destructor Documentation

geos::operation::overlayng::OverlayNG::OverlayNG ( const geom::Geometry geom0,
const geom::Geometry geom1,
const geom::GeometryFactory p_geomFact,
int  p_opCode 
)
inline

Creates an overlay operation on the given geometries, with a defined precision model. The noding strategy is determined by the precision model.

Definition at line 177 of file OverlayNG.h.

geos::operation::overlayng::OverlayNG::OverlayNG ( const geom::Geometry geom0,
const geom::Geometry geom1,
const geom::PrecisionModel p_pm,
int  p_opCode 
)
inline

Creates an overlay operation on the given geometries, with a defined precision model. The noding strategy is determined by the precision model.

Definition at line 196 of file OverlayNG.h.

geos::operation::overlayng::OverlayNG::OverlayNG ( const geom::Geometry geom0,
const geom::Geometry geom1,
int  p_opCode 
)
inline

Creates an overlay operation on the given geometries using the precision model of the geometries.

The noder is chosen according to the precision model specified.

Definition at line 223 of file OverlayNG.h.

geos::operation::overlayng::OverlayNG::OverlayNG ( const geom::Geometry geom0,
const geom::PrecisionModel p_pm 
)
inline

Definition at line 227 of file OverlayNG.h.

Member Function Documentation

std::unique_ptr<geom::Geometry> geos::operation::overlayng::OverlayNG::computeEdgeOverlay ( )
private
std::unique_ptr<geom::Geometry> geos::operation::overlayng::OverlayNG::createEmptyResult ( )
private
std::unique_ptr<geom::Geometry> geos::operation::overlayng::OverlayNG::extractResult ( int  opCode,
OverlayGraph graph 
)
private

Extracts the result geometry components from the fully labelled topology graph.

This method implements the semantic that the result of an intersection operation is homogeneous with highest dimension. In other words, if an intersection has components of a given dimension no lower-dimension components are output. For example, if two polygons intersect in an area, no linestrings or points are included in the result, even if portions of the input do meet in lines or points. This semantic choice makes more sense for typical usage, in which only the highest dimension components are of interest.

static std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::geomunion ( const Geometry geom,
const PrecisionModel pm 
)
static

Computes a union operation on the given geometry, with the supplied precision model. The primary use for this is to perform precision reduction (round the geometry to the supplied precision).

The input must be a valid geometry. Collections must be homogeneous. IMPORTANT: You probably want OverlayNGUnaryUnion, not this.

Parameters
geomthe geometry
pmthe precision model to use
Returns
the result of the union operation
See also
OverlayMixedPoints
PrecisionReducer
UnaryUnionNG
CoverageUnion
static std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::geomunion ( const Geometry geom,
const PrecisionModel pm,
noding::Noder noder 
)
static

Computes a union of a single geometry using a custom noder.

The primary use of this is to support coverage union.

The input must be a valid geometry. Collections must be homogeneous. IMPORTANT: You probably want OverlayNGUnaryUnion, not this.

Parameters
geomthe geometry to union
pmthe precision model to use (maybe be null)
noderthe noder to use
Returns
the result geometry
See also
CoverageUnion
std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::getResult ( )

Gets the result of the overlay operation.

Returns
the result of the overlay operation.
Exceptions
IllegalArgumentExceptionif the input is not supported (e.g. a mixed-dimension geometry)
TopologyExceptionif a robustness error occurs
static bool geos::operation::overlayng::OverlayNG::isResultOfOp ( int  overlayOpCode,
Location  loc0,
Location  loc1 
)
static

Tests whether a point with given geom::Locations relative to two geometries would be contained in the result of overlaying the geometries using a given overlay operation. This is used to determine whether components computed during the overlay process should be included in the result geometry.

The method handles arguments of Location#NONE correctly.

static bool geos::operation::overlayng::OverlayNG::isResultOfOpPoint ( const OverlayLabel label,
int  opCode 
)
static

Tests whether a point with a given topological OverlayLabel 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

void geos::operation::overlayng::OverlayNG::labelGraph ( OverlayGraph graph)
private
static std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::overlay ( const Geometry geom0,
const Geometry geom1,
int  opCode,
const PrecisionModel pm 
)
static

Computes an overlay operation for the given geometry operands, with the noding strategy determined by the precision model.

Parameters
geom0the first geometry argument
geom1the second geometry argument
opCodethe code for the desired overlay operation
pmthe precision model to use
Returns
the result of the overlay operation
static std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::overlay ( const Geometry geom0,
const Geometry geom1,
int  opCode,
const PrecisionModel pm,
noding::Noder noder 
)
static

Computes an overlay operation on the given geometry operands, using a supplied noding::Noder.

Parameters
geom0the first geometry argument
geom1the second geometry argument
opCodethe code for the desired overlay operation
pmthe precision model to use (which may be null if the noder does not use one)
noderthe noder to use
Returns
the result of the overlay operation
static std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::overlay ( const Geometry geom0,
const Geometry geom1,
int  opCode,
noding::Noder noder 
)
static

Computes an overlay operation on the given geometry operands, using a supplied noding::Noder.

Parameters
geom0the first geometry argument
geom1the second geometry argument
opCodethe code for the desired overlay operation
noderthe noder to use
Returns
the result of the overlay operation
static std::unique_ptr<Geometry> geos::operation::overlayng::OverlayNG::overlay ( const Geometry geom0,
const Geometry geom1,
int  opCode 
)
static

Computes an overlay operation on the given geometry operands, using the precision model of the geometry. and an appropriate noder.

The noder is chosen according to the precision model specified.

Parameters
geom0the first argument geometry
geom1the second argument geometry
opCodethe code for the desired overlay operation
Returns
the result of the overlay operation
void geos::operation::overlayng::OverlayNG::setAreaResultOnly ( bool  p_areaResultOnly)
inline

Definition at line 241 of file OverlayNG.h.

void geos::operation::overlayng::OverlayNG::setNoder ( noding::Noder p_noder)
inline

Definition at line 244 of file OverlayNG.h.

void geos::operation::overlayng::OverlayNG::setOptimized ( bool  p_isOptimized)
inline

Sets whether overlay processing optimizations are enabled. It may be useful to disable optimizations for testing purposes. Default is TRUE (optimization enabled).

Parameters
p_isOptimizedwhether to optimize processing

Definition at line 239 of file OverlayNG.h.

void geos::operation::overlayng::OverlayNG::setOutputEdges ( bool  p_isOutputEdges)
inline

Definition at line 242 of file OverlayNG.h.

void geos::operation::overlayng::OverlayNG::setOutputNodedEdges ( bool  p_isOutputNodedEdges)
inline

Definition at line 246 of file OverlayNG.h.

void geos::operation::overlayng::OverlayNG::setOutputResultEdges ( bool  p_isOutputResultEdges)
inline

Definition at line 243 of file OverlayNG.h.

void geos::operation::overlayng::OverlayNG::setStrictMode ( bool  p_isStrictMode)
inline

Definition at line 240 of file OverlayNG.h.

Member Data Documentation

constexpr int geos::operation::overlayng::OverlayNG::DIFFERENCE = overlay::OverlayOp::opDIFFERENCE
static

Definition at line 169 of file OverlayNG.h.

const geom::GeometryFactory* geos::operation::overlayng::OverlayNG::geomFact
private

Definition at line 122 of file OverlayNG.h.

InputGeometry geos::operation::overlayng::OverlayNG::inputGeom
private

Definition at line 121 of file OverlayNG.h.

constexpr int geos::operation::overlayng::OverlayNG::INTERSECTION = overlay::OverlayOp::opINTERSECTION
static

Definition at line 167 of file OverlayNG.h.

bool geos::operation::overlayng::OverlayNG::isAreaResultOnly
private

Definition at line 127 of file OverlayNG.h.

bool geos::operation::overlayng::OverlayNG::isOptimized
private

Definition at line 126 of file OverlayNG.h.

bool geos::operation::overlayng::OverlayNG::isOutputEdges
private

Definition at line 128 of file OverlayNG.h.

bool geos::operation::overlayng::OverlayNG::isOutputNodedEdges
private

Definition at line 130 of file OverlayNG.h.

bool geos::operation::overlayng::OverlayNG::isOutputResultEdges
private

Definition at line 129 of file OverlayNG.h.

bool geos::operation::overlayng::OverlayNG::isStrictMode
private

Definition at line 125 of file OverlayNG.h.

noding::Noder* geos::operation::overlayng::OverlayNG::noder
private

Definition at line 124 of file OverlayNG.h.

int geos::operation::overlayng::OverlayNG::opCode
private

Definition at line 123 of file OverlayNG.h.

const geom::PrecisionModel* geos::operation::overlayng::OverlayNG::pm
private

Definition at line 120 of file OverlayNG.h.

constexpr bool geos::operation::overlayng::OverlayNG::STRICT_MODE_DEFAULT = false
static

The default setting for Strict Mode.

The original JTS overlay semantics used non-strict result semantics, including;

  • An Intersection result can be mixed-dimension, due to inclusion of intersection components of all dimensions
  • Results can include lines caused by Area topology collapse

Definition at line 165 of file OverlayNG.h.

constexpr int geos::operation::overlayng::OverlayNG::SYMDIFFERENCE = overlay::OverlayOp::opSYMDIFFERENCE
static

Definition at line 170 of file OverlayNG.h.

constexpr int geos::operation::overlayng::OverlayNG::UNION = overlay::OverlayOp::opUNION
static

Definition at line 168 of file OverlayNG.h.


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