Пример #1
0
        private static bool TryGetArcBoundingBox(DxfVertex v1, DxfVertex v2, out DxfBoundingBox bbox)
        {
            if (!DxfArc.TryCreateFromVertices(v1, v2, out var arc))
            {
                bbox = default(DxfBoundingBox);
                return(false);
            }

            var boundingBox = arc.GetBoundingBox();

            if (!boundingBox.HasValue)
            {
                bbox = default(DxfBoundingBox);
                return(false);
            }

            bbox = boundingBox.Value;
            return(true);
        }
Пример #2
0
        protected override IEnumerable <DxfPoint> GetExtentsPoints()
        {
            if (GetEntities != null)
            {
                var boundingBoxes = GetEntities().Select(e => e.GetBoundingBox()).Where(bb => bb.HasValue).Select(bb => bb.GetValueOrDefault()).ToList();
                if (boundingBoxes.Count == 0)
                {
                    yield break;
                }

                var boundingBox = DxfBoundingBox.FromEnumerable(boundingBoxes);
                var minX        = boundingBox.MinimumPoint.X * XScaleFactor + Location.X;
                var minY        = boundingBox.MinimumPoint.Y * YScaleFactor + Location.Y;
                var minZ        = boundingBox.MinimumPoint.Z * ZScaleFactor + Location.Z;
                var maxX        = boundingBox.MaximumPoint.X * XScaleFactor + Location.X;
                var maxY        = boundingBox.MaximumPoint.Y * YScaleFactor + Location.Y;
                var maxZ        = boundingBox.MaximumPoint.Z * ZScaleFactor + Location.Z;
                var minP        = new DxfPoint(minX, minY, minZ);
                var maxP        = new DxfPoint(maxX, maxY, maxZ);
                yield return(minP);

                yield return(maxP);
            }
        }
Пример #3
0
 public DxfBoundingBox? GetBoundingBox()
 {
     return DxfBoundingBox.FromPoints(GetExtentsPoints());
 }
Пример #4
0
 public ConverterDxfRect(DxfBoundingBox bbox)
     : this(bbox.MinimumPoint.X, bbox.MaximumPoint.X, bbox.MinimumPoint.Y, bbox.MaximumPoint.Y)
 {
 }