private WW.Math.Geometry.Polyline3D method_14( GraphicsConfig config, out bool approximationPointsDrawn) { approximationPointsDrawn = false; WW.Math.Geometry.Polyline3D polyline3D = (WW.Math.Geometry.Polyline3D)null; if (config.ShowSplineInterpolatedPoints) { switch (this.splineType_0) { case SplineType.None: polyline3D = this.method_17(); approximationPointsDrawn = true; break; case SplineType.QuadraticBSpline: polyline3D = this.method_18(2, (int)config.NoOfSplineLineSegments); break; case SplineType.CubicBSpline: polyline3D = this.method_18(3, (int)config.NoOfSplineLineSegments); break; } } return(polyline3D); }
public Class385( GraphicsConfig graphicsConfig, Graphics graphics, SmoothingMode?textSmoothingMode, BlinnClipper4D drawingBoundsClipper, Matrix4D transform, Interface38 textLineWeightScaler, Interface38 nonTextLineWeightScaler, float fixedTextPenWidth, float fixedNonTextPenWidth, Interface22 nonTextColorContext, Interface22 textColorContext) { this.graphicsConfig_0 = graphicsConfig; this.graphics_0 = graphics; this.smoothingMode_0 = graphics.SmoothingMode; this.nullable_0 = textSmoothingMode; this.blinnClipper4D_0 = drawingBoundsClipper; this.matrix4D_0 = transform; this.interface38_1 = textLineWeightScaler; this.interface38_2 = nonTextLineWeightScaler; this.float_1 = fixedTextPenWidth; this.float_2 = fixedNonTextPenWidth; this.interface22_1 = nonTextColorContext; this.interface22_2 = textColorContext; this.interface22_0 = nonTextColorContext; this.interface38_0 = nonTextLineWeightScaler; this.float_0 = fixedNonTextPenWidth; }
private WW.Math.Geometry.Polyline3D method_14( GraphicsConfig graphicsConfig, double startAngle, double endAngle) { double num1 = 2.0 * System.Math.PI / (double)graphicsConfig.NoOfArcLineSegments; double num2 = startAngle; Matrix4D denormalizationTransform = this.DenormalizationTransform; WW.Math.Geometry.Polyline3D polyline3D = new WW.Math.Geometry.Polyline3D(); if ((endAngle - num2) / num1 < (double)graphicsConfig.NoOfArcLineSegmentsMinimum) { double lineSegmentsMinimum = (double)graphicsConfig.NoOfArcLineSegmentsMinimum; double a = (endAngle - num2) / lineSegmentsMinimum; if (!MathUtil.AreApproxEqual(a, 0.0)) { num1 = a; } } for (; num2 <= endAngle; num2 += num1) { WW.Math.Point2D point = new WW.Math.Point2D(System.Math.Cos(num2), System.Math.Sin(num2)); polyline3D.Add(denormalizationTransform.TransformTo3D4x3(point)); } polyline3D.Add(denormalizationTransform.TransformTo3D4x3(new WW.Math.Point2D(System.Math.Cos(endAngle), System.Math.Sin(endAngle)))); return(polyline3D); }
private void GetPolylines4D( DrawContext context, IClippingTransformer transformer, out bool fill, out IList <Polyline4D> polylines4D) { DxfHeader header = context.Model.Header; GraphicsConfig config = context.Config; IList <WW.Math.Geometry.Polyline3D> polylines = (IList <WW.Math.Geometry.Polyline3D>) new List <WW.Math.Geometry.Polyline3D>(); fill = false; if (header.ShowSplineControlPoints || config.ShowSplineControlPoints) { this.method_14(polylines); } if (config.ShowSplineApproximationPoints) { this.method_15(polylines); } if (!header.ShowSplineControlPoints || config.ShowSplineInterpolatedPoints) { int splineLineSegments = (int)context.Config.NoOfSplineLineSegments; this.method_18(polylines, splineLineSegments, splineLineSegments); } IClippingTransformer transformer1 = (IClippingTransformer)transformer.Clone(); transformer1.SetPreTransform(this.Transform); polylines4D = DxfUtil.smethod_36(polylines, false, transformer1); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, Matrix4D transform, GraphicsConfig graphicsConfig) { return(ImageExporter.CreateAutoSizedBitmap(model, transform, graphicsConfig, SmoothingMode.AntiAlias)); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, Matrix4D transform, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, System.Drawing.Color backColor, Size maxSize) { BoundsCalculator boundsCalculator = new BoundsCalculator(graphicsConfig); boundsCalculator.GetBounds(model, layout, viewports, transform); Bounds3D bounds = boundsCalculator.Bounds; if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap(backColor, maxSize.Width, maxSize.Height)); } int num1 = maxSize.Width - 4; int num2 = maxSize.Height - 4; Matrix4D scaleTransform = DxfUtil.GetScaleTransform(bounds.Corner1, bounds.Corner2, new WW.Math.Point3D(bounds.Corner1.X, bounds.Corner2.Y, 0.0), new WW.Math.Point3D(0.0, (double)num2, 0.0), new WW.Math.Point3D((double)num1, 0.0, 0.0), new WW.Math.Point3D(2.0, 2.0, 0.0)); Matrix4D to2DTransform = scaleTransform * transform; WW.Math.Vector3D vector3D = scaleTransform.Transform(bounds.Corner2) - scaleTransform.Transform(bounds.Corner1); int width = System.Math.Min(maxSize.Width, (int)System.Math.Ceiling(System.Math.Abs(vector3D.X)) + 4); int height = System.Math.Min(maxSize.Height, (int)System.Math.Ceiling(System.Math.Abs(vector3D.Y)) + 4); return(ImageExporter.CreateBitmap(model, layout, viewports, graphicsConfig, smoothingMode, backColor, to2DTransform, width, height)); }
internal Polyline2D2WN method_0( IVertex2DCollection vertices, GraphicsConfig config, bool closed) { int count = vertices.Count; if (count == 0) { return(new Polyline2D2WN(0)); } IVertex2D vertex = vertices.GetIVertex2D(0); Polyline2D2WN polyline = new Polyline2D2WN(count, closed); for (int index = 1; index < count; ++index) { IVertex2D ivertex2D = vertices.GetIVertex2D(index); this.method_1(config, polyline, vertex, ivertex2D); vertex = ivertex2D; } if (closed) { this.method_1(config, polyline, vertex, vertices.GetIVertex2D(0)); } else { double startWidth = vertex.StartWidth == 0.0 ? this.double_0 : vertex.StartWidth; double endWidth = vertex.EndWidth == 0.0 ? this.double_1 : vertex.EndWidth; Point2D2WN point2D2Wn = new Point2D2WN(vertex.Position, startWidth, endWidth); polyline.Add(point2D2Wn); } return(polyline); }
public void Transform(ITransformer4D transformer, GraphicsConfig graphicsConfig) { for (int index = 0; index < this.interface23_0.Length; ++index) { this.interface23_0[index].Transform(transformer); } }
public static Bitmap CreateBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, System.Drawing.Color backColor, Matrix4D to2DTransform, int width, int height) { Bitmap bitmap = new Bitmap(width, height); using (Graphics graphics = Graphics.FromImage((Image)bitmap)) { graphics.SmoothingMode = smoothingMode; graphics.Clear(backColor); if (layout.PaperSpace) { GraphicsConfig config = (GraphicsConfig)graphicsConfig.Clone(); double length = to2DTransform.Transform(WW.Math.Vector3D.XAxis).GetLength(); config.DotsPerInch = length * layout.GetLineWeightUnitsToPaperUnits() * 2540.0; GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(config); gdiGraphics3D.CreateDrawables(model, layout, viewports); gdiGraphics3D.Draw(graphics, new Rectangle(0, 0, width, height), to2DTransform); } else { GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(graphicsConfig); gdiGraphics3D.CreateDrawables(model); gdiGraphics3D.Draw(graphics, new Rectangle(0, 0, width, height), to2DTransform); } } return(bitmap); }
public ViewControl() { InitializeComponent(); //控制控件闪烁 SetStyle(ControlStyles.AllPaintingInWmPaint, true); //禁止擦除背景 SetStyle(ControlStyles.DoubleBuffer, true); //双缓冲 SetStyle(ControlStyles.UserPaint, true); //自行绘制图片 GraphicsConfig graphicsConfig = new GraphicsConfig(); graphicsConfig.BackColor = BackColor; graphicsConfig.CorrectColorForBackgroundColor = true; gdiGraphics3D = new GDIGraphics3D(graphicsConfig); gdiGraphics3D.EnableDrawablesUpdate(); graphicsCache = new WireframeGraphicsCache(false, true); graphicsCache.Config = graphicsConfig; graphicsHelper = new GraphicsHelper(System.Drawing.Color.Blue); bounds = new Bounds3D(); transformationProvider = new SimpleTransformationProvider3D(); transformationProvider.TransformsChanged += new EventHandler(transformationProvider_TransformsChanged); panInteractor = new SimplePanInteractor(transformationProvider); rectZoomInteractor = new SimpleRectZoomInteractor(transformationProvider); zoomWheelInteractor = new SimpleZoomWheelInteractor(transformationProvider); rectZoomInteractorDrawable = new SimpleRectZoomInteractor.WinFormsDrawable(rectZoomInteractor); }
public ViewControl() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); fishNetGraphics3D = new GDIGraphics3D(graphicsConfig); } { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); graphicsConfig.FixedForegroundColor = System.Drawing.Color.Red; dynamicGdiGraphics3D = new GDIGraphics3D(graphicsConfig); } { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); axisGraphics3D = new GDIGraphics3D(graphicsConfig); } { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); polyGdiGraphics3D = new GDIGraphics3D(graphicsConfig); } this.KeyUp += new KeyEventHandler(ViewControl_KeyUp); modelPoly = new DxfModel(); bounds = new Bounds3D(); }
private void GetPolylines( DrawContext context, ILineTypeScaler lineTypeScaler, out IList <Polyline3D> polylines, out IList <FlatShape4D> flatShapes) { Polyline3D polyline = this.method_14(); polylines = (IList <Polyline3D>) new List <Polyline3D>(); if (polyline != null) { DxfHeader header = context.Model.Header; GraphicsConfig config = context.Config; WW.Math.Vector3D upward = WW.Math.Vector3D.CrossProduct(this.point3D_0 - this.point3D_3, this.point3D_2 - this.point3D_3); upward.Normalize(); if (config.ApplyLineType) { flatShapes = (IList <FlatShape4D>) new List <FlatShape4D>(); DxfUtil.smethod_3(context.Config, polylines, flatShapes, polyline, this.GetLineType(context), upward, context.TotalLineTypeScale * this.LineTypeScale, lineTypeScaler, true); } else { polylines.Add(polyline); flatShapes = (IList <FlatShape4D>)null; } } else { flatShapes = (IList <FlatShape4D>)null; } }
private WW.Math.Geometry.Polyline3D method_14(GraphicsConfig graphicsConfig) { double num1 = 2.0 * System.Math.PI / (double)graphicsConfig.NoOfArcLineSegments; double double2 = this.double_2; double double3 = this.double_3; if (double3 <= double2) { double3 += 2.0 * System.Math.PI; } Matrix4D transform = this.Transform; Vector3D vector3D0 = this.vector3D_0; vector3D0.Normalize(); Vector3D vector3D = Vector3D.CrossProduct(this.vector3D_1, vector3D0); vector3D.Normalize(); double length = this.vector3D_0.GetLength(); double num2 = this.double_1 * length; WW.Math.Geometry.Polyline3D polyline3D = new WW.Math.Geometry.Polyline3D(); for (; double2 < double3; double2 += num1) { WW.Math.Point3D point = (WW.Math.Point3D)(length * System.Math.Cos(double2) * vector3D0 + num2 * System.Math.Sin(double2) * vector3D); polyline3D.Add(transform.Transform(point)); } polyline3D.Add(transform.Transform((WW.Math.Point3D)(length * System.Math.Cos(double3) * vector3D0 + num2 * System.Math.Sin(double3) * vector3D))); return(polyline3D); }
internal static Polyline2D2N smethod_0( IVertex2DCollection vertices, GraphicsConfig config, bool closed) { int count = vertices.Count; if (count == 0) { return(new Polyline2D2N(0)); } IVertex2D vertex = vertices.GetIVertex2D(0); Polyline2D2N polyline = new Polyline2D2N(count, closed); for (int index = 1; index < count; ++index) { IVertex2D ivertex2D = vertices.GetIVertex2D(index); Class639.Class641.smethod_1(config, polyline, vertex, ivertex2D); vertex = ivertex2D; } if (closed) { Class639.Class641.smethod_1(config, polyline, vertex, vertices.GetIVertex2D(0)); } else { Point2D2N point2D2N = new Point2D2N(vertex.Position); polyline.Add(point2D2N); } return(polyline); }
public static Bitmap CreateViewportConfigurationBitmap( DxfModel model, string vportName, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, int width, int height) { Bitmap bitmap = new Bitmap(width, height); Rectangle2D targetRectangle = new Rectangle2D(0.0, 0.0, (double)width, (double)height); Rectangle drawingBounds = new Rectangle(0, 0, width, height); using (Graphics graphics = Graphics.FromImage((Image)bitmap)) { graphics.SmoothingMode = smoothingMode; graphics.Clear((System.Drawing.Color)graphicsConfig.BackColor); GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(graphicsConfig); gdiGraphics3D.CreateDrawables(model); foreach (DxfVPort vport in (DxfHandledObjectCollection <DxfVPort>)model.VPorts) { if (vportName.Equals(vport.Name, StringComparison.InvariantCultureIgnoreCase)) { IViewDescription viewDescription = vport.ViewDescription; Matrix4D transform = ViewUtil.GetTransform(viewDescription, targetRectangle, true); float num = 1f - (float)(viewDescription.ViewportCenter.Y + viewDescription.ViewportHeight / 2.0); RectangleF rect = new RectangleF((float)width * (float)(viewDescription.ViewportCenter.X - viewDescription.ViewportWidth / 2.0), (float)height * num, (float)width * (float)viewDescription.ViewportWidth, (float)height * (float)viewDescription.ViewportHeight); graphics.Clip = new System.Drawing.Region(rect); gdiGraphics3D.Draw(graphics, drawingBounds, transform); } } } return(bitmap); }
public override IList <Polygon2D> GetClipBoundary(GraphicsConfig graphicsConfig) { WW.Cad.Drawing.Polyline2DE polyline2De = (WW.Cad.Drawing.Polyline2DE)null; switch (this.splineType_0) { case SplineType.None: if (!graphicsConfig.ShowSplineApproximationPoints) { polyline2De = this.method_19(); break; } break; case SplineType.QuadraticBSpline: polyline2De = this.method_28(2, (int)graphicsConfig.NoOfSplineLineSegments); break; case SplineType.CubicBSpline: polyline2De = this.method_28(3, (int)graphicsConfig.NoOfSplineLineSegments); break; } if (polyline2De == null) { return((IList <Polygon2D>) new Polygon2D[0]); } Polygon2D polygon2D = new Polygon2D(polyline2De.Count); foreach (Point2DE point2De in (List <Point2DE>)polyline2De) { polygon2D.Add(point2De.Position); } return((IList <Polygon2D>) new Polygon2D[1] { polygon2D }); }
private void method_1(GraphicsConfig config, Matrix4D to2DTransform) { Class809.smethod_0(Enum15.const_2); this.graphicsConfig_0 = config; this.To2DTransform = to2DTransform; this.linkedList_0 = new LinkedList <Interface12>(); this.linkedList_1 = new LinkedList <Interface12>(); }
internal DxfMText method_20(GraphicsConfig config) { if (config.MultiLineAttributeHandling != MultiLineAttributeHandling.UseMultiLine) { return((DxfMText)null); } return(this.method_21()); }
public void Draw( DxfModel model, GraphicsConfig config, Matrix4D modelToPsTransform, ProgressEventHandler progressEventHandler) { this.Write(model, (DxfLayout)null, (ICollection <DxfViewport>)null, config, modelToPsTransform, progressEventHandler); }
public void Process(GraphicsConfig graphicsConfig, Graphics graphics) { ProcessedGraphics.Class731 class731 = new ProcessedGraphics.Class731(this, graphicsConfig, (ProcessedGraphicElementBlock)this, Matrix4D.Identity); foreach (IGraphicElement graphicElement in graphics.GraphicElements) { graphicElement.Accept((IGraphicElementVisitor)class731); } }
protected bool IsVisibleMultiLine(GraphicsConfig config) { if (this.MultiLineState == AttributeMultiLineState.SecondarySingleLine) { return(config.MultiLineAttributeHandling == MultiLineAttributeHandling.UseSingleLine); } return(true); }
private void method_0(GraphicsConfig config) { this.graphicsConfig_0 = config; this.nullable_0 = this.graphicsConfig_0.FixedForegroundColor; this.bool_0 = this.graphicsConfig_0.CorrectColorForBackgroundColor; this.argbColor_0 = this.graphicsConfig_0.BackColor; this.argbColor_1 = new ArgbColor((int)byte.MaxValue - this.argbColor_0.Red, (int)byte.MaxValue - this.argbColor_0.Green, (int)byte.MaxValue - this.argbColor_0.Blue); }
public void DeserializesMinimalGraphicsConfigFiles() { using var dir = new TestFolder(); dir.WriteText("MinimalConfig.xml", _minimalConfig); var status = GraphicsConfig.FromFile(dir.Resolve("MinimalConfig.xml")); Assert.Null(status.GuiColour); }
public void Transform(ITransformer4D transformer, GraphicsConfig graphicsConfig) { if (this.nullable_0.HasValue) { this.nullable_0 = new Vector4D?(transformer.Transform(this.nullable_0.Value)); } this.segment4D_0.Start = transformer.Transform(this.segment4D_0.Start); this.segment4D_0.End = transformer.Transform(this.segment4D_0.End); }
public void Draw( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, GraphicsConfig config, Matrix4D paperToXamlTransform) { this.Draw(model, layout, viewports, config, paperToXamlTransform, (ProgressEventHandler)null); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, Matrix4D transform, GraphicsConfig graphicsConfig) { return(ImageExporter.CreateAutoSizedBitmap(model, layout, viewports, transform, graphicsConfig, SmoothingMode.AntiAlias)); }
public static Bitmap CreateBitmap( DxfModel model, Matrix4D transform, GraphicsConfig graphicsConfig, int width, int height) { return(ImageExporter.CreateBitmap(model, transform, graphicsConfig, SmoothingMode.AntiAlias, width, height)); }
public static Bitmap CreateBitmap( DxfModel model, Matrix4D transform, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, Size size) { return(ImageExporter.CreateBitmap(model, transform, graphicsConfig, smoothingMode, size.Width, size.Height)); }
public void Draw( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, GraphicsConfig config, Matrix4D paperToPsTransform, ProgressEventHandler progressEventHandler) { this.Write(model, layout, viewports, config, paperToPsTransform, progressEventHandler); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, Matrix4D transform, GraphicsConfig graphicsConfig, Size maxSize) { return(ImageExporter.CreateAutoSizedBitmap(model, layout, viewports, transform, graphicsConfig, (System.Drawing.Color)graphicsConfig.BackColor, maxSize)); }
public static Bitmap CreateBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, Matrix4D transform, GraphicsConfig graphicsConfig, Size size) { return(ImageExporter.CreateBitmap(model, layout, viewports, transform, graphicsConfig, size.Width, size.Height)); }
public void initParameter() { model=null; gdiGraphics3D=null; bounds=null; //Matrix4D tempfrom2DTransform; //from2DTransform=tempfrom2DTransform; //Point tempmouseClickLocation; //mouseClickLocation=tempmouseClickLocation; mouseDown=false; shiftPressed=false; SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); GraphicsConfig graphicsConfig = new GraphicsConfig(); //graphicsConfig.BackColor = BackColor; graphicsConfig.CorrectColorForBackgroundColor = true; gdiGraphics3D = new GDIGraphics3D(graphicsConfig); bounds = new Bounds3D(); transformationProvider = new SimpleTransformationProvider3D(); transformationProvider.TransformsChanged += new EventHandler(transformationProvider_TransformsChanged); panInteractor = new SimplePanInteractor(transformationProvider); rectZoomInteractor = new SimpleRectZoomInteractor(transformationProvider); zoomWheelInteractor = new SimpleZoomWheelInteractor(transformationProvider); rectZoomInteractorDrawable = new SimpleRectZoomInteractor.WinFormsDrawable(rectZoomInteractor); }