1 : /******************************************************************************
2 : * $Id: ogr_gpsbabel.h 19796 2010-06-02 22:09:30Z 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 : int ForkAndPipe(const char * const argv[], FILE* fin, FILE* fout);
37 :
38 : /************************************************************************/
39 : /* OGRGPSBabelDataSource */
40 : /************************************************************************/
41 :
42 : class OGRGPSBabelDataSource : public OGRDataSource
43 : {
44 : int nLayers;
45 : OGRLayer* apoLayers[5];
46 : char *pszName;
47 : char *pszGPSBabelDriverName;
48 : char *pszFilename;
49 : CPLString osTmpFileName;
50 : OGRDataSource *poGPXDS;
51 :
52 : public:
53 : OGRGPSBabelDataSource();
54 : ~OGRGPSBabelDataSource();
55 :
56 2 : virtual const char *GetName() { return pszName; }
57 2 : virtual int GetLayerCount() { return nLayers; }
58 : virtual OGRLayer *GetLayer( int );
59 :
60 : virtual int TestCapability( const char * );
61 :
62 : int Open ( const char* pszFilename, int bUpdateIn );
63 :
64 : static int IsSpecialFile(const char* pszFilename);
65 : static int IsValidDriverName(const char* pszGPSBabelDriverName);
66 : };
67 :
68 :
69 : /************************************************************************/
70 : /* OGRGPSBabelWriteDataSource */
71 : /************************************************************************/
72 :
73 : class OGRGPSBabelWriteDataSource : public OGRDataSource
74 : {
75 : char *pszName;
76 : char *pszGPSBabelDriverName;
77 : char *pszFilename;
78 : CPLString osTmpFileName;
79 : OGRDataSource *poGPXDS;
80 :
81 : int Convert();
82 :
83 : public:
84 : OGRGPSBabelWriteDataSource();
85 : ~OGRGPSBabelWriteDataSource();
86 :
87 1 : virtual const char *GetName() { return pszName; }
88 : virtual int GetLayerCount();
89 : virtual OGRLayer *GetLayer( int );
90 :
91 : virtual int TestCapability( const char * );
92 :
93 : virtual OGRLayer *CreateLayer( const char * pszLayerName,
94 : OGRSpatialReference *poSRS,
95 : OGRwkbGeometryType eType,
96 : char ** papszOptions );
97 :
98 : int Create ( const char* pszFilename, char **papszOptions );
99 : };
100 :
101 : /************************************************************************/
102 : /* OGRGPSBabelDriver */
103 : /************************************************************************/
104 :
105 : class OGRGPSBabelDriver : public OGRSFDriver
106 80 : {
107 : public:
108 : ~OGRGPSBabelDriver();
109 :
110 : virtual const char *GetName();
111 : virtual OGRDataSource *Open( const char *, int );
112 : virtual OGRDataSource *CreateDataSource( const char * pszName,
113 : char **papszOptions );
114 : virtual OGRErr DeleteDataSource( const char *pszFilename );
115 :
116 : virtual int TestCapability( const char * );
117 : };
118 :
119 : #endif /* ndef _OGR_GPSBABEL_H_INCLUDED */
120 :
|