This document is archived and information here might be outdated. Recommended version. |
Determines why a geometry is not simple. Currently only implemented for polygons.
[Visual Basic .NET] Public Function get_IsSimpleEx ( _ ByRef reason As esriNonSimpleReasonEnum _ ) As Boolean
[C#] public bool get_IsSimpleEx ( ref esriNonSimpleReasonEnum reason );
[C++]
HRESULT get_IsSimpleEx(
esriNonSimpleReasonEnum* reason,
Boolean* IsSimple
);
[C++] Parameters reason [out]
reason is a parameter of type esriNonSimpleReasonEnum* IsSimple [out, retval]
IsSimple is a parameter of type bool*
The return boolean value indicates whether or not the geometry is simple. If the return is false, the "reason" parameter can be inspected.
Note: All geometries involved in ITopologicalOperator operations must be high-level geometries. 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 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).
//How to use get_IsSimpleEx
ITopologicalOperator3 topoOp3 = inGeom as ITopologicalOperator3; //Must be polygon
ESRI.ArcGIS.Geometry.esriNonSimpleReasonEnum reason = ESRI.ArcGIS.Geometry.esriNonSimpleReasonEnum.esriNonSimpleOK; //Initialize
topoOp3.IsKnownSimple_2 = false;
Boolean pBool = topoOp3.get_IsSimpleEx(out reason); //Inspect pReason for description code
//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