/// <summary> /// calculates the restore data /// </summary> /// <returns></returns> public static RestoreData GetRestoreData(GeometryObject geometryObject) { Node node = geometryObject as Node; if (node != null) { return GetRestoreData(node); } Edge edge = geometryObject as Edge; if (edge != null) { return GetRestoreData(edge); } Label label = geometryObject as Label; if (label != null) { return GetRestoreData(label); } GeometryGraph graph = geometryObject as GeometryGraph; if (graph != null) { return GetRestoreData(graph); } return null; }
/// <summary> /// Constructor /// </summary> ///<param name="labelWidth">width</param> ///<param name="labelHeight">height</param> ///<param name="parentP">the corresponding edge</param> public Label(double labelWidth, double labelHeight, GeometryObject parentP) { Width = labelWidth; Height = labelHeight; GeometryParent = parentP; PlacementStrategyPriority = new[] { PlacementStrategy.AlongCurve, PlacementStrategy.Horizontal }; }
internal Label(GeometryObject parentPar) { GeometryParent = parentPar; }
/// <summary> /// Constructor /// </summary> ///<param name="labelWidth">width</param> ///<param name="labelHeight">height</param> ///<param name="parentP">the corresponding edge</param> public Label(double labelWidth, double labelHeight, GeometryObject parentP) { Width = labelWidth; Height = labelHeight; GeometryParent = parentP; PlacementStrategyPriority = new[] {PlacementStrategy.AlongCurve, PlacementStrategy.Horizontal}; }
static EdgeGeometry CreateEdgeGeometryForSelfEdge(GeometryObject geometryGraph, GeometryNode node) { var tempEdge = new Core.Layout.Edge(node, node) { GeometryParent = geometryGraph, SourcePort = new FloatingPort(node.BoundaryCurve, node.Center), TargetPort = new FloatingPort(node.BoundaryCurve, node.Center), EdgeGeometry = { TargetArrowhead = new Arrowhead() } }; StraightLineEdges.CreateSimpleEdgeCurveWithUnderlyingPolyline(tempEdge); return tempEdge.EdgeGeometry; }
void UpdateGraphBoundingBoxWithCheck(GeometryObject geomObj) { var cl = geomObj as Cluster; Rectangle bBox = cl != null ? cl.BoundaryCurve.BoundingBox : geomObj.BoundingBox; { var edge = geomObj as GeomEdge; if (edge != null && edge.Label != null) bBox.Add(edge.Label.BoundingBox); } var p = new Point(-Graph.Margins, Graph.Margins); Rectangle bounds = Graph.BoundingBox; GraphBoundingBoxGetsExtended |= bounds.AddWithCheck(bBox.LeftTop + p); GraphBoundingBoxGetsExtended |= bounds.AddWithCheck(bBox.RightBottom - p); Graph.BoundingBox = bounds; }
static void ShiftDragEdge(Point delta, GeometryObject geomObj) { var edge = geomObj as GeomEdge; if (edge != null) edge.Translate(delta); else { var label = geomObj as GeomLabel; if (label != null) DragLabel(label, delta); else throw new NotImplementedException(); } }
void ReadLabelFromAttribute(GeometryObject geomObj) { string str; if (!TryGetAttribute(GeometryToken.Label, out str)) return; var label = new Label(geomObj); Point center; double width, height; ParseLabel(str, out center, out width, out height); label.Center = center; label.Width = width; label.Height = height; var edge = geomObj as Edge; if (edge != null) { edge.Label = label; } }
internal void AddRestoreData(GeometryObject msaglObject, RestoreData restoreData) { lock (restoreData) restoreDataDictionary[msaglObject] = restoreData; }
internal RestoreData GetRestoreData(GeometryObject msaglObject) { return restoreDataDictionary[msaglObject]; }
internal static GeometryGraph GetParentGraph(GeometryObject geomObj) { do { GeometryGraph graph = geomObj.GeometryParent as GeometryGraph; if (graph != null) return graph; geomObj = geomObj.GeometryParent; } while (true); }