void Parent_PCBIFormGraphicPaneDrawing(Graphics g, int ClientWidth, int ClientHeight) { if (!parent.JobIsLoaded) { return; } g.TranslateTransform(1, -1); foreach (IODBObject obj in parent.GetCurrentStep().GetSelectedElements()) { if (obj.GetSpecifics() is ILineSpecifics) { ILineSpecifics ls = (ILineSpecifics)obj.GetSpecifics(); Pen pen = new Pen(Color.Aquamarine, 10); pen.DashOffset = 4; //pen.DashPattern = 0.5f; pen.DashStyle = DashStyle.DashDotDot; pen.StartCap = LineCap.Triangle; pen.EndCap = LineCap.ArrowAnchor; g.DrawLine(pen, parent.WorldToClient(ls.Start), parent.WorldToClient(ls.End)); Point locatioStart = parent.WorldToClient(ls.Start); locatioStart = new Point(locatioStart.X - 20, locatioStart.Y - 20); RectangleF SRect = new RectangleF(locatioStart, new Size(40, 40)); Pen PStart = new Pen(Color.AliceBlue, 4); g.DrawEllipse(PStart, SRect); } else if (obj.GetSpecifics() is IArcSpecifics) { IArcSpecifics aspec = (IArcSpecifics)obj.GetSpecifics(); Pen pen = new Pen(Color.Yellow, 10); pen.DashOffset = 4; //pen.DashPattern = 0.5f; pen.DashStyle = DashStyle.DashDotDot; pen.StartCap = LineCap.Triangle; pen.EndCap = LineCap.ArrowAnchor; g.DrawLine(pen, parent.WorldToClient(aspec.Start), parent.WorldToClient(aspec.End)); g.DrawLine(pen, parent.WorldToClient(aspec.Start), parent.WorldToClient(aspec.Center)); g.DrawLine(pen, parent.WorldToClient(aspec.End), parent.WorldToClient(aspec.Center)); Point locatioStart = parent.WorldToClient(aspec.Start); locatioStart = new Point(locatioStart.X - 20, locatioStart.Y - 20); RectangleF SRect = new RectangleF(locatioStart, new Size(40, 40)); Pen PStart = new Pen(Color.AliceBlue, 4); g.DrawEllipse(PStart, SRect); } } }
public void Execute(IPCBIWindow parent) { IStep step = parent.GetCurrentStep(); if (step == null) { return; } IFilter PCBI_filter = new IFilter(parent); IODBLayer newOutlineLayer = PCBI_filter.CreateEmptyODBLayer("poly_to_line", step.Name); float LineWith = 10; //diameter symbol foreach (IODBObject obj in step.GetSelectedElements()) { foreach (IObjectSpecifics os in obj.GetOutline()) { if (os.GetType() == typeof(ILineSpecifics)) { ILineSpecifics lineEdges = (ILineSpecifics)os; IODBObject line = PCBI_filter.CreateLine(newOutlineLayer); lineEdges.ShapeIndex = CheckShapeIndexRound(PCBI_filter, newOutlineLayer, LineWith); lineEdges.Type = PCBI.Symbol_Type.r; line.SetSpecifics(lineEdges, lineEdges.ShapeIndex); } else if (os.GetType() == typeof(IArcSpecifics)) { IArcSpecifics arcEdges = (IArcSpecifics)os; IODBObject arc = PCBI_filter.CreateArc(newOutlineLayer); arcEdges.ShapeIndex = CheckShapeIndexRound(PCBI_filter, newOutlineLayer, LineWith); arcEdges.Type = PCBI.Symbol_Type.r; arc.SetSpecifics(arcEdges, arcEdges.ShapeIndex); } } } parent.UpdateView(); IMatrix matrix = parent.GetMatrix(); matrix.UpdateDataAndList(); }
void Parent_PCBIFormGraphicPaneDrawing(Graphics g, int ClientWidth, int ClientHeight) { if (!parent.JobIsLoaded) { return; } IStep step = parent.GetCurrentStep(); if (step == null) { return; } foreach (IODBObject selectedObject in step.GetSelectedElements()) { if (selectedObject.Type == IObjectType.Line) { ILineSpecifics line = (ILineSpecifics)selectedObject.GetSpecifics(); Point startOfLine = parent.WorldToClient(line.Start); float dimaeter = (float)line.Diameter; g.DrawLine(Pens.Bisque, new PointF(startOfLine.X, startOfLine.Y + dimaeter), new PointF(startOfLine.X + dimaeter, startOfLine.Y)); g.DrawLine(Pens.Bisque, new PointF(startOfLine.X + dimaeter, startOfLine.Y), new PointF(startOfLine.X, startOfLine.Y - dimaeter)); g.DrawLine(Pens.Bisque, new PointF(startOfLine.X + dimaeter, startOfLine.Y), new PointF(startOfLine.X - dimaeter, startOfLine.Y)); } else if (selectedObject.Type == IObjectType.Arc) { IArcSpecifics arc = (IArcSpecifics)selectedObject.GetSpecifics(); Point startOfArc = parent.WorldToClient(arc.Start); float dimaeter = (float)arc.PenWidth; g.DrawLine(Pens.Bisque, new PointF(startOfArc.X, startOfArc.Y + dimaeter), new PointF(startOfArc.X + dimaeter, startOfArc.Y)); g.DrawLine(Pens.Bisque, new PointF(startOfArc.X + dimaeter, startOfArc.Y), new PointF(startOfArc.X, startOfArc.Y - dimaeter)); g.DrawLine(Pens.Bisque, new PointF(startOfArc.X + dimaeter, startOfArc.Y), new PointF(startOfArc.X - dimaeter, startOfArc.Y)); } } }