/// <summary> /// Transfer selection state to Point2. /// </summary> public void ToStatePoint2() { _line12 = LineShape.Create(0, 0, _style, null); _helperPoint2 = PointShape.Create(0, 0, _point); _layer.Shapes = _layer.Shapes.Add(_line12); _layer.Shapes = _layer.Shapes.Add(_helperPoint2); }
/// <summary> /// Transfer selection state to Point3. /// </summary> public void ToStatePoint3() { _line43 = LineShape.Create(0, 0, _style, null); _line23 = LineShape.Create(0, 0, _style, null); _helperPoint3 = PointShape.Create(0, 0, _point); _layer.Shapes = _layer.Shapes.Add(_line43); _layer.Shapes = _layer.Shapes.Add(_line23); _layer.Shapes = _layer.Shapes.Add(_helperPoint3); }
/// <inheritdoc/> LineShape IShapeFactory.Line(PointShape start, PointShape end, bool isStroked) { var style = _editor.Project.CurrentStyleLibrary.Selected; var line = LineShape.Create( start, end, _editor.Project.Options.CloneStyle ? style.Clone() : style, _editor.Project.Options.PointShape, isStroked); _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, line); return(line); }
/// <inheritdoc/> LineShape IShapeFactory.Line(double x1, double y1, double x2, double y2, bool isStroked) { var style = _editor.Project.CurrentStyleLibrary.Selected; var line = LineShape.Create( x1, y1, x2, y2, _editor.Project.Options.CloneStyle ? style.Clone() : style, _editor.Project.Options.PointShape, isStroked); _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, line); return(line); }
/// <summary> /// Transfer selection state to Point4. /// </summary> public void ToStatePoint4() { if (_ellipse != null) { _layer.Shapes = _layer.Shapes.Remove(_ellipse); _ellipse = null; } _endLine = LineShape.Create(0, 0, _style, null); _endHelperPoint = PointShape.Create(0, 0, _point); _layer.Shapes = _layer.Shapes.Add(_endLine); _layer.Shapes = _layer.Shapes.Add(_endHelperPoint); }
/// <summary> /// Transfer selection state to Point3. /// </summary> public void ToStatePoint3() { if (_p1HelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_p1HelperPoint); _p1HelperPoint = null; } if (_p2HelperPoint != null) { _layer.Shapes = _layer.Shapes.Remove(_p2HelperPoint); _p2HelperPoint = null; } _startLine = LineShape.Create(0, 0, _style, null); _startHelperPoint = PointShape.Create(0, 0, _point); _layer.Shapes = _layer.Shapes.Add(_startLine); _layer.Shapes = _layer.Shapes.Add(_startHelperPoint); }
/// <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); }