public PolygonBuilder( IEnumerable<MapPoint> points )
Public Function New( _ ByVal points As IEnumerable(Of MapPoint) _ )
Parameters
- points
- Points for the first ring.
public PolygonBuilder( IEnumerable<MapPoint> points )
Public Function New( _ ByVal points As IEnumerable(Of MapPoint) _ )
Exception | Description |
---|---|
System.InvalidOperationException | Incompatible spatial references. |
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
System.ArgumentNullException | points is null. |
// Use a builder convenience method or use a builder constructor. MapPoint pt1 = MapPointBuilder.CreateMapPoint(1.0, 1.0); MapPoint pt2 = MapPointBuilder.CreateMapPoint(1.0, 2.0); MapPoint pt3 = MapPointBuilder.CreateMapPoint(2.0, 2.0); MapPoint pt4 = MapPointBuilder.CreateMapPoint(2.0, 1.0); List<MapPoint> list = new List<MapPoint>() { pt1, pt2, pt3, pt4 }; // Builder convenience methods don't need to run on the MCT. Polygon polygon = PolygonBuilder.CreatePolygon(list, SpatialReferences.WGS84); // Builder constructors need to run on the MCT. ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (PolygonBuilder polygonBuilder = new PolygonBuilder(list)) { polygonBuilder.SpatialReference = SpatialReferences.WGS84; polygon = polygonBuilder.ToGeometry(); } }); // builderEx constructor's don't need to run on the MCT PolygonBuilderEx polygonBuilderEx = new PolygonBuilderEx(list); polygonBuilderEx.SpatialReference = SpatialReferences.WGS84; polygon = polygonBuilderEx.ToGeometry() as Polygon; // builderEx convenience methods don't need to run on the MCT // use AttributeFlags.NoAttributes because we only have 2d points in the list polygon = PolygonBuilderEx.CreatePolygon(list, AttributeFlags.NoAttributes);
Target Platforms: Windows 10, Windows 8.1