Exemplo n.º 1
0
 internal UndoRedoAction InsertToListAndSetTheBoxBefore(UndoRedoAction action)
 {
     UndoRedoActionsList.AddAction(action);
     action.GraphBoundingBoxBefore = action.Graph.BoundingBox;
     RaiseChangeInUndoList();
     return(action);
 }
Exemplo n.º 2
0
 /// <summary>
 ///     clear the editor
 /// </summary>
 public void Clear()
 {
     objectsToDrag = new Set <GeometryObject>();
     edgesDraggedWithSource.Clear();
     edgesDraggedWithTarget.Clear();
     UndoRedoActionsList = new UndoRedoActionsList();
     EditedEdge          = null;
 }
Exemplo n.º 3
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;
            }
        }