private void InitializeGraph() { IGraph graph = graphControl.Graph; // initialize defaults graph.NodeDefaults.Style = new ShinyPlateNodeStyle { Brush = Brushes.DarkOrange }; graph.EdgeDefaults.Style = new PolylineEdgeStyle { TargetArrow = Arrows.Default }; // create sample graph graph.AddLabel(graph.CreateNode(new PointD(30, 30)), "Node"); INode node = graph.CreateNode(new PointD(90, 30)); graph.CreateEdge(node, graph.CreateNode(new PointD(90, 90))); graphControl.FitGraphBounds(); // initially set the export rect to enclose part of the graph's contents exportRect.Reshape(graphControl.ContentRect); graph.CreateEdge(node, graph.CreateNode(new PointD(200, 30))); graphControl.FitGraphBounds(); }
/// <summary> /// Called after the a layout run finished. /// </summary> private void OnExecutorFinished() { if (canceled) { layoutEdit.Cancel(); } else if (stopped) { // finish undo/redo // save the layout of the rectangular area before and after the gesture var newRect = clearRect.ToRectD(); var oldRect = oldClearRect; graphControl.Graph.AddUndoUnit("Rectangle changed", "Rectangle changed", () => clearRect.Reshape(oldRect), () => clearRect.Reshape(newRect)); // add all changes of the complete gesture as one undo/redo unit layoutEdit.Commit(); } }
/// <summary> /// Updates the target bounds of the currently hit layer. /// </summary> private int UpdateTargetBounds(PointD location) { int lastLayer = layerVisualCreator.GetLayer(location); RectD indicatedBounds = layerVisualCreator.GetLayerBounds(lastLayer); if (!indicatedBounds.IsFinite) { indicatedBounds = RectD.Empty; } targetBounds.Reshape(indicatedBounds); return(lastLayer); }
public void Reshape(IRectangle newRectangle) { tightRect = newRectangle.ToRectD(); rectangle.Reshape(tightRect.GetEnlarged(Margins)); invalid = false; }
public void HandleReshape(IInputModeContext context, RectD originalBounds, RectD newBounds) { simulationRectangle.Reshape(newBounds); }
public IVisual UpdateVisual(IRenderContext context, IVisual oldVisual) { rectangle.Reshape(RectD.FromCenter(Center, new SizeD(PageWidth + Margin, PageHeight + Margin))); return(oldVisual); }