1 /**********************************************************************
2  * $Id: mitab_ogr_driver.h,v 1.14 2007-03-22 20:01:36 dmorissette Exp $
3  *
4  * Name:     mitab_ogr_drive.h
5  * Project:  Mid/mif tab ogr support
6  * Language: C++
7  * Purpose:  Header file containing public definitions for the library.
8  * Author:   Stephane Villeneuve, stephane.v@videotron.ca
9  *
10  **********************************************************************
11  * Copyright (c) 1999, 2000, Stephane Villeneuve
12  * Copyright (c) 2014, Even Rouault <even.rouault at spatialys.com>
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the "Software"),
16  * to deal in the Software without restriction, including without limitation
17  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18  * and/or sell copies of the Software, and to permit persons to whom the
19  * Software is furnished to do so, subject to the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be included
22  * in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  **********************************************************************
32  *
33  * $Log: mitab_ogr_driver.h,v $
34  * Revision 1.14  2007-03-22 20:01:36  dmorissette
35  * Added SPATIAL_INDEX_MODE=QUICK creation option (MITAB bug 1669)
36  *
37  * Revision 1.13  2004/07/07 16:11:39  fwarmerdam
38  * fixed up some single layer creation issues
39  *
40  * Revision 1.12  2004/02/27 21:06:03  fwarmerdam
41  * Better support for "single file" creation ... don't allow other layers to
42  * be created.  But *do* single file to satisfy the first layer creation request
43  * made.  Also, allow creating a datasource "on" an existing directory.
44  *
45  * Revision 1.11  2003/03/20 15:57:46  warmerda
46  * Added delete datasource support
47  *
48  * Revision 1.10  2002/02/08 16:52:16  warmerda
49  * added support for FORMAT=MIF option for creating layers
50  *
51  * Revision 1.9  2001/09/14 03:22:58  warmerda
52  * added RegisterOGRTAB() prototype
53  *
54  * Revision 1.8  2001/01/22 16:03:59  warmerda
55  * expanded tabs
56  *
57  * Revision 1.7  2000/01/26 18:17:00  warmerda
58  * reimplement OGR driver
59  *
60  * Revision 1.6  2000/01/15 22:30:44  daniel
61  * Switch to MIT/X-Consortium OpenSource license
62  *
63  * Revision 1.5  1999/12/15 16:28:17  warmerda
64  * fixed a few type problems
65  *
66  * Revision 1.4  1999/12/15 16:15:05  warmerda
67  * Avoid unused parameter warnings.
68  *
69  * Revision 1.3  1999/12/14 02:23:05  daniel
70  * Merged TAB+MIF DataSource/Driver into one using IMapInfoFile class
71  *
72  * Revision 1.2  1999/11/12 02:44:36  stephane
73  * added comment, change Register name.
74  *
75  * Revision 1.1  1999/11/08 21:05:51  svillene
76  * first revision
77  *
78  **********************************************************************/
79 
80 #include "mitab.h"
81 #include "ogrsf_frmts.h"
82 
83 #ifndef _MITAB_OGR_DRIVER_H_INCLUDED_
84 #define _MITAB_OGR_DRIVER_H_INCLUDED_
85 
86 /*=====================================================================
87  *            OGRTABDataSource Class
88  *
89  * These classes handle all the file types supported by the MITAB lib.
90  * through the IMapInfoFile interface.
91  *====================================================================*/
92 class OGRTABDataSource : public OGRDataSource
93 {
94   private:
95     char                *m_pszName;
96     char                *m_pszDirectory;
97 
98     int                 m_nLayerCount;
99     IMapInfoFile        **m_papoLayers;
100 
101     char                **m_papszOptions;
102     int                 m_bCreateMIF;
103     int                 m_bSingleFile;
104     int                 m_bSingleLayerAlreadyCreated;
105     GBool               m_bQuickSpatialIndexMode;
106     int                 m_bUpdate;
107 
108   public:
109                 OGRTABDataSource();
110     virtual     ~OGRTABDataSource();
111 
112     int         Open( GDALOpenInfo* poOpenInfo, int bTestOpen );
113     int         Create( const char *pszName, char ** papszOptions );
114 
GetName()115     const char  *GetName() { return m_pszName; }
116     int          GetLayerCount();
117     OGRLayer    *GetLayer( int );
118     int          TestCapability( const char * );
119 
120     OGRLayer    *ICreateLayer(const char *,
121                              OGRSpatialReference * = NULL,
122                              OGRwkbGeometryType = wkbUnknown,
123                              char ** = NULL );
124 
125     char        **GetFileList();
126 };
127 
128 void CPL_DLL RegisterOGRTAB();
129 
130 #endif /* _MITAB_OGR_DRIVER_H_INCLUDED_ */
131