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) { BorderWidthValue = 1; BorderColorValue = Color.Black; Connector1Value = conn1; Connector2Value = conn2; Connector1Value.AddLink(this); Connector2Value.AddLink(this); }
public RightAngleLinkElement(ConnectorElement conn1, ConnectorElement conn2) : base(conn1, conn2) { NeedCalcLinkValue = true; InitConnectors(conn1, conn2); foreach (var l in LineElements) { l.StartCap = LineCap.Round; l.EndCap = LineCap.Round; } StartCapValue = LineCap.Round; EndCapValue = LineCap.Round; _label.PositionBySite(LineElements[1]); }
public void Refresh(Image image, string labelText, object blockState, object[] inputStates, object[] outputStates, PropertyInfo connectionTextProperty) { _image = image; _labelText = labelText; _connectionTextProperty = connectionTextProperty; State = blockState; SyncContructors(); _inputStates = inputStates; _outputStates = outputStates; if (Connects == null || Connects.Length != inputStates.Length + outputStates.Length) { Connects = new ConnectorElement[inputStates.Length + outputStates.Length]; for (var i = 0; i < inputStates.Length; i++) { Connects[i] = new ConnectorElement(this) { State = inputStates[i] }; } for (var i = 0; i < outputStates.Length; i++) { Connects[inputStates.Length + i] = new ConnectorElement(this) { State = outputStates[i] }; } } else { for (var i = 0; i < inputStates.Length; i++) { Connects[i].State = inputStates[i]; } for (var i = 0; i < outputStates.Length; i++) { Connects[inputStates.Length + i].State = outputStates[i]; } } UpdateConnectorsPosition(); SyncContructors(); }
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))) ) { LineElements = new LineElement[2]; LineElements[0] = new LineElement(0, 0, 0, 0); LineElements[1] = new LineElement(0, 0, 0, 0); } else { LineElements = new LineElement[3]; LineElements[0] = new LineElement(0, 0, 0, 0); LineElements[1] = new LineElement(0, 0, 0, 0); LineElements[2] = new LineElement(0, 0, 0, 0); } CalcLinkFirtTime(); CalcLink(); RestartProps(); }
internal StraightLinkElement(ConnectorElement conn1, ConnectorElement conn2) : base(conn1, conn2) { _label.PositionBySite(Line1); }