private void DragEdgeEdit(Point delta) { EdgeRestoreData edgeRestoreData = CurrentUndoAction.GetRestoreData(this.EditedEdge) as EdgeRestoreData; DragEdgeWithSite(delta, EditedEdge, edgeRestoreData, edgeRestoreData.Site, edgeRestoreData.InitialSitePosition); }
Rectangle GetUpdatedRegionAndCleanUpAffectedObjects() { Rectangle rect = Rectangle.CreateAnEmptyBox(); var affectedObjectList = new List <IViewerObject>(CurrentUndoAction.AffectedObjects); foreach (var ivObj in affectedObjectList) { var inode = ivObj as IViewerNode; if (inode == null) { continue; } var node = (GeomNode)inode.DrawingObject.GeometryObject; NodeRestoreData nrd = (NodeRestoreData)CurrentUndoAction.GetRestoreData(node); var oldBoundingBox = nrd.BoundaryCurve.BoundingBox; if (!oldBoundingBox.Equals(node.BoundingBox)) { rect.Add(node.BoundingBox); rect.Add(oldBoundingBox); } else { CurrentUndoAction.RemoveAffectedObject(ivObj); } } foreach (var e in edgesDraggedWithSource.Concat(edgesDraggedWithTarget)) { rect.Add(e.BoundingBox); } rect.Pad(layoutSettings.EdgeRoutingSettings.Padding); return(rect); }
/// <summary> /// /// </summary> /// <param name="changedClusters"></param> public void PrepareForClusterCollapseChange(IEnumerable <IViewerNode> changedClusters) { InsertToListAndSetTheBoxBefore(new ClustersCollapseExpandUndoRedoAction(graph)); foreach (var iCluster in changedClusters) { CurrentUndoAction.AddAffectedObject(iCluster); } }
/// <summary> /// deletes the polyline corner /// </summary> /// <param name="edge"></param> /// <param name="site"></param> /// <param name="userData">an object to be stored in the unde action</param> public void DeleteSite(GeomEdge edge, Site site, object userData) { this.EditedEdge = edge; PrepareForPolylineCornerRemoval(userData, site); site.Previous.Next = site.Next;//removing the site from the list site.Next.Previous = site.Previous; //just to recalc everything in a correct way DragEdgeWithSite(new Point(0, 0), edge, CurrentUndoAction.GetRestoreData(edge) as EdgeRestoreData, site.Previous, site.Previous.Point); }
private void DragEdgesWithSource(Point delta) { foreach (GeomEdge edge in this.edgesDraggedForTheSource) { EdgeRestoreData edgeRestoreData = CurrentUndoAction.GetRestoreData(edge) as EdgeRestoreData; DragEdgeWithSource(delta, edge, edgeRestoreData); UpdateGraphBoundingBoxWithCheck(edge); } }
/// <summary> /// insert a polyline corner /// </summary> /// <param name="edge"></param> /// <param name="point">the point to insert the corner</param> /// <param name="siteBeforeInsertion"></param> ///<param name="affectedEntity">an object to be stored in the undo action</param> public void InsertSite(GeomEdge edge, Point point, Site siteBeforeInsertion, object affectedEntity) { this.EditedEdge = edge; //creating the new site Site first = siteBeforeInsertion; Site second = first.Next; Site s = new Site(first, point, second); PrepareForPolylineCornerInsertion(affectedEntity, s); //just to recalc everything in a correct way DragEdgeWithSite(new Point(0, 0), edge, CurrentUndoAction.GetRestoreData(edge) as EdgeRestoreData, s, point); }
/// <summary> /// drags elements by the delta /// </summary> /// <param name="delta"></param> public void Drag(Point delta) { GraphBoundingBoxGetsExtended = false; if (delta.X != 0 || delta.Y != 0) { if (EditedEdge == null) { foreach (GeometryObject geomObj in objectsToDrag) { GeomNode node = geomObj as GeomNode; if (node != null) { DragNode(node, delta, CurrentUndoAction.GetRestoreData(node) as NodeRestoreData); } else { GeomEdge edge = geomObj as GeomEdge; if (edge != null) { TranslateEdge(edge, delta, CurrentUndoAction.GetRestoreData(edge) as EdgeRestoreData); } else { GeomLabel label = geomObj as GeomLabel; if (label != null) { DragLabel(label, delta, (CurrentUndoAction.GetRestoreData(label) as LabelRestoreData).Center); } else { throw new NotImplementedException(); } } } UpdateGraphBoundingBoxWithCheck(geomObj); } DragEdgesWithSource(delta); DragEdgesWithTarget(delta); } else if (EditedEdge != null) { DragEdgeEdit(delta); UpdateGraphBoundingBoxWithCheck(EditedEdge); } } }