Ejemplo n.º 1
0
        public Port AddPort(string name, float offsetX, float offsetY, PortShapes shape)
        {
            Port port = new Port();

            port.Name       = name;
            port.Offset     = new DiagramPoint(offsetX, offsetY);
            port.Visibility = PortVisibility.Visible;
            port.Shape      = shape;
            if (shape == PortShapes.Circle)
            {
                port.BorderColor = "#E4B123";
            }
            else if (shape == PortShapes.X)
            {
                port.BorderColor = "#F05023";
            }
            else if (shape == PortShapes.Path)
            {
                port.FillColor = port.BorderColor = "#3CB549";
                port.PathData  = "M6.805,0L13.61,10.703L0,10.703z";
            }
            else
            {
                port.BorderColor = "#D572AD";
            }
            port.ConnectorPadding = 4;
            port.Constraints      = PortConstraints.Connect | PortConstraints.ConnectOnDrag;
            return(port);
        }
Ejemplo n.º 2
0
        private ConnectionPort addcport(Node node, PortShapes sp, bool head, LineConnector line)
        {
            ConnectionPort cp = null;

            if (head)
            {
                cp        = new ConnectionPort();
                cp.Width  = 10;
                cp.Height = 10;
                if (line.ConnectionHeadPort == null)
                {
                    cp.Top                  = 20;
                    cp.Left                 = 20;
                    cp.PortShape            = sp;
                    line.ConnectionHeadPort = cp;
                }
                else
                {
                    ConnectionPort headport = (line.ConnectionHeadPort as ConnectionPort);
                    cp.Top  = headport.Top;
                    cp.Left = headport.Left;
                    node.Ports.Remove(headport);
                    cp.PortShape            = sp;
                    line.ConnectionHeadPort = cp;
                }
                node.Ports.Add(cp);
                cp.Node = node;
            }
            else if (!head)
            {
                cp           = new ConnectionPort();
                cp.Width     = 10;
                cp.Height    = 10;
                cp.PortShape = sp;
                if (line.ConnectionTailPort == null)
                {
                    cp.Top                  = 20;
                    cp.Left                 = 20;
                    cp.PortShape            = sp;
                    line.ConnectionTailPort = cp;
                }
                else
                {
                    ConnectionPort tailport = (line.ConnectionTailPort as ConnectionPort);
                    cp.Top  = tailport.Top;
                    cp.Left = tailport.Left;
                    node.Ports.Remove(tailport);
                    cp.PortShape            = sp;
                    line.ConnectionTailPort = cp;
                }
                node.Ports.Add(cp);
                cp.Node = node;
            }
            return(cp);
        }
Ejemplo n.º 3
0
        public Port AddPorts(string name, float offsetX, float offsetY, PortShapes shape)
        {
            Port port = new Port();

            port.Name             = name;
            port.Offset           = new DiagramPoint(offsetX, offsetY);
            port.Visibility       = PortVisibility.Hidden;
            port.Shape            = shape;
            port.BorderColor      = "transparent";
            port.ConnectorPadding = 4;
            return(port);
        }
Ejemplo n.º 4
0
        public Port AddPort(string name, float offsetX, float offsetY, PortShapes shape = PortShapes.Square, PortVisibility visiblity = PortVisibility.Hidden)
        {
            Port port = new Port();

            port.Name        = name;
            port.Offset      = new DiagramPoint(offsetX, offsetY);
            port.Visibility  = visiblity;
            port.FillColor   = "red";
            port.BorderColor = "black";
            port.Shape       = shape;
            if (shape == PortShapes.Path)
            {
                port.FillColor = port.BorderColor = "black";
                port.PathData  = "M6.805,0L13.61,10.703L0,10.703z";
            }
            port.ConnectorPadding = 4;
            return(port);
        }
Ejemplo n.º 5
0
        //Add connection port to Nodes
        private ConnectionPort Addcport(Node n, double top, double left, SolidColorBrush solidColorBrush, PortShapes ps)
        {
            ConnectionPort cp = new ConnectionPort(n, new Point(left, top));

            cp.PortShape      = ps;
            cp.Width          = 12;
            cp.Height         = 12;
            cp.PortStyle.Fill = solidColorBrush;
            cp.Node           = n;
            n.Ports.Add(cp);
            return(cp);
        }