private void DrawLineArrowsInternal(XGraphics gfx, Core2D.Shapes.XLine line, double dx, double dy, out XPoint pt1, out XPoint pt2) { XSolidBrush fillStartArrow = ToXSolidBrush(line.Style.StartArrowStyle.Fill); XPen strokeStartArrow = ToXPen(line.Style.StartArrowStyle, _scaleToPage, _sourceDpi, _targetDpi); XSolidBrush fillEndArrow = ToXSolidBrush(line.Style.EndArrowStyle.Fill); XPen strokeEndArrow = ToXPen(line.Style.EndArrowStyle, _scaleToPage, _sourceDpi, _targetDpi); double _x1 = line.Start.X + dx; double _y1 = line.Start.Y + dy; double _x2 = line.End.X + dx; double _y2 = line.End.Y + dy; Core2D.Shapes.XLineExtensions.GetMaxLength(line, ref _x1, ref _y1, ref _x2, ref _y2); double x1 = _scaleToPage(_x1); double y1 = _scaleToPage(_y1); double x2 = _scaleToPage(_x2); double y2 = _scaleToPage(_y2); var sas = line.Style.StartArrowStyle; var eas = line.Style.EndArrowStyle; double a1 = Math.Atan2(y1 - y2, x1 - x2) * 180.0 / Math.PI; double a2 = Math.Atan2(y2 - y1, x2 - x1) * 180.0 / Math.PI; // Draw start arrow. pt1 = DrawLineArrowInternal(gfx, strokeStartArrow, fillStartArrow, x1, y1, a1, sas); // Draw end arrow. pt2 = DrawLineArrowInternal(gfx, strokeEndArrow, fillEndArrow, x2, y2, a2, eas); }
/// <inheritdoc/> public override void Draw(object dc, Core2D.Shapes.XLine line, double dx, double dy, ImmutableArray <Core2D.Data.XProperty> db, Core2D.Data.Database.XRecord r) { if (!line.IsStroked) { return; } var _gfx = dc as XGraphics; XPen strokeLine = ToXPen(line.Style, _scaleToPage, _sourceDpi, _targetDpi); XPoint pt1, pt2; DrawLineArrowsInternal(_gfx, line, dx, dy, out pt1, out pt2); if (line.Style.LineStyle.IsCurved) { DrawLineCurveInternal( _gfx, strokeLine, line.IsStroked, ref pt1, ref pt2, line.Style.LineStyle.Curvature, line.Style.LineStyle.CurveOrientation, line.Start.Alignment, line.End.Alignment); } else { DrawLineInternal(_gfx, strokeLine, line.IsStroked, ref pt1, ref pt2); } }
/// <inheritdoc/> public override void Draw(object dc, Core2D.Shapes.XLine line, double dx, double dy, ImmutableArray <Core2D.Data.XProperty> db, Core2D.Data.Database.XRecord r) { if (!line.IsStroked) { return; } var dxf = dc as DxfDocument; double _x1 = line.Start.X + dx; double _y1 = line.Start.Y + dy; double _x2 = line.End.X + dx; double _y2 = line.End.Y + dy; Core2D.Shapes.XLineExtensions.GetMaxLength(line, ref _x1, ref _y1, ref _x2, ref _y2); // TODO: Draw line start arrow. // TODO: Draw line end arrow. // TODO: Draw line curve. DrawLineInternal(dxf, _currentLayer, line.Style, line.IsStroked, _x1, _y1, _x2, _y2); }