What do I need to know before calling Simplify?

In this topic

About the Simplify method

The Simplify method 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. See the following code example:
//The following code shows to wrap a line segment into a polyline in C#
//Assume a line (line1 as ILine) is already created
ILine line1 = new Line();
ISpatialReference spatialRef = null;
ISegmentCollection segCollection = new Polyline();
segCollection.addSegment((ISegment)line1, null, null);

//Set the spatial reference on the new polyline
//The spatial reference is not transfered automatically from the segments
IGeometry geom = (IGeometry)segCollection;
//Can now be used with ITopologicalOperator methods

Determining if the geometry is simple

The Simplify method permanently alters the input geometry, making its definition topologically legal with respect to its geometry type. Before explicitly calling Simplify, determine if the geometry is simple. A geometry is known or assumed to be simple if it is an empty geometry, a geometry directly from a feature class, or output of any method of ITopologicalOperator.
A geometry is known or assumed to be not simple if it is not a new empty geometry or a geometry after projection (IGeometry.Project), generalization (IPolycurve.Generalize), or smoothing (IPolycurve.Smooth).
By setting the IsKnownSimple property to false, the user explicitly determines if the geometry is not already known or assumed to be simple, then running the IsSimple method indicates whether this geometry is topologically correct (simple). Calling either IsSimple makes the IsSimple state known to the geometry. Topologically altering the geometry makes the IsKnownSimple state false until the IsSimple state is checked again. See the following code example:
boolean isSimple = topoOp2.isSimple();
Like the IsSimple method, Simplify first looks at the ITopologicalOperator.IsKnownSimple flag before processing. If the flag is true, operation is interrupted and the geometry is considered simple. If the flag is false, the geometry consistency is checked and the geometry is updated as needed. After calling Simplify, the IsKnownSimple flag is set to true. See the following code example:

See Also:

When do I need to simplify a geometry?