/// <summary>
        /// Creates a shape with a RelativeFloatingPort for the node center, 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 CreateShapeWithCenterPort(Node node)
        {
            Debug.Assert(node is Cluster == false);
            // Debug.Assert(ApproximateComparer.Close(node.BoundaryCurve.BoundingBox, node.BoundingBox), "node's curve doesn't fit its bounds!");
            var shape = new RelativeShape(() => node.BoundaryCurve);
            var port  = new RelativeFloatingPort(() => 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 TEST_MSAGL
            // shape.UserData = node.ToString();
#endif
            return(shape);
        }
        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       
                ;
        }
示例#3
0
        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 shape with a RelativeFloatingPort for the node center, 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 CreateShapeWithCenterPort(Node node)
        {
            // Debug.Assert(ApproximateComparer.Close(node.BoundaryCurve.BoundingBox, node.BoundingBox), "node's curve doesn't fit its bounds!");
            var shape = new RelativeShape(() => node.BoundaryCurve);
            var port = new RelativeFloatingPort(() => 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;
        }
        /// <summary>
        /// Creates a shape with a RelativeFloatingPort for the node center, 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 CreateShapeWithCenterPort(Node node)
        {
            var shape = new RelativeShape(() => node.BoundaryCurve);
            var port  = new RelativeFloatingPort(() => 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 TEST_MSAGL
            // shape.UserData = node.ToString();
#endif
            return(shape);
        }