Пример #1
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (this.list_0.Count <= 1 || this.list_0.Count >= 5 || !graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            switch (this.list_0.Count)
            {
            case 2:
                if (this.FirstEdgeInvisible)
                {
                    break;
                }
                graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, new GraphicElement1(new WW.Cad.Drawing.Surface.Geometry((IPrimitive) new WW.Cad.Drawing.Surface.Segment(this.list_0[0], this.list_0[1])), plotColor));
                break;

            case 3:
                graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, new GraphicElement1(new WW.Cad.Drawing.Surface.Geometry((IPrimitive) new TriangleWithEdges(this.list_0[0], this.list_0[1], this.list_0[2], !this.FirstEdgeInvisible, !this.SecondEdgeInvisible, !this.ThirdEdgeInvisible)), plotColor));
                break;

            case 4:
                graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, new GraphicElement1(new WW.Cad.Drawing.Surface.Geometry((IPrimitive) new QuadWithEdges(this.list_0[0], this.list_0[1], this.list_0[2], this.list_0[3], !this.FirstEdgeInvisible, !this.SecondEdgeInvisible, !this.ThirdEdgeInvisible, !this.FourthEdgeInvisible)), plotColor));
                break;
            }
        }
Пример #2
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            if (this.list_0.Count <= 0)
            {
                return;
            }
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            GraphicElement1 graphicElement = new GraphicElement1(plotColor);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, graphicElement);
            List <WW.Math.Point3D> point3DList = new List <WW.Math.Point3D>(4);

            foreach (DxfMeshFace dxfMeshFace in this.list_0)
            {
                point3DList.Clear();
                foreach (DxfMeshFace.Corner corner in dxfMeshFace.Corners)
                {
                    if (corner.Vertex != null)
                    {
                        point3DList.Add(corner.Vertex.Position);
                    }
                }
                Class940.smethod_22(graphicElement.Geometry, (IList <WW.Math.Point3D>)point3DList);
            }
        }
Пример #3
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            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;
            }
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            WW.Math.Point2D endPoint;
            new Class355((DxfEntity)this, context, graphics, parentGraphicElementBlock).DrawPath(shapeByIndex.GetGlyphShape(false, out endPoint), this.Transform, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), false, false, this.double_1);
        }
Пример #4
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ushort mApproximationPointCount;
            ushort nApproximationPointCount;

            this.method_13(out mApproximationPointCount, out nApproximationPointCount);
            if (mApproximationPointCount <= (ushort)0 || nApproximationPointCount <= (ushort)0)
            {
                return;
            }
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            GraphicElement1 graphicElement = new GraphicElement1(plotColor);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, graphicElement);
            WW.Math.Point3D[,] mesh = this.method_19((int)mApproximationPointCount - 1, (int)nApproximationPointCount - 1);
            graphicElement.Geometry.Add((IPrimitive) new PolygonMesh(mesh, this.ClosedInMDirection, this.ClosedInNDirection));
        }
Пример #5
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            DxfImageDef imageDef = this.ImageDef;

            if (imageDef == null || !imageDef.Bitmap.IsValid)
            {
                return;
            }
            List <WW.Math.Point2D> clipBoundary = (List <WW.Math.Point2D>) this.GetClipBoundary((DrawContext)context);

            if (clipBoundary == null || clipBoundary.Count <= 0 || !graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, ArgbColor.Empty))
            {
                return;
            }
            List <Triangulator2D.Triangle> triangleList = new List <Triangulator2D.Triangle>();
            List <WW.Math.Point2D>         point2DList  = new List <WW.Math.Point2D>();

            Triangulator2D.Triangulate((IList <IList <WW.Math.Point2D> >) new List <WW.Math.Point2D>[1]
            {
                clipBoundary
            }, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList);
            Matrix4D matrix4D = this.method_15();

            WW.Math.Point2D[] point2DArray        = new WW.Math.Point2D[point2DList.Count];
            WW.Math.Point3D[] point3DArray        = new WW.Math.Point3D[point2DList.Count];
            Size2D            referencedImageSize = this.ReferencedImageSize;
            double            num1     = 1.0 / referencedImageSize.X;
            double            num2     = 1.0 / referencedImageSize.Y;
            Vector2D          vector2D = new Vector2D(0.5, 0.5);

            for (int index = point2DList.Count - 1; index >= 0; --index)
            {
                WW.Math.Point2D point = point2DList[index] + vector2D;
                point2DArray[index] = new WW.Math.Point2D(num1 * point.X, 1.0 - num2 * point.Y);
                point3DArray[index] = matrix4D.TransformTo3D(point);
            }
            GraphicElement1 graphicElement = new GraphicElement1(ArgbColor.Empty);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, graphicElement);
            TexturedTriangleList texturedTriangleList = new TexturedTriangleList();

            graphicElement.Geometry.Add((IPrimitive)texturedTriangleList);
            texturedTriangleList.RgbaBytes          = imageDef.Bitmap.GetRgbaBytes();
            texturedTriangleList.Width              = imageDef.Bitmap.Width;
            texturedTriangleList.Height             = imageDef.Bitmap.Height;
            texturedTriangleList.Normal             = matrix4D.Transform(WW.Math.Vector3D.ZAxis);
            texturedTriangleList.Triangles          = (IList <Triangulator2D.Triangle>)triangleList;
            texturedTriangleList.TextureCoordinates = (IList <WW.Math.Point2D>)point2DArray;
            texturedTriangleList.Points             = (IList <WW.Math.Point3D>)point3DArray;
        }
Пример #6
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            this.method_16((DrawContext)context, (IPathDrawer) new Class355((DxfEntity)this, context, graphics, parentGraphicElementBlock));
        }
Пример #7
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            GraphicElement1 graphicElement = new GraphicElement1(plotColor);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, graphicElement);
            if (this.double_1 != 0.0)
            {
                graphicElement.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(this.point3D_0, this.point3D_0 + this.double_1 * this.vector3D_0));
            }
            else
            {
                graphicElement.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Point(this.point3D_0));
            }
        }
Пример #8
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            int ushort0 = (int)this.ushort_0;
            int ushort1 = (int)this.ushort_1;

            if (ushort0 <= 0 || ushort1 <= 0)
            {
                return;
            }
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            GraphicElement1 graphicElement = new GraphicElement1(plotColor);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, graphicElement);
            WW.Math.Point3D[,] mesh = new WW.Math.Point3D[ushort0, ushort1];
            int index1 = 0;

            for (int index2 = 0; index2 < ushort0; ++index2)
            {
                int index3 = 0;
                while (index3 < ushort1)
                {
                    mesh[index2, index3] = this.dxfHandledObjectCollection_1[index1].Position;
                    ++index3;
                    ++index1;
                }
            }
            graphicElement.Geometry.Add((IPrimitive) new PolygonMesh(mesh, this.ClosedInMDirection, this.ClosedInNDirection));
        }
Пример #9
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            GraphicElement1 graphicElement = new GraphicElement1(plotColor);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, graphicElement);
            WW.Math.Geometry.Polyline3D polyline = this.method_13();
            if (this.double_1 != 0.0)
            {
                Class940.Extrude(graphicElement.Geometry, polyline, this.Model.Header.FillMode, this.Thickness * this.ZAxis);
            }
            else
            {
                Class940.smethod_21((DxfEntity)this, context, graphicElement.Geometry, polyline, this.Model.Header.FillMode);
            }
        }