public void AddShape(IShapeObject shapeObject, ShapeTool tool) { var visual = shapeObject.Shape; ShapeTool.SetShapeObject(visual, shapeObject); ShapeTool.SetShapeCreate(visual, tool); scene.Host.Paint(visual); }
public void CreateShape( DxfEntity entity, DrawContext.Wireframe drawContext, ArgbColor color, bool forText, IShape4D shape) { WW.Math.Point2D[] points = new WW.Math.Point2D[3]; if (shape.IsEmpty) { return; } this.textWriter_0.WriteLine("newpath"); WW.Math.Point2D point2D = new WW.Math.Point2D(); WW.Math.Point2D p0 = new WW.Math.Point2D(); ISegment2DIterator iterator = shape.ToShape2D(Matrix4D.Identity).CreateIterator(); while (iterator.MoveNext()) { switch (iterator.Current(points, 0)) { case SegmentType.MoveTo: WW.Math.Point2D p; p0 = p = points[0]; point2D = p; this.method_8(p); continue; case SegmentType.LineTo: this.method_9(p0 = points[0]); continue; case SegmentType.QuadTo: Pair <WW.Math.Point2D, WW.Math.Point2D> cubicBezier = ShapeTool.QuadToCubicBezier(p0, points[0], points[1]); this.method_10(cubicBezier.First, cubicBezier.Second, p0 = points[1]); continue; case SegmentType.CubicTo: this.method_10(points[0], points[1], p0 = points[2]); continue; case SegmentType.Close: this.textWriter_0.WriteLine("closepath"); p0 = point2D; continue; default: continue; } } if (shape.IsFilled) { this.textWriter_0.WriteLine("fill"); } this.textWriter_0.WriteLine("stroke"); }
IShapeObject GetHit(Point mousePoint) { hitArea.Center = mousePoint; var visuals = scene.Host.GetVisuals(hitArea); var hit = visuals.Select(v => ShapeTool.GetShapeObject(v)).FirstOrDefault(); return(hit); }
public void CreateShape( DxfEntity entity, DrawContext.Wireframe drawContext, ArgbColor color, bool forText, IShape4D shape) { using (GraphicsPath graphicsPath = ShapeTool.ToGraphicsPath(shape.ToShape2D(Matrix4D.Identity))) this.graphicsPath_0.AddPath(graphicsPath, false); }
public void DrawPath( IShape2D path, Matrix4D transform, Color color, short lineWeight, bool filled, bool forText, double extrusion) { if (!path.HasSegments) { return; } IClippingTransformer transformer = (IClippingTransformer)this.wireframe_0.GetTransformer().Clone(); transformer.SetPreTransform(transform); if (extrusion == 0.0) { IShape4D shape1 = (IShape4D) new FlatShape4D(path, filled); IShape4D shape2 = transformer.Transform(shape1); if (shape2.IsEmpty) { return; } this.iwireframeGraphicsFactory2_0.BeginGeometry(this.dxfEntity_0, this.wireframe_0, this.wireframe_0.GetPlotColor(this.dxfEntity_0, color), false, filled, !filled, true); this.iwireframeGraphicsFactory2_0.CreateShape(this.dxfEntity_0, shape2); this.iwireframeGraphicsFactory2_0.EndGeometry(); } else { IList <Polyline2D> flattened = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.wireframe_0.Config.ShapeFlattenEpsilon); IList <Polyline4D> polylines1 = DxfUtil.smethod_39(flattened, filled, transformer); ArgbColor plotColor = this.wireframe_0.GetPlotColor(this.dxfEntity_0, color); Class940.smethod_3(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines1); transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion)); IList <Polyline4D> polylines2 = DxfUtil.smethod_39(flattened, filled, transformer); Class940.smethod_3(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines2); Polyline4D polyline4D1 = new Polyline4D(2); polyline4D1.Add(Vector4D.Zero); polyline4D1.Add(Vector4D.Zero); IList <Polyline4D> polylines3 = (IList <Polyline4D>) new List <Polyline4D>(1); polylines3.Add(polyline4D1); for (int index1 = polylines1.Count - 1; index1 >= 0; --index1) { Polyline4D polyline4D2 = polylines1[index1]; Polyline4D polyline4D3 = polylines2[index1]; for (int index2 = polyline4D2.Count - 1; index2 >= 0; --index2) { polyline4D1[0] = polyline4D2[index2]; polyline4D1[1] = polyline4D3[index2]; Class940.smethod_2(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines3); } } } }
public void Draw(Class386 context) { if (this.ishape4D_0.IsFilled) { using (GraphicsPath graphicsPath = ShapeTool.ToGraphicsPath(this.ishape4D_0.ToShape2D(context.Transform))) context.Graphics.FillPath((Brush)this.method_3((Class385)context), graphicsPath); } else { IShape2D shape2D = this.ishape4D_0.ToShape2D(context.Transform); GeneralShape2D shape = shape2D as GeneralShape2D ?? new GeneralShape2D(shape2D, true); context.FastRasterizer.DrawShape(shape, (uint)this.Color.ToArgb()); } }
public void DrawPath( IShape2D path, Matrix4D transform, Color color, short lineWeight, bool filled, bool forText, double extrusion) { if (!path.HasSegments) { return; } IClippingTransformer transformer = (IClippingTransformer)this.wireframe_0.GetTransformer().Clone(); transformer.SetPreTransform(transform); IWireframeGraphicsFactory graphicsFactory0 = this.iwireframeGraphicsFactory_0; if (extrusion == 0.0) { IShape4D shape1 = (IShape4D) new FlatShape4D((IShape2D)(path as GeneralShape2D ?? new GeneralShape2D(path, true)), filled); IShape4D shape2 = transformer.Transform(shape1); if (shape2.IsEmpty) { return; } graphicsFactory0.CreateShape(this.dxfEntity_0, this.wireframe_0, this.wireframe_0.GetPlotColor(this.dxfEntity_0, color), forText, shape2); } else { IList <Polyline2D> flattened = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.wireframe_0.Config.ShapeFlattenEpsilon); IList <Polyline4D> polylines1 = DxfUtil.smethod_39(flattened, filled, transformer); ArgbColor plotColor = this.wireframe_0.GetPlotColor(this.dxfEntity_0, color); graphicsFactory0.CreatePathAsOne(this.dxfEntity_0, this.wireframe_0, plotColor, forText, polylines1, false, true); transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion)); IList <Polyline4D> polylines2 = DxfUtil.smethod_39(flattened, filled, transformer); graphicsFactory0.CreatePathAsOne(this.dxfEntity_0, this.wireframe_0, plotColor, forText, polylines2, false, true); for (int index1 = polylines1.Count - 1; index1 >= 0; --index1) { Polyline4D polyline4D1 = polylines1[index1]; Polyline4D polyline4D2 = polylines2[index1]; for (int index2 = polyline4D1.Count - 1; index2 >= 0; --index2) { graphicsFactory0.CreateLine(this.dxfEntity_0, this.wireframe_0, plotColor, forText, polyline4D1[index2], polyline4D2[index2]); } } } }
public Class521(ShxFile font, ShxShape shape, GraphicsConfig graphicsConfig) { this.int_0 = font.Above; Point2D endPoint; IShape2D glyphShape = shape.GetGlyphShape(false, out endPoint); this.vector2D_0 = (Vector2D)endPoint; this.ilist_0 = (IList <Polyline2D>)ShapeTool.GetFlattened(glyphShape, graphicsConfig.ShapeFlattenEpsilon); foreach (List <Point2D> point2DList in (IEnumerable <Polyline2D>) this.ilist_0) { foreach (Point2D p in point2DList) { this.bounds2D_0.Update(p); } } }
private void OnButtonClick(string toolName) { Tool chosenTool = null; if (toolName == "arrowBtn") { //chosenTool = new PointerTool(toolArgs); } if (toolName == "lineBtn") { //toolArgs.pictureBox.Cursor = Cursors.Cross; chosenTool = new ShapeTool(new LineCreator()); } else if (toolName == "rectangleBtn") { //toolArgs.pictureBox.Cursor = Cursors.Cross; chosenTool = new ShapeTool(new RectangleCreator()); } else if (toolName == "pencilBtn") { //chosenTool = new PencilTool(toolArgs); } else if (toolName == "brushBtn") { chosenTool = new BrushTool(); } else if (toolName == "ellipseBtn") { //toolArgs.pictureBox.Cursor = Cursors.Cross; chosenTool = new ShapeTool(new ElipseCreator()); } else if (toolName == "textBtn") { //chosenTool = new TextTool(toolArgs); } else if (toolName == "fillBtn") { //chosenTool = new FillTool(toolArgs); } else if (toolName == "eraserBtn") { //chosenTool = new BrushTool(toolArgs, BrushToolType.Eraser); } model.DrawingTool = chosenTool; }
public void DrawPath( IShape2D shape, Matrix4D transform, WW.Cad.Model.Color color, short lineWeight, bool filled, bool forText, double extrusion) { Matrix transform1 = this.graphics_0.Transform; using (Matrix matrix = new Matrix((float)transform.M00, (float)transform.M10, (float)transform.M01, (float)transform.M11, (float)transform.M03, (float)transform.M13)) { this.graphics_0.Transform = matrix; using (GraphicsPath graphicsPath = ShapeTool.ToGraphicsPath(shape)) this.graphics_0.DrawPath(this.pen_0, graphicsPath); } this.graphics_0.Transform = transform1; }
internal Class454(IShape2D shape, GraphicsConfig config) { IList <Polyline2D> flattened = (IList <Polyline2D>)ShapeTool.GetFlattened(shape, config.ShapeFlattenEpsilon); if (flattened != null) { IList <Polygon2D> input1 = (IList <Polygon2D>) new List <Polygon2D>(flattened.Count); IList <Polygon2D> polygon2DList = (IList <Polygon2D>) new List <Polygon2D>(); for (int index = 0; index < flattened.Count; ++index) { Polygon2D polygon2D = new Polygon2D((IEnumerable <Point2D>)flattened[index]); if (polygon2D.IsClockwise()) { polygon2DList.Add(polygon2D); } else if (input1.Count == 0) { input1.Add(polygon2D); } else { input1 = (IList <Polygon2D>)Polygon2D.GetUnion(input1, (IList <Polygon2D>) new Polygon2D[1] { polygon2D }); } } List <IList <Point2D> > point2DListList = new List <IList <Point2D> >(input1.Count + polygon2DList.Count); point2DListList.AddRange((IEnumerable <IList <Point2D> >)input1); point2DListList.AddRange((IEnumerable <IList <Point2D> >)polygon2DList); Triangulator2D.Triangulate((IList <IList <Point2D> >)point2DListList, (IList <Triangulator2D.Triangle>) this.list_0, (IList <Point2D>) this.list_1); } else { this.list_0 = (List <Triangulator2D.Triangle>)null; this.list_1 = (List <Point2D>)null; } }
private void method_2( WoutWareGlyph glyph, IList <Pair <WoutWareGlyph, IList <Pair <Matrix3D, int> > > > pendingGlyphs) { IShape2D path = glyph.Path; if (path.HasSegments) { List <Pair <Matrix3D, int> > pairList = new List <Pair <Matrix3D, int> >(); foreach (IShape2D shape2D in ShapeTool.SplitIntoUnbroken(path)) { bool flag = false; IList <int> intList = this.method_3(shape2D); foreach (int second in (IEnumerable <int>)intList) { Matrix3D?transformation = ShapeTool.GetTransformation(this.ilist_0[second], shape2D, 0.01); if (transformation.HasValue) { flag = true; pairList.Add(new Pair <Matrix3D, int>(transformation.Value, second)); break; } } if (!flag) { pairList.Add(new Pair <Matrix3D, int>(Matrix3D.Identity, this.ilist_0.Count)); intList.Add(this.ilist_0.Count); this.ilist_0.Add(shape2D); } } pendingGlyphs.Add(new Pair <WoutWareGlyph, IList <Pair <Matrix3D, int> > >(glyph, (IList <Pair <Matrix3D, int> >)pairList)); } else { pendingGlyphs.Add(new Pair <WoutWareGlyph, IList <Pair <Matrix3D, int> > >(glyph, (IList <Pair <Matrix3D, int> >)null)); } }
public LineCurveEditEngine(ShapeTool passedOwner): base(passedOwner) { }
/// <inheritdoc/> public override IDock CreateLayout() { // Documents var pageDocument = new PageDocument { Id = nameof(PageDocument), Title = "Page" }; // Tools var projectTool = new ProjectTool { Id = nameof(ProjectTool), Title = "Project" }; var optionsTool = new OptionsTool { Id = nameof(OptionsTool), Title = "Options" }; var imagesTool = new ImagesTool { Id = nameof(ImagesTool), Title = "Images" }; var groupsTool = new GroupsTool { Id = nameof(GroupsTool), Title = "Groups" }; var databasesTool = new DatabasesTool { Id = nameof(DatabasesTool), Title = "Databases" }; var scriptTool = new ScriptTool { Id = nameof(ScriptTool), Title = "Script" }; var browserTool = new BrowserTool { Id = nameof(BrowserTool), Title = "Browser" }; var stylesTool = new StylesTool { Id = nameof(StylesTool), Title = "Styles" }; var templatesTool = new TemplatesTool { Id = nameof(TemplatesTool), Title = "Templates" }; var containerTool = new ContainerTool { Id = nameof(ContainerTool), Title = "Container" }; var zoomTool = new ZoomTool { Id = nameof(ZoomTool), Title = "Zoom" }; var shapeTool = new ShapeTool { Id = nameof(ShapeTool), Title = "Shape" }; var toolsTool = new ToolsTool { Id = nameof(ToolsTool), Title = "Tools" }; var dataTool = new DataTool { Id = nameof(DataTool), Title = "Data" }; var styleTool = new StyleTool { Id = nameof(StyleTool), Title = "Style" }; var templateTool = new TemplateTool { Id = nameof(TemplateTool), Title = "Template" }; // Panes var leftPane = new LayoutDock { Id = nameof(ILayoutDock), Title = "EditorLeft", Orientation = Orientation.Vertical, Proportion = 0.17, CurrentView = null, Views = new ObservableCollection <IView> { new ToolDock { Id = nameof(IToolDock), Title = "EditorLeftTop", Proportion = double.NaN, CurrentView = projectTool, Views = new ObservableCollection <IView> { projectTool, optionsTool, imagesTool } }, new SplitterDock() { Id = nameof(ISplitterDock), Title = "LeftTopSplitter" }, new ToolDock { Id = nameof(IToolDock), Title = "EditorLeftBottom", Proportion = double.NaN, CurrentView = groupsTool, Views = new ObservableCollection <IView> { groupsTool, databasesTool, scriptTool, browserTool } } } }; var rightPane = new LayoutDock { Id = nameof(ILayoutDock), Title = "EditorRight", Orientation = Orientation.Vertical, Proportion = 0.17, CurrentView = null, Views = new ObservableCollection <IView> { new ToolDock { Id = nameof(IToolDock), Title = "EditorRightTop", Proportion = double.NaN, CurrentView = stylesTool, Views = new ObservableCollection <IView> { stylesTool, templatesTool, containerTool, zoomTool } }, new SplitterDock() { Id = nameof(ISplitterDock), Title = "RightTopSplitter" }, new ToolDock { Id = nameof(IToolDock), Title = "EditorRightBottom", Proportion = double.NaN, CurrentView = shapeTool, Views = new ObservableCollection <IView> { shapeTool, toolsTool, dataTool, styleTool, templateTool } } } }; var documentsPane = new DocumentDock { Id = nameof(IDocumentDock), Title = "DocumentsPane", Proportion = double.NaN, CurrentView = pageDocument, Views = new ObservableCollection <IView> { pageDocument } }; // Editor var editorLayout = new LayoutDock { Id = nameof(ILayoutDock), Title = "EditorLayout", Orientation = Orientation.Horizontal, Proportion = double.NaN, CurrentView = null, Views = new ObservableCollection <IView> { leftPane, new SplitterDock() { Id = nameof(ISplitterDock), Title = "LeftSplitter" }, documentsPane, new SplitterDock() { Id = nameof(ISplitterDock), Title = "RightSplitter" }, rightPane } }; // Views var editorView = new EditorView { Id = nameof(EditorView), Title = "Editor", CurrentView = editorLayout, Views = new ObservableCollection <IView> { editorLayout } }; var aboutView = new AboutView { Id = nameof(AboutView), Title = "About" }; var browserView = new BrowserView { Id = nameof(BrowserView), Title = "Browser" }; var scriptView = new ScriptView { Id = nameof(ScriptView), Title = "Script" }; var documentView = new DocumentView { Id = nameof(DocumentView), Title = "Document" }; var dashboardView = new DashboardView { Id = nameof(DashboardView), Title = "Dashboard" }; // Root var layout = new RootDock { Id = nameof(IRootDock), Title = "Root", CurrentView = dashboardView, DefaultView = dashboardView, Views = new ObservableCollection <IView> { dashboardView, editorView, aboutView, browserView, scriptView, documentView } }; return(layout); }
public ArrowedEditEngine(ShapeTool passedOwner): base(passedOwner) { }
/// <inheritdoc/> public override IDock CreateLayout() { // Documents var pageDocument = new PageDocument { Id = nameof(PageDocument), Width = double.NaN, Height = double.NaN, Title = "Page" }; // Left / Top var projectView = new ProjectTool { Id = nameof(ProjectTool), Width = double.NaN, Height = double.NaN, Title = "Project" }; var optionsView = new OptionsTool { Id = nameof(OptionsTool), Width = 200, Height = 200, Title = "Options" }; var imagesView = new ImagesTool { Id = nameof(ImagesTool), Width = double.NaN, Height = double.NaN, Title = "Images" }; // Left / Bottom var groupsView = new GroupsTool { Id = nameof(GroupsTool), Width = double.NaN, Height = double.NaN, Title = "Groups" }; var databasesView = new DatabasesTool { Id = nameof(DatabasesTool), Width = double.NaN, Height = double.NaN, Title = "Databases" }; // Right / Top var stylesView = new StylesTool { Id = nameof(StylesTool), Width = double.NaN, Height = double.NaN, Title = "Styles" }; var templatesView = new TemplatesTool { Id = nameof(TemplatesTool), Width = double.NaN, Height = double.NaN, Title = "Templates" }; var containerView = new ContainerTool { Id = nameof(ContainerTool), Width = double.NaN, Height = double.NaN, Title = "Container" }; var zoomView = new ZoomTool { Id = nameof(ZoomTool), Width = double.NaN, Height = double.NaN, Title = "Zoom" }; // Right / Bottom var toolsView = new ToolsTool { Id = nameof(ToolsTool), Width = double.NaN, Height = double.NaN, Title = "Tools" }; var shapeView = new ShapeTool { Id = nameof(ShapeTool), Width = double.NaN, Height = double.NaN, Title = "Shape" }; var dataView = new DataTool { Id = nameof(DataTool), Width = double.NaN, Height = double.NaN, Title = "Data" }; var styleView = new StyleTool { Id = nameof(StyleTool), Width = double.NaN, Height = double.NaN, Title = "Style" }; var templateView = new TemplateTool { Id = nameof(TemplateTool), Width = double.NaN, Height = double.NaN, Title = "Template" }; // Left Pane var leftPane = new LayoutDock { Id = nameof(ILayoutDock), Dock = "Left", Width = 200, Height = double.NaN, Title = "EditorLeft", CurrentView = null, Views = new ObservableCollection <IView> { new ToolDock { Id = nameof(IToolDock), Dock = "Top", Width = double.NaN, Height = 340, Title = "EditorLeftTop", CurrentView = projectView, Views = new ObservableCollection <IView> { projectView, optionsView, imagesView } }, new SplitterDock() { Id = nameof(ISplitterDock), Dock = "Top", Title = "LeftTopSplitter" }, new ToolDock { Id = nameof(IToolDock), Dock = "Bottom", Width = double.NaN, Height = double.NaN, Title = "EditorLeftBottom", CurrentView = groupsView, Views = new ObservableCollection <IView> { groupsView, databasesView } } } }; // Right Pane var rightPane = new LayoutDock { Id = nameof(ILayoutDock), Dock = "Right", Width = 240, Height = double.NaN, Title = "EditorRight", CurrentView = null, Views = new ObservableCollection <IView> { new ToolDock { Id = nameof(IToolDock), Dock = "Top", Width = double.NaN, Height = 340, Title = "EditorRightTop", CurrentView = stylesView, Views = new ObservableCollection <IView> { stylesView, templatesView, containerView, zoomView } }, new SplitterDock() { Id = nameof(ISplitterDock), Dock = "Top", Title = "RightTopSplitter" }, new ToolDock { Id = nameof(IToolDock), Dock = "Bottom", Width = double.NaN, Height = double.NaN, Title = "EditorRightBottom", CurrentView = toolsView, Views = new ObservableCollection <IView> { toolsView, shapeView, dataView, styleView, templateView } } } }; // Documents var documentsPane = new DocumentDock { Id = nameof(IDocumentDock), Dock = "", Width = double.NaN, Height = double.NaN, Title = "DocumentsPane", CurrentView = pageDocument, Views = new ObservableCollection <IView> { pageDocument } }; // Main var editorLayout = new LayoutDock { Id = nameof(ILayoutDock), Dock = "", Width = double.NaN, Height = double.NaN, Title = "EditorLayout", CurrentView = null, Views = new ObservableCollection <IView> { leftPane, new SplitterDock() { Id = nameof(ISplitterDock), Dock = "Left", Title = "LeftSplitter" }, rightPane, new SplitterDock() { Id = nameof(ISplitterDock), Dock = "Right", Title = "RightSplitter" }, documentsPane } }; var editorView = new EditorView { Id = nameof(EditorView), Width = double.NaN, Height = double.NaN, Title = "Editor", CurrentView = editorLayout, Views = new ObservableCollection <IView> { editorLayout } }; // About var aboutView = new AboutView { Id = nameof(AboutView), Width = double.NaN, Height = double.NaN, Title = "About" }; // Browser var browserView = new BrowserView { Id = nameof(BrowserView), Width = double.NaN, Height = double.NaN, Title = "Browser" }; // Document var documentView = new DocumentView { Id = nameof(DocumentView), Width = double.NaN, Height = double.NaN, Title = "Document" }; // Dashboard var dashboardView = new DashboardView { Id = nameof(DashboardView), Width = double.NaN, Height = double.NaN, Title = "Dashboard" }; // Main var layout = new RootDock { Id = nameof(IRootDock), Width = double.NaN, Height = double.NaN, Title = "Root", CurrentView = dashboardView, DefaultView = dashboardView, Views = new ObservableCollection <IView> { dashboardView, editorView, aboutView, browserView, documentView } }; return(layout); }
public RoundedLineEditEngine(ShapeTool passedOwner): base(passedOwner) { }
private void method_0( IShape2D path, Color color, Matrix4D transform, bool filled, double extrusion, bool isChar) { if (!path.HasSegments) { return; } ArgbColor plotColor = this.surface_0.GetPlotColor(this.dxfEntity_0, color); if (this.graphicElement1Node_0 == null) { this.graphicElement1Node_0 = new GraphicElement1Node(plotColor); this.graphics_0.AddNewGraphicElement(this.dxfEntity_0, this.igraphicElementBlock_0, (GraphicElement1)this.graphicElement1Node_0); } else if (this.graphicElement1Node_0.Color != plotColor) { this.graphicElement1Node_0.Next = new GraphicElement1Node(plotColor); this.graphicElement1Node_0 = this.graphicElement1Node_0.Next; } IList <Polyline2D> flattened = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.surface_0.Config.ShapeFlattenEpsilon); if (!filled) { IList <WW.Math.Geometry.Polyline3D> polyline3DList1 = DxfUtil.smethod_41(flattened, transform); foreach (WW.Math.Geometry.Polyline3D polyline in (IEnumerable <WW.Math.Geometry.Polyline3D>)polyline3DList1) { this.graphicElement1Node_0.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(polyline)); } if (extrusion == 0.0) { return; } IList <WW.Math.Geometry.Polyline3D> polyline3DList2 = DxfUtil.smethod_41(flattened, transform * Transformation4D.Translation(0.0, 0.0, extrusion)); foreach (WW.Math.Geometry.Polyline3D polyline in (IEnumerable <WW.Math.Geometry.Polyline3D>)polyline3DList2) { this.graphicElement1Node_0.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(polyline)); } for (int index1 = polyline3DList1.Count - 1; index1 >= 0; --index1) { WW.Math.Geometry.Polyline3D polyline3D1 = polyline3DList1[index1]; WW.Math.Geometry.Polyline3D polyline3D2 = polyline3DList2[index1]; for (int index2 = polyline3D1.Count - 1; index2 >= 0; --index2) { this.graphicElement1Node_0.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(polyline3D1[index2], polyline3D2[index2])); } } } else { List <Triangulator2D.Triangle> triangleList; List <WW.Math.Point2D> point2DList; if (isChar) { Class454 class454 = this.surface_0.CharTriangulationCache.method_0(path, this.surface_0.Config); triangleList = class454.Triangles; point2DList = class454.Points; } else { triangleList = new List <Triangulator2D.Triangle>(); point2DList = new List <WW.Math.Point2D>(); IList <IList <WW.Math.Point2D> > polygons = (IList <IList <WW.Math.Point2D> >) new List <IList <WW.Math.Point2D> >(); foreach (Polyline2D polyline2D in (IEnumerable <Polyline2D>)flattened) { polygons.Add((IList <WW.Math.Point2D>)polyline2D); } Triangulator2D.Triangulate(polygons, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList); } Polyline2D polyline = new Polyline2D((IEnumerable <WW.Math.Point2D>)point2DList); WW.Math.Geometry.Polyline3D polyline3D1 = DxfUtil.smethod_42(polyline, transform); if (extrusion == 0.0) { for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.graphicElement1Node_0.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(polyline3D1[triangle.I0], polyline3D1[triangle.I1], polyline3D1[triangle.I2])); } } else { if (extrusion == 0.0) { return; } IList <WW.Math.Geometry.Polyline3D> polyline3DList1 = DxfUtil.smethod_41(flattened, transform); Matrix4D transform1 = transform * Transformation4D.Translation(0.0, 0.0, extrusion); WW.Math.Geometry.Polyline3D polyline3D2 = DxfUtil.smethod_42(polyline, transform1); IList <WW.Math.Geometry.Polyline3D> polyline3DList2 = DxfUtil.smethod_41(flattened, transform1); if (extrusion > 0.0) { for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.graphicElement1Node_0.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(polyline3D1[triangle.I0], polyline3D1[triangle.I2], polyline3D1[triangle.I1])); } for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.graphicElement1Node_0.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(polyline3D2[triangle.I0], polyline3D2[triangle.I1], polyline3D2[triangle.I2])); } } else { for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.graphicElement1Node_0.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(polyline3D1[triangle.I0], polyline3D1[triangle.I1], polyline3D1[triangle.I2])); } for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.graphicElement1Node_0.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(polyline3D2[triangle.I0], polyline3D2[triangle.I2], polyline3D2[triangle.I1])); } } for (int index1 = polyline3DList1.Count - 1; index1 >= 0; --index1) { WW.Math.Geometry.Polyline3D polyline3D3 = polyline3DList1[index1]; WW.Math.Geometry.Polyline3D polyline3D4 = polyline3DList2[index1]; Polyline2D polyline2D = flattened[index1]; IList <Vector3D> normals = (IList <Vector3D>) new List <Vector3D>(polyline3D3.Count + 1); for (int index2 = 0; index2 < polyline3D3.Count; ++index2) { int index3 = (index2 + 1) % polyline3D3.Count; Vector2D vector2D = polyline2D[index3] - polyline2D[index2]; normals.Add(transform.Transform(new Vector3D(vector2D.Y, -vector2D.X, 0.0))); } normals.Add(normals[0]); this.graphicElement1Node_0.Geometry.Add((IPrimitive) new QuadStrip2((IList <WW.Math.Point3D>)polyline3D3, (IList <WW.Math.Point3D>)polyline3D4, normals, 0, 0)); } } } }
public EllipseEditEngine (ShapeTool owner) : base (owner) { }
/// <inheritdoc/> public override DM.IDock CreateLayout() { // Documents var pageDocument = new PageDocument { Id = nameof(PageDocument), Title = "Page" }; // Tools var projectTool = new ProjectTool { Id = nameof(ProjectTool), Title = "Project" }; var optionsTool = new OptionsTool { Id = nameof(OptionsTool), Title = "Options" }; var imagesTool = new ImagesTool { Id = nameof(ImagesTool), Title = "Images" }; var groupsTool = new GroupsTool { Id = nameof(GroupsTool), Title = "Groups" }; var databasesTool = new DatabasesTool { Id = nameof(DatabasesTool), Title = "Databases" }; var scriptTool = new ScriptTool { Id = nameof(ScriptTool), Title = "Script" }; var exportTool = new ExportTool { Id = nameof(ExportTool), Title = "Export" }; var browserTool = new BrowserTool { Id = nameof(BrowserTool), Title = "Browser" }; var documentTool = new DocumentTool { Id = nameof(DocumentTool), Title = "Document" }; var stylesTool = new StylesTool { Id = nameof(StylesTool), Title = "Styles" }; var templatesTool = new TemplatesTool { Id = nameof(TemplatesTool), Title = "Templates" }; var scriptsTool = new ScriptsTool { Id = nameof(ScriptsTool), Title = "Scripts" }; var containerTool = new ContainerTool { Id = nameof(ContainerTool), Title = "Container" }; var zoomTool = new ZoomTool { Id = nameof(ZoomTool), Title = "Zoom" }; var rendererTool = new RendererTool { Id = nameof(RendererTool), Title = "Renderer" }; var shapeTool = new ShapeTool { Id = nameof(ShapeTool), Title = "Shape" }; var toolsTool = new ToolsTool { Id = nameof(ToolsTool), Title = "Tools" }; var recordTool = new RecordTool { Id = nameof(RecordTool), Title = "Record" }; var propertiesTool = new PropertiesTool { Id = nameof(PropertiesTool), Title = "Properties" }; var styleTool = new StyleTool { Id = nameof(StyleTool), Title = "Style" }; var templateTool = new TemplateTool { Id = nameof(TemplateTool), Title = "Template" }; // Panes var leftPane = new DMC.ProportionalDock { Id = nameof(DMC.IProportionalDock), Title = "EditorLeft", Orientation = DM.Orientation.Vertical, Proportion = 0.17, ActiveDockable = null, VisibleDockables = CreateList <DM.IDockable> ( new DMC.ToolDock { Id = nameof(DMC.IToolDock), Title = "EditorLeftTop", Proportion = double.NaN, ActiveDockable = projectTool, VisibleDockables = CreateList <DM.IDockable> ( projectTool, optionsTool, rendererTool, imagesTool ) }, new DMC.SplitterDock() { Id = nameof(DMC.ISplitterDock), Title = "LeftTopSplitter" }, new DMC.ToolDock { Id = nameof(DMC.IToolDock), Title = "EditorLeftBottom", Proportion = double.NaN, ActiveDockable = groupsTool, VisibleDockables = CreateList <DM.IDockable> ( groupsTool, databasesTool, toolsTool, scriptsTool ) } ) }; var rightPane = new DMC.ProportionalDock { Id = nameof(DMC.IProportionalDock), Title = "EditorRight", Orientation = DM.Orientation.Vertical, Proportion = 0.20, ActiveDockable = null, VisibleDockables = CreateList <DM.IDockable> ( new DMC.ToolDock { Id = nameof(DMC.IToolDock), Title = "EditorRightTop", Proportion = double.NaN, ActiveDockable = stylesTool, VisibleDockables = CreateList <DM.IDockable> ( stylesTool, containerTool, templatesTool, templateTool ) }, new DMC.SplitterDock() { Id = nameof(DMC.ISplitterDock), Title = "RightTopSplitter" }, new DMC.ToolDock { Id = nameof(DMC.IToolDock), Title = "EditorRightBottom", Proportion = double.NaN, ActiveDockable = shapeTool, VisibleDockables = CreateList <DM.IDockable> ( shapeTool, propertiesTool, recordTool, styleTool, zoomTool ) } ) }; var documentsPane = new DMC.DocumentDock { Id = nameof(DMC.IDocumentDock), Title = "DocumentsPane", IsCollapsable = false, Proportion = double.NaN, ActiveDockable = pageDocument, VisibleDockables = CreateList <DM.IDockable> ( pageDocument, documentTool, scriptTool, exportTool, browserTool ) }; // Editor var editorLayout = new DMC.ProportionalDock { Id = nameof(DMC.IProportionalDock), Title = "EditorLayout", Orientation = DM.Orientation.Horizontal, Proportion = double.NaN, ActiveDockable = null, VisibleDockables = CreateList <DM.IDockable> ( leftPane, new DMC.SplitterDock() { Id = nameof(DMC.ISplitterDock), Title = "LeftSplitter" }, documentsPane, new DMC.SplitterDock() { Id = nameof(DMC.ISplitterDock), Title = "RightSplitter" }, rightPane ) }; // Views var dashboardView = new DashboardView { Id = nameof(DashboardView), Title = "Dashboard" }; var editorView = new EditorView { Id = nameof(EditorView), Title = "Editor", ActiveDockable = editorLayout, VisibleDockables = CreateList <DM.IDockable> ( editorLayout ) }; // Root var root = new DMC.RootDock { Id = nameof(DMC.IRootDock), Title = "Root", IsCollapsable = false, ActiveDockable = dashboardView, DefaultDockable = dashboardView, VisibleDockables = CreateList <DM.IDockable> ( dashboardView, editorView ) }; root.Top = CreatePinDock(); root.Top.Alignment = DM.Alignment.Top; root.Bottom = CreatePinDock(); root.Bottom.Alignment = DM.Alignment.Bottom; root.Left = CreatePinDock(); root.Left.Alignment = DM.Alignment.Left; root.Right = CreatePinDock(); root.Right.Alignment = DM.Alignment.Right; return(root); }
public BaseEditEngine(ShapeTool passedOwner) { owner = passedOwner; owner.IsEditableShapeTool = true; ResetShapes(); }
private void method_0( IShape2D path, Color color, Matrix4D transform, bool filled, double extrusion, bool isChar) { if (!path.HasSegments) { return; } ISurfaceGraphicsFactory graphicsFactory0 = this.isurfaceGraphicsFactory_0; IList <Polyline2D> flattened = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.surface_0.Config.ShapeFlattenEpsilon); this.isurfaceGraphicsFactory_0.SetColor(this.surface_0.GetPlotColor(this.dxfEntity_0, color)); Interface41 transformer = (Interface41)this.surface_0.GetTransformer().Clone(); transformer.SetPreTransform(transform); if (!filled) { IList <Polyline4D> polyline4DList1 = DxfUtil.smethod_48(flattened, transformer); foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList1) { graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed); } if (extrusion == 0.0) { return; } transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion)); IList <Polyline4D> polyline4DList2 = DxfUtil.smethod_48(flattened, transformer); foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList2) { graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed); } Polyline4D polyline4D1 = new Polyline4D(2); polyline4D1.Add(Vector4D.Zero); polyline4D1.Add(Vector4D.Zero); for (int index1 = polyline4DList1.Count - 1; index1 >= 0; --index1) { Polyline4D polyline4D2 = polyline4DList1[index1]; Polyline4D polyline4D3 = polyline4DList2[index1]; for (int index2 = polyline4D2.Count - 1; index2 >= 0; --index2) { polyline4D1[0] = polyline4D2[index2]; polyline4D1[1] = polyline4D3[index2]; graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D1, false); } } } else { List <Triangulator2D.Triangle> triangleList; List <WW.Math.Point2D> point2DList; if (isChar) { Class454 class454 = this.surface_0.CharTriangulationCache.method_0(path, this.surface_0.Config); triangleList = class454.Triangles; point2DList = class454.Points; } else { triangleList = new List <Triangulator2D.Triangle>(); point2DList = new List <WW.Math.Point2D>(); IList <IList <WW.Math.Point2D> > polygons = (IList <IList <WW.Math.Point2D> >) new List <IList <WW.Math.Point2D> >(); foreach (Polyline2D polyline2D in (IEnumerable <Polyline2D>)flattened) { polygons.Add((IList <WW.Math.Point2D>)polyline2D); } Triangulator2D.Triangulate(polygons, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList); } Polyline2D polyline = new Polyline2D((IEnumerable <WW.Math.Point2D>)point2DList); Polyline4D polyline4D1 = DxfUtil.smethod_49(polyline, transformer); if (extrusion == 0.0) { for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I1], polyline4D1[triangle.I2], (IList <bool>)null); } } else { if (extrusion == 0.0) { return; } IList <Polyline4D> polyline4DList1 = DxfUtil.smethod_48(flattened, transformer); transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion)); Polyline4D polyline4D2 = DxfUtil.smethod_49(polyline, transformer); IList <Polyline4D> polyline4DList2 = DxfUtil.smethod_48(flattened, transformer); if (extrusion > 0.0) { for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I2], polyline4D1[triangle.I1], (IList <bool>)null); } for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D2[triangle.I0], polyline4D2[triangle.I1], polyline4D2[triangle.I2], (IList <bool>)null); } } else { for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I1], polyline4D1[triangle.I2], (IList <bool>)null); } for (int index = 0; index < triangleList.Count; ++index) { Triangulator2D.Triangle triangle = triangleList[index]; this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D2[triangle.I0], polyline4D2[triangle.I2], polyline4D2[triangle.I1], (IList <bool>)null); } } for (int index1 = polyline4DList1.Count - 1; index1 >= 0; --index1) { Polyline4D polyline4D3 = polyline4DList1[index1]; Polyline4D polyline4D4 = polyline4DList2[index1]; Polyline2D polyline2D = flattened[index1]; IList <Vector3D> normals = (IList <Vector3D>) new List <Vector3D>(polyline4D3.Count + 1); for (int index2 = 0; index2 < polyline4D3.Count; ++index2) { int index3 = (index2 + 1) % polyline4D3.Count; Vector2D vector2D = polyline2D[index3] - polyline2D[index2]; normals.Add(transformer.Transform(new Vector3D(vector2D.Y, -vector2D.X, 0.0))); } normals.Add(normals[0]); this.isurfaceGraphicsFactory_0.CreateQuadStrip((IList <Vector4D>)polyline4D3, (IList <Vector4D>)polyline4D4, normals, 0, 0); } } } }
private static ShapeTool GetShapeTool() { ShapeTool tool = new ShapeTool(); tool.Shapes.Add(new RectangleShape()); tool.Shapes.Add(new EllipseShape()); tool.Shapes.Add(new LineShape()); return tool; }
public RectangleEditEngine(ShapeTool passedOwner): base(passedOwner) { }