public override void Draw(XGraphics graphics, Palette palette, DrawingContext context) { List <LineSegment> lineSegments; if (context.UseSmartLineSegments) { lineSegments = m_smartSegments; } else { lineSegments = GetSegments(); } var path = palette.Path(); var random = new Random(GetHashCode()); foreach (var lineSegment in lineSegments) { var pen = palette.GetLinePen(context.Selected, context.Hover, Style == ConnectionStyle.Dashed); if (!Settings.DebugDisableLineRendering) { graphics.DrawLine(pen, lineSegment.Start.ToPointF(), lineSegment.End.ToPointF()); } var delta = lineSegment.Delta; if (Flow == ConnectionFlow.OneWay && delta.Length > Settings.ConnectionArrowSize) { var brush = palette.GetLineBrush(context.Selected, context.Hover); Drawing.DrawChevron(graphics, lineSegment.Mid.ToPointF(), (float)(Math.Atan2(delta.Y, delta.X) / Math.PI * 180), Settings.ConnectionArrowSize, brush); } context.LinesDrawn.Add(lineSegment); } Annotate(graphics, palette, lineSegments); }
public override void Draw(XGraphics graphics, Palette palette, DrawingContext context) { var lineSegments = context.UseSmartLineSegments ? m_smartSegments : GetSegments(); foreach (var lineSegment in lineSegments) { var pen = palette.GetLinePen(context.Selected, context.Hover, Style == ConnectionStyle.Dashed); Pen specialPen = null; if (!context.Hover) { if ((ConnectionColor != Color.Transparent) && !context.Selected) { specialPen = (Pen)pen.Clone(); specialPen.Color = ConnectionColor; } } if (!Settings.DebugDisableLineRendering) { graphics.DrawLine(specialPen ?? pen, lineSegment.Start.ToPointF(), lineSegment.End.ToPointF()); } var delta = lineSegment.Delta; if (Flow == ConnectionFlow.OneWay && delta.Length > Settings.ConnectionArrowSize) { SolidBrush brush = (SolidBrush)palette.GetLineBrush(context.Selected, context.Hover); SolidBrush specialBrush = null; if (!context.Hover) { if ((ConnectionColor != Color.Transparent) && !context.Selected) { specialBrush = (SolidBrush)brush.Clone(); specialBrush.Color = ConnectionColor; } } Drawing.DrawChevron(graphics, lineSegment.Mid.ToPointF(), (float)(Math.Atan2(delta.Y, delta.X) / Math.PI * 180), Settings.ConnectionArrowSize, specialBrush ?? brush); } context.LinesDrawn.Add(lineSegment); } Annotate(graphics, palette, lineSegments); }
public override void Draw(XGraphics graphics, Palette palette, DrawingContext context) { var lineSegments = context.UseSmartLineSegments ? m_smartSegments : GetSegments(); foreach (var lineSegment in lineSegments) { var pen = palette.GetLinePen(context.Selected, context.Hover, Style == ConnectionStyle.Dashed); Pen specialPen = null; if (!context.Hover) if ((ConnectionColor != Color.Transparent) && !context.Selected) { specialPen = (Pen) pen.Clone(); specialPen.Color = ConnectionColor; } if (!Settings.DebugDisableLineRendering) { graphics.DrawLine(specialPen ?? pen, lineSegment.Start.ToPointF(), lineSegment.End.ToPointF()); } var delta = lineSegment.Delta; if (Flow == ConnectionFlow.OneWay && delta.Length > Settings.ConnectionArrowSize) { SolidBrush brush = (SolidBrush) palette.GetLineBrush(context.Selected, context.Hover); SolidBrush specialBrush = null; if (!context.Hover) if ((ConnectionColor != Color.Transparent) && !context.Selected) { specialBrush = (SolidBrush) brush.Clone(); specialBrush.Color = ConnectionColor; } Drawing.DrawChevron(graphics, lineSegment.Mid.ToPointF(), (float) (Math.Atan2(delta.Y, delta.X)/Math.PI*180), Settings.ConnectionArrowSize, specialBrush ?? brush); } context.LinesDrawn.Add(lineSegment); } Annotate(graphics, palette, lineSegments); }
public override void Draw(XGraphics graphics, Palette palette, DrawingContext context) { List<LineSegment> lineSegments; if (context.UseSmartLineSegments) { lineSegments = m_smartSegments; } else { lineSegments = GetSegments(); } var path = palette.Path(); var random = new Random(GetHashCode()); foreach (var lineSegment in lineSegments) { var pen = palette.GetLinePen(context.Selected, context.Hover, Style == ConnectionStyle.Dashed); if (!Settings.DebugDisableLineRendering) { graphics.DrawLine(pen, lineSegment.Start.ToPointF(), lineSegment.End.ToPointF()); } var delta = lineSegment.Delta; if (Flow == ConnectionFlow.OneWay && delta.Length > Settings.ConnectionArrowSize) { var brush = palette.GetLineBrush(context.Selected, context.Hover); Drawing.DrawChevron(graphics, lineSegment.Mid.ToPointF(), (float)(Math.Atan2(delta.Y, delta.X) / Math.PI * 180), Settings.ConnectionArrowSize, brush); } context.LinesDrawn.Add(lineSegment); } Annotate(graphics, palette, lineSegments); }