1 : /******************************************************************************
2 : * $Id: ogrvfkdriver.cpp 25340 2012-12-21 20:30:21Z rouault $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Implements OGRVFKDriver class.
6 : * Author: Martin Landa, landa.martin gmail.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2009-2010, Martin Landa <landa.martin gmail.com>
10 : *
11 : * Permission is hereby granted, free of charge, to any person
12 : * obtaining a copy of this software and associated documentation
13 : * files (the "Software"), to deal in the Software without
14 : * restriction, including without limitation the rights to use, copy,
15 : * modify, merge, publish, distribute, sublicense, and/or sell copies
16 : * of the Software, and to permit persons to whom the Software is
17 : * furnished to do so, subject to the following conditions:
18 : *
19 : * The above copyright notice and this permission notice shall be
20 : * included in all copies or substantial portions of the Software.
21 : *
22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 : * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 : * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 : * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 : * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 : * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 : * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 : * SOFTWARE.
30 : ****************************************************************************/
31 :
32 : #include "ogr_vfk.h"
33 : #include "cpl_conv.h"
34 : #include "cpl_string.h"
35 :
36 : CPL_CVSID("$Id: ogrvfkdriver.cpp 25340 2012-12-21 20:30:21Z rouault $");
37 :
38 : /************************************************************************/
39 : /* ~OGRVFKDriver() */
40 : /************************************************************************/
41 214 : OGRVFKDriver::~OGRVFKDriver()
42 : {
43 214 : }
44 :
45 : /************************************************************************/
46 : /* GetName() */
47 : /************************************************************************/
48 13854 : const char *OGRVFKDriver::GetName()
49 : {
50 13854 : return "VFK";
51 : }
52 :
53 : /*
54 : \brief Open existing data source
55 :
56 : \param pszFilename data source name to be open
57 : \param pUpdate non-zero for update, zero for read-only
58 :
59 : \return pointer to OGRDataSource instance
60 : \return NULL on failure
61 : */
62 145 : OGRDataSource *OGRVFKDriver::Open(const char * pszFilename,
63 : int bUpdate)
64 : {
65 : OGRVFKDataSource *poDS;
66 :
67 145 : if (bUpdate)
68 9 : return NULL;
69 :
70 136 : poDS = new OGRVFKDataSource();
71 :
72 138 : if(!poDS->Open(pszFilename, TRUE) || poDS->GetLayerCount() == 0) {
73 134 : delete poDS;
74 134 : return NULL;
75 : }
76 : else
77 2 : return poDS;
78 : }
79 :
80 : /*!
81 : \brief Test driver capability
82 :
83 : \param pszCap capability
84 :
85 : \return TRUE on success or FALSE on failure
86 : */
87 0 : int OGRVFKDriver::TestCapability(const char *pszCap)
88 : {
89 0 : return FALSE;
90 : }
91 :
92 : /*!
93 : \brief Register VFK driver
94 : */
95 226 : void RegisterOGRVFK()
96 : {
97 226 : if (!GDAL_CHECK_VERSION("OGR/VFK driver"))
98 0 : return;
99 226 : OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver(new OGRVFKDriver);
100 : }
|