public void DeleteMapObject() { if (!Selection.Empty) { foreach (MapObject mapObject in Selection) { SceneDocument.RemoveMapObject(mapObject); } Selection.Clear(); UpdateSolidPropertiesControl(); editorStatusbar.ResetData(); RenderViewports(); } }
private void UngroupMapObject() { if (!Selection.Empty) { List <MapObjectGroup> groups = new List <MapObjectGroup>(); CustomOperation collectGroupsOperation = new CustomOperation { OnMapObjectGroup = group => { if (!group.IsTransient) { return; } groups.Add(group); } }; // collect all top level groups Selection.MapObjectList.ForEach(m => m.PerformOperation(collectGroupsOperation)); // remove groups that have been ungrouped groups.ForEach(group => { group.Selected = false; Selection.Remove(group); SceneDocument.RemoveMapObject(group); group.MapObjectList.ForEach(mapObject => { mapObject.Selected = true; Selection.Add(mapObject); SceneDocument.AddMapObject(mapObject); }); }); groups.Clear(); UpdateGroupToolbar(); } }
private void GroupMapObject() { if (!Selection.Empty && Selection.MapObjectList.Count > 1) { // remove the map objects from the document foreach (MapObject mapObject in Selection) { SceneDocument.RemoveMapObject(mapObject); } // clone and clear the selected map objects MapObject newMapObjectGroup = (MapObject)Selection.Clone(); Selection.Clear(); // add map object group with map objects in it to the document and selection map object SceneDocument.AddMapObject(newMapObjectGroup); Selection.Add(newMapObjectGroup); UpdateGroupToolbar(); RenderViewports(); } }