1 : /******************************************************************************
2 : * $Id: ogr_idrisi.h 23040 2011-09-04 14:42:12Z 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 : int bEOF;
48 :
49 : int nNextFID;
50 :
51 : int bExtentValid;
52 : double dfMinX;
53 : double dfMinY;
54 : double dfMaxX;
55 : double dfMaxY;
56 :
57 : unsigned int nTotalFeatures;
58 :
59 : virtual OGRFeature * GetNextRawFeature();
60 :
61 : public:
62 : OGRIdrisiLayer(const char* pszLayerName, VSILFILE* fp,
63 : OGRwkbGeometryType eGeomType, const char* pszWTKString);
64 : ~OGRIdrisiLayer();
65 :
66 :
67 : virtual void ResetReading();
68 : virtual OGRFeature * GetNextFeature();
69 :
70 6 : virtual OGRFeatureDefn * GetLayerDefn() { return poFeatureDefn; }
71 :
72 : virtual int TestCapability( const char * );
73 :
74 2 : virtual OGRSpatialReference *GetSpatialRef() { return poSRS; }
75 :
76 : void SetExtent(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY);
77 : virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
78 :
79 : virtual int GetFeatureCount( int bForce = TRUE );
80 : };
81 :
82 : /************************************************************************/
83 : /* OGRIdrisiDataSource */
84 : /************************************************************************/
85 :
86 : class OGRIdrisiDataSource : public OGRDataSource
87 : {
88 : char* pszName;
89 :
90 : OGRLayer** papoLayers;
91 : int nLayers;
92 :
93 : public:
94 : OGRIdrisiDataSource();
95 : ~OGRIdrisiDataSource();
96 :
97 : int Open( const char * pszFilename,
98 : int bUpdate );
99 :
100 6 : virtual const char* GetName() { return pszName; }
101 :
102 0 : virtual int GetLayerCount() { return nLayers; }
103 : virtual OGRLayer* GetLayer( int );
104 :
105 : virtual int TestCapability( const char * );
106 : };
107 :
108 : /************************************************************************/
109 : /* OGRIdrisiDriver */
110 : /************************************************************************/
111 :
112 : class OGRIdrisiDriver : public OGRSFDriver
113 389 : {
114 : public:
115 : ~OGRIdrisiDriver();
116 :
117 : virtual const char* GetName();
118 : virtual OGRDataSource* Open( const char *, int );
119 : virtual int TestCapability( const char * );
120 : };
121 :
122 :
123 : #endif /* ndef _OGR_IDRISI_H_INCLUDED */
|