1 : /******************************************************************************
2 : * $Id: ogrxplanedriver.cpp
3 : *
4 : * Project: X-Plane aeronautical data reader
5 : * Purpose: Implements OGRXPlaneDriver.
6 : * Author: Even Rouault, even dot rouault at mines dash paris dot org
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2008, 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_xplane.h"
31 : #include "cpl_conv.h"
32 :
33 : /************************************************************************/
34 : /* GetName() */
35 : /************************************************************************/
36 :
37 10019 : const char *OGRXPlaneDriver::GetName()
38 :
39 : {
40 10019 : return "XPlane";
41 : }
42 :
43 : /************************************************************************/
44 : /* Open() */
45 : /************************************************************************/
46 :
47 130 : OGRDataSource *OGRXPlaneDriver::Open( const char * pszFilename, int bUpdate )
48 :
49 : {
50 130 : if ( bUpdate )
51 : {
52 13 : return FALSE;
53 : }
54 :
55 117 : OGRXPlaneDataSource *poDS = new OGRXPlaneDataSource();
56 :
57 117 : int bReadWholeFile = CSLTestBoolean(CPLGetConfigOption("OGR_XPLANE_READ_WHOLE_FILE", "TRUE"));
58 :
59 117 : if( !poDS->Open( pszFilename, bReadWholeFile ) )
60 : {
61 112 : delete poDS;
62 112 : poDS = NULL;
63 : }
64 :
65 117 : return poDS;
66 : }
67 :
68 : /************************************************************************/
69 : /* TestCapability() */
70 : /************************************************************************/
71 :
72 0 : int OGRXPlaneDriver::TestCapability( const char * pszCap )
73 : {
74 0 : return FALSE;
75 : }
76 :
77 : /************************************************************************/
78 : /* RegisterOGRXPlane() */
79 : /************************************************************************/
80 :
81 178 : void RegisterOGRXPlane()
82 :
83 : {
84 178 : OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( new OGRXPlaneDriver );
85 178 : }
86 :
|