static void CreateShapeIfNeeeded(Node n, Dictionary<Node, Shape> nodesToShapes) { if (nodesToShapes.ContainsKey(n)) return; nodesToShapes[n] = new RelativeShape(() => n.BoundaryCurve) #if DEBUG { UserData = n.ToString() } #endif ; }
/// <summary> /// Creates a ClusterBoundaryPort for the cluster boundary, attaches it to the shape and all edges /// </summary> /// <param name="node"></param> /// <returns>Shape obstacle for the node with simple port</returns> static Shape CreateShapeWithClusterBoundaryPort(Node node) { // Debug.Assert(ApproximateComparer.Close(node.BoundaryCurve.BoundingBox, node.BoundingBox), "node's curve doesn't fit its bounds!"); Debug.Assert(node is Cluster); var shape = new RelativeShape(() => node.BoundaryCurve); var port = new ClusterBoundaryPort(()=>node.BoundaryCurve, ()=>node.Center); shape.Ports.Insert(port); foreach (var e in node.InEdges) FixPortAtTarget(shape, port, e); foreach (var e in node.OutEdges) FixPortAtSource(shape, port, e); foreach (var e in node.SelfEdges) { FixPortAtSource(shape, port, e); FixPortAtTarget(shape, port, e); } #if DEBUG shape.UserData = node.ToString(); #endif return shape; }