public GraphConnector(int idConnector, GraphElement parent, Point position, GraphSide side) { this.idConnector = idConnector; this.parent = parent; this.side = side; this.Surface = new Surface(ElementGraphics.connectorGraphic); this.Center = position; this.Visible = false; }
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); }
/// <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 StartSegment(Connector connector, Point startPoint, Point endPoint, Point arrowPosition) : base(startPoint, endPoint) { this.startSide = connector.Side; switch (this.startSide) { case GraphSide.Right: this.Surface = new Surface(this.endPoint.X - this.startPoint.X + 4, 10); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.StartRightGraphic), new Point(4, 0)); this.Position = new Point(this.startPoint.X - arrowPosition.X - 4, this.startPoint.Y - arrowPosition.Y - 5); this.modifier = new ConnectorModifier(new Point(4, 5)); break; case GraphSide.Top: this.Surface = new Surface(10, this.startPoint.Y - this.endPoint.Y + 4); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.StartTopGraphic), new Point(0, this.Surface.Height - 24)); this.Position = new Point(this.endPoint.X - arrowPosition.X - 5, this.endPoint.Y - arrowPosition.Y); this.modifier = new ConnectorModifier(new Point(5, this.Surface.Height - 4)); break; case GraphSide.Left: this.Surface = new Surface(this.startPoint.X - this.endPoint.X + 4, 10); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.StartLeftGraphic), new Point(this.Width - 24, 0)); this.Position = new Point(this.endPoint.X - arrowPosition.X, this.endPoint.Y - arrowPosition.Y - 5); this.modifier = new ConnectorModifier(new Point(this.Surface.Width - 4, 5)); break; case GraphSide.Bottom: this.Surface = new Surface(10, this.endPoint.Y - this.startPoint.Y + 4); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.StartBottomGraphic), new Point(0, 4)); this.Position = new Point(this.startPoint.X - arrowPosition.X - 5, this.startPoint.Y - arrowPosition.Y - 4); this.modifier = new ConnectorModifier(new Point(5, 4)); break; } this.Transparent = true; this.TransparentColor = GraphDiagram.TRASPARENT_COLOR; }
private void DrawOutIcon(Surface graphic, GraphSide side) { switch (side) { case GraphSide.Top: this.Surface.Blit(graphic, new Point(54, 0)); break; case GraphSide.Bottom: this.Surface.Blit(graphic, new Point(54, 65)); break; case GraphSide.Left: this.Surface.Blit(graphic, new Point(0, 41)); break; case GraphSide.Right: this.Surface.Blit(graphic, new Point(93, 26)); break; } }
public virtual Connector GetConnector(GraphSide side) { return((Connector)this.connectors[(int)side]); }
public virtual void UpdatePrevPoint(Point point) { this.prevSide = this.CalculePrevSide(point); this.UpdateSegment(); }
public EndSegment(Connector connector, Point startPoint, Point endPoint, Point prevPoint, Point arrowPosition) : base(startPoint, endPoint) { this.endSide = connector.Side; this.prevSide = this.CalculePrevSide(prevPoint); switch (this.endSide) { case GraphSide.Right: this.Surface = new Surface(this.startPoint.X - this.endPoint.X + 6, 10); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.EndRightGraphic), new Point(4, 0)); if (this.prevSide == GraphSide.Top) { this.Surface.Blit(new Surface(ArrowGraphics.CornerBottomRightGraphic), new Point(this.Width - 4, 3)); } else if (this.prevSide == GraphSide.Bottom) { this.Surface.Blit(new Surface(ArrowGraphics.CornerTopRightGraphic), new Point(this.Width - 4, 3)); } this.Position = new Point(this.endPoint.X - arrowPosition.X - 4, this.endPoint.Y - arrowPosition.Y - 5); this.modifier = new ConnectorModifier(new Point(4, 5)); break; case GraphSide.Top: this.Surface = new Surface(10, this.endPoint.Y - this.startPoint.Y + 6); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.EndTopGraphic), new Point(0, this.Height - 26)); if (this.prevSide == GraphSide.Right) { this.Surface.Blit(new Surface(ArrowGraphics.CornerTopLeftGraphic), new Point(3, 0)); } else if (this.prevSide == GraphSide.Left) { this.Surface.Blit(new Surface(ArrowGraphics.CornerTopRightGraphic), new Point(3, 0)); } this.Position = new Point(this.startPoint.X - arrowPosition.X - 5, this.startPoint.Y - arrowPosition.Y - 2); this.modifier = new ConnectorModifier(new Point(5, this.Surface.Height - 4)); break; case GraphSide.Left: this.Surface = new Surface(this.endPoint.X - this.startPoint.X + 6, 10); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.EndLeftGraphic), new Point(this.Width - 24, 0)); if (this.prevSide == GraphSide.Top) { this.Surface.Blit(new Surface(ArrowGraphics.CornerBottomLeftGraphic), new Point(0, 3)); } else if (this.prevSide == GraphSide.Bottom) { this.Surface.Blit(new Surface(ArrowGraphics.CornerTopLeftGraphic), new Point(0, 3)); } this.Position = new Point(this.startPoint.X - arrowPosition.X - 2, this.startPoint.Y - arrowPosition.Y - 5); this.modifier = new ConnectorModifier(new Point(this.Surface.Width - 4, 5)); break; case GraphSide.Bottom: this.Surface = new Surface(10, this.startPoint.Y - this.endPoint.Y + 6); this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR); this.Surface.Blit(new Surface(ArrowGraphics.EndBottomGraphic), new Point(0, 4)); if (this.prevSide == GraphSide.Right) { this.Surface.Blit(new Surface(ArrowGraphics.CornerBottomLeftGraphic), new Point(3, this.Height - 4)); } else if (this.prevSide == GraphSide.Left) { this.Surface.Blit(new Surface(ArrowGraphics.CornerBottomRightGraphic), new Point(3, this.Height - 4)); } this.Position = new Point(this.endPoint.X - arrowPosition.X - 5, this.endPoint.Y - arrowPosition.Y - 4); this.modifier = new ConnectorModifier(new Point(5, 4)); break; } this.Transparent = true; this.TransparentColor = GraphDiagram.TRASPARENT_COLOR; }