1 : /******************************************************************************
2 : * $Id: ogrsdtsdriver.cpp 12396 2007-10-13 10:02:17Z rouault $
3 : *
4 : * Project: SDTS Translator
5 : * Purpose: Implements OGRSDTSDriver
6 : * Author: Frank Warmerdam, warmerdam@pobox.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 1999, Frank Warmerdam
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_sdts.h"
31 : #include "cpl_conv.h"
32 :
33 : CPL_CVSID("$Id: ogrsdtsdriver.cpp 12396 2007-10-13 10:02:17Z rouault $");
34 :
35 : /************************************************************************/
36 : /* ~OGRSDTSDriver() */
37 : /************************************************************************/
38 :
39 72 : OGRSDTSDriver::~OGRSDTSDriver()
40 :
41 : {
42 72 : }
43 :
44 : /************************************************************************/
45 : /* TestCapability() */
46 : /************************************************************************/
47 :
48 0 : int OGRSDTSDriver::TestCapability( const char * )
49 :
50 : {
51 0 : return FALSE;
52 : }
53 :
54 : /************************************************************************/
55 : /* GetName() */
56 : /************************************************************************/
57 :
58 3310 : const char *OGRSDTSDriver::GetName()
59 :
60 : {
61 3310 : return "SDTS";
62 : }
63 :
64 : /************************************************************************/
65 : /* Open() */
66 : /************************************************************************/
67 :
68 295 : OGRDataSource *OGRSDTSDriver::Open( const char * pszFilename, int bUpdate )
69 :
70 : {
71 295 : OGRSDTSDataSource *poDS = new OGRSDTSDataSource();
72 :
73 295 : if( !poDS->Open( pszFilename, TRUE ) )
74 : {
75 294 : delete poDS;
76 294 : poDS = NULL;
77 : }
78 :
79 295 : if( poDS != NULL && bUpdate )
80 : {
81 : CPLError( CE_Failure, CPLE_OpenFailed,
82 0 : "SDTS Driver doesn't support update." );
83 0 : delete poDS;
84 0 : poDS = NULL;
85 : }
86 :
87 295 : return poDS;
88 : }
89 :
90 : /************************************************************************/
91 : /* RegisterOGRSDTS() */
92 : /************************************************************************/
93 :
94 80 : void RegisterOGRSDTS()
95 :
96 : {
97 80 : if (! GDAL_CHECK_VERSION("SDTS driver"))
98 0 : return;
99 80 : OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( new OGRSDTSDriver );
100 : }
101 :
|