Line data Source code
1 : /****************************************************************************** 2 : * $Id$ 3 : * 4 : * Project: STS Translator 5 : * Purpose: Definition of classes finding SDTS support into OGRDriver 6 : * framework. 7 : * Author: Frank Warmerdam, warmerdam@pobox.com 8 : * 9 : ****************************************************************************** 10 : * Copyright (c) 1999, Frank Warmerdam 11 : * 12 : * Permission is hereby granted, free of charge, to any person obtaining a 13 : * copy of this software and associated documentation files (the "Software"), 14 : * to deal in the Software without restriction, including without limitation 15 : * the rights to use, copy, modify, merge, publish, distribute, sublicense, 16 : * and/or sell copies of the Software, and to permit persons to whom the 17 : * Software is furnished to do so, subject to the following conditions: 18 : * 19 : * The above copyright notice and this permission notice shall be included 20 : * in all copies or substantial portions of the Software. 21 : * 22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 : * DEALINGS IN THE SOFTWARE. 29 : ****************************************************************************/ 30 : 31 : #ifndef OGR_SDTS_H_INCLUDED 32 : #define OGR_SDTS_H_INCLUDED 33 : 34 : #include "sdts_al.h" 35 : #include "ogrsf_frmts.h" 36 : 37 : class OGRSDTSDataSource; 38 : 39 : /************************************************************************/ 40 : /* OGRSDTSLayer */ 41 : /************************************************************************/ 42 : 43 : class OGRSDTSLayer final : public OGRLayer 44 : { 45 : OGRFeatureDefn *poFeatureDefn; 46 : 47 : SDTSTransfer *poTransfer; 48 : int iLayer; 49 : SDTSIndexedReader *poReader; 50 : 51 : OGRSDTSDataSource *poDS; 52 : 53 : OGRFeature *GetNextUnfilteredFeature(); 54 : 55 : public: 56 : OGRSDTSLayer(SDTSTransfer *, int, OGRSDTSDataSource *); 57 : ~OGRSDTSLayer(); 58 : 59 : void ResetReading() override; 60 : OGRFeature *GetNextFeature() override; 61 : 62 52 : OGRFeatureDefn *GetLayerDefn() override 63 : { 64 52 : return poFeatureDefn; 65 : } 66 : 67 : int TestCapability(const char *) override; 68 : }; 69 : 70 : /************************************************************************/ 71 : /* OGRSDTSDataSource */ 72 : /************************************************************************/ 73 : 74 : class OGRSDTSDataSource final : public OGRDataSource 75 : { 76 : SDTSTransfer *poTransfer; 77 : char *pszName; 78 : 79 : int nLayers; 80 : OGRSDTSLayer **papoLayers; 81 : 82 : OGRSpatialReference *poSRS; 83 : 84 : public: 85 : OGRSDTSDataSource(); 86 : ~OGRSDTSDataSource(); 87 : 88 : int Open(const char *pszFilename, int bTestOpen); 89 : 90 0 : const char *GetName() override 91 : { 92 0 : return pszName; 93 : } 94 : 95 44 : int GetLayerCount() override 96 : { 97 44 : return nLayers; 98 : } 99 : 100 : OGRLayer *GetLayer(int) override; 101 : int TestCapability(const char *) override; 102 : 103 202 : OGRSpatialReference *DSGetSpatialRef() 104 : { 105 202 : return poSRS; 106 : } 107 : }; 108 : 109 : #endif /* ndef OGR_SDTS_H_INCLUDED */