public void RemoveArrow(GraphArrow arrow)
 {
     if (!this.connections.Contains(arrow))
     {
         throw new GraphException("This connector don't have the arrow");
     }
     this.connections.Remove(arrow);
 }
예제 #2
0
 /// <summary>
 /// Returns the connector for the previous element represented by a graphic arrow
 /// </summary>
 /// <param name="graphArrow">Graphic arrow</param>
 /// <returns>Previous connector</returns>
 public virtual Connector GetPrevConnector(GraphArrow graphArrow)
 {
     foreach (Connector connector in this.connectors)
     {
         if (connector.Connections.Contains(graphArrow))
         {
             return(connector);
         }
     }
     return(null);
 }
예제 #3
0
        public virtual void AddPrevious(GraphSide side, GraphArrow arrow)
        {
            Connector connector = (Connector)this.connectors[(int)side];

            if (!this.previous.Contains(connector))
            {
                this.previous.Add(connector);
            }
            connector.AddArrow(arrow);
            this.element.AddPrevious(arrow.element);
            arrow.element.AddNext(this.element);
        }
예제 #4
0
        public GraphElement Clone(List <GraphElement> elements, List <GraphElement> clonedElements, Hashtable element_clone)
        {
            //you get the previous element of the arrow
            GraphElement prevElement = (GraphElement)element_clone[this.Previous[0]];

            if (prevElement == null)
            {
                prevElement = this.Previous[0].Clone();
                clonedElements.Add(prevElement);
                element_clone.Add(this.Previous[0], prevElement);
            }
            //you get the next element of the arrow
            GraphElement nextElement = (GraphElement)element_clone[this.Next];

            if (nextElement == null)
            {
                if (this.Next is GraphArrow)
                {
                    nextElement = ((GraphArrow)this.Next).Clone(elements, clonedElements, element_clone);
                }
                else
                {
                    nextElement = this.Next.Clone();
                }
                clonedElements.Add(nextElement);
                element_clone.Add(this.Next, nextElement);
            }

            Connector initConnector = prevElement.GetConnector(this.initConnector.Side);
            Connector finConnector  = nextElement.GetConnector(this.next.Side);

            GraphArrow clone = new GraphArrow(initConnector, finConnector, this.segments);

            if (prevElement is GraphConditional)
            {
                if (((GraphConditional)this.initConnector.Parent).NextTrue == this)
                {
                    ((GraphConditional)prevElement).AddNext(initConnector, clone, ConditionalOut.True);
                }
                else
                {
                    ((GraphConditional)prevElement).AddNext(initConnector, clone, ConditionalOut.False);
                }
            }
            else
            {
                prevElement.AddNext(initConnector, clone);
            }
            nextElement.AddPrevious(finConnector, clone);

            return(clone);
        }
 private void AddNextFalse(Connector conector, GraphArrow arrow)
 {
     if (this.nextFalse == null)
     {
         this.nextFalse = conector;
         conector.AddArrow(arrow);
         this.DrawOutIcons();
     }
     else
     {
         throw new GraphException("It's necessary that next false is free");
     }
 }
예제 #6
0
 public virtual void AddPrevious(Connector connector, GraphArrow arrow)
 {
     if (!this.connectors.Contains(connector))
     {
         throw new GraphException("This element don't have the conector");
     }
     if (!this.previous.Contains(connector))
     {
         this.previous.Add(connector);
     }
     connector.AddArrow(arrow);
     this.element.AddPrevious(arrow.element);
     arrow.element.AddNext(this.element);
 }
예제 #7
0
 public virtual void RemoveNext(Connector connector, GraphArrow arrow)
 {
     if (!this.connectors.Contains(connector))
     {
         throw new GraphException("This element don't have the conector");
     }
     if (this.next != connector)
     {
         throw new GraphException("This connector isn't next");
     }
     connector.RemoveArrow(arrow);
     this.element.RemoveNext(arrow.element);
     arrow.element.RemovePrevious(this.element);
     this.next = null;
 }
예제 #8
0
 /// <summary>
 ///Add a following element represented by an arrow to a certain side of the element
 /// </summary>
 /// <param name="side">Side of the element where the following element is added</param>
 /// <param name="arrow"> Next item represented by an arrow</param>
 /// <returns>Connector where the following element has been included</returns>
 public virtual Connector AddNext(GraphSide side, GraphArrow arrow)
 {
     if (this.next == null)
     {
         this.next = (Connector)this.connectors[(int)side];
         this.next.AddArrow(arrow);
         this.element.AddNext(arrow.element);
         arrow.element.AddPrevious(this.element);
         return(this.next);
     }
     else
     {
         throw new GraphException("The next output should be null");
     }
 }
        public void AddNext(GraphSide side, GraphArrow arrow, ConditionalOut outLine)
        {
            Connector connector = (Connector)this.connectors[(int)side];

            if (outLine == ConditionalOut.True)
            {
                this.AddNextTrue(connector, arrow);
            }
            else
            {
                this.AddNextFalse(connector, arrow);
            }
            ((Conditional)this.element).AddNext(arrow.Element, outLine);
            arrow.Element.AddPrevious(this.element);
        }
 public void AddNext(Connector conector, GraphArrow arrow, ConditionalOut outLine)
 {
     if (!this.connectors.Contains(conector))
     {
         throw new GraphException("This element don't have the conector");
     }
     if (outLine == ConditionalOut.True)
     {
         this.AddNextTrue(conector, arrow);
     }
     else
     {
         this.AddNextFalse(conector, arrow);
     }
     ((Conditional)this.element).AddNext(arrow.Element, outLine);
     arrow.Element.AddPrevious(this.element);
 }
예제 #11
0
 public virtual void RemovePrevious(Connector connector, GraphArrow arrow)
 {
     if (!this.connectors.Contains(connector))
     {
         throw new GraphException("This element don't have the conector");
     }
     if (!this.previous.Contains(connector))
     {
         throw new GraphException("This connector isn't a previous");
     }
     connector.RemoveArrow(arrow);
     this.element.RemovePrevious(arrow.element);
     arrow.Element.RemoveNext(this.element);
     if (connector.Connections.Count == 0)
     {
         this.previous.Remove(connector);
     }
 }
예제 #12
0
 /// <summary>
 /// Add a following element represented by an arrow in a particular connector
 /// </summary>
 /// <param name="connector">Connector where the following element has been included</param>
 /// <param name="arrow">Next item represented by an arrow</param>
 public virtual void AddNext(Connector connector, GraphArrow arrow)
 {
     if (!this.connectors.Contains(connector))
     {
         throw new GraphException("The element don't have this conector");
     }
     if (this.next == null)
     {
         this.next = connector;
         connector.AddArrow(arrow);
         this.element.AddNext(arrow.element);
         arrow.element.AddPrevious(this.element);
     }
     else
     {
         throw new GraphException("The next output shoulb be null");
     }
 }
 public override void RemoveNext(Connector connector, GraphArrow arrow)
 {
     if (!this.connectors.Contains(connector))
     {
         throw new GraphException("This element don't have the conector");
     }
     if ((this.nextTrue != connector) && (this.nextFalse != connector))
     {
         throw new GraphException("This connector isn't next true or false");
     }
     connector.RemoveArrow(arrow);
     if (this.nextTrue == connector)
     {
         this.nextTrue = null;
         this.DrawOutIcon(new Surface(ElementGraphics.eraseGraphic), connector.Side);
     }
     else
     {
         this.nextFalse = null;
         this.DrawOutIcon(new Surface(ElementGraphics.eraseGraphic), connector.Side);
     }
     this.element.RemoveNext(arrow.Element);
     arrow.Element.RemovePrevious(this.element);
 }
예제 #14
0
 public override void AddPrevious(Connector conector, GraphArrow arrow)
 {
     throw new GraphException("This methods is inaccesible");
 }
예제 #15
0
 public void AddArrow(GraphArrow arrow)
 {
     this.connections.Add(arrow);
 }
예제 #16
0
 public override void RemoveNext(Connector connector, GraphArrow arrow)
 {
     throw new GraphException("This methods is inaccesible");
 }
 public override void AddNext(Connector conector, GraphArrow arrow)
 {
     throw new GraphException("Innaccesible method");
 }