Beispiel #1
0
 public void Visit(DxfSpatialFilter spatialFilter)
 {
     this.bool_0 = true;
 }
Beispiel #2
0
 public void Visit(DxfSpatialFilter spatialFilter)
 {
 }
Beispiel #3
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);
        }