private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args) { MyDrawObject.IsEnabled = false; offsetGraphicsLayer.ClearGraphics(); ESRI.ArcGIS.Client.Geometry.MapPoint point = args.Geometry as ESRI.ArcGIS.Client.Geometry.MapPoint; point.SpatialReference = MyMap.SpatialReference; System.Windows.Point screenPnt = MyMap.MapToScreen(point); // Account for difference between Map and application origin GeneralTransform generalTransform = MyMap.TransformToVisual(null); System.Windows.Point transformScreenPnt = generalTransform.Transform(screenPnt); IEnumerable <Graphic> selected = parcelGraphicsLayer.FindGraphicsInHostCoordinates(transformScreenPnt); List <Graphic> graphicsList = new List <Graphic>(); foreach (Graphic g in selected) { graphicsList.Add(g); } if (graphicsList.Count < 1) { MyDrawObject.IsEnabled = true; return; } geometryService = new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryService.OffsetCompleted += GeometryService_OffsetCompleted; geometryService.Failed += GeometryService_Failed; OffsetParameters offsetParameters = new OffsetParameters() { BevelRatio = 1.1, OffsetDistance = -30, OffsetHow = GeometryOffset.Bevelled, OffsetUnit = LinearUnit.Meter, Simplify = true }; geometryService.OffsetAsync(graphicsList, offsetParameters); }
private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args) { MyDrawObject.IsEnabled = false; offsetGraphicsLayer.ClearGraphics(); ESRI.ArcGIS.Client.Geometry.MapPoint point = args.Geometry as ESRI.ArcGIS.Client.Geometry.MapPoint; point.SpatialReference = MyMap.SpatialReference; System.Windows.Point screenPnt = MyMap.MapToScreen(point); // Account for difference between Map and application origin GeneralTransform generalTransform = MyMap.TransformToVisual(null); System.Windows.Point transformScreenPnt = generalTransform.Transform(screenPnt); IEnumerable<Graphic> selected = parcelGraphicsLayer.FindGraphicsInHostCoordinates(transformScreenPnt); List<Graphic> graphicsList = new List<Graphic>(); foreach (Graphic g in selected) { graphicsList.Add(g); } if (graphicsList.Count < 1) { MyDrawObject.IsEnabled = true; return; } geometryService = new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryService.OffsetCompleted += GeometryService_OffsetCompleted; geometryService.Failed += GeometryService_Failed; OffsetParameters offsetParameters = new OffsetParameters() { BevelRatio = 1.1, OffsetDistance = -30, OffsetHow = GeometryOffset.Bevelled, OffsetUnit = LinearUnit.Meter, Simplify = true }; geometryService.OffsetAsync(graphicsList, offsetParameters); }