Example #1
0
 internal UndoRedoAction InsertToListAndSetTheBoxBefore(UndoRedoAction action)
 {
     UndoRedoActionsList.AddAction(action);
     action.GraphBoundingBoxBefore = action.Graph.BoundingBox;
     RaiseChangeInUndoList();
     return(action);
 }
Example #2
0
        /// <summary>
        /// Preparing for an edge corner dragging
        /// </summary>
        /// <param name="geometryEdge"></param>
        /// <param name="site"></param>
        /// <returns></returns>
        public UndoRedoAction PrepareForEdgeCornerDragging(GeomEdge geometryEdge, Site site)
        {
            EditedEdge = geometryEdge;
            UndoRedoAction edgeDragUndoRedoAction = CreateEdgeEditUndoRedoAction();

            //            var edgeRestoreDate = (EdgeRestoreData) edgeDragUndoRedoAction.GetRestoreData(geometryEdge);
            //            edgeRestoreDate.Site = site;

            return(InsertToListAndSetTheBoxBefore(edgeDragUndoRedoAction));
        }
Example #3
0
        internal UndoRedoAction AddAction(UndoRedoAction action)
        {
            if (CurrentUndo != null)
            {
                CurrentUndo.Next = action;
            }

            action.Previous = CurrentUndo;
            CurrentUndo     = action;
            CurrentRedo     = null;

            return(action);
        }
Example #4
0
        /// <summary>
        /// Creates a "tight" bounding box
        /// </summary>
        /// <param name="affectedEntity">the object corresponding to the graph</param>
        /// <param name="geometryGraph"></param>
        public void FitGraphBoundingBox(IViewerObject affectedEntity, GeometryGraph geometryGraph)
        {
            if (geometryGraph != null)
            {
                var uAction = new UndoRedoAction(geometryGraph)
                {
                    Graph = geometryGraph
                };
                UndoRedoActionsList.AddAction(uAction);
                var r = new Rectangle();
                foreach (GeomNode n in geometryGraph.Nodes)
                {
                    r = n.BoundingBox;
                    break;
                }
                foreach (GeomNode n in geometryGraph.Nodes)
                {
                    r.Add(n.BoundingBox);
                }
                foreach (GeomEdge e in geometryGraph.Edges)
                {
                    r.Add(e.BoundingBox);
                    if (e.Label != null)
                    {
                        r.Add(e.Label.BoundingBox);
                    }
                }


                r.Left   -= geometryGraph.Margins;
                r.Top    += geometryGraph.Margins;
                r.Bottom -= geometryGraph.Margins;
                r.Right  += geometryGraph.Margins;
                uAction.ClearAffectedObjects();
                uAction.AddAffectedObject(affectedEntity);
                uAction.GraphBoundingBoxAfter = geometryGraph.BoundingBox = r;
            }
        }