public void AddPinGroup(DrawPinModel pin) { if (PinCollections == null) { PinCollections = new List <DrawPinModel>(); } PinCollections.Add(pin); }
private void btnAddNewPin_Click(object sender, EventArgs e) { DefinitionPinControl PinGroupControl = new DefinitionPinControl(CurrentPinModel); PinGroupControl.RemoveEvent += PinGroupControl_RemoveEvent; PinCollectionTable.Controls.Add(PinGroupControl); EplDrawinSymbolModel.AddPinGroup(CurrentPinModel); CurrentPinModel = new DrawPinModel { PinGroup = EplDrawinSymbolModel.PinGroupIndex }; PinOulineBSource.DataSource = CurrentPinModel; }
public void DrawPinOutline(ref Page refPage, DrawPinModel pinModel, PointD baselocation) { Logger.WriteLine(JsonConvert.SerializeObject(pinModel)); PointD location = new PointD(pinModel.PositionX + baselocation.X, pinModel.PositionY + baselocation.Y); Rectangle rectangle = new Rectangle(); rectangle.Create(refPage); rectangle.IsSurfaceFilled = pinModel.Fill; rectangle.Pen.Width = pinModel.OutlineWidthVal; rectangle.Pen.StyleId = pinModel.StyleId; rectangle.Pen.ColorId = pinModel.ColorId; rectangle.Location = location; rectangle.SetArea(location, new PointD(location.X + pinModel.DimensionX, location.Y + pinModel.DimensionY)); }
public SymbolAutoDrawingForm() { InitializeComponent(); EplDrawinSymbolModel = new EplDrawSymbolModel(); CurrentPinModel = new DrawPinModel { PinGroup = EplDrawinSymbolModel.PinGroupIndex }; PinOulineBSource.DataSource = CurrentPinModel; MainOutlineBSource.DataSource = EplDrawinSymbolModel.MainLayout; DisplayTextBSource.DataSource = EplDrawinSymbolModel.DrawDisplayText; cbxPinShape.SelectedIndex = 0; cbxPinColor.SelectedIndex = 0; cbxPinWidth.SelectedIndex = 0; cbx_LayoutShape.SelectedIndex = 0; cbx_LayoutWidth.SelectedIndex = 0; cbxLayoutColor.SelectedIndex = 0; EplDrawinSymbolModel.MainLayout.Font = this.Font; }
public void UpdateUI(DrawPinModel pinItem) { DrawPinModel = pinItem; UpdateUI(); }
public DefinitionPinControl(DrawPinModel pinItem) { InitializeComponent(); UpdateUI(pinItem); }
public DefinitionPinControl() { InitializeComponent(); DrawPinModel = new DrawPinModel(); BindingSource.DataSource = DrawPinModel; }
public void DrawPolyline(ref Page refPage, DrawPinModel pinModel) { Logger.WriteLine(JsonConvert.SerializeObject(pinModel)); string symbolName = ""; PointD[] PinTextPos = new PointD[2]; PointD DescriptionTextPos = new PointD(); PointD[] PinOutline = new PointD[5]; PointD[] points = new PointD[10]; int index = 0; string[] pinDefs = pinModel.Number.Split(new string[] { "(", ")" }, StringSplitOptions.None); string[] pinName = new string[pinDefs.Length]; string[] pinNum = new string[pinDefs.Length]; string[] pinDescription = pinModel.FunctionDescription.Split(new string[] { "," }, StringSplitOptions.None); foreach (var item in pinDefs) { string[] temp = item.Split(new string[] { "," }, StringSplitOptions.None); if (temp.Length >= 2) { pinName[index] = temp[1]; pinNum[index] = temp[0]; index++; } } int pinMarkSize = (int)pinModel.Font.Size; int offset = Math.Max(pinModel.DimensionX, pinModel.DimensionY) + pinMarkSize; offset = offset + pinModel.PolylineOffset; switch (pinModel.LocationSide) { case EplDrawPosition.Left: symbolName = "LeftConnectionPoint"; PinOutline[0] = new PointD(pinModel.PositionX + pinMarkSize, pinModel.PositionY); PinOutline[1] = new PointD(pinModel.PositionX + pinMarkSize, pinModel.PositionY + pinModel.PinDistance); points[0] = new PointD(PinOutline[0].X, PinOutline[0].Y + pinModel.DimensionY / 2); points[1] = new PointD(PinOutline[0].X + offset, PinOutline[0].Y + pinModel.DimensionY / 2); points[2] = new PointD(PinOutline[0].X + offset, PinOutline[0].Y + pinModel.PinDistance - pinModel.DimensionY / 2);; points[3] = new PointD(PinOutline[0].X, PinOutline[0].Y + pinModel.PinDistance - pinModel.DimensionY / 2); PinTextPos[0] = new PointD(points[0].X, points[0].Y + offset); PinTextPos[1] = new PointD(points[3].X, points[0].Y - offset); DescriptionTextPos = new PointD(points[0].X + 5, points[0].Y + pinModel.PinDistance / 2); break; case EplDrawPosition.Right: symbolName = "RightConnectionPoint"; PinOutline[0] = new PointD(pinModel.PositionX - pinMarkSize, pinModel.PositionY); PinOutline[1] = new PointD(pinModel.PositionX - pinMarkSize, pinModel.PositionY + pinModel.PinDistance); points[0] = new PointD(PinOutline[0].X, PinOutline[0].Y + pinModel.DimensionY / 2); points[1] = new PointD(PinOutline[0].X - offset, PinOutline[0].Y + pinModel.DimensionY / 2); points[2] = new PointD(PinOutline[0].X - offset, PinOutline[0].Y + pinModel.PinDistance - pinModel.DimensionY / 2);; points[3] = new PointD(PinOutline[0].X, PinOutline[0].Y + pinModel.PinDistance - pinModel.DimensionY / 2); PinTextPos[0] = new PointD(points[0].X, points[0].Y + offset); PinTextPos[1] = new PointD(points[3].X, points[0].Y - offset); DescriptionTextPos = new PointD(points[0].X - 5, points[0].Y + pinModel.PinDistance / 2); break; case EplDrawPosition.Bottom: symbolName = "BottomConnectionPoint"; PinOutline[0] = new PointD(pinModel.PositionX, pinModel.PositionY + pinMarkSize); PinOutline[1] = new PointD(pinModel.PositionX + pinModel.PinDistance, pinModel.PositionY + pinMarkSize); points[0] = new PointD(PinOutline[0].X + pinModel.DimensionY / 2, PinOutline[0].Y); points[1] = new PointD(PinOutline[0].X + pinModel.DimensionY / 2, PinOutline[0].Y + offset); points[2] = new PointD(PinOutline[0].X + pinModel.PinDistance - pinModel.DimensionY / 2, PinOutline[0].Y + offset);; points[3] = new PointD(PinOutline[0].X + pinModel.PinDistance - pinModel.DimensionY / 2, PinOutline[0].Y); PinTextPos[0] = new PointD(points[0].X + offset, points[0].Y); PinTextPos[1] = new PointD(points[3].X - offset, points[0].Y); DescriptionTextPos = new PointD(points[0].X + pinModel.PinDistance / 2, points[0].Y + 5); break; case EplDrawPosition.Top: symbolName = "TopConnectionPoint"; PinOutline[0] = new PointD(pinModel.PositionX, pinModel.PositionY - pinMarkSize); PinOutline[1] = new PointD(pinModel.PositionX + pinModel.PinDistance, pinModel.PositionY - pinMarkSize); points[0] = new PointD(PinOutline[0].X + pinModel.DimensionY / 2, PinOutline[0].Y); points[1] = new PointD(PinOutline[0].X + pinModel.DimensionY / 2, PinOutline[0].Y - offset); points[2] = new PointD(PinOutline[0].X + pinModel.PinDistance - pinModel.DimensionY / 2, PinOutline[0].Y - offset); points[3] = new PointD(PinOutline[0].X + pinModel.PinDistance - pinModel.DimensionY / 2, PinOutline[0].Y); PinTextPos[0] = new PointD(points[0].X + offset, points[0].Y); PinTextPos[1] = new PointD(points[3].X - offset, points[0].Y); DescriptionTextPos = new PointD(points[0].X + pinModel.PinDistance / 2, points[0].Y - 5); break; default: break; } Rectangle(ref refPage, pinModel, PinOutline[0]); Rectangle(ref refPage, pinModel, PinOutline[1]); refPage.InsertConnectingPoint("MY_LIB_K", symbolName, PinOutline[0]); refPage.InsertConnectingPoint("MY_LIB_K", symbolName, PinOutline[1]); Text text1 = new Text(); text1.Create(refPage, pinName[0], pinModel.Font.Height); Text text2 = new Text(); text2.Create(refPage, pinName[1], pinModel.Font.Height); text1.Location = PinTextPos[0]; text2.Location = PinTextPos[1]; PolyLine polyLine = new PolyLine(); polyLine.Create(refPage); polyLine.Pen.Width = pinModel.OutlineWidthVal; for (int i = 0; i < 4; i++) { polyLine.SetPointAt(i, ref points[i]); } Text text3 = new Text(); switch (pinModel.Function) { case EplDrawPinFunction.POWER_AC: text3.Create(refPage, "PWR AC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.POWER_DC: text3.Create(refPage, "PWR DC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.SIGNAL_PIN: break; case EplDrawPinFunction.INPUT_AC_V: text3.Create(refPage, "Input\nV-AC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.INPUT_AC_A: text3.Create(refPage, "Input\nA-AC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.INPUT_DC_V: text3.Create(refPage, "Input\nV-DC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.INPUT_DC_A: text3.Create(refPage, "Input\nA-DC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.OUPUT_AC_V: text3.Create(refPage, "Output\nV-AC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.OUPUT_AC_A: text3.Create(refPage, "Output\nV-AC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.OUPUT_DC_V: text3.Create(refPage, "Output\nV-DC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.OUPUT_DC_A: text3.Create(refPage, "Output\nA-DC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.CONTACT_NO: text3.Create(refPage, "NO", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.CONTACT_NC: text3.Create(refPage, "NC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.CONTACT_NOC: text3.Create(refPage, "NO-NC", pinModel.Font.Height); text3.Location = DescriptionTextPos; break; case EplDrawPinFunction.SHILED: break; case EplDrawPinFunction.EARTH: break; case EplDrawPinFunction.RECTANGLE: break; case EplDrawPinFunction.CIRCLE: break; case EplDrawPinFunction.TEXT: break; default: break; } }
public void DrawPinOutline(ref Page refPage, DrawPinModel pinModel) { DrawPinOutline(ref refPage, pinModel, BasePosition); }