ITopologicalOperator Interface

Provides access to members for constructing new geometries based upon topological relationships between existing geometries.

Members

Name Description
Read-only property Boundary The boundary of this geometry. A polygon's boundary is a polyline. A polyline's boundary is a multipoint. A point or multipoint's boundary is an empty point or multipoint.
Method Buffer Constructs a polygon that is the locus of points at a distance less than or equal to a specified distance from this geometry.
Method Clip Constructs the intersection of this geometry and the specified envelope.
Method ClipDense Constructs the intersection of this geometry and the specified envelope; densifies lines in output contributed by the clipping envelope.
Method ConstructUnion Defines this geometry to be the union of the inputs. More efficient for unioning multiple geometries than calling Union repeatedly.
Method ConvexHull Constructs the convex hull of this geometry.
Method Cut Splits this geometry into a part left of the cutting polyline, and a part right of it.
Method Difference Constructs the geometry containing points from this geometry but not the other geometry.
Method Intersect Constructs the geometry that is the set-theoretic intersection of the input geometries. Use different resultDimension values to generate results of different dimensions.
Read-only property IsKnownSimple Indicates whether this geometry is known (or assumed) to be topologically correct.
Read-only property IsSimple Indicates whether this geometry is known (or assumed) to be topologically correct, after explicitly determining this if the geometry is not already known (or assumed) to be simple.
Method QueryClipped Redefines clippedGeometry to be the intersection of this geometry and the clipping envelope.
Method QueryClippedDense Redefines clippedGeometry to be the intersection of this geometry and the clipping envelope; densifies lines in the output contributed by the clipping envelope.
Method Simplify Makes this geometry topologically correct.
Method SymmetricDifference Constructs the geometry that contains points from either but not both input geometries.
Read-only property TopologyCache Provides a handle to the TopologyCache.
Method Union Constructs the geometry that is the set-theoretic union of the input geometries.

ITopologicalOperator.Boundary Property

The boundary of this geometry. A polygon's boundary is a polyline. A polyline's boundary is a multipoint. A point or multipoint's boundary is an empty point or multipoint.

Public ReadOnly Property Boundary As IGeometry
public IGeometry Boundary {get;}

Description

The Boundary of a Geometry is the part one the exterior of the Geometry. The Boundary is one Dimension lower than the Dimension of the original Geometry. The Boundary of a Polygon are the Polylines that form the Rings of the Polygon. The Boundary of a Polyline is a Multipoint corresponding to the endpoints of each Path in the Polyline. The Boundary of a Multipoint is an empty set.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

Boundary Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.Buffer Method

Constructs a polygon that is the locus of points at a distance less than or equal to a specified distance from this geometry.

Public Function Buffer ( _
    ByVal distance As Double _
) As IGeometry
public IGeometry Buffer (
    double distance
);

Description

Remarks

The buffer distance is in the same units as the source shape that is being buffered.

A negative distance can be specified to produce a buffer inside the original polygon. This cannot be used with polyline.

ITopologicalOperator methods must be applied on top-level geometries only. Top-Level geometries are point, multipoint, polyline and polygon. To use this method with segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), paths or rings, they must be wrapped with a top-level type.

A buffer distance of 0 will generate an empty polygon with the input geometry being a polyline and multipoint. However, if the input geometry is a point, the output will be the original point.

Buffer Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods



 [C#]//This example demonstrates how to use ITopologicalOperator::Buffer

 private void BufferArea()

   {

   IPoint[] points = new IPoint[5];

   //The spatial reference should be set here using IGeometry::SpatialReference (Code skipped here)

   for(int i = 0; i < points.Length; i++)

   {

      points[i] = new PointClass();

   }

   points[0].PutCoords(0, 0);

   points[1].PutCoords(0, 10);

   points[2].PutCoords(10, 10);

   points[3].PutCoords(10, 0);

   points[4].PutCoords(0, 0);

   IPointCollection4 pointCollection = new PolygonClass();

   IGeometryBridge geometryBride = new GeometryEnvironmentClass();

   geometryBride.AddPoints(pointCollection, ref points);

   IArea area = pointCollection as IArea;

   System.Windows.Forms.MessageBox.Show("Area original polygon : " + area.Area);

   ITopologicalOperator topologicalOperator = pointCollection as ITopologicalOperator;

   //Outside buffer

   IPolygon polygon = topologicalOperator.Buffer(1) as IPolygon;

   area = polygon as IArea;

   System.Windows.Forms.MessageBox.Show( "Area polygon positive distance : " + area.Area);

   //Inside buffer

   polygon = topologicalOperator.Buffer(-1) as IPolygon;

   area = polygon as IArea;

   System.Windows.Forms.MessageBox.Show("Area polygon negative distance : " + area.Area);

 }
Sub exampleITopologicalOperator_Buffer()

         Dim ptc As ESRI.ArcGIS.Geometry.IPointCollection, i As Long, pa As ESRI.ArcGIS.Geometry.IArea, ptopo As ESRI.ArcGIS.Geometry.ITopologicalOperator

         ptc = New ESRI.ArcGIS.Geometry.Polygon

         Dim pt(4) As ESRI.ArcGIS.Geometry.IPoint, poutPoly As ESRI.ArcGIS.Geometry.IPolygon

         'The spatial reference should be set here using IGeometry::SpatialReference (Code skipped here)

         For i = 0 To 4

             pt(i) = New ESRI.ArcGIS.Geometry.Point

         Next

         pt(0).PutCoords(0, 0)

         pt(1).PutCoords(0, 10)

         pt(2).PutCoords(10, 10)

         pt(3).PutCoords(10, 0)

         pt(4).PutCoords(0, 0)

         Dim geometryBride As ESRI.ArcGIS.Geometry.IGeometryBridge

         geometryBride = New ESRI.ArcGIS.Geometry.GeometryEnvironmentClass()

         geometryBride.AddPoints(ptc, pt)

         pa = ptc

         Debug.Print("Area original polygon : " & pa.Area)

         ptopo = ptc

         poutPoly = ptopo.Buffer(1) 'Outside buffer

         pa = poutPoly

         Debug.Print("Area polygon positive distance : " & pa.Area)

         poutPoly = ptopo.Buffer(-1) 'Inside buffer

         pa = poutPoly

         Debug.Print("Area polygon negative distance : " & pa.Area)

     End Sub

ITopologicalOperator.Clip Method

Constructs the intersection of this geometry and the specified envelope.

Public Sub Clip ( _
    ByVal clipperEnvelope As IEnvelope _
)
public void Clip (
    IEnvelope clipperEnvelope
);

Description

The Clip method clips the geometry with the input envelope.

Remarks

Use QueryClipped or QueryClippedDense methods to send the results to a different polygon.

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

ITopologicalOperator Clip Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.ClipDense Method

Constructs the intersection of this geometry and the specified envelope; densifies lines in output contributed by the clipping envelope.

Public Sub ClipDense ( _
    ByVal clipperEnvelope As IEnvelope, _
    ByVal denseDistance As Double _
)
public void ClipDense (
    IEnvelope clipperEnvelope,
    double denseDistance
);

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

ITopologicalOperator.ConstructUnion Method

Defines this geometry to be the union of the inputs. More efficient for unioning multiple geometries than calling Union repeatedly.

Public Sub ConstructUnion ( _
    ByVal geometries As IEnumGeometry _
)
public void ConstructUnion (
    IEnumGeometry geometries
);

Description

ConstructUnion simultaneously Unions an Enumeration of geometries of the same Dimension into a single geometry. ConstructUnion is more efficient for unioning a large collection of geometries simultaneously rather than cycling through each geometry individually.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

Temproray files might be created. If environment variable "ARCTMPDIR" exists, then the files are written to the path, otherwise written to current directory or system temp directory.

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.ConvexHull Method

Constructs the convex hull of this geometry.

Public Function ConvexHull ( _
) As IGeometry
public IGeometry ConvexHull (
);

Description

The ConvexHull of a geometry is the minimal bounding polygon such that all outer angles are convex. The ConvexHull of a point is the point itself.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

ConvexHull method does not deal with Z attribute now.

ConvexHull Example

ITopologicalOperator.Cut Method

Splits this geometry into a part left of the cutting polyline, and a part right of it.

Public Sub Cut ( _
    ByVal cutter As IPolyline, _
    ByRef leftGeom As IGeometry, _
    ByRef rightGeom As IGeometry _
)
public void Cut (
    IPolyline cutter,
    ref IGeometry leftGeom,
    ref IGeometry rightGeom
);

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

When a polyline/polygon is cut, it is split where it intersects the cutter polyline. Each piece is classified as ‘left of’ or ‘right of’ the cutter. This classification is based on the orientation of the cutter line. Parts of the target polyline that do not intersect the cutting polyline are returned as part of the ‘right of’ result for that input polyline. If a geometry is not cut, the left geometry will be empty.

When using a multi-part polyline to cut a single ring of a polyline, the orientation of the polyline paths is important. The cut piece of the ring must be on the same side of each cutting path as defined by the orientation of each path.

This method does not support GeometryBags.

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.Difference Method

Constructs the geometry containing points from this geometry but not the other geometry.

Public Function Difference ( _
    ByVal other As IGeometry _
) As IGeometry
public IGeometry Difference (
    IGeometry other
);

Description

Difference create a Geometry that is composed only of the region unique to the base geometry but not part of the input geometry.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

ITopologicalOperator Differenece Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.Intersect Method

Constructs the geometry that is the set-theoretic intersection of the input geometries. Use different resultDimension values to generate results of different dimensions.

Public Function Intersect ( _
    ByVal other As IGeometry, _
    ByVal resultDimension As esriGeometryDimension _
) As IGeometry
public IGeometry Intersect (
    IGeometry other,
    esriGeometryDimension resultDimension
);

Description

When two geometries of the same dimension intersect with resultDimension the same as the input geometries, the output is a geometry containing only the regions of overlap between the original geometries.

Remarks

Intersection is basically an AND between input geometries.

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), paths or rings, they must be wrapped into high-level geometries types.

Note that when esriGeometryNoDimension is specified as resultDimension, the output will be in the dimension of the minimum dimension of the input geometries.

This method does not support GeometryBags.

Since ArcGIS 9.2, Intersect has a larger cost - it takes longer to run the method. Therefore, it is a better approach to test if the two geometries are disjoint before calling Intersect.

Intersection Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.IsKnownSimple Property

Indicates whether this geometry is known (or assumed) to be topologically correct.

Public ReadOnly Property IsKnownSimple As Boolean
public bool IsKnownSimple {get;}

Description

Returns TRUE when the geometry is aware that it is Simple. IsKnownSimple may return FALSE even if the geometry is simple as long as the geometry is not aware of its IsSimple state. Calling either IsSimple or Simplify makes the IsSimple state known to the geometry. Topologically altering the geometry makes the IsKnownSimple state FALSE until the IsSimple state is again checked.

Remarks

Here is the status of the IsKnownSimple flag in some common situations:

IsKnownSimple = 'False'- A non-empty newly created geometry. For example, creating a polygon using IPointCollection sets the flag IsKnownSimple = 'false' on that geometry.- Geometry after projection (IGeometry::Project )- Geometry after generalization (IPolycurve::Generalize ) or smoothing(IPolycurve::Smooth )- �

IsKnownSimple = 'True'- A geometry coming directly from a feature class- An empty geometry- Output geometry of any method on ITopologicalOperator- �

This method does not support GeometryBags.

ITopologicalOperator.IsSimple Property

Indicates whether this geometry is known (or assumed) to be topologically correct, after explicitly determining this if the geometry is not already known (or assumed) to be simple.

Public ReadOnly Property IsSimple As Boolean
public bool IsSimple {get;}

Description

Returns TRUE if the geometry is topologically Simple (refer to the discussion for the Simplify method). If the geometry is not Simple, it may be necessary to call Simplify to enforce topological consistency. Editing a geometry can change the IsSimple state of the geometry.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

The xy cluster tolerance value of the geometry's associated spatial reference is used by this method. If the goal of this method is to determine if a geometry can be persisted in an sde (or other integer-based) layer without alteration, you may wish to use the minimum xy cluster tolerance value (ISpatialReferenceTolerance::SetMinimumXYTolerance) before applying this method (don't forget to set it back).

This method does not support GeometryBags.

ITopologicalOperator IsSimple SimplePolygon Example

ITopologicalOperator IsSimple SimplePolyline Example

ITopologicalOperator IsSimple SimplePoint Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.QueryClipped Method

Redefines clippedGeometry to be the intersection of this geometry and the clipping envelope.

Public Sub QueryClipped ( _
    ByVal clipperEnvelope As IEnvelope, _
    ByVal clippedGeometry As IGeometry _
)
public void QueryClipped (
    IEnvelope clipperEnvelope,
    IGeometry clippedGeometry
);

Description

QueryClipped returns the portion of the input Geometry that is Contained by the input Envelope. The returned geometry is the same type as the original geometry.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

The other geometry must be an high-level geometry. High-Level geometries are point, multipoint, polyline and polygon. To use it with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), path or ring they must be wrapped into high-level geometries type. The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

This method does not support GeometryBags.

QueryClipped Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.QueryClippedDense Method

Redefines clippedGeometry to be the intersection of this geometry and the clipping envelope; densifies lines in the output contributed by the clipping envelope.

Public Sub QueryClippedDense ( _
    ByVal clipperEnvelope As IEnvelope, _
    ByVal denseDistance As Double, _
    ByVal clippedGeometry As IGeometry _
)
public void QueryClippedDense (
    IEnvelope clipperEnvelope,
    double denseDistance,
    IGeometry clippedGeometry
);

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), paths or rings, they must be wrapped into high-level geometries types.

The other geometry must be an high-level geometry. High-Level geometries are point, multipoint, polyline and polygon. To use it with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), path or ring they must be wrapped into high-level geometries type. The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

This method does not support GeometryBags.

ITopologicalOperator.Simplify Method

Makes this geometry topologically correct.

Public Sub Simplify ( _
)
public void Simplify (
);

Description

Simplify permanently alters the input geometry, making its definition "topologically legal" with respect to its geometry type:

  • For Points, Simplify does nothing. A point has no constraints on the values of its coordinates.
  • For Multipoints, Simplify snaps all X, Y, Z, and M coordinates to the grid of the associated spatial reference, then removes identical points. A point is identical to another point when the two have identical X and Y coordinates (after snapping), and when attributes for which it is aware are identical to the attributes for which the other point is aware. For example, if both points are Z aware, the Z coordinate values must be identical.
  • For Polylines, Simplify has two variations: planar and non-planar. By default, polylines that are not M-aware are simplified in a planar manner: all overlapping segments are reduced to a single segment, and segments are split at intersection points. Output paths are created for connected sequences of segments. Input segment orientation is preserved where possible, but segments in the interior of a path will be reoriented if necessary. Polylines that are M-aware use non-planar simplification: 1. Overlaps and self-intersections are preserved, but zero length segments are removed, 2. Segment orientations are adjusted so that the 'to' point of segment I is identical to (considering vertex attributes) the 'from' point of Segment I+1, 3. New paths are created where segments are not connected, 4. Existing paths are merged where only two of them meet at a segment endpoint.
  • For Polygons, Simplify identifies an interior and exterior for the polygon, then modifies the polygon structure to be consistent with that determination. The default methodology for identifying interior and exterior is: 1. Remove all dangling sequences of segments, 2. Identify the largest legal rings, add them to the output version of the polygon, then delete them from the working version, 3. Repeat. If this approach ends up removing too many segments for your application, consider using IPolygon4::SimplifyEx with the XOR parameter set to TRUE. At the end of Simplify, no rings will overlap, no self intersection will occur (except in certain circumstances) and, in general, an arbitrary point can always be classified unambiguously as either outside, on the boundary of, or inside the polygon.

The XY tolerance property of the geometry's associated spatial reference is used during the simplify operation for polylines and polygons.

Remarks

This method first looks at the ITopologicalOperator::IsKnownSimple flag before starting processing. If the flag is 'true' then operation is interrupted and the geometry is considered simple. If the flag is 'false' then the geometry consistency is checked and the geometry is updated as needed.

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

Simplify Polygon Example

Simplify Polyline Example

Simplify Point Example

ITopologicalOperator.SymmetricDifference Method

Constructs the geometry that contains points from either but not both input geometries.

Public Function SymmetricDifference ( _
    ByVal other As IGeometry _
) As IGeometry
public IGeometry SymmetricDifference (
    IGeometry other
);

Description

The SymmetricDifference between two Geometries of the same Dimension is the Union of those Geometries minus the Intersection of those Geometries. Thus, the SymmetricDifference is composed only of regions unique to only one of the geometries.

This method does not support GeometryBags.

Remarks

SymmetricDifference is basically an XOR between the input geometries.

SymmetricDifference of G1 and G2 can also be described as the Union(Difference(G1, G2), Difference(G2, G1)).

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

Symmetric Difference Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

ITopologicalOperator.TopologyCache Property

Provides a handle to the TopologyCache.

Public Sub TopologyCache ( _
    ByRef topologyCacheHandle As Int64& _
)
public void TopologyCache (
    ref Int64& topologyCacheHandle
);

ITopologicalOperator.Union Method

Constructs the geometry that is the set-theoretic union of the input geometries.

Public Function Union ( _
    ByVal other As IGeometry _
) As IGeometry
public IGeometry Union (
    IGeometry other
);

Description

The Union of two Geometries of the same Dimension is a single Geometry corresponding to the combination of both Geometries such that anything within either of the original geometries is also part of the unioned geometry, but anything common to both geometries only exists once in the unioned geometry.

Remarks

The Union is basically an OR between the input geometries.

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

Union Example

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

Classes that implement ITopologicalOperator

Classes Description
GeometryBag An ordered collection of objects that support the IGeometry interface.
MultiPatch A collection of surface patches.
Multipoint An ordered collection of points; optionally has measure, height and ID attributes.
Point A two dimensional point, optionally with measure, height, and ID attributes.
Polygon A collection of rings ordered by their containment relationship; optionally has measure, height and ID attributes.
Polyline An ordered collection of paths; optionally has measure, height and ID attributes.

Remarks

Buffer, Clip, and Simplify are the only methods of ITopologicalOperator supported on GeometryBags.

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this interface with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bezier Curve), paths or rings, they must be wrapped into high-level geometry types.

For multipatch geometries, generally the footprint or envelope is used.

Every Geometry created within ArcGIS should be assigned a spatial reference. Always attach well-defined spatial references to new geometries. This improves processing efficiency, in particular, when using ITopologicalOperator on geometries that contain curved segments (circular arcs, bezier curves, elliptical arcs).New geometries include any geometry that is created in memory. It does not matter whether it will be stored in a feature class or not. Well-defined as applied to a spatial reference means that it not only has its coordinate system (projection) defined, but also its coordinate grid. The coordinate grid consists of the xy domain, xy resolution, and xy cluster tolerance properties of a spatial reference. If the Geometry includes z or m values, the z or m domains, z or m resolutions, and z or m cluster tolerance properties must also be defined. The cluster tolerance and resolutions can be quickly and easily set using SetDefault methods on ISpatialReferenceResolution and ISpatialReferenceTolerance interfaces.

//The following

code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj =   Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom =   segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator3 methods

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.