Example #1
0
        internal void DrawInternal(DxfInsert.Interface46 drawHandler, bool applyBlockBaseTransformation)
        {
            bool     flag1 = true;
            DxfModel model;

            if (this.IsExternalReference && !string.IsNullOrEmpty(this.string_2) && drawHandler.InsertCellDrawContext.Model.ExternalReferences.TryGetValue(this.string_2, out model))
            {
                DrawContext drawContext = drawHandler.InsertCellDrawContext;
                bool        flag2       = false;
                while (drawContext.Model != model)
                {
                    drawContext = drawContext.ParentContext;
                    if (drawContext == null)
                    {
                        goto label_5;
                    }
                }
                flag2 = true;
label_5:
                flag1 = false;
                if (!flag2)
                {
                    drawHandler.Draw(this, model);
                }
            }
            if (!flag1 || this.dxfEntityCollection_0.Count < 1)
            {
                return;
            }
            drawHandler.imethod_2(applyBlockBaseTransformation ? this.BaseTransformation : Matrix4D.Identity);
            foreach (DxfEntity entity in (IEnumerable <DxfEntity>) this.GetEntitiesInDrawingOrder(drawHandler.InsertCellDrawContext.Config.UseSortEntsTables))
            {
                drawHandler.imethod_3(entity);
            }
        }
Example #2
0
        private void DrawInternal(DxfInsert.Interface46 drawHandler, bool drawBlock)
        {
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(this.ZAxis);
            Matrix4D matrix4D1      = Transformation4D.Translation((WW.Math.Vector3D) this.InsertionPoint);
            Matrix4D matrix4D2      = Transformation4D.RotateZ(this.Rotation);
            Matrix4D matrix4D3      = Transformation4D.Scaling(this.ScaleFactor);
            ushort   num1           = this.RowCount;

            if (num1 < (ushort)1)
            {
                num1 = (ushort)1;
            }
            ushort num2 = this.ColumnCount;

            if (num2 < (ushort)1)
            {
                num2 = (ushort)1;
            }
            for (int row = 0; row < (int)num1; ++row)
            {
                for (int column = 0; column < (int)num2; ++column)
                {
                    if (drawBlock)
                    {
                        Matrix4D matrix4D4 = toWcsTransform * matrix4D1 * matrix4D2 * Transformation4D.Translation((double)column * this.ColumnSpacing, (double)row * this.RowSpacing, 0.0) * matrix4D3;
                        drawHandler.imethod_0(row, column, matrix4D4);
                        if (this.Block != null)
                        {
                            switch (this.method_16(matrix4D4, drawHandler))
                            {
                            case DxfInsert.Enum44.const_1:
                            case DxfInsert.Enum44.const_2:
                                drawHandler.Draw(this.Block, true);
                                break;

                            case DxfInsert.Enum44.const_3:
                                drawHandler.Draw(this.Block, true);
                                drawHandler.InsertCellDrawContext.vmethod_1();
                                break;
                            }
                        }
                    }
                    if (this.Attributes.Count > 0)
                    {
                        WW.Math.Vector3D vector = new WW.Math.Vector3D((double)column * this.ColumnSpacing, (double)row * this.RowSpacing, 0.0);
                        vector = (toWcsTransform * matrix4D2).Transform(vector);
                        Matrix4D instanceTransform = Transformation4D.Translation(vector.X, vector.Y, vector.Z);
                        drawHandler.imethod_1(row, column, instanceTransform);
                        foreach (DxfAttribute attribute in (IEnumerable <DxfAttribute>) this.Attributes)
                        {
                            drawHandler.Draw(attribute);
                        }
                    }
                }
            }
        }
Example #3
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory graphicsFactory)
        {
            IList <Polyline3D>  polylines1;
            IList <FlatShape4D> shapes;

            this.method_14((DrawContext)context, context.GetTransformer().LineTypeScaler, out polylines1, out shapes);
            IList <Polyline4D> polylines2 = DxfUtil.smethod_36(polylines1, false, context.GetTransformer());

            if (polylines2.Count > 0)
            {
                graphicsFactory.CreatePath((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this, this.dxfDimensionStyleOverrides_0.DimensionLineColor), false, polylines2, false, true);
            }
            if (shapes != null)
            {
                Class940.smethod_23((IPathDrawer) new ns0.Class0((DxfEntity)this, context, graphicsFactory), (IEnumerable <IShape4D>)shapes, this.dxfDimensionStyleOverrides_0.DimensionLineColor, context.GetLineWeight((DxfEntity)this));
            }
            if (!DxfLeader.smethod_7((ILeader)this, (IList <WW.Math.Point3D>) this.list_0))
            {
                return;
            }
            if (this.dxfDimensionStyleOverrides_0.LeaderArrowBlock == null)
            {
                Polyline3D polyline = this.method_15();
                if (polyline == null)
                {
                    return;
                }
                IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();
                clippingTransformer.SetPreTransform(this.method_16());
                List <Polyline4D> polyline4DList = new List <Polyline4D>((IEnumerable <Polyline4D>)clippingTransformer.Transform(polyline, polyline.Closed));
                if (polyline4DList.Count <= 0)
                {
                    return;
                }
                graphicsFactory.CreatePath((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this, this.dxfDimensionStyleOverrides_0.DimensionLineColor), false, (IList <Polyline4D>)polyline4DList, true, true);
            }
            else
            {
                DxfInsert.Interface46 nterface46 = (DxfInsert.Interface46) new DxfInsert.Class1019((DxfEntity)this, context, graphicsFactory);
                nterface46.imethod_0(0, 0, this.method_16());
                nterface46.Draw(this.dxfDimensionStyleOverrides_0.LeaderArrowBlock, true);
            }
        }
Example #4
0
        private DxfInsert.Enum44 method_16(
            Matrix4D insertionTransform,
            DxfInsert.Interface46 drawHandler)
        {
            if (drawHandler.InsertCellDrawContext.Config.UseSpatialFilters)
            {
                DxfSpatialFilter spatialFilter = this.SpatialFilter;
                if (spatialFilter != null && spatialFilter.ClipBoundaryDisplayEnabled)
                {
                    Polygon2D clipPolygon = spatialFilter.GetClipBoundaryPolygon();
                    if (clipPolygon.Count < 3)
                    {
                        return(DxfInsert.Enum44.const_1);
                    }
                    if (clipPolygon.GetArea() < 0.0)
                    {
                        clipPolygon = clipPolygon.GetReverse();
                    }
                    Matrix4D         boundaryTransform     = spatialFilter.ClipBoundaryTransform;
                    Matrix4D         transform             = insertionTransform * this.Block.BaseTransformation * spatialFilter.InverseInsertionTransform;
                    Matrix4D         inverse1              = boundaryTransform.GetInverse();
                    Matrix4D         clipBoundaryTransform = transform * inverse1;
                    DxfInsert.Enum44 enum44;
                    if (clipPolygon.IsConvex())
                    {
                        List <BlinnClipper4D.ClipPlane> clipPlaneList = new List <BlinnClipper4D.ClipPlane>();
                        WW.Math.Point2D  point2D             = clipPolygon[clipPolygon.Count - 1];
                        WW.Math.Vector3D boundaryPlaneNormal = spatialFilter.ClipBoundaryPlaneNormal;
                        Matrix4D         inverse2            = transform.GetInverse();
                        inverse2.Transpose();
                        foreach (WW.Math.Point2D point in (List <WW.Math.Point2D>)clipPolygon)
                        {
                            Vector2D v = point - point2D;
                            BlinnClipper4D.ClipPlane clipPlane = new BlinnClipper4D.ClipPlane(WW.Math.Vector3D.CrossProduct(inverse1.TransformTo3D(v), boundaryPlaneNormal), inverse1.TransformTo3D(point));
                            clipPlane.TransformBy(transform, inverse2);
                            clipPlaneList.Add(clipPlane);
                            point2D = point;
                        }
                        BoundsCalculator boundsCalculator = new BoundsCalculator();
                        boundsCalculator.GetBounds(drawHandler.InsertCellDrawContext.Model, (IEnumerable <DxfEntity>) this.Block.Entities, insertionTransform * this.Block.BaseTransformation);
                        switch (new BlinnClipper4D((ICollection <BlinnClipper4D.ClipPlane>)clipPlaneList).TryIsInside(boundsCalculator.Bounds))
                        {
                        case InsideTestResult.Inside:
                            enum44 = DxfInsert.Enum44.const_2;
                            break;

                        case InsideTestResult.Outside:
                            enum44 = DxfInsert.Enum44.const_0;
                            break;

                        default:
                            enum44 = DxfInsert.Enum44.const_3;
                            break;
                        }
                        if (enum44 == DxfInsert.Enum44.const_3)
                        {
                            Class808 class808 = new Class808((ICollection <BlinnClipper4D.ClipPlane>)clipPlaneList);
                            class808.imethod_0(insertionTransform.GetInverse());
                            GraphicsConfig config = drawHandler.InsertCellDrawContext.Config;
                            ModelSpaceClippingTransformer clippingTransformer = new ModelSpaceClippingTransformer(Matrix4D.Identity, (Interface32)class808, config.ShapeFlattenEpsilon, config.ShapeFlattenEpsilonForBoundsCalculation);
                            drawHandler.InsertCellDrawContext.vmethod_0((IClippingTransformer)clippingTransformer);
                        }
                    }
                    else
                    {
                        Class455         class455         = new Class455(clipBoundaryTransform, clipPolygon, false);
                        BoundsCalculator boundsCalculator = new BoundsCalculator();
                        boundsCalculator.GetBounds(drawHandler.InsertCellDrawContext.Model, (IEnumerable <DxfEntity>) this.Block.Entities, insertionTransform * this.Block.BaseTransformation);
                        switch (class455.TryIsInside(boundsCalculator.Bounds))
                        {
                        case InsideTestResult.Inside:
                            enum44 = DxfInsert.Enum44.const_2;
                            break;

                        case InsideTestResult.Outside:
                            enum44 = DxfInsert.Enum44.const_0;
                            break;

                        default:
                            enum44 = DxfInsert.Enum44.const_3;
                            break;
                        }
                        if (enum44 == DxfInsert.Enum44.const_3)
                        {
                            Matrix4D inverse2 = insertionTransform.GetInverse();
                            class455.imethod_0(inverse2);
                            GraphicsConfig config = drawHandler.InsertCellDrawContext.Config;
                            ModelSpaceClippingTransformer clippingTransformer = new ModelSpaceClippingTransformer(Matrix4D.Identity, (Interface32)class455, config.ShapeFlattenEpsilon, config.ShapeFlattenEpsilonForBoundsCalculation);
                            drawHandler.InsertCellDrawContext.vmethod_0((IClippingTransformer)clippingTransformer);
                        }
                    }
                    if ((!spatialFilter.ClipBoundaryDisplayEnabled || drawHandler.InsertCellDrawContext.Model.Header.ExternalReferenceClippingBoundaryType == WW.Cad.Model.SimpleLineType.Off ? 0 : (this.IsEntityVisibleInContext(drawHandler.InsertCellDrawContext, true) ? 1 : 0)) != 0)
                    {
                        WW.Math.Geometry.Polyline3D polygon = new WW.Math.Geometry.Polyline3D(clipPolygon.Count);
                        foreach (WW.Math.Point2D point in (List <WW.Math.Point2D>)clipPolygon)
                        {
                            polygon.Add(clipBoundaryTransform.TransformTo3D(point));
                        }
                        polygon.Closed = true;
                        drawHandler.Draw(polygon);
                    }
                    return(enum44);
                }
            }
            return(DxfInsert.Enum44.const_1);
        }