/// <summary> /// Delete action. /// </summary> virtual public void Delete(bool batch = false) { if (!batch) { History <ShapeCollection> .Memorize(_shapes); } for (int i = 0; i < _shapes.Count; i++) { if (_shapes[i].Selected) { _shapes.Remove(_shapes[i]); i = -1; } } if (!batch) { Invalidate(); } }
public void AddStoreSectionDialogOkButtonHandler() { if (Regex.IsMatch(NewlyCreatedStoreSectionName, @"^[a-zA-Z0-9-øØ-æÆ-åÅ\s]+$")) { long newStoreSectionID = _db.TableStoreSection.CreateStoreSection(NewlyCreatedStoreSectionName, (long)_newlyCreatedSection.Left, (long)_newlyCreatedSection.Top, _floorplanID); _newlyCreatedSection.ID = newStoreSectionID; _newlyCreatedSection.Name = "Button" + newStoreSectionID; } else { ShapeCollection.Remove(_newlyCreatedSection); } }
/// <summary> /// Delete action. /// </summary> virtual public void Delete() { History <ShapeCollection> .Memorize(_shapes); for (int i = 0; i < _shapes.Count; i++) { if (_shapes[i].Selected) { _shapes.Remove(_shapes[i]); i = -1; } } Invalidate(); }
private void deleteStoreSectionHandler() { SectionShape shapeToDelete = null; string sectionShapeToDelete = "Button" + _selectedStoreSection; foreach (var shape in ShapeCollection) { if (shape.Name == sectionShapeToDelete) { shapeToDelete = shape; } } if (shapeToDelete != null) { ShapeCollection.Remove(shapeToDelete); } _db.TableStoreSection.DeleteStoreSection(_selectedStoreSection); }
public void UnSelectUIShape(UIShapeBase shape) { //m_selectedShapeList.Remove(shape); //m_UIShapeList.Clear(); if (m_bCopying == true) { return; } if (m_selectedShapeList.Contains(shape)) // 테스트 { m_selectedShapeList.Remove(shape); } // if (shape == m_baseDialog || shape.Parent == m_baseDialog) //{ // //if (m_selectedShapeList.Contains(shape)) // 테스트 // m_selectedShapeList.Remove(shape); //} //m_baseDialog = null; // m_UIShapeList.Remove(shape); // // foreach (ShapeBase child in shape.ChildCollection) // { // if (child is UIShapeBase) // { // m_UIShapeList.Remove(child as UIShapeBase); // } // } }
void CommonInit(ShapeCollection shapes, Shape3D.DropToFloorMode mode, Vector3F axis, bool includeShapes) { for (int i = 0; i < shapes.Count; i++) { Shape3D shape = shapes[i] as Shape3D; if (shape == null || !shape.Traceable || !shape.Modifiable) { continue; } ShapeCollection colliderShapes = null; if (includeShapes) { colliderShapes = EditorManager.Scene.AllShapesOfType(typeof(Shape3D), true); if (colliderShapes.Contains(shape)) { colliderShapes.Remove(shape); } } // use a replacement action? (e.g. billboards rather want to drop every single instance) IAction custom = shape.GetCustomDropToFloorAction(mode, axis, colliderShapes); if (custom != null) { this.Add(custom); continue; } float fHeight = EditorApp.ActiveView.EngineManager.GetDropToFloorHeight(shape, mode, axis, colliderShapes); if (fHeight == 0.0f) { continue; } this.Add(new MoveShapeAction(shape, shape.Position, shape.Position + axis * fHeight)); } }
private void SortSelectedShapes(MoveShapesDirection moveDirection) { ShapeCollection selected = shapeTreeView.SelectedShapes; // return if any of the indices is already on the maximum. foreach (ShapeBase shape in selected) { if (moveDirection == MoveShapesDirection.Up) { if (shape.Parent.ChildCollection.FindIndex(i => i == shape) <= 0) return; } else if (shape.Parent.ChildCollection.FindIndex(i => i == shape) >= shape.Parent.ChildCollection.Count - 1) return; } // get all parents to share modified collections between their children. ShapeCollection parents = new ShapeCollection(); foreach (ShapeBase shape in selected) if (!parents.Contains(shape.Parent)) parents.Add(shape.Parent); EditorManager.Actions.StartGroup("Sort Shapes"); foreach (ShapeBase parent in parents) { // create copy of the original collection before sorting ShapeCollection copyOfChildren = new ShapeCollection(); copyOfChildren.AddRange(parent.ChildCollection); if (moveDirection == MoveShapesDirection.Up) { for (int i = 0; i < selected.Count; i++) { ShapeBase child = selected[i]; if (child.Parent == parent) { int index = copyOfChildren.FindIndex(c => c == child); copyOfChildren.Remove(child); copyOfChildren.Insert(index - 1, child); EditorManager.Actions.Add(new SortShapeChildrenAction(parent, copyOfChildren)); } } } else for (int i = selected.Count - 1; i > -1; i--) { ShapeBase child = selected[i]; if (child.Parent == parent) { int index = copyOfChildren.FindIndex(c => c == child); copyOfChildren.Remove(child); copyOfChildren.Insert(index + 1, child); EditorManager.Actions.Add(new SortShapeChildrenAction(parent, copyOfChildren)); } } } EditorManager.Actions.EndGroup(); // recover selection ArrayList newSelection = new ArrayList(); foreach (ShapeTreeNode node in shapeTreeView.Nodes) { if (selected.Contains(node.shape)) // root newSelection.Add(node); foreach (ShapeTreeNode subNode in shapeTreeView.GetChildNodes(node)) { if (selected.Contains(subNode.shape)) // all children newSelection.Add(subNode); } } shapeTreeView.SelectedNodes = newSelection; }
public void AddStoreSectionDialogCancelButtonHandler() { ShapeCollection.Remove(_newlyCreatedSection); }