DrawMode.Freehand results to a polyline geometry. If your QueryTask need a polygon geometry, you can convert your polyline to polygon. private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args) { Polygon polygon = args.Geometry is Polygon ? args.Geometry as Polygon: new Polygon(); if (args.Geometry is Polyline) { Polyline source = args.Geometry as Polyline; foreach (var path in source.Paths) polygon.Rings.Add(path); } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = polygon, Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as Symbol }; graphicsLayer.Graphics.Add(graphic); }
private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args) { Polygon polygon = args.Geometry is Polygon ? args.Geometry as Polygon: new Polygon(); if (args.Geometry is Polyline) { Polyline source = args.Geometry as Polyline; foreach (var path in source.Paths) polygon.Rings.Add(path); } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = polygon, Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as Symbol }; graphicsLayer.Graphics.Add(graphic); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.