コード例 #1
0
ファイル: ToolArcSelection.cs プロジェクト: dagrigorev/Core2D
 /// <summary>
 /// Initialize new instance of <see cref="ToolArcSelection"/> class.
 /// </summary>
 /// <param name="serviceProvider">The service provider.</param>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 public ToolArcSelection(IServiceProvider serviceProvider, ILayerContainer layer, IArcShape shape, IShapeStyle style)
 {
     _serviceProvider = serviceProvider;
     _layer           = layer;
     _arc             = shape;
     _style           = style;
 }
コード例 #2
0
 public static SKPath ToSKPath(this IBaseShape shape, double dx, double dy, Func <double, float> scale)
 {
     return(shape switch
     {
         ILineShape lineShape => ToSKPath(lineShape, dx, dy, scale),
         IRectangleShape rectangleShape => ToSKPath(rectangleShape, dx, dy, scale),
         IEllipseShape ellipseShape => ToSKPath(ellipseShape, dx, dy, scale),
         IImageShape imageShape => ToSKPath(imageShape, dx, dy, scale),
         IArcShape arcShape => ToSKPath(arcShape, dx, dy, scale),
         ICubicBezierShape cubicBezierShape => ToSKPath(cubicBezierShape, dx, dy, scale),
         IQuadraticBezierShape quadraticBezierShape => ToSKPath(quadraticBezierShape, dx, dy, scale),
         ITextShape textShape => ToSKPath(textShape, dx, dy, scale),
         IPathShape pathShape => ToSKPath(pathShape, dx, dy, scale),
         IGroupShape groupShape => ToSKPath(groupShape.Shapes, dx, dy, scale),
         _ => null,
     });
コード例 #3
0
ファイル: BoundsArc.cs プロジェクト: iomeone/Core2D
        public static Rect2 ArcBounds(IArcShape arc)
        {
            double x1 = arc.Point1.X;
            double y1 = arc.Point1.Y;
            double x2 = arc.Point2.X;
            double y2 = arc.Point2.Y;

            double x0 = (x1 + x2) / 2.0;
            double y0 = (y1 + y2) / 2.0;

            double r      = Math.Sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
            double x      = x0 - r;
            double y      = y0 - r;
            double width  = 2.0 * r;
            double height = 2.0 * r;

            return(new Rect2(x, y, width, height));
        }
コード例 #4
0
        public static AM.Geometry ToGeometry(IArcShape arc)
        {
            var sg = new AM.StreamGeometry();

            using var sgc = sg.Open();
            var a = new WpfArc(
                Point2.FromXY(arc.Point1.X, arc.Point1.Y),
                Point2.FromXY(arc.Point2.X, arc.Point2.Y),
                Point2.FromXY(arc.Point3.X, arc.Point3.Y),
                Point2.FromXY(arc.Point4.X, arc.Point4.Y));

            sgc.BeginFigure(
                new A.Point(a.Start.X, a.Start.Y),
                arc.IsFilled);
            sgc.ArcTo(
                new A.Point(a.End.X, a.End.Y),
                new A.Size(a.Radius.Width, a.Radius.Height),
                0.0,
                a.IsLargeArc,
                AM.SweepDirection.Clockwise);
            sgc.EndFigure(false);
            return(sg);
        }
コード例 #5
0
ファイル: ArcTool.cs プロジェクト: wilsoc5/tikzedt
 public ArcTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewArc = overlay.ShapeFactory.GetPreviewArc();
     PreviewPie = overlay.ShapeFactory.GetPreviewPie();
 }
コード例 #6
0
 public ArcDrawNode(IArcShape arc, IShapeStyle style)
 {
     Style = style;
     Arc   = arc;
     UpdateGeometry();
 }
コード例 #7
0
ファイル: ArcTool.cs プロジェクト: JoeyEremondi/tikzedt
 public ArcTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewArc = overlay.ShapeFactory.GetPreviewArc();
     PreviewPie = overlay.ShapeFactory.GetPreviewPie();
 }
コード例 #8
0
ファイル: DataFlow.cs プロジェクト: will8886/Core2D
 /// <inheritdoc/>
 public void Bind(IArcShape arc, object db, object r)
 {
 }
コード例 #9
0
 public IArcDrawNode CreateArcDrawNode(IArcShape arc, IShapeStyle style)
 {
     return(new ArcDrawNode(arc, style));
 }