Numéro d’ID de bogue |
BUG-000176904 |
Envoi | June 3, 2025 |
Dernière modification | June 20, 2025 |
S’applique à | ArcGIS Pro SDK for .NET |
Version trouvée | 3.5 |
Système d’exploitation | Windows OS |
Version du système d’exploitation | 11.0 64 bit |
Statut | As Designed
Après examen par l’équipe de développement, il a été déterminé que ce comportement est prévu. Pour plus d’informations, reportez-vous à la section Informations supplémentaires.
|
Informations supplémentaires
The CreatePolygon method inserts each polyline as a separate part; however, each polyline contains only two points. The resulting polygon has four parts, each of which degenerates to a line. When SimplifyAsFeature is called, the degenerate parts are removed, leaving an empty polygon.
Instead of creating two-point polylines, create line segments and either call PolygonBuilderEx.AddSegment for each segment, or create the polygon by using PolygonBuilderEx.CreatePolygon.
Here is an example.
// Define input polyline edges (clockwise)
Segment lnN = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(0, 10), MapPointBuilderEx.CreateMapPoint(10, 10));
Segment lnE = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(10, 10), MapPointBuilderEx.CreateMapPoint(10, 0));
Segment lnS = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(10, 0), MapPointBuilderEx.CreateMapPoint(0, 0));
Segment lnW = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(0, 0), MapPointBuilderEx.CreateMapPoint(0, 10));
Polygon plyNew = PolygonBuilderEx.CreatePolygon(new Segment[] { lnN, lnE, lnS, lnW });
double length = plyNew.Length; // length = 40
Polygon simplifiedPolygon = GeometryEngine.Instance.SimplifyAsFeature(plyNew) as Polygon;
length = simplifiedPolygon.Length; // length = 40
bool isSimple = GeometryEngine.Instance.IsSimpleAsFeature(simplifiedPolygon); // isSimple = true
Étapes pour reproduire
ID de bogue: BUG-000176904
Logiciel: