示例#1
0
        /// <summary>
        /// Transfer selection state to Point2.
        /// </summary>
        public void ToStatePoint2()
        {
            _ellipse           = EllipseShape.Create(0, 0, _style, null);
            _p1HelperPoint     = PointShape.Create(0, 0, _point);
            _p2HelperPoint     = PointShape.Create(0, 0, _point);
            _centerHelperPoint = PointShape.Create(0, 0, _point);

            _layer.Shapes = _layer.Shapes.Add(_ellipse);
            _layer.Shapes = _layer.Shapes.Add(_p1HelperPoint);
            _layer.Shapes = _layer.Shapes.Add(_p2HelperPoint);
            _layer.Shapes = _layer.Shapes.Add(_centerHelperPoint);
        }
示例#2
0
        /// <inheritdoc/>
        EllipseShape IShapeFactory.Ellipse(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string text)
        {
            var style   = _editor.Project.CurrentStyleLibrary.Selected;
            var ellipse = EllipseShape.Create(
                x1, y1,
                x2, y2,
                _editor.Project.Options.CloneStyle ? style.Clone() : style,
                _editor.Project.Options.PointShape,
                isStroked,
                isFilled,
                text);

            _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, ellipse);
            return(ellipse);
        }
示例#3
0
        /// <inheritdoc/>
        EllipseShape IShapeFactory.Ellipse(PointShape topLeft, PointShape bottomRight, bool isStroked, bool isFilled, string text)
        {
            var style   = _editor.Project.CurrentStyleLibrary.Selected;
            var ellipse = EllipseShape.Create(
                topLeft,
                bottomRight,
                _editor.Project.Options.CloneStyle ? style.Clone() : style,
                _editor.Project.Options.PointShape,
                isStroked,
                isFilled,
                text);

            _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, ellipse);
            return(ellipse);
        }
示例#4
0
        /// <summary>
        /// Initializes static designer context.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        public static void InitializeContext(IServiceProvider serviceProvider)
        {
            // Editor

            Editor = serviceProvider.GetService <ProjectEditor>();

            // Recent Projects

            Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test1", "Test1.project"));
            Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test2", "Test2.project"));

            // New Project

            Editor.OnNewProject();

            // Transform

            Transform = MatrixObject.Identity;

            // Data

            var db      = Database.Create("Db");
            var fields  = new string[] { "Column0", "Column1" };
            var columns = ImmutableArray.CreateRange(fields.Select(c => Column.Create(db, c)));

            db.Columns = columns;
            var values = Enumerable.Repeat("<empty>", db.Columns.Length).Select(c => Value.Create(c));
            var record = Record.Create(
                db,
                ImmutableArray.CreateRange(values));

            db.Records       = db.Records.Add(record);
            db.CurrentRecord = record;

            Database = db;
            Data     = Context.Create(record);
            Record   = record;

            // Project

            IProjectFactory factory = new ProjectFactory();

            Project = factory.GetProject();

            Template = PageContainer.CreateTemplate();

            Page = PageContainer.CreatePage();
            var layer = Page.Layers.FirstOrDefault();

            layer.Shapes      = layer.Shapes.Add(LineShape.Create(0, 0, null, null));
            Page.CurrentLayer = layer;
            Page.CurrentShape = layer.Shapes.FirstOrDefault();
            Page.Template     = Template;

            Document = DocumentContainer.Create();
            Layer    = LayerContainer.Create();
            Options  = Options.Create();

            // State

            State = ShapeState.Create();

            // Style

            ArgbColor       = ArgbColor.Create(128, 255, 0, 0);
            ArrowStyle      = ArrowStyle.Create();
            FontStyle       = FontStyle.Create();
            LineFixedLength = LineFixedLength.Create();
            LineStyle       = LineStyle.Create();
            Style           = ShapeStyle.Create("Default");
            TextStyle       = TextStyle.Create();

            // Shapes

            Arc             = ArcShape.Create(0, 0, Style, null);
            CubicBezier     = CubicBezierShape.Create(0, 0, Style, null);
            Ellipse         = EllipseShape.Create(0, 0, Style, null);
            Group           = GroupShape.Create(Constants.DefaulGroupName);
            Image           = ImageShape.Create(0, 0, Style, null, "key");
            Line            = LineShape.Create(0, 0, Style, null);
            Path            = PathShape.Create(Style, null);
            Point           = PointShape.Create();
            QuadraticBezier = QuadraticBezierShape.Create(0, 0, Style, null);
            Rectangle       = RectangleShape.Create(0, 0, Style, null);
            Text            = TextShape.Create(0, 0, Style, null, "Text");

            // Path

            ArcSegment                 = ArcSegment.Create(PointShape.Create(), PathSize.Create(), 180, true, SweepDirection.Clockwise, true, true);
            CubicBezierSegment         = CubicBezierSegment.Create(PointShape.Create(), PointShape.Create(), PointShape.Create(), true, true);
            LineSegment                = LineSegment.Create(PointShape.Create(), true, true);
            PathFigure                 = PathFigure.Create(PointShape.Create(), false, true);
            PathGeometry               = PathGeometry.Create(ImmutableArray.Create <PathFigure>(), FillRule.EvenOdd);
            PathSize                   = PathSize.Create();
            PolyCubicBezierSegment     = PolyCubicBezierSegment.Create(ImmutableArray.Create <PointShape>(), true, true);
            PolyLineSegment            = PolyLineSegment.Create(ImmutableArray.Create <PointShape>(), true, true);
            PolyQuadraticBezierSegment = PolyQuadraticBezierSegment.Create(ImmutableArray.Create <PointShape>(), true, true);
            QuadraticBezierSegment     = QuadraticBezierSegment.Create(PointShape.Create(), PointShape.Create(), true, true);
        }