1 : /******************************************************************************
2 : * $Id: ogr_gpsbabel.h 25526 2013-01-19 20:41:08Z rouault $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Private definitions for OGR/GPSBabel driver.
6 : * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2010, Even Rouault
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_GPSBABEL_H_INCLUDED
31 : #define _OGR_GPSBABEL_H_INCLUDED
32 :
33 : #include "ogrsf_frmts.h"
34 : #include "cpl_string.h"
35 :
36 : /************************************************************************/
37 : /* OGRGPSBabelDataSource */
38 : /************************************************************************/
39 :
40 : class OGRGPSBabelDataSource : public OGRDataSource
41 : {
42 : int nLayers;
43 : OGRLayer* apoLayers[5];
44 : char *pszName;
45 : char *pszGPSBabelDriverName;
46 : char *pszFilename;
47 : CPLString osTmpFileName;
48 : OGRDataSource *poGPXDS;
49 :
50 : public:
51 : OGRGPSBabelDataSource();
52 : ~OGRGPSBabelDataSource();
53 :
54 2 : virtual const char *GetName() { return pszName; }
55 2 : virtual int GetLayerCount() { return nLayers; }
56 : virtual OGRLayer *GetLayer( int );
57 :
58 : virtual int TestCapability( const char * );
59 :
60 : int Open ( const char* pszFilename, int bUpdateIn );
61 :
62 : static int IsSpecialFile(const char* pszFilename);
63 : static int IsValidDriverName(const char* pszGPSBabelDriverName);
64 : };
65 :
66 :
67 : /************************************************************************/
68 : /* OGRGPSBabelWriteDataSource */
69 : /************************************************************************/
70 :
71 : class OGRGPSBabelWriteDataSource : public OGRDataSource
72 : {
73 : char *pszName;
74 : char *pszGPSBabelDriverName;
75 : char *pszFilename;
76 : CPLString osTmpFileName;
77 : OGRDataSource *poGPXDS;
78 :
79 : int Convert();
80 :
81 : public:
82 : OGRGPSBabelWriteDataSource();
83 : ~OGRGPSBabelWriteDataSource();
84 :
85 1 : virtual const char *GetName() { return pszName; }
86 : virtual int GetLayerCount();
87 : virtual OGRLayer *GetLayer( int );
88 :
89 : virtual int TestCapability( const char * );
90 :
91 : virtual OGRLayer *CreateLayer( const char * pszLayerName,
92 : OGRSpatialReference *poSRS,
93 : OGRwkbGeometryType eType,
94 : char ** papszOptions );
95 :
96 : int Create ( const char* pszFilename, char **papszOptions );
97 : };
98 :
99 : /************************************************************************/
100 : /* OGRGPSBabelDriver */
101 : /************************************************************************/
102 :
103 : class OGRGPSBabelDriver : public OGRSFDriver
104 244 : {
105 : public:
106 : ~OGRGPSBabelDriver();
107 :
108 : virtual const char *GetName();
109 : virtual OGRDataSource *Open( const char *, int );
110 : virtual OGRDataSource *CreateDataSource( const char * pszName,
111 : char **papszOptions );
112 : virtual OGRErr DeleteDataSource( const char *pszFilename );
113 :
114 : virtual int TestCapability( const char * );
115 : };
116 :
117 : #endif /* ndef _OGR_GPSBABEL_H_INCLUDED */
118 :
|