Ejemplo n.º 1
0
 public void DrawFrame(DrawContext.Wireframe context, IWireframeGraphicsFactory2 graphicsFactory)
 {
     foreach (DxfEntity dxfEntity in (DxfHandledObjectCollection <DxfViewport>) this.dxfViewportCollection_0)
     {
         dxfEntity.Draw(context, graphicsFactory);
     }
 }
Ejemplo n.º 2
0
 public override void DrawInternal(
     DrawContext.Wireframe context,
     IWireframeGraphicsFactory2 graphicsFactory)
 {
     if (context.Config.TryDrawingTextAsText && graphicsFactory.SupportsText)
     {
         graphicsFactory.BeginGeometry((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this), true, true, false, true);
         graphicsFactory.CreateMText(this);
         graphicsFactory.EndGeometry();
     }
     else
     {
         this.method_16((DrawContext)context, (IPathDrawer) new Class396((DxfEntity)this, context, graphicsFactory));
         if (!context.Config.ShowTextAlignmentPoints)
         {
             return;
         }
         IList <Polyline4D> polylines = DxfUtil.smethod_36(this.method_18(), false, context.GetTransformer());
         if (polylines.Count <= 0)
         {
             return;
         }
         Class940.smethod_3((DxfEntity)this, context, graphicsFactory, context.GetPlotColor((DxfEntity)this), true, false, true, polylines);
     }
 }
Ejemplo n.º 3
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory2 graphicsFactory)
        {
            IList <Polyline4D>  polylines4D;
            IList <FlatShape4D> shapes;
            bool fill;

            this.GetPolylines4D((DrawContext)context, context.GetTransformer(), out polylines4D, out shapes, out fill);
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (polylines4D.Count > 0)
            {
                Class940.smethod_3((DxfEntity)this, context, graphicsFactory, plotColor, false, fill, !fill, polylines4D);
            }
            if (shapes == null)
            {
                return;
            }
            IPathDrawer pathDrawer = (IPathDrawer) new Class396((DxfEntity)this, context, graphicsFactory);

            foreach (FlatShape4D flatShape4D in (IEnumerable <FlatShape4D>)shapes)
            {
                pathDrawer.DrawPath(flatShape4D.FlatShape, flatShape4D.Transformation, this.Color.ToColor(), (short)0, flatShape4D.IsFilled, false, this.Thickness);
            }
        }
Ejemplo n.º 4
0
        private void method_15(
            DrawContext.Wireframe context,
            Bitmap bitmap,
            out DxfRasterImage rasterImage,
            out Vector4D transformedOrigin,
            out Vector4D transformedXAxis,
            out Vector4D transformedYAxis)
        {
            GdiBitmap gdiBitmap = new GdiBitmap(bitmap);

            rasterImage = (DxfRasterImage) new DxfImage();
            DxfImageDef imageDef = new DxfImageDef(context.Model);

            imageDef.SetBitmap((IBitmap)gdiBitmap);
            rasterImage.SetImageDef(imageDef, true);
            IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();
            Matrix4D             preTransform1       = Transformation4D.Translation((WW.Math.Vector3D) this.point3D_3);

            clippingTransformer.SetPreTransform(preTransform1);
            Matrix4D preTransform2 = Transformation4D.Scaling((this.point3D_2 - this.point3D_3).GetLength() / (double)bitmap.Width, (this.point3D_0 - this.point3D_3).GetLength() / (double)bitmap.Height, 1.0);

            clippingTransformer.SetPreTransform(preTransform2);
            Matrix4D matrix = clippingTransformer.Matrix;

            WW.Math.Point3D zero = WW.Math.Point3D.Zero;
            transformedOrigin = matrix.TransformTo4D(zero);
            transformedXAxis  = matrix.TransformTo4D(zero + WW.Math.Vector3D.XAxis);
            transformedYAxis  = matrix.TransformTo4D(zero + WW.Math.Vector3D.YAxis);
        }
Ejemplo n.º 5
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory2 graphicsFactory)
        {
            DxfTextStyle textStyle = this.TextStyle;

            if (textStyle == null)
            {
                return;
            }
            ShxFile shxFile = textStyle.GetShxFile();

            if (shxFile == null)
            {
                return;
            }
            ShxShape shapeByIndex = shxFile.GetShapeByIndex(this.ushort_0);

            if (shapeByIndex == null)
            {
                return;
            }
            WW.Math.Point2D endPoint;
            new Class396((DxfEntity)this, context, graphicsFactory).DrawPath(shapeByIndex.GetGlyphShape(false, out endPoint), this.Transform, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), false, false, this.double_1);
        }
Ejemplo n.º 6
0
            public void BeginGeometry(
                DxfEntity entity,
                DrawContext.Wireframe drawContext,
                ArgbColor color,
                bool forText,
                bool fill,
                bool stroke,
                bool correctForBackgroundColor)
            {
                if (this.class453_0 != null)
                {
                    throw new InvalidOperationException("BeginGeometry calls may not be nested.");
                }
                this.class453_0 = new WpfWireframeGraphics3D.Class452.Class453(this.objectTaggerDelegate_0(entity, (DrawContext)drawContext));
                Brush brush = (correctForBackgroundColor ? this.interface11_0 : this.interface11_1).imethod_0(color);

                this.class453_0.Path.Fill = brush;
                if (fill)
                {
                    this.class453_0.Fill = true;
                }
                if (stroke)
                {
                    this.class453_0.Stroke                = true;
                    this.class453_0.Path.Stroke           = brush;
                    this.class453_0.Path.StrokeThickness  = this.method_0(entity, (DrawContext)drawContext, forText);
                    this.class453_0.Path.StrokeMiterLimit = 2.0;
                    if (this.wpfWireframeGraphics3D_0.pathStrokePreparerDelegate_0 != null)
                    {
                        this.wpfWireframeGraphics3D_0.pathStrokePreparerDelegate_0(this.class453_0.Path, entity, (DrawContext)drawContext, forText);
                    }
                }
                this.linkedListNodeRef_0.Insert((Interface37) new Class747((FrameworkElement)this.class453_0.Path));
            }
Ejemplo n.º 7
0
 public void Draw(DrawContext.Wireframe context, IWireframeGraphicsFactory2 graphicsFactory)
 {
     foreach (DxfEntity dxfEntity in this.GetEntitiesInDrawingOrder(context.Config))
     {
         dxfEntity.Draw(context, graphicsFactory);
     }
     this.DrawFrame(context, graphicsFactory);
 }
Ejemplo n.º 8
0
 public void CreateRay(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     ArgbColor color,
     Segment4D segment)
 {
     this.method_4(segment, color);
 }
Ejemplo n.º 9
0
 public override void DrawInternal(
     DrawContext.Wireframe context,
     IWireframeGraphicsFactory2 graphicsFactory)
 {
     graphicsFactory.BeginInsert(this);
     this.DrawInternal((DxfInsert.Interface46) new DxfInsert.Class1020((DxfEntity)this, context, graphicsFactory), true);
     graphicsFactory.EndInsert();
 }
Ejemplo n.º 10
0
 public void CreateRay(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     ArgbColor color,
     Segment4D segment)
 {
     this.method_4(false, (Interface12) new Class345(new Vector4D?(segment.Start), segment, this.GetColor(color), drawContext.GetLineWeight(entity)));
 }
Ejemplo n.º 11
0
 public void CreateText(DxfText text, DrawContext.Wireframe drawContext, ArgbColor color)
 {
     if (text.Text == null || text.Text.Trim() == string.Empty)
     {
         return;
     }
     this.method_3(Class666.smethod_5(text, text.Color.ToColor(), drawContext.GetLineWeight((DxfEntity)text), drawContext.GetTransformer().Matrix *text.Transform, (Bounds2D)null), (DxfEntity)text, drawContext);
 }
Ejemplo n.º 12
0
 public Class1020(
     DxfEntity insert,
     DrawContext.Wireframe drawContext,
     IWireframeGraphicsFactory2 graphicsFactory)
 {
     this.dxfEntity_0 = insert;
     this.wireframe_0 = drawContext;
     this.iwireframeGraphicsFactory2_0 = graphicsFactory;
 }
Ejemplo n.º 13
0
            public void CreateImage(
                DxfRasterImage rasterImage,
                WW.Math.Point2D imageCorner1,
                WW.Math.Point2D imageCorner2,
                Vector4D transformedOrigin,
                Vector4D transformedXAxis,
                Vector4D transformedYAxis,
                DrawContext.Wireframe drawContext)
            {
                IBitmap bitmap = rasterImage.ImageDef.Bitmap;

                if (!bitmap.IsValid)
                {
                    return;
                }
                imageCorner1 += DxfRasterImage.PixelOffset;
                imageCorner2 -= DxfRasterImage.PixelOffset;
                double width  = (double)bitmap.Width;
                double height = (double)bitmap.Height;

                imageCorner1.X = IntervalD.GetRestrictedValue(imageCorner1.X, 0.0, width - 1.0);
                imageCorner1.Y = IntervalD.GetRestrictedValue(imageCorner1.Y, 0.0, height - 1.0);
                imageCorner2.X = IntervalD.GetRestrictedValue(imageCorner2.X, 0.0, width - 1.0);
                imageCorner2.Y = IntervalD.GetRestrictedValue(imageCorner2.Y, 0.0, height - 1.0);
                bool   flag    = imageCorner1.X != 0.0 || imageCorner1.Y != 0.0 || imageCorner2.X != width - 1.0 || imageCorner2.Y != height - 1.0;
                IntPtr hbitmap = bitmap.Image.GetHbitmap();

                try
                {
                    BitmapSource source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hbitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                    if (flag)
                    {
                        source = (BitmapSource) new CroppedBitmap(source, new Int32Rect((int)imageCorner1.X, (int)imageCorner1.Y, (int)(imageCorner2.X - imageCorner1.X), (int)(imageCorner2.Y - imageCorner1.Y)));
                    }
                    WW.Math.Point2D   point2D1          = this.matrix4D_0.TransformToPoint2D(transformedOrigin);
                    WW.Math.Point2D   point2D2          = this.matrix4D_0.TransformToPoint2D(transformedXAxis);
                    WW.Math.Point2D   point2D3          = this.matrix4D_0.TransformToPoint2D(transformedYAxis);
                    Vector2D          vector2D1         = point2D2 - point2D1;
                    Vector2D          vector2D2         = point2D3 - point2D1;
                    TransformedBitmap transformedBitmap = new TransformedBitmap();
                    transformedBitmap.BeginInit();
                    transformedBitmap.Source    = source;
                    transformedBitmap.Transform = (Transform) new MatrixTransform(new Matrix(1.0, 0.0, 0.0, 1.0, 0.0, point2D1.Y) * new Matrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0) * new Matrix(1.0, 0.0, 0.0, 1.0, 0.0, -point2D1.Y) * new Matrix(vector2D1.X, vector2D2.X, vector2D1.Y, vector2D2.Y, 0.0, 0.0));
                    transformedBitmap.EndInit();
                    Image image = new Image();
                    image.BeginInit();
                    image.Source          = (ImageSource)transformedBitmap;
                    image.RenderTransform = (Transform) new TranslateTransform(point2D1.X, point2D1.Y);
                    image.Stretch         = Stretch.None;
                    image.EndInit();
                    this.visualCollection_0.Add((Visual)image);
                }
                finally
                {
                    Class975.DeleteObject(hbitmap);
                }
            }
Ejemplo n.º 14
0
 public Class396(
     DxfEntity entity,
     DrawContext.Wireframe context,
     IWireframeGraphicsFactory2 graphicsFactory)
 {
     this.dxfEntity_0 = entity;
     this.wireframe_0 = context;
     this.iwireframeGraphicsFactory2_0 = graphicsFactory;
 }
Ejemplo n.º 15
0
 public void CreateXLine(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     ArgbColor color,
     Vector4D?startPoint,
     Segment4D segment)
 {
     this.method_4(segment, color);
 }
Ejemplo n.º 16
0
 public void Draw(DrawContext.Wireframe context, IWireframeGraphicsFactory2 graphicsFactory)
 {
     graphicsFactory.BeginEntity(this, context);
     if (this.IsEntityVisibleInContext((DrawContext)context, this.UseLayerEnabled))
     {
         this.DrawInternal(context, graphicsFactory);
     }
     graphicsFactory.EndEntity();
 }
Ejemplo n.º 17
0
 public override void DrawInternal(
     DrawContext.Wireframe context,
     IWireframeGraphicsFactory graphicsFactory)
 {
     foreach (Segment4D segment in (IEnumerable <Segment4D>)context.GetTransformer().Transform(new Segment3D(this.point3D_0, this.point3D_0 + 10000000.0 * this.vector3D_0)))
     {
         graphicsFactory.CreateRay((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this), segment);
     }
 }
Ejemplo n.º 18
0
 public void CreateDot(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     ArgbColor color,
     bool forText,
     Vector4D position)
 {
     this.method_3(position, color);
 }
Ejemplo n.º 19
0
        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");
        }
Ejemplo n.º 20
0
 public void CreateImage(
     DxfRasterImage rasterImage,
     DrawContext.Wireframe drawContext,
     Polyline4D clipPolygon,
     Polyline4D imageBoundary,
     Vector4D transformedOrigin,
     Vector4D transformedXAxis,
     Vector4D transformedYAxis)
 {
 }
Ejemplo n.º 21
0
 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);
 }
Ejemplo n.º 22
0
 public void CreateLine(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     ArgbColor color,
     bool forText,
     Vector4D start,
     Vector4D end)
 {
     this.DrawLine(start, end, color);
 }
Ejemplo n.º 23
0
 public override void DrawInternal(
     DrawContext.Wireframe context,
     IWireframeGraphicsFactory2 graphicsFactory)
 {
     if (!this.method_17((DrawContext)context))
     {
         return;
     }
     base.DrawInternal(context, graphicsFactory);
 }
Ejemplo n.º 24
0
 public override void DrawInternal(
     DrawContext.Wireframe context,
     IWireframeGraphicsFactory2 graphicsFactory)
 {
     if (this.proxyGraphics_0 == null)
     {
         return;
     }
     this.proxyGraphics_0.Draw((DxfEntity)this, context.CreateChildContext((DxfEntity)this, Matrix4D.Identity), graphicsFactory);
 }
Ejemplo n.º 25
0
 public void CreateImage(
     DxfRasterImage rasterImage,
     WW.Math.Point2D imageCorner1,
     WW.Math.Point2D imageCorner2,
     Vector4D transformedOrigin,
     Vector4D transformedXAxis,
     Vector4D transformedYAxis,
     DrawContext.Wireframe drawContext)
 {
 }
Ejemplo n.º 26
0
            public void CreateShape(
                DxfEntity entity,
                DrawContext.Wireframe drawContext,
                ArgbColor color,
                bool forText,
                IShape4D shape)
            {
                Interface12 drawable = (Interface12) new Class342(this.GetColor(color), shape, shape.IsFilled ? (short)0 : drawContext.GetLineWeight(entity));

                this.method_4(forText, drawable);
            }
Ejemplo n.º 27
0
        public void CreateRay(
            DxfEntity entity,
            DrawContext.Wireframe drawContext,
            ArgbColor color,
            Segment4D segment)
        {
            Point2D start = (Point2D)segment.Start;
            Point2D end   = (Point2D)segment.End;

            this.graphicsPath_0.AddLine((float)start.X, (float)start.Y, (float)end.X, (float)end.Y);
        }
Ejemplo n.º 28
0
 public void CreateScalableImage(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     IBitmapProvider bitmapProvider,
     Polyline4D clipPolygon,
     Size2D displaySize,
     Vector4D transformedOrigin,
     Vector4D transformedXAxis,
     Vector4D transformedYAxis)
 {
 }
Ejemplo n.º 29
0
            public void CreateDot(
                DxfEntity entity,
                DrawContext.Wireframe drawContext,
                ArgbColor color,
                bool forText,
                Vector4D position)
            {
                Interface12 drawable = (Interface12) new Class343(position, this.GetColor(color), drawContext.GetLineWeight(entity));

                this.method_4(forText, drawable);
            }
Ejemplo n.º 30
0
 public void CreatePathAsOne(
     DxfEntity entity,
     DrawContext.Wireframe drawContext,
     ArgbColor color,
     bool forText,
     IList <Polyline4D> polylines,
     bool fill,
     bool correctForBackgroundColor)
 {
     this.method_0(polylines);
 }