protected void RenderArrowPoints(SolidV.MVC.IView <Context, SolidV.MVC.Model> view, Context context, double x, double y, double connectorSize, double extra_thickness = 0) { PointD[] pts = new PointD[] { new PointD(x - (connectorSize + 1.0) - extra_thickness, y + (connectorSize / 1.5) + extra_thickness), new PointD(x + 1.0f + extra_thickness, y), new PointD(x - (connectorSize + 1.0) - extra_thickness, y - (connectorSize / 1.5) - extra_thickness) }; context.MoveTo(pts[0]); context.LineTo(pts[1]); context.LineTo(pts[2]); if (view.Mode == ViewMode.Render) { context.ClosePath(); context.Fill(); } }
public override void DrawItem(SolidV.MVC.IView <Context, SolidV.MVC.Model> view, Context context, object shape) { BezierCurvedArrowShape sh = (BezierCurvedArrowShape)shape; if (view.Mode == ViewMode.Render) { context.NewPath(); } context.Save(); PointD from = new PointD(); if (sh.From != null) { from = (sh.FromGlue != null) ? sh.FromGlue.TransformPointToGlobal(sh.FromGlue.Center, context) : sh.From.Center; from = sh.TransformPointToLocal(from, context); } PointD to = new PointD(); if (sh.To != null) { to = (sh.ToGlue != null) ? sh.ToGlue.TransformPointToGlobal(sh.ToGlue.Center, context) : sh.To.Center; to = sh.TransformPointToLocal(to, context); } GetArrowLinePoints(context, from.X, from.Y, to.X, to.Y, sh.LineWidth, sh.ConnectorSize, view.Mode == ViewMode.Select ? sh.ExtraThickness : sh.LineWidth); if (view.Mode == ViewMode.Render) { context.Fill(); } RenderArrowPoints(view, context, to.X, to.Y, sh.ConnectorSize, view.Mode == ViewMode.Select ? sh.ExtraThickness : sh.LineWidth); context.Restore(); }