1 : /******************************************************************************
2 : * $Id: ogrosmdriver.cpp 24950 2012-09-22 13:54:36Z rouault $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Implements OGROSMDriver class.
6 : * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2012, 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 : #include "ogr_osm.h"
31 : #include "cpl_conv.h"
32 :
33 : /* g++ -DHAVE_EXPAT -fPIC -g -Wall ogr/ogrsf_frmts/osm/ogrosmdriver.cpp ogr/ogrsf_frmts/osm/ogrosmdatasource.cpp ogr/ogrsf_frmts/osm/ogrosmlayer.cpp -Iport -Igcore -Iogr -Iogr/ogrsf_frmts/osm -Iogr/ogrsf_frmts/mitab -Iogr/ogrsf_frmts -shared -o ogr_OSM.so -L. -lgdal */
34 :
35 : extern "C" void CPL_DLL RegisterOGROSM();
36 :
37 : CPL_CVSID("$Id: ogrosmdriver.cpp 24950 2012-09-22 13:54:36Z rouault $");
38 :
39 : /************************************************************************/
40 : /* ~OGROSMDriver() */
41 : /************************************************************************/
42 :
43 214 : OGROSMDriver::~OGROSMDriver()
44 :
45 : {
46 214 : }
47 :
48 : /************************************************************************/
49 : /* GetName() */
50 : /************************************************************************/
51 :
52 13880 : const char *OGROSMDriver::GetName()
53 :
54 : {
55 13880 : return "OSM";
56 : }
57 :
58 : /************************************************************************/
59 : /* Open() */
60 : /************************************************************************/
61 :
62 143 : OGRDataSource *OGROSMDriver::Open( const char * pszFilename,
63 : int bUpdate )
64 :
65 : {
66 143 : if (bUpdate)
67 9 : return NULL;
68 :
69 134 : OGROSMDataSource *poDS = new OGROSMDataSource();
70 :
71 134 : if( !poDS->Open( pszFilename, bUpdate ) )
72 : {
73 124 : delete poDS;
74 124 : poDS = NULL;
75 : }
76 :
77 134 : return poDS;
78 : }
79 :
80 : /************************************************************************/
81 : /* CreateDataSource() */
82 : /************************************************************************/
83 :
84 0 : OGRDataSource *OGROSMDriver::CreateDataSource( const char * pszName,
85 : char **papszOptions )
86 :
87 : {
88 0 : return NULL;
89 : }
90 :
91 : /************************************************************************/
92 : /* TestCapability() */
93 : /************************************************************************/
94 :
95 0 : int OGROSMDriver::TestCapability( const char * pszCap )
96 :
97 : {
98 0 : return FALSE;
99 : }
100 :
101 : /************************************************************************/
102 : /* RegisterOGROSM() */
103 : /************************************************************************/
104 :
105 226 : void RegisterOGROSM()
106 : {
107 226 : if (! GDAL_CHECK_VERSION("OGR/OSM driver"))
108 0 : return;
109 :
110 226 : OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( new OGROSMDriver );
111 : }
112 :
|