1 : /******************************************************************************
2 : * $Id: ogrvfkdriver.cpp 18452 2010-01-07 15:18:49Z martinl $
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 18452 2010-01-07 15:18:49Z martinl $");
37 :
38 : /************************************************************************/
39 : /* ~OGRVFKDriver() */
40 : /************************************************************************/
41 96 : OGRVFKDriver::~OGRVFKDriver()
42 : {
43 96 : }
44 :
45 : /************************************************************************/
46 : /* GetName() */
47 : /************************************************************************/
48 1863 : const char *OGRVFKDriver::GetName()
49 : {
50 1863 : 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 5 : OGRDataSource *OGRVFKDriver::Open(const char * pszFilename,
63 : int bUpdate)
64 : {
65 : OGRVFKDataSource *poDS;
66 :
67 5 : if (bUpdate)
68 2 : return NULL;
69 :
70 3 : poDS = new OGRVFKDataSource();
71 :
72 4 : if(!poDS->Open(pszFilename, TRUE) || poDS->GetLayerCount() == 0) {
73 2 : delete poDS;
74 2 : return NULL;
75 : }
76 : else
77 1 : return poDS;
78 : }
79 :
80 : /*!
81 : \brief Test driver capability
82 :
83 : \param pszCap capability
84 :
85 : \return TRUE on success
86 : \return False on failure
87 : */
88 0 : int OGRVFKDriver::TestCapability(const char *pszCap)
89 : {
90 0 : return FALSE;
91 : }
92 :
93 : /*!
94 : \brief Register VFK driver
95 : */
96 64 : void RegisterOGRVFK()
97 : {
98 64 : if (!GDAL_CHECK_VERSION("OGR/VFK driver"))
99 0 : return;
100 64 : OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver(new OGRVFKDriver);
101 : }
|