Class OverlayOp
- Namespace
- NetTopologySuite.Operation.Overlay
- Assembly
- NetTopologySuite.dll
Computes the geometric overlay of two Geometrys. The overlay can be used to determine any bool combination of the geometries.
public class OverlayOp : GeometryGraphOperation
- Inheritance
-
OverlayOp
- Inherited Members
Constructors
OverlayOp(Geometry, Geometry)
Constructs an instance to compute a single overlay operation for the given geometries.
public OverlayOp(Geometry g0, Geometry g1)
Parameters
Properties
Graph
Gets the graph constructed to compute the overlay.
public PlanarGraph Graph { get; }
Property Value
NodingValidatorDisabled
Disable EdgeNodingValidator when an intersection is made (NetTopologySuite.Operation.Overlay.OverlayOp.ComputeOverlay(NetTopologySuite.Operation.Overlay.SpatialFunction)), so performances are dramatically improved but failures are not managed.
public static bool NodingValidatorDisabled { get; set; }
Property Value
Remarks
Use ay your own risk!
Methods
CreateEmptyResult(SpatialFunction, Geometry, Geometry, GeometryFactory)
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:- Intersection - result has the dimension of the lowest input dimension
- Union - result has the dimension of the highest input dimension
- Difference - result has the dimension of the left-hand input
- SymDifference - result has the dimension of the highest input dimension (since symDifference is the union of the differences).
public static Geometry CreateEmptyResult(SpatialFunction overlayOpCode, Geometry a, Geometry b, GeometryFactory geomFact)
Parameters
overlayOpCode
SpatialFunctionThe overlay operation being performed
a
GeometryAn input geometry
b
GeometryAn input geometry
geomFact
GeometryFactoryThe geometry factory being used for the operation
Returns
- Geometry
An empty atomic geometry of the appropriate dimension
GetResultGeometry(SpatialFunction)
Gets the result of the overlay for a given overlay operation.
Note: this method can be called once only.public Geometry GetResultGeometry(SpatialFunction overlayOpCode)
Parameters
overlayOpCode
SpatialFunctionThe code of the overlay operation to perform
Returns
- Geometry
The computed result geometry
Exceptions
- TopologyException
Thrown if a robustness problem is encountered
InsertUniqueEdge(Edge)
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.
protected void InsertUniqueEdge(Edge e)
Parameters
e
EdgeThe edge to insert
IsCoveredByA(Coordinate)
Tests if an L edge should be included in the result or not.
public bool IsCoveredByA(Coordinate coord)
Parameters
coord
CoordinateThe point coordinate
Returns
- bool
true
if the coordinate point is covered by a result Area geometry.
IsCoveredByLA(Coordinate)
Tests if a point node should be included in the result or not.
public bool IsCoveredByLA(Coordinate coord)
Parameters
coord
CoordinateThe point coordinate
Returns
- bool
true
if the coordinate point is covered by a result Line or Area geometry.
IsResultOfOp(Location, Location, SpatialFunction)
Tests whether a point with given Locations relative to two geometries is contained in the result of overlaying the geometries using a given overlay operation.
The method handles arguments of Null correctlypublic static bool IsResultOfOp(Location loc0, Location loc1, SpatialFunction overlayOpCode)
Parameters
loc0
Locationthe code for the location in the first geometry
loc1
Locationthe code for the location in the second geometry
overlayOpCode
SpatialFunctionthe code for the overlay operation to test
Returns
- bool
true
if the locations correspond to the overlayOpCode.
IsResultOfOp(Label, SpatialFunction)
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 Null correctlypublic static bool IsResultOfOp(Label label, SpatialFunction overlayOpCode)
Parameters
label
LabelThe topological label of the point
overlayOpCode
SpatialFunctionThe code for the overlay operation to test
Returns
- bool
true
if the label locations correspond to the overlayOpCode
Overlay(Geometry, Geometry, SpatialFunction)
Computes an overlay operation for the given geometry arguments.
public static Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode)
Parameters
geom0
GeometryThe first geometry argument
geom1
GeometryThe second geometry argument
opCode
SpatialFunctionThe code for the desired overlay operation
Returns
- Geometry
The result of the overlay operation
Exceptions
- TopologyException
Thrown if a robustness problem is encountered.