Line data Source code
1 : /****************************************************************************** 2 : * $Id$ 3 : * 4 : * Project: NAS Reader 5 : * Purpose: Declarations for OGR wrapper classes for NAS, and NAS<->OGR 6 : * translation of geometry. 7 : * Author: Frank Warmerdam, warmerdam@pobox.com 8 : * 9 : ****************************************************************************** 10 : * Copyright (c) 2002, 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 OR 23 : * 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_NAS_H_INCLUDED 32 : #define OGR_NAS_H_INCLUDED 33 : 34 : #include "ogrsf_frmts.h" 35 : #include "nasreaderp.h" 36 : #include "ogr_api.h" 37 : #include <vector> 38 : 39 : class OGRNASDataSource; 40 : 41 : /************************************************************************/ 42 : /* OGRNASLayer */ 43 : /************************************************************************/ 44 : 45 : class OGRNASLayer final : public OGRLayer 46 : { 47 : OGRFeatureDefn *poFeatureDefn; 48 : 49 : int iNextNASId; 50 : 51 : OGRNASDataSource *poDS; 52 : 53 : GMLFeatureClass *poFClass; 54 : 55 : public: 56 : OGRNASLayer(const char *pszName, OGRNASDataSource *poDS); 57 : 58 : virtual ~OGRNASLayer(); 59 : 60 : void ResetReading() override; 61 : OGRFeature *GetNextFeature() override; 62 : 63 : GIntBig GetFeatureCount(int bForce = TRUE) override; 64 : OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) override; 65 : 66 0 : virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent, 67 : int bForce) override 68 : { 69 0 : return OGRLayer::GetExtent(iGeomField, psExtent, bForce); 70 : } 71 : 72 51 : OGRFeatureDefn *GetLayerDefn() override 73 : { 74 51 : return poFeatureDefn; 75 : } 76 : 77 : int TestCapability(const char *) override; 78 : }; 79 : 80 : /************************************************************************/ 81 : /* OGRNASDataSource */ 82 : /************************************************************************/ 83 : 84 : class OGRNASDataSource final : public OGRDataSource 85 : { 86 : OGRLayer **papoLayers; 87 : int nLayers; 88 : 89 : char *pszName; 90 : 91 : OGRNASLayer *TranslateNASSchema(GMLFeatureClass *); 92 : 93 : // input related parameters. 94 : IGMLReader *poReader; 95 : 96 : void InsertHeader(); 97 : 98 : public: 99 : OGRNASDataSource(); 100 : ~OGRNASDataSource(); 101 : 102 : int Open(const char *); 103 : int Create(const char *pszFile, char **papszOptions); 104 : 105 0 : const char *GetName() override 106 : { 107 0 : return pszName; 108 : } 109 : 110 7 : int GetLayerCount() override 111 : { 112 7 : return nLayers; 113 : } 114 : 115 : OGRLayer *GetLayer(int) override; 116 : 117 : int TestCapability(const char *) override; 118 : 119 18 : IGMLReader *GetReader() 120 : { 121 18 : return poReader; 122 : } 123 : 124 : void GrowExtents(OGREnvelope *psGeomBounds); 125 : }; 126 : 127 : #endif /* OGR_NAS_H_INCLUDED */