Private Sub MyDrawObject_DrawComplete(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.DrawEventArgs) 'args.Geometry.rings Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer) Dim graphic As New ESRI.ArcGIS.Client.Graphic() With { .Geometry = args.Geometry, .Symbol = _activeSymbol } graphicsLayer.Graphics.Add(graphic) End Sub
Solved! Go to Solution.
if ( args.Geometry is Polygon ) { PointCollection points = ((Polygon)geometry).Rings[0]; foreach ( MapPoint mapPoint in points ) { //Save the points } }
if ( args.Geometry is Polygon ) { PointCollection points = ((Polygon)geometry).Rings[0]; foreach ( MapPoint mapPoint in points ) { //Save the points } }
You cast the geometry to a Polygon, which has a collection of Rings. Each Ring is a
if ( args.Geometry is Polygon )
{
PointCollection points = ((Polygon)geometry).Rings[0];
foreach ( MapPoint mapPoint in points )
{
//Save the points
}
}
If TypeOf args.Geometry Is Polygon Then Dim points As PointCollection = DirectCast(geometry, Polygon).Rings(0) 'Save the points For Each mapPoint As MapPoint In points Next End If
I am getting errors like
'Polygon' is ambiguous, imported from the namespaces or types 'ESRI.ArcGIS.Client.Geometry, System.Windows.Shapes'.
'PointCollection' is ambiguous, imported from the namespaces or types 'ESRI.ArcGIS.Client.Geometry, System.Windows.Media'.
using Polygon = ESRI.ArcGIS.Client.Geometry.Polygon;
Polygon poly = new Polygon(); // no ambiguous error...