Exemplo n.º 1
0
 public ArcSelection(IServiceProvider serviceProvider, LayerContainerViewModel layer, ArcShapeViewModel shapeViewModel, ShapeStyleViewModel style)
 {
     _serviceProvider = serviceProvider;
     _layer           = layer;
     _arc             = shapeViewModel;
     _styleViewModel  = style;
 }
Exemplo n.º 2
0
        public void BeginDown(InputArgs args)
        {
            var factory = _serviceProvider.GetService <IFactory>();
            var editor  = _serviceProvider.GetService <ProjectEditorViewModel>();

            (decimal sx, decimal sy) = editor.TryToSnap(args);
            switch (_currentState)
            {
            case State.Point1:
            {
                editor.IsToolIdle = false;
                var style = editor.Project.CurrentStyleLibrary?.Selected is { } ?
                editor.Project.CurrentStyleLibrary.Selected :
                editor.Factory.CreateShapeStyle(ProjectEditorConfiguration.DefaulStyleName);
                _connectedPoint3 = false;
                _connectedPoint4 = false;
                _arc             = factory.CreateArcShape(
                    (double)sx, (double)sy,
                    (ShapeStyleViewModel)style.Copy(null),
                    editor.Project.Options.DefaultIsStroked,
                    editor.Project.Options.DefaultIsFilled);

                editor.SetShapeName(_arc);

                var result = editor.TryToGetConnectionPoint((double)sx, (double)sy);
                if (result is { })
Exemplo n.º 3
0
    public override object Copy(IDictionary <object, object>?shared)
    {
        var copy = new ArcShapeViewModel(ServiceProvider)
        {
            Name       = Name,
            State      = State,
            Style      = _style?.CopyShared(shared),
            IsStroked  = IsStroked,
            IsFilled   = IsFilled,
            Properties = _properties.CopyShared(shared).ToImmutable(),
            Record     = _record,
            Point1     = _point1?.CopyShared(shared),
            Point2     = _point2?.CopyShared(shared),
            Point3     = _point3?.CopyShared(shared),
            Point4     = _point4?.CopyShared(shared)
        };

        return(copy);
    }
Exemplo n.º 4
0
        public static AM.Geometry ToGeometry(ArcShapeViewModel 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);
        }
Exemplo n.º 5
0
 public ArcDrawNode(ArcShapeViewModel arc, ShapeStyleViewModel style)
 {
     Style = style;
     Arc   = arc;
     UpdateGeometry();
 }
Exemplo n.º 6
0
 public void Bind(ArcShapeViewModel arc, object db, object r)
 {
 }
Exemplo n.º 7
0
 public IArcDrawNode CreateArcDrawNode(ArcShapeViewModel arc, ShapeStyleViewModel style)
 {
     return(new ArcDrawNode(arc, style));
 }