ArcGIS Explorer Component Help |
GeometryOperations..::.Simplify Method (Polygon) |
GeometryOperations Class Example See Also |
Assembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static Polygon Simplify( Polygon polygon ) |
Visual Basic (Declaration) |
---|
Public Shared Function Simplify ( _ polygon As Polygon _ ) As Polygon |
Parameters
- polygon
- Type: ESRI.ArcGISExplorer.Geometry..::.Polygon
The Polygon to copy and apply geometrical correctness rules to.
Return Value
A new Polygon.Remarks
Use the Simplify method to create a new geometry, based on an input geometry with the rules of geometrical correctness applied. Note that the input geometry is not changed. Specific overloads are available for the types of geometry which are most commonly simplified, Simplify(Polygon), Simplify(Polyline), and Simplify(Multipoint).
Geometrical shapes have constraints on their shapes. For example, a Polygon object only represents a valid polygon shape if it has closed rings that clearly define the interior and exterior of the shape. If all constraints are met, a geometry is considered to be "simple." If not met, the geometry is "non-simple."
Some GeometryOperations require geometries to be simple or they cannot proceed; for example, the Union operation relies on geometrical shapes to be valid and simple to calculate the shape's Union regions. In such cases, the GeometryOperations class ensures simplicity of inputs internally without the developer needing to perform this simplification; the input geometry is always left unchanged. However, you may need to use the Simplify method when looking at the spatial properties of a shape; for example, a non-simple Polygon might return an invalid value for its Area because the shape of the Polygon is not defined correctly; therefore, it cannot have a correct Area value.
For more information on the details of the Simplify method, refer to the ArcGIS Desktop developer help for the ITopologicalOperator.Simplify method.
Examples
MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; // Create a Polygon. Polygon multipartPolygon = new Polygon(); // Use TrackPolygon to add two separate rings to the Polygon. Polygon firstRing = disp.TrackPolygon(); if (firstRing != null) { multipartPolygon.AddRing(firstRing.GetRing(0)); } Polygon secondRing = disp.TrackPolygon(); if (secondRing != null) { multipartPolygon.AddRing(secondRing.GetRing(0)); } // Use the Simplify method to correct the shape of the geometry. Polygon corrected = GeometryOperations.Simplify(multipartPolygon);
Dim disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay ' Create a Polygon. Dim multipartPolygon As Polygon = New Polygon() ' Use TrackPolygon to add two separate rings to the Polygon. Dim firstRing As Polygon = disp.TrackPolygon() If Not firstRing Is Nothing Then multipartPolygon.AddRing(firstRing.GetRing(0)) End If Dim secondRing As Polygon = disp.TrackPolygon() If Not secondRing Is Nothing Then multipartPolygon.AddRing(secondRing.GetRing(0)) End If ' Use the Simplify method to correct the shape of the geometry. Dim corrected As Polygon = GeometryOperations.Simplify(multipartPolygon)