public void AddGeometries( IEnumerable<Geometry> geometries )
Public Sub AddGeometries( _ ByVal geometries As IEnumerable(Of Geometry) _ )
Parameters
- geometries
- The list of geometries to add.
public void AddGeometries( IEnumerable<Geometry> geometries )
Public Sub AddGeometries( _ ByVal geometries As IEnumerable(Of Geometry) _ )
Exception | Description |
---|---|
System.ArgumentNullException | geometries is null. |
System.ArgumentNullException | A geometry in geometries is null. You cannot insert a null geometry into a GeometryBag. |
System.ArgumentException | A geometry in geometries is GeometryBag. You cannot insert a GeometryBag into another GeometryBag. |
MapPoint point = MapPointBuilderEx.CreateMapPoint(10, 20); List<Coordinate2D> coords = new List<Coordinate2D>() { new Coordinate2D(50, 60), new Coordinate2D(-120, -70), new Coordinate2D(40, 60) }; Multipoint multipoint = MultipointBuilderEx.CreateMultipoint(coords, SpatialReferences.WebMercator); Polyline polyline = PolylineBuilderEx.CreatePolyline(coords); string json = "{\"rings\":[[[0,0],[0,1],[1,1],[1,0],[0,0]],[[3,0],[3,1],[4,1],[4,0],[3,0]]]}"; Polygon polygon = PolygonBuilderEx.FromJson(json); var geometries = new List<Geometry>() { point, multipoint, polyline, polygon }; //At 2.x - using (var builder = new GeometryBagBuilder(SpatialReferences.WGS84)) var builder = new GeometryBagBuilderEx(SpatialReferences.WGS84); builder.AddGeometries(geometries); GeometryBag geomBag = builder.ToGeometry(); // geomBag.PartCount == 4 (point, multipoint, polyline, polygon) geometries = new List<Geometry>() { point, polyline }; builder.InsertGeometries(1, geometries); // builder.GeometryCount == 6 geomBag = builder.ToGeometry(); // geomBag.PartCount == 6 (point, point, polyline, multipoint, polyline, polygon)
Target Platforms: Windows 11, Windows 10