private void DrawOrientedRect(YOrientedRectangle pos, Graphics g) { points[0] = new PointF((float)pos.AnchorX, (float)pos.AnchorY); points[1] = new PointF((float)(pos.AnchorX + pos.Height * pos.UpX), (float)(pos.AnchorY + pos.Height * pos.UpY)); points[2] = new PointF((float)(pos.AnchorX + pos.Height * pos.UpX + pos.Width * -pos.UpY), (float)(pos.AnchorY + pos.Height * pos.UpY + pos.Width * pos.UpX)); points[3] = new PointF((float)(pos.AnchorX + pos.Width * -pos.UpY), (float)(pos.AnchorY + pos.Width * pos.UpX)); g.DrawPolygon(this.labelBorderPen, points); }
private static Polygon GetPolygon(YOrientedRectangle orientedRectangle) { var poly = new Polygon(); poly.Stroke = Brushes.Red; poly.Points.Add(new Point((float)orientedRectangle.AnchorX, (float)orientedRectangle.AnchorY)); poly.Points.Add(new Point((float)(orientedRectangle.AnchorX + orientedRectangle.Height * orientedRectangle.UpX), (float)(orientedRectangle.AnchorY + orientedRectangle.Height * orientedRectangle.UpY))); poly.Points.Add(new Point((float)(orientedRectangle.AnchorX + orientedRectangle.Height * orientedRectangle.UpX + orientedRectangle.Width * -orientedRectangle.UpY), (float)(orientedRectangle.AnchorY + orientedRectangle.Height * orientedRectangle.UpY + orientedRectangle.Width * orientedRectangle.UpX))); poly.Points.Add(new Point((float)(orientedRectangle.AnchorX + orientedRectangle.Width * -orientedRectangle.UpY), (float)(orientedRectangle.AnchorY + orientedRectangle.Width * orientedRectangle.UpX))); return(poly); }
private static YOrientedRectangle GetEdgeLabelLocation(LayoutGraph graph, Edge e, IEdgeLabelLayout ell) { YOrientedRectangle ellp = ell.LabelModel.GetLabelPlacement( ell.BoundingBox, graph.GetLayout(e), graph.GetLayout(e.Source), graph.GetLayout(e.Target), ell.ModelParameter); return(ellp); }
protected void PaintEdgeLabel(Graphics g, LayoutGraph graph, Edge edge, IEdgeLabelLayout label) { YOrientedRectangle pos = GetEdgeLabelLocation(graph, edge, label); DrawOrientedRect(pos, g); }
protected void PaintNodeLabel(Graphics g, LayoutGraph graph, Node node, INodeLabelLayout label) { YOrientedRectangle pos = GetNodeLabelLocation(graph, node, label); DrawOrientedRect(pos, g); }