Table of Contents

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

g0 Geometry

The first geometry argument

g1 Geometry

The second geometry argument

Properties

Graph

Gets the graph constructed to compute the overlay.

public PlanarGraph Graph { get; }

Property Value

PlanarGraph

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

bool

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 SpatialFunction

The overlay operation being performed

a Geometry

An input geometry

b Geometry

An input geometry

geomFact GeometryFactory

The 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 SpatialFunction

The 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 Edge

The 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 Coordinate

The 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 Coordinate

The 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 correctly
public static bool IsResultOfOp(Location loc0, Location loc1, SpatialFunction overlayOpCode)

Parameters

loc0 Location

the code for the location in the first geometry

loc1 Location

the code for the location in the second geometry

overlayOpCode SpatialFunction

the 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 correctly
public static bool IsResultOfOp(Label label, SpatialFunction overlayOpCode)

Parameters

label Label

The topological label of the point

overlayOpCode SpatialFunction

The 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 Geometry

The first geometry argument

geom1 Geometry

The second geometry argument

opCode SpatialFunction

The code for the desired overlay operation

Returns

Geometry

The result of the overlay operation

Exceptions

TopologyException

Thrown if a robustness problem is encountered.