Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: OpenGIS Simple Features Reference Implementation 4 : * Purpose: Private definitions for OGR/VFK driver. 5 : * Author: Martin Landa, landa.martin gmail.com 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2009-2010, Martin Landa <landa.martin gmail.com> 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDAL_OGR_VFK_H_INCLUDED 14 : #define GDAL_OGR_VFK_H_INCLUDED 15 : 16 : #include <map> 17 : #include <string> 18 : 19 : #include "ogrsf_frmts.h" 20 : #include "vfkreader.h" 21 : 22 : class OGRVFKDataSource; 23 : 24 : /************************************************************************/ 25 : /* OGRVFKLayer */ 26 : /************************************************************************/ 27 : 28 : class OGRVFKLayer final : public OGRLayer 29 : { 30 : private: 31 : /* spatial reference */ 32 : OGRSpatialReference *poSRS; 33 : 34 : /* feature definition */ 35 : OGRFeatureDefn *poFeatureDefn; 36 : 37 : /* VFK data block */ 38 : IVFKDataBlock *poDataBlock; 39 : 40 : /* get next feature */ 41 : int m_iNextFeature; 42 : 43 : /* private methods */ 44 : static const OGRGeometry *GetGeometry(IVFKFeature *); 45 : OGRFeature *GetFeature(IVFKFeature *); 46 : 47 : public: 48 : OGRVFKLayer(const char *, OGRSpatialReference *, OGRwkbGeometryType, 49 : OGRVFKDataSource *); 50 : ~OGRVFKLayer() override; 51 : 52 : OGRFeature *GetNextFeature() override; 53 : OGRFeature *GetFeature(GIntBig) override; 54 : 55 : using OGRLayer::GetLayerDefn; 56 : 57 9479 : const OGRFeatureDefn *GetLayerDefn() const override 58 : { 59 9479 : return poFeatureDefn; 60 : } 61 : 62 : void ResetReading() override; 63 : 64 : int TestCapability(const char *) const override; 65 : 66 : GIntBig GetFeatureCount(int = TRUE) override; 67 : }; 68 : 69 : /************************************************************************/ 70 : /* OGRVFKDataSource */ 71 : /************************************************************************/ 72 : class OGRVFKDataSource final : public GDALDataset 73 : { 74 : private: 75 : /* list of available layers */ 76 : OGRVFKLayer **papoLayers; 77 : int nLayers; 78 : 79 : /* input related parameters */ 80 : IVFKReader *poReader; 81 : 82 : /* private methods */ 83 : OGRVFKLayer *CreateLayerFromBlock(const IVFKDataBlock *); 84 : 85 : public: 86 : OGRVFKDataSource(); 87 : ~OGRVFKDataSource() override; 88 : 89 : int Open(GDALOpenInfo *poOpenInfo); 90 : 91 160 : int GetLayerCount() const override 92 : { 93 160 : return nLayers; 94 : } 95 : 96 : const OGRLayer *GetLayer(int) const override; 97 : 98 : int TestCapability(const char *) const override; 99 : 100 976 : IVFKReader *GetReader() const 101 : { 102 976 : return poReader; 103 : } 104 : }; 105 : 106 : #endif // GDAL_OGR_VFK_H_INCLUDED