Esempio n. 1
0
        public static DXFUtilitiesResult RequestBoundariesFromLineWork(MemoryStream dxfFileStream, DxfUnitsType units, uint maxBoundariesToProcess, bool convertLineStringCoordsToPolygon, out PolyLineBoundaries boundaries)
        {
            boundaries = null;
            var reader = new DXFReader(dxfFileStream, units);

            try
            {
                if (!reader.FindEntitiesSection())
                {
                    return(DXFUtilitiesResult.NoEntitiesSectionFound);
                }

                var extractor = new PolyLineBoundaryExtractor(reader);
                var result    = extractor.Extract(units, maxBoundariesToProcess, convertLineStringCoordsToPolygon);

                if (result == DXFUtilitiesResult.Ok)
                {
                    boundaries = extractor.Boundaries;
                }

                return(result);
            }
            catch (FormatException e)
            {
                Log.LogError(e, "DXF file not in expected format");
                return(DXFUtilitiesResult.UnknownFileFormat);
            }
            catch (Exception e)
            {
                Log.LogError(e, "Exception processing DXF file");
                throw;
            }
        }
Esempio n. 2
0
 public PolyLineBoundaryExtractor(DXFReader reader)
 {
     _reader = reader;
 }