static public string drawLine(Equipment.Point a, Equipment.Point b) { string result = ""; result = $"pline {a.X},{-a.Y} {b.X},{-b.Y} \r\n"; return(result); }
static public double distance(Equipment.Point a, Equipment.Point b) { return(Math.Sqrt(Math.Pow(a.X - b.X, 2) + Math.Pow(a.Y - b.Y, 2))); }
public override void drawCon(Graphics g) { if (seized.Count == 0) { foreach (var i in Schemes_Editor.mainList.Find(x => x.id == globalId).compatibilities) { seized.Add(0); } } if (labels == null) { string a = Schemes_Editor.mainList.Find(x => x.id == globalId).name; labels = new string[] { a, a, a, a }; } int localSheetIndex = 1; List <Equipment.VectorPic> list = new List <Equipment.VectorPic>(); if (Schemes_Editor.mainList.Find(x => x.id == globalId).inPlacementScheme != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inPlacementScheme.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inConnectionScheme != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inConnectionScheme.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inBox != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inBox.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inStructural != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inStructural.copy()); } else { list.Add(null); } if (list[localSheetIndex] != null) { Equipment.Point WidthHeight = list[localSheetIndex].GetProp(); float Xprop = WidthHeight.X / (scales[localSheetIndex].X * 1.0f), Yprop = WidthHeight.Y / (scales[localSheetIndex].Y * 1.0f); list[localSheetIndex].divide(Xprop, Yprop); foreach (var j in list[localSheetIndex].circles) { g.DrawEllipse(Pens.Black, locations[localSheetIndex].X + (float)j.center.X - (float)j.radiusX, locations[localSheetIndex].Y + (float)j.center.Y - (float)j.radiusY, (float)j.radiusX * 2, (float)j.radiusY * 2); } foreach (var j in list[localSheetIndex].polyLines) { for (int k = 0; k < j.Count - 1; k++) { g.DrawLine(Pens.Black, j[k].X + locations[localSheetIndex].X, j[k].Y + locations[localSheetIndex].Y, j[k + 1].X + locations[localSheetIndex].X, j[k + 1].Y + locations[localSheetIndex].Y); } } } //по надписи StringFormat f = new StringFormat(); f.Alignment = StringAlignment.Center; //найти название if (Schemes_Editor.mainList.Find(x => x.id == globalId) != null) { string roomName = Schemes_Editor.mainList.Find(x => x.id == globalId).name; g.DrawString(roomName, new Font("Arial", 10), Brushes.DarkRed, new RectangleF(locations[localSheetIndex].X, locations[localSheetIndex].Y - 30, scales[localSheetIndex].X, 30), f); } }
public override void drawStrExp(ref string result) { int localSheetIndex = 3; List <Equipment.VectorPic> list = new List <Equipment.VectorPic>(); if (Schemes_Editor.mainList.Find(x => x.id == globalId).inPlacementScheme != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inPlacementScheme.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inConnectionScheme != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inConnectionScheme.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inBox != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inBox.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inStructural != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inStructural.copy()); } else { list.Add(null); } if (list[localSheetIndex] != null) { Equipment.Point WidthHeight = list[localSheetIndex].GetProp(); float Xprop = WidthHeight.X / (scales[localSheetIndex].X * 1.0f), Yprop = WidthHeight.Y / (scales[localSheetIndex].Y * 1.0f); list[localSheetIndex].divide(Xprop, Yprop); //foreach (var j in list[localSheetIndex].circles) // g.DrawEllipse(Pens.Black, locations[localSheetIndex].X + (float)j.center.X - (float)j.radiusX, locations[localSheetIndex].Y + (float)j.center.Y - (float)j.radiusY, (float)j.radiusX * 2, (float)j.radiusY * 2); foreach (var j in list[localSheetIndex].polyLines) { for (int k = 0; k < j.Count - 1; k++) { result += AutocadExport.drawLine(offsetConnection * 3 + j[k].X + locations[localSheetIndex].X, j[k].Y + locations[localSheetIndex].Y, offsetConnection * 3 + j[k + 1].X + locations[localSheetIndex].X, j[k + 1].Y + locations[localSheetIndex].Y); //g.DrawLine(Pens.Black, j[k].X + locations[localSheetIndex].X, j[k].Y + locations[localSheetIndex].Y, j[k + 1].X + locations[localSheetIndex].X, j[k + 1].Y + locations[localSheetIndex].Y); } } } //по надписи StringFormat f = new StringFormat(); f.Alignment = StringAlignment.Center; //найти название if (Schemes_Editor.mainList.Find(x => x.id == globalId) != null) { string roomName = Schemes_Editor.mainList.Find(x => x.id == globalId).name; result += AutocadExport.drawText(new RectangleF(offsetConnection * 3 + locations[localSheetIndex].X, locations[localSheetIndex].Y - 30, scales[localSheetIndex].X, 30), roomName); // g.DrawString(roomName, new Font("Arial", 10), Brushes.DarkRed, new RectangleF(locations[localSheetIndex].X, locations[localSheetIndex].Y - 30, scales[localSheetIndex].X, 30), f); } }
public override void drawBox(Graphics g) { if (labels == null) { string name = Schemes_Editor.mainList.Find(x => x.id == globalId).name; labels = new string[] { name, name, name, name }; } int localSheetIndex = 2; List <Equipment.VectorPic> list = new List <Equipment.VectorPic>(); if (Schemes_Editor.mainList.Find(x => x.id == globalId).inPlacementScheme != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inPlacementScheme.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inConnectionScheme != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inConnectionScheme.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inBox != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inBox.copy()); } else { list.Add(null); } if (Schemes_Editor.mainList.Find(x => x.id == globalId).inStructural != null) { list.Add(Schemes_Editor.mainList.Find(x => x.id == globalId).inStructural.copy()); } else { list.Add(null); } if (list[localSheetIndex] != null) { Equipment.Point WidthHeight = list[localSheetIndex].GetProp(); float Xprop = WidthHeight.X / (scales[localSheetIndex].X * 1.0f), Yprop = WidthHeight.Y / (scales[localSheetIndex].Y * 1.0f); list[localSheetIndex].divide(Xprop, Yprop); foreach (var j in list[localSheetIndex].circles) { g.DrawEllipse(Pens.Black, locations[localSheetIndex].X + (float)j.center.X - (float)j.radiusX, locations[localSheetIndex].Y + (float)j.center.Y - (float)j.radiusY, (float)j.radiusX * 2, (float)j.radiusY * 2); } foreach (var j in list[localSheetIndex].polyLines) { for (int k = 0; k < j.Count - 1; k++) { g.DrawLine(Pens.Black, j[k].X + locations[localSheetIndex].X, j[k].Y + locations[localSheetIndex].Y, j[k + 1].X + locations[localSheetIndex].X, j[k + 1].Y + locations[localSheetIndex].Y); } } } if (vinoska != null && vinoska[localSheetIndex] != null) { if (localSheetIndex == 2 && inbox) { int index = 0; //найти коробку в которой он foreach (boxes i in Schemes_Editor.mainWorkList.Where(x => x is boxes)) { int founded = i.equipInside.FindIndex(x => x.localID == localID); if (founded != -1) { index = i.positions[founded] + 1; break; } } g.DrawLines(Pens.Blue, new Point[] { vinoska[localSheetIndex].startPoint, vinoska[localSheetIndex].vertex1, vinoska[localSheetIndex].vertex2 }); if (vinoska[localSheetIndex].vertex1.X < vinoska[localSheetIndex].vertex2.X) { g.DrawString(index.ToString(), new Font("Arial", 14), Brushes.DarkGreen, vinoska[localSheetIndex].vertex1.X, vinoska[localSheetIndex].vertex1.Y - 30); } else { g.DrawString(index.ToString(), new Font("Arial", 14), Brushes.DarkGreen, vinoska[localSheetIndex].vertex2.X, vinoska[localSheetIndex].vertex1.Y - 30); } } else { g.DrawLines(Pens.Blue, new Point[] { vinoska[localSheetIndex].startPoint, vinoska[localSheetIndex].vertex1, vinoska[localSheetIndex].vertex2 }); if (vinoska[localSheetIndex].vertex1.X < vinoska[localSheetIndex].vertex2.X) { g.DrawString(labels[localSheetIndex], new Font("Arial", 14), Brushes.DarkGreen, vinoska[localSheetIndex].vertex1.X, vinoska[localSheetIndex].vertex1.Y - 30); } else { g.DrawString(labels[localSheetIndex], new Font("Arial", 14), Brushes.DarkGreen, vinoska[localSheetIndex].vertex2.X, vinoska[localSheetIndex].vertex1.Y - 30); } } } }