/// <ToBeCompleted></ToBeCompleted> public void Cut(Diagram source, IEnumerable<Shape> shapes, bool withModelObjects, Point startPos) { if (source == null) throw new ArgumentNullException("source"); if (shapes == null) throw new ArgumentNullException("shapes"); editBuffer.Clear(); editBuffer.action = EditAction.Cut; editBuffer.withModelObjects = withModelObjects; editBuffer.initialMousePos = startPos; editBuffer.shapes.AddRange(shapes); ICommand cmd = new DeleteShapeCommand(source, editBuffer.shapes, withModelObjects); project.ExecuteCommand(cmd); }
/// <ToBeCompleted></ToBeCompleted> public void DeleteShapes(Diagram diagram, IEnumerable<Shape> shapes, bool withModelObjects) { if (diagram == null) throw new ArgumentNullException("diagram"); if (shapes == null) throw new ArgumentNullException("shapes"); if (withModelObjects) { foreach (Shape s in shapes) { if (s.ModelObject != null && s.ModelObject.ShapeCount > 1) { string messageText = string.Format("{0} '{1}' can not be deleted while more than one shapes refer to it.", s.ModelObject.Type.Name, s.ModelObject.Name); throw new NShapeException(messageText); } } } ICommand cmd = new DeleteShapeCommand(diagram, shapes, withModelObjects); Project.ExecuteCommand(cmd); }