private void AddFloor(Floor floor) { var clone = floors.FirstOrDefault(x => x.Model == floor); if (clone != null) { return; } var vFloor = new VisualFloor(floor); floors.Add(vFloor); shells.Add(new VisualShell(vFloor, this)); }
public override void Do() { foreach (IVisualElement entity in AffectedEntities) { _context.SelectedEntities.Remove(entity); // remove all building shape manipulation helpers var items = _context.MapEntities.Where(item => item is VisualCornerManipulator).ToList(); for (int i = 0; i < items.Count; i++) { _context.MapEntities.Remove(items[i]); } if (_context is DataModel) { ((DataModel)_context).CurrentCorners = null; } if (entity is WallElement) { foreach (VisualDoor door in ((WallElement)entity).Doors) { _context.MapEntities.Remove(door); } //TODO: Windows } _context.MapEntities.Remove(entity); } // handle floor removal if (_context is IVisualBuilding) { IVisualBuilding building = (IVisualBuilding)_context; VisualFloor floor = building.CurrentFloor; if (floor != null && floor.IsSelected) { RemovedFloorIndex = building.Floors.IndexOf(floor); building.Floors.Remove(floor); RemovedFloor = floor; if (building.Floors.Count > 0) { building.CurrentFloor = building.Floors[0]; } else { building.CurrentFloor = null; } } } }
private void RemoveFloor(Floor floor) { var visual = floors.FirstOrDefault(x => x.Model == floor); floors.Remove(visual); var shell = shells.FirstOrDefault(x => x.Floor == visual); shells.Remove(shell); if (floor.ParentBuilding.IsEmpty) { CurrentFloor = null; } }