Line data Source code
1 : /****************************************************************************** 2 : * $Id$ 3 : * 4 : * Project: OpenGIS Simple Features Reference Implementation 5 : * Purpose: Private definitions for OGR/VFK driver. 6 : * Author: Martin Landa, landa.martin gmail.com 7 : * 8 : ****************************************************************************** 9 : * Copyright (c) 2009-2010, Martin Landa <landa.martin gmail.com> 10 : * 11 : * Permission is hereby granted, free of charge, to any person 12 : * obtaining a copy of this software and associated documentation 13 : * files (the "Software"), to deal in the Software without 14 : * restriction, including without limitation the rights to use, copy, 15 : * modify, merge, publish, distribute, sublicense, and/or sell copies 16 : * of the Software, and to permit persons to whom the Software is 17 : * furnished to do so, subject to the following conditions: 18 : * 19 : * The above copyright notice and this permission notice shall be 20 : * included in all copies or substantial portions of the Software. 21 : * 22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 : * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 : * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 : * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 26 : * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 27 : * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 : * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 : * SOFTWARE. 30 : ****************************************************************************/ 31 : 32 : #ifndef GDAL_OGR_VFK_H_INCLUDED 33 : #define GDAL_OGR_VFK_H_INCLUDED 34 : 35 : #include <map> 36 : #include <string> 37 : 38 : #include "ogrsf_frmts.h" 39 : #include "vfkreader.h" 40 : 41 : class OGRVFKDataSource; 42 : 43 : /************************************************************************/ 44 : /* OGRVFKLayer */ 45 : /************************************************************************/ 46 : 47 : class OGRVFKLayer : public OGRLayer 48 : { 49 : private: 50 : /* spatial reference */ 51 : OGRSpatialReference *poSRS; 52 : 53 : /* feature definition */ 54 : OGRFeatureDefn *poFeatureDefn; 55 : 56 : /* VFK data block */ 57 : IVFKDataBlock *poDataBlock; 58 : 59 : /* get next feature */ 60 : int m_iNextFeature; 61 : 62 : /* private methods */ 63 : static const OGRGeometry *GetGeometry(IVFKFeature *); 64 : OGRFeature *GetFeature(IVFKFeature *); 65 : 66 : public: 67 : OGRVFKLayer(const char *, OGRSpatialReference *, OGRwkbGeometryType, 68 : OGRVFKDataSource *); 69 : ~OGRVFKLayer(); 70 : 71 : OGRFeature *GetNextFeature() override; 72 : OGRFeature *GetFeature(GIntBig) override; 73 : 74 9479 : OGRFeatureDefn *GetLayerDefn() override 75 : { 76 9479 : return poFeatureDefn; 77 : } 78 : 79 : void ResetReading() override; 80 : 81 : int TestCapability(const char *) override; 82 : 83 : GIntBig GetFeatureCount(int = TRUE) override; 84 : }; 85 : 86 : /************************************************************************/ 87 : /* OGRVFKDataSource */ 88 : /************************************************************************/ 89 : class OGRVFKDataSource : public OGRDataSource 90 : { 91 : private: 92 : /* list of available layers */ 93 : OGRVFKLayer **papoLayers; 94 : int nLayers; 95 : 96 : char *pszName; 97 : 98 : /* input related parameters */ 99 : IVFKReader *poReader; 100 : 101 : /* private methods */ 102 : OGRVFKLayer *CreateLayerFromBlock(const IVFKDataBlock *); 103 : 104 : public: 105 : OGRVFKDataSource(); 106 : ~OGRVFKDataSource(); 107 : 108 : int Open(GDALOpenInfo *poOpenInfo); 109 : 110 0 : const char *GetName() override 111 : { 112 0 : return pszName; 113 : } 114 : 115 160 : int GetLayerCount() override 116 : { 117 160 : return nLayers; 118 : } 119 : 120 : OGRLayer *GetLayer(int) override; 121 : 122 : int TestCapability(const char *) override; 123 : 124 976 : IVFKReader *GetReader() const 125 : { 126 976 : return poReader; 127 : } 128 : }; 129 : 130 : #endif // GDAL_OGR_VFK_H_INCLUDED