private void StartAddLink(ConnectorElement connStart, Point mousePoint) { if (document.Action == DesignerAction.Connect) { this.connStart = connStart; this.connEnd = new ConnectorElement(connStart.ParentElement); connEnd.Location = connStart.Location; IMoveController ctrl = (IMoveController)((IControllable)connEnd).GetController(); ctrl.Start(mousePoint); isAddLink = true; switch (document.LinkType) { case (LinkType.Straight): linkLine = new StraightLinkElement(connStart, connEnd); break; case (LinkType.RightAngle): linkLine = new RightAngleLinkElement(connStart, connEnd); break; } linkLine.Visible = true; linkLine.BorderColor = Color.FromArgb(150, Color.Black); linkLine.BorderWidth = 1; this.Invalidate(linkLine, true); OnElementConnecting(new ElementConnectEventArgs(connStart.ParentElement, null, linkLine)); } }
public BaseLinkElement AddLink(ConnectorElement connStart, ConnectorElement connEnd) { if (CanAddLink(connStart, connEnd)) { BaseLinkElement lnk; if (linkType == LinkType.Straight) { lnk = new StraightLinkElement(connStart, connEnd); } else // (linkType == LinkType.RightAngle) { lnk = new RightAngleLinkElement(connStart, connEnd); } elements.Add(lnk); lnk.AppearanceChanged += new EventHandler(element_AppearanceChanged); OnAppearancePropertyChanged(new EventArgs()); return(lnk); } else { return(null); } }
private void EndAddLink() { if (connEnd != linkLine.Connector2) { linkLine.Connector1.RemoveLink(linkLine); linkLine = document.AddLink(linkLine.Connector1, linkLine.Connector2); if (ElementsWillLink != null) { var args = new ElementsLinkedArgs { Connector1 = linkLine.Connector1, Connector2 = linkLine.Connector2, Element1 = linkLine.Connector1.ParentElement, Element2 = linkLine.Connector2.ParentElement, NewLink = linkLine }; ElementsWillLink(this, args); if (args.Cancel) { document.DeleteLink(linkLine); connStart = null; connEnd = null; linkLine = null; return; } } OnElementConnected(new ElementConnectEventArgs(linkLine.Connector1.ParentElement, linkLine.Connector2.ParentElement, linkLine)); } connStart = null; connEnd = null; linkLine = null; }
protected virtual void InitConnectors() { Connectors[0] = new ConnectorElement(this); Connectors[1] = new ConnectorElement(this); Connectors[2] = new ConnectorElement(this); Connectors[3] = new ConnectorElement(this); UpdateConnectorsPosition(); }
protected void InitConnectors() { connects[0] = new ConnectorElement(this); connects[1] = new ConnectorElement(this); //connects[2] = new ConnectorElement(this); //connects[3] = new ConnectorElement(this); UpdateConnectorsPosition(); }
internal BaseLinkElement(ConnectorElement conn1, ConnectorElement conn2): base() { borderWidth = 1; borderColor = Color.Black; connector1 = conn1; connector2 = conn2; connector1.AddLink(this); connector2.AddLink(this); }
internal BaseLinkElement(ConnectorElement conn1, ConnectorElement conn2) : base() { borderWidth = 1; borderColor = Color.Black; connector1 = conn1; connector2 = conn2; connector1.AddLink(this); connector2.AddLink(this); }
private void EndAddLink() { if (connEnd != linkLine.Connector2) { linkLine.Connector1.RemoveLink(linkLine); linkLine = document.AddLink(linkLine.Connector1, linkLine.Connector2); OnElementConnected(new ElementConnectEventArgs(linkLine.Connector1.ParentElement, linkLine.Connector2.ParentElement, linkLine)); } connStart = null; connEnd = null; linkLine = null; }
public RightAngleLinkElement(ConnectorElement conn1, ConnectorElement conn2): base(conn1, conn2) { needCalcLink = true; InitConnectors(conn1, conn2); foreach(LineElement l in lines) { l.StartCap = LineCap.Round; l.EndCap = LineCap.Round; } startCap = LineCap.Round; endCap = LineCap.Round; label.PositionBySite(lines[1]); }
public RightAngleLinkElement(ConnectorElement conn1, ConnectorElement conn2) : base(conn1, conn2) { needCalcLink = true; InitConnectors(conn1, conn2); foreach (LineElement l in lines) { l.StartCap = LineCap.Round; l.EndCap = LineCap.Round; } startCap = LineCap.Round; endCap = LineCap.Round; label.PositionBySite(lines[1]); }
private void RestartInitValues() { // Reinitialize status moveAction = null; isMultiSelection = false; isAddSelection = false; isAddLink = false; changed = false; connStart = null; selectionArea.FillColor1 = SystemColors.Control; selectionArea.BorderColor = SystemColors.Control; selectionArea.Visible = false; document.CalcWindow(true); }
private void StartAddLink(ConnectorElement connStart, Point mousePoint) { if (document.Action == DesignerAction.Connect) { this.connStart = connStart; this.connEnd = new ConnectorElement(connStart.ParentElement); connEnd.Location = connStart.Location; IMoveController ctrl = (IMoveController)((IControllable)connEnd).GetController(); ctrl.Start(mousePoint); isAddLink = true; linkLine = CreateElementInstance(connStart, connEnd); this.Invalidate(linkLine, true); OnElementConnecting(new ElementConnectEventArgs(connStart.ParentElement, null, linkLine)); } }
public BaseLinkElement AddLink(ConnectorElement connStart, ConnectorElement connEnd) { if (CanAddLink(connStart, connEnd)) { BaseLinkElement lnk; if (linkType == LinkType.Straight) lnk = new StraightLinkElement(connStart, connEnd); else // (linkType == LinkType.RightAngle) lnk = new RightAngleLinkElement(connStart, connEnd); elements.Add(lnk); lnk.AppearanceChanged +=new EventHandler(element_AppearanceChanged); OnAppearancePropertyChanged(new EventArgs()); return lnk; } else { return null; } }
protected virtual BaseLinkElement CreateElementInstance(ConnectorElement connStart, ConnectorElement connEnd) { BaseLinkElement linkLine; switch (document.LinkType) { default: case (LinkType.Straight): linkLine = new StraightLinkElement(connStart, connEnd); break; case (LinkType.RightAngle): linkLine = new RightAngleLinkElement(connStart, connEnd); break; } linkLine.Visible = true; linkLine.BorderColor = Color.FromArgb(150, Color.Black); linkLine.BorderWidth = 1; return(linkLine); }
private void InitConnectors(ConnectorElement conn1, ConnectorElement conn2) { conn1Dir = conn1.GetDirection(); conn2Dir = conn2.GetDirection(); if ((conn1Dir == CardinalDirection.North) || (conn1Dir == CardinalDirection.South)) { orientation = Orientation.Vertical; } else { orientation = Orientation.Horizontal; } if ( ( ((conn1Dir == CardinalDirection.North) || (conn1Dir == CardinalDirection.South)) && ((conn2Dir == CardinalDirection.East) || (conn2Dir == CardinalDirection.West))) || ( ((conn1Dir == CardinalDirection.East) || (conn1Dir == CardinalDirection.West)) && ((conn2Dir == CardinalDirection.North) || (conn2Dir == CardinalDirection.South))) ) { lines = new LineElement[2]; lines[0] = new LineElement(0, 0, 0, 0); lines[1] = new LineElement(0, 0, 0, 0); } else { lines = new LineElement[3]; lines[0] = new LineElement(0, 0, 0, 0); lines[1] = new LineElement(0, 0, 0, 0); lines[2] = new LineElement(0, 0, 0, 0); } CalcLinkFirtTime(); CalcLink(); RestartProps(); }
public BaseLinkElement AddLink(ConnectorElement connStart, ConnectorElement connEnd) { if (CanAddLink(connStart, connEnd)) { BaseLinkElement lnk; if (linkType == LinkType.Straight) { lnk = new StraightLinkElement(connStart, connEnd); } else // (linkType == LinkType.RightAngle) { lnk = new RightAngleLinkElement(connStart, connEnd); } AddLink(lnk); return(lnk); } else { return(null); } }
public ConnectorController(ConnectorElement element): base(element) {}
public ConnectorController(ConnectorElement element) : base(element) { }
public AdvancedStraightLinkElement(BaseElement StartElement, ConnectorElement conn1, BaseElement EndElement, ConnectorElement conn2) : base(conn1, conn2) { this.StartElement = StartElement; this.EndElement = EndElement; }
private void InitConnectors(ConnectorElement conn1, ConnectorElement conn2) { conn1Dir = conn1.GetDirection(); conn2Dir = conn2.GetDirection(); if ((conn1Dir == CardinalDirection.North) || (conn1Dir == CardinalDirection.South)) orientation = Orientation.Vertical; else orientation = Orientation.Horizontal; if ( ( ((conn1Dir == CardinalDirection.North) || (conn1Dir == CardinalDirection.South)) && ((conn2Dir == CardinalDirection.East) || (conn2Dir == CardinalDirection.West))) || ( ((conn1Dir == CardinalDirection.East) || (conn1Dir == CardinalDirection.West)) && ((conn2Dir == CardinalDirection.North) || (conn2Dir == CardinalDirection.South))) ) { lines = new LineElement[2]; lines[0] = new LineElement(0, 0, 0, 0); lines[1] = new LineElement(0, 0, 0, 0); } else { lines = new LineElement[3]; lines[0] = new LineElement(0, 0, 0, 0); lines[1] = new LineElement(0, 0, 0, 0); lines[2] = new LineElement(0, 0, 0, 0); } CalcLinkFirtTime(); CalcLink(); RestartProps(); }
internal bool CanAddLink(ConnectorElement connStart, ConnectorElement connEnd) { return((connStart != connEnd) && (connStart.ParentElement != connEnd.ParentElement)); }
internal StraightLinkElement(ConnectorElement conn1, ConnectorElement conn2) : base(conn1, conn2) { label.PositionBySite(line1); }
protected void InitConnectors() { connects[0] = new ConnectorElement(this); connects[1] = new ConnectorElement(this); connects[2] = new ConnectorElement(this); connects[3] = new ConnectorElement(this); connects[4] = new ConnectorElement(this); connects[5] = new ConnectorElement(this); UpdateConnectorsPosition(); }
protected virtual bool CanAddLink(ConnectorElement start, BaseElement end) { var connector = end as ConnectorElement; return(connector != null && document.CanAddLink(start, connector)); }
internal bool CanAddLink(ConnectorElement connStart, ConnectorElement connEnd) { return ((connStart != connEnd) && (connStart.ParentElement != connEnd.ParentElement)); }
internal StraightLinkElement(ConnectorElement conn1, ConnectorElement conn2): base(conn1, conn2) { label.PositionBySite(line1); }
private void StartAddLink(ConnectorElement connStart, Point mousePoint) { if (document.Action == DesignerAction.Connect) { this.connStart = connStart; this.connEnd = new ConnectorElement(connStart.ParentElement); connEnd.Location = connStart.Location; IMoveController ctrl = (IMoveController) ((IControllable) connEnd).GetController(); ctrl.Start(mousePoint); isAddLink = true; switch(document.LinkType) { case (LinkType.Straight): linkLine = new StraightLinkElement(connStart, connEnd); break; case (LinkType.RightAngle): linkLine = new RightAngleLinkElement(connStart, connEnd); break; } linkLine.Visible = true; linkLine.BorderColor = Color.FromArgb(150, Color.Black); linkLine.BorderWidth = 1; this.Invalidate(linkLine, true); OnElementConnecting(new ElementConnectEventArgs(connStart.ParentElement, null, linkLine)); } }