Esempio n. 1
0
        private static ShapeFileType GetShapeFileTypeInternal(string shapePathFileName)
        {
            Stream stream = null;

            try
            {
                stream = File.OpenRead(shapePathFileName);
                stream.Seek(32, SeekOrigin.Begin);
                var shapeTypeFlag = IOUtil.ReadIntFromStream(stream, WkbByteOrder.LittleEndian);
                return(ShapeFileHeader.ConvertIntToShapeFileType(shapeTypeFlag));
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
        }
Esempio n. 2
0
        public static ShapeFileHeader GetHeaderFromStream(Stream stream)
        {
            ShapeFileHeader returnHeader = new ShapeFileHeader();

            stream.Seek(0, SeekOrigin.Begin);

            returnHeader.fileCode = IOUtil.ReadIntFromStream(stream, WkbByteOrder.BigEndian);

            stream.Seek(fileLengthInfoPosition, SeekOrigin.Begin);
            returnHeader.fileLength = IOUtil.ReadIntFromStream(stream, WkbByteOrder.BigEndian);


            returnHeader.version = IOUtil.ReadIntFromStream(stream, WkbByteOrder.LittleEndian);

            returnHeader.shapeFileType = ConvertIntToShapeFileType(IOUtil.ReadIntFromStream(stream, WkbByteOrder.LittleEndian));

            returnHeader.boundingBox = ShapeFileBoundingBox.GetHeaderBoundingBox(stream);

            return(returnHeader);
        }
 public ShapeFileIndex(string shxPathFileName)
 {
     this.shxPathFileName = shxPathFileName;
     fileHeader           = new ShapeFileHeader();
 }