Esempio n. 1
0
        public bool Connect(dynPortModel p)
        {
            //test if the port that you are connecting too is not the start port or the end port
            //of the current connector
            if (p.Equals(pStart) || p.Equals(pEnd))
            {
                return(false);
            }

            //if the selected connector is also an output connector, return false
            //output ports can't be connected to eachother
            if (p.PortType == PortType.OUTPUT)
            {
                return(false);
            }

            //test if the port that you are connecting to is an input and
            //already has other connectors
            if (p.PortType == PortType.INPUT && p.Connectors.Count > 0)
            {
                p.Disconnect(p.Connectors[0]);
            }

            //turn the line solid
            pEnd = p;

            if (pEnd != null)
            {
                p.Connect(this);
            }

            return(true);
        }
Esempio n. 2
0
        private dynConnectorModel(dynNodeModel start, dynNodeModel end, int startIndex, int endIndex, int portType )
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            pStart = start.OutPorts[startIndex];

            dynPortModel endPort = null;

            if (portType == 0)
                endPort = end.InPorts[endIndex];

            pStart.Connect(this);
            this.Connect(endPort);
            sw.Stop();
            Debug.WriteLine(string.Format("{0} elapsed for constructing connector.", sw.Elapsed));
        }
Esempio n. 3
0
        private dynConnectorModel(dynNodeModel start, dynNodeModel end, int startIndex, int endIndex, int portType)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            pStart = start.OutPorts[startIndex];

            dynPortModel endPort = null;

            if (portType == 0)
            {
                endPort = end.InPorts[endIndex];
            }

            pStart.Connect(this);
            this.Connect(endPort);
            sw.Stop();
            Debug.WriteLine(string.Format("{0} elapsed for constructing connector.", sw.Elapsed));
        }
Esempio n. 4
0
        public dynConnectorModel(dynNodeModel start, dynNodeModel end, int startIndex, int endIndex, int portType, bool visible)
        {
            //don't try to create a connector with a bad start,
            //end, or if we're trying to connector the same
            //port to itself.
            if (start == null || end == null || start == end)
            {
                throw new Exception("Attempting to create connector with invalid start or end nodes.");
            }

            pStart = start.OutPorts[startIndex];

            dynPortModel endPort = null;

            if (portType == 0)
                endPort = end.InPorts[endIndex];

            pStart.Connect(this);
            this.Connect(endPort);
        }
Esempio n. 5
0
        public bool Connect(dynPortModel p)
        {
            //test if the port that you are connecting too is not the start port or the end port
            //of the current connector
            if (p.Equals(pStart) || p.Equals(pEnd))
            {
                return false;
            }

            //if the selected connector is also an output connector, return false
            //output ports can't be connected to eachother
            if (p.PortType == PortType.OUTPUT)
            {
                return false;
            }

            //test if the port that you are connecting to is an input and
            //already has other connectors
            if (p.PortType == PortType.INPUT && p.Connectors.Count > 0)
            {
                return false;
            }

            //turn the line solid
            pEnd = p;

            if (pEnd != null)
            {
                //set the start and end values to equal so this
                //starts evaulating immediately
                //pEnd.Owner.InPortData[p.Index].Object = pStart.Owner.OutPortData.Object;
                p.Connect(this);

                Debug.WriteLine("Ports no longer call update....is it still working?");
                //pEnd.Update();
            }

            return true;
        }
Esempio n. 6
0
        public bool Connect(dynPortModel p)
        {
            //test if the port that you are connecting too is not the start port or the end port
            //of the current connector
            if (p.Equals(pStart) || p.Equals(pEnd))
            {
                return false;
            }

            //if the selected connector is also an output connector, return false
            //output ports can't be connected to eachother
            if (p.PortType == PortType.OUTPUT)
            {
                return false;
            }

            //test if the port that you are connecting to is an input and
            //already has other connectors
            if (p.PortType == PortType.INPUT && p.Connectors.Count > 0)
            {
                p.Disconnect(p.Connectors[0]);
            }

            //turn the line solid
            pEnd = p;

            if (pEnd != null)
            {
                p.Connect(this);
            }

            return true;
        }