/// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public bool MoveNext()
 {
     if (_shpBinaryReader.PeekChar() != -1)
     {
         int recordNumber  = _shpBinaryReader.ReadInt32BE();
         int contentLength = _shpBinaryReader.ReadInt32BE();
         _geometry = _handler.Read(_shpBinaryReader, _parent._geometryFactory);
         return(true);
     }
     else
     {
         // reached end of file, so close the reader.
         _shpBinaryReader.Close();
         return(false);
     }
 }
        /// <summary>
        /// Initializes a new instance of the Shapefile class with the given parameters.
        /// </summary>
        /// <param name="filename">The filename of the shape file to read (with .shp).</param>
        /// <param name="geometryFactory">The GeometryFactory to use when creating Geometry objects.</param>
        public ShapefileReader(string filename, GeometryFactory geometryFactory)
        {
            if (filename == null)
            {
                throw new ArgumentNullException("filename");
            }
            if (geometryFactory == null)
            {
                throw new ArgumentNullException("geometryFactory");
            }

            _filename        = filename;
            _geometryFactory = geometryFactory;

            // read header information. note, we open the file, read the header information and then
            // close the file. This means the file is not opened again until GetEnumerator() is requested.
            // For each call to GetEnumerator() a new BinaryReader is created.
            FileStream            stream          = new FileStream(filename, System.IO.FileMode.Open, FileAccess.Read, FileShare.Read);
            BigEndianBinaryReader shpBinaryReader = new BigEndianBinaryReader(stream);

            _mainHeader = new ShapefileHeader(shpBinaryReader);
            shpBinaryReader.Close();
        }