1 : /******************************************************************************
2 : * $Id: ogr_idrisi.h 24397 2012-05-07 20:11:28Z rouault $
3 : *
4 : * Project: Idrisi Translator
5 : * Purpose: Definition of classes for OGR Idrisi driver.
6 : * Author: Even Rouault, even dot rouault at mines dash paris dot org
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2011, Even Rouault <even dot rouault at mines dash paris dot org>
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #ifndef _OGR_IDRISI_H_INCLUDED
31 : #define _OGR_IDRISI_H_INCLUDED
32 :
33 : #include "ogrsf_frmts.h"
34 :
35 : /************************************************************************/
36 : /* OGRIdrisiLayer */
37 : /************************************************************************/
38 :
39 : class OGRIdrisiLayer : public OGRLayer
40 : {
41 : protected:
42 : OGRFeatureDefn* poFeatureDefn;
43 : OGRSpatialReference *poSRS;
44 : OGRwkbGeometryType eGeomType;
45 :
46 : VSILFILE* fp;
47 : VSILFILE* fpAVL;
48 : int bEOF;
49 :
50 : int nNextFID;
51 :
52 : int bExtentValid;
53 : double dfMinX;
54 : double dfMinY;
55 : double dfMaxX;
56 : double dfMaxY;
57 :
58 : unsigned int nTotalFeatures;
59 :
60 : int Detect_AVL_ADC(const char* pszFilename);
61 : void ReadAVLLine(OGRFeature* poFeature);
62 :
63 : virtual OGRFeature * GetNextRawFeature();
64 :
65 : public:
66 : OGRIdrisiLayer(const char* pszFilename,
67 : const char* pszLayerName, VSILFILE* fp,
68 : OGRwkbGeometryType eGeomType, const char* pszWTKString);
69 : ~OGRIdrisiLayer();
70 :
71 :
72 : virtual void ResetReading();
73 : virtual OGRFeature * GetNextFeature();
74 :
75 5 : virtual OGRFeatureDefn * GetLayerDefn() { return poFeatureDefn; }
76 :
77 : virtual int TestCapability( const char * );
78 :
79 1 : virtual OGRSpatialReference *GetSpatialRef() { return poSRS; }
80 :
81 : void SetExtent(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY);
82 : virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
83 :
84 : virtual int GetFeatureCount( int bForce = TRUE );
85 : };
86 :
87 : /************************************************************************/
88 : /* OGRIdrisiDataSource */
89 : /************************************************************************/
90 :
91 : class OGRIdrisiDataSource : public OGRDataSource
92 : {
93 : char* pszName;
94 :
95 : OGRLayer** papoLayers;
96 : int nLayers;
97 :
98 : public:
99 : OGRIdrisiDataSource();
100 : ~OGRIdrisiDataSource();
101 :
102 : int Open( const char * pszFilename,
103 : int bUpdate );
104 :
105 3 : virtual const char* GetName() { return pszName; }
106 :
107 0 : virtual int GetLayerCount() { return nLayers; }
108 : virtual OGRLayer* GetLayer( int );
109 :
110 : virtual int TestCapability( const char * );
111 : };
112 :
113 : /************************************************************************/
114 : /* OGRIdrisiDriver */
115 : /************************************************************************/
116 :
117 : class OGRIdrisiDriver : public OGRSFDriver
118 226 : {
119 : public:
120 : ~OGRIdrisiDriver();
121 :
122 : virtual const char* GetName();
123 : virtual OGRDataSource* Open( const char *, int );
124 : virtual int TestCapability( const char * );
125 : };
126 :
127 :
128 : #endif /* ndef _OGR_IDRISI_H_INCLUDED */
|