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); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.