public ShapefileDataReader(string path, IGeometryFactory geometryFactory = null, GeometryTransform transform = null)
            : base(path, geometryFactory, transform)
        {
            _dbf = DbfFile.Open(Path.ChangeExtension(path, ".dbf"));

            _currentRecord = new DbfRecord(_dbf.Header);
        }
 public ShapefileBlockReader(string path, ShapefileIndexReader index, IGeometryFactory geometryFactory = null, GeometryTransform transform = null, int blockSize = 25)
     : base(path, geometryFactory, transform)
 {
     _block = new int[blockSize, 2];
     _blockPos = blockSize;
     _index = index;
 }
Exemplo n.º 3
0
        public ShapefileReader(string path, IGeometryFactory geometryFactory = null, GeometryTransform transform = null)
        {
            _gf = geometryFactory ?? new GeometryFactory();
            _reader = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read));
            ShapeHeader = ShapefileHeader.Read(_reader);
            ShapeEnvelope = new Envelope();

            switch (ShapeHeader.ShapeType)
            {
                case ShapefileGeometryType.Point:
                case ShapefileGeometryType.PointZ:
                    _shapeFunc = ReadPoint;
                    break;
                case ShapefileGeometryType.PolyLine:
                case ShapefileGeometryType.PolyLineZ:
                    _shapeFunc = ReadPolyLine;
                    break;
                case ShapefileGeometryType.Polygon:
                case ShapefileGeometryType.PolygonZ:
                    _shapeFunc = ReadPolygon;
                    break;
                case ShapefileGeometryType.MultiPoint:
                case ShapefileGeometryType.MultiPointZ:
                    _shapeFunc = ReadMultiPoint;
                    break;
                default:
                    throw new Exception("Shape type is not supported");
            }

            if (transform != null)
            {
                _transform = transform;

                Func<IGeometry> origFun = _shapeFunc;
                _shapeFunc = () =>
                {
                    return _transform.Apply(origFun());
                };
            }
        }
 public ShapefileBlockReader CreateBlockReader(IGeometryFactory geometryFactory = null, GeometryTransform transform = null)
 {
     return new ShapefileBlockReader(Path.ChangeExtension(_path, ".shp"), this, geometryFactory, transform);
 }