Jennifer, Thank you for your reply. I was trying to edit each selected Graphic.Geometry object directly and change it's vertices. But when I tried to save the changes were lost. What did work was making a clone of the geometry, editing the vertices, and then assigning the clone back to the Graphic.Geometry object. Now I can move and rotate groups of polygons together. Here's the code I used to move polygons. foreach (var graphic in flayer.SelectedGraphics) { _edit_Geometry.StartEdit(graphic); ESRI.ArcGIS.Client.Geometry.Geometry geom = ESRI.ArcGIS.Client.Geometry.Geometry.Clone(graphic.Geometry); ESRI.ArcGIS.Client.Geometry.Polygon polygon = geom as ESRI.ArcGIS.Client.Geometry.Polygon; if (polygon != null) { foreach (var ring in polygon.Rings) { IEnumerator<MapPoint> points = ring.GetEnumerator(); while (points.MoveNext()) { points.Current.X = points.Current.X + changeinX; points.Current.Y = points.Current.Y + changeinY; } } } graphic.Geometry = geom; _edit_Geometry.StopEdit(); }
foreach (var graphic in flayer.SelectedGraphics) { _edit_Geometry.StartEdit(graphic); ESRI.ArcGIS.Client.Geometry.Geometry geom = ESRI.ArcGIS.Client.Geometry.Geometry.Clone(graphic.Geometry); ESRI.ArcGIS.Client.Geometry.Polygon polygon = geom as ESRI.ArcGIS.Client.Geometry.Polygon; if (polygon != null) { foreach (var ring in polygon.Rings) { IEnumerator<MapPoint> points = ring.GetEnumerator(); while (points.MoveNext()) { points.Current.X = points.Current.X + changeinX; points.Current.Y = points.Current.Y + changeinY; } } } graphic.Geometry = geom; _edit_Geometry.StopEdit(); }
If you are using Editor.EditVertices, I don't see a reason why edits are not saved since geometries are first simplified before it overwrites your geometry. If you are using EditGeometry, you may need to simplify the geometry first: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Simplify. Kindly check Fiddler when saving this edit, SpatialReference on Geometry might be missing. If so, we have logged this bug in EditGeometry.
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.