protected void buttonEditShape_Click(object sender, EventArgs e) { LayerOverlay dynamicOverlay = (LayerOverlay)Map1.CustomOverlays["DynamicOverlay"]; InMemoryFeatureLayer shapeLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["shapeLayer"]; foreach (Feature feature in shapeLayer.InternalFeatures) { Map1.EditOverlay.Features.Add(feature.Id, feature); } shapeLayer.InternalFeatures.Clear(); Map1.EditOverlay.TrackMode = TrackMode.Edit; if (Map1.EditOverlay.Features.Count > 0) { foreach (Feature item in Map1.EditOverlay.Features) { PolygonShape itemShape = item.GetShape() as PolygonShape; if (itemShape != null && PolygonIsRectangleShape(itemShape)) { Map1.EditOverlay.EditSettings.IsRotatable = false; break; } else { Map1.EditOverlay.EditSettings.IsRotatable = true; } } } dynamicOverlay.Redraw(); } private bool PolygonIsRectangleShape(PolygonShape polygon) { Collection ourerRingVertices = polygon.OuterRing.Vertices; if (ourerRingVertices.Count == 5 && Math.Abs((ourerRingVertices[0].X - ourerRingVertices[2].X)) == Math.Abs((ourerRingVertices[1].X - ourerRingVertices[3].X)) && Math.Abs((ourerRingVertices[0].Y - ourerRingVertices[2].Y)) == Math.Abs((ourerRingVertices[1].Y - ourerRingVertices[3].Y)) ) { return true; } return false; }