Version: 0.6.0
sysop.h
1 /******************************************************************************
2  * Project: wxGIS
3  * Purpose: system operations.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009-2011,2013 Dmitry Baryshnikov
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 #pragma once
22 
23 #include "wxgis/datasource/datasource.h"
24 #include "wxgis/datasource/gdalinh.h"
25 
26 
27 WXDLLIMPEXP_GIS_DS inline bool IsFileDataset(wxGISEnumDatasetType eDSType, long SubType)
28 {
29  switch (eDSType)
30  {
31  case enumGISAny:
32  return false;
33  case enumGISFeatureDataset:
34  {
35  wxGISEnumVectorDatasetType eSubType = (wxGISEnumVectorDatasetType)SubType;
36  switch (eSubType)
37  {
38  case enumVecESRIShapefile:
39  case enumVecMapinfoTab:
40  case enumVecMapinfoMif:
41  case enumVecKML:
42  case enumVecKMZ:
43  case enumVecDXF:
44  return true;
45  case enumVecPostGIS:
46  return false;
47  case enumVecGML:
48  case enumVecGeoJSON:
49  case enumVecS57:
50  case enumVecCSV:
51  return true;
52  case enumVecWFS:
53  case enumVecMem:
54  case enumVecMAX:
55  case enumVecUnknown:
56  case enumVecFileDBLayer:
57  default:
58  return false;
59  }
60  }
61  break;
62  case enumGISTable:
63  {
64  wxGISEnumTableType eSubType = (wxGISEnumTableType)SubType;
65  switch (eSubType)
66  {
67  case enumTableUnknown:
68  return false;
69  case enumTableDBF:
70  return true;
71  case enumTablePostgres:
72  return false;
73  case enumTableQueryResult:
74  return false;
75  case enumTableMapinfoTab:
76  case enumTableMapinfoMif:
77  case enumTableCSV:
78  case enumTableODS:
79  case enumTableXLS:
80  case enumTableXLSX:
81  return true;
82  case enumTableFileDBLayer:
83  default:
84  return false;
85  }
86  }
87  break;
88  case enumGISRasterDataset:
89  {
90  wxGISEnumRasterDatasetType eSubType = (wxGISEnumRasterDatasetType)SubType;
91  switch (eSubType)
92  {
93  case enumRasterUnknown:
94  return false;
95  case enumRasterBmp:
96  case enumRasterTiff:
97  case enumRasterTil:
98  case enumRasterImg:
99  case enumRasterJpeg:
100  case enumRasterPng:
101  case enumRasterGif:
102  case enumRasterSAGA:
103  case enumRasterVRT:
104  return true;
105  case enumRasterFileDBLayer:
106  case enumRasterWMS:
107  case enumRasterWMSTMS:
108  return false;
109  default:
110  return false;
111  }
112  }
113  break;
114  case enumGISContainer:
115  {
116  wxGISEnumContainerType eSubType = (wxGISEnumContainerType)SubType;
117  switch (eSubType)
118  {
119  case enumContFolder:
120  case enumContGDBFolder:
121  case enumContDataset:
122  case enumContGDB:
123  return true;
124  case enumContRemoteDBConnection:
125  case enumContWebServiceConnection:
126  default:
127  return false;
128  }
129  }
130  break;
131  default:
132  return false;
133  }
134 }
135 
136 WXDLLIMPEXP_GIS_DS inline wxString GetDriverByType(wxGISEnumDatasetType eDSType, long SubType)
137 {
138  switch (eDSType)
139  {
140  case enumGISAny:
141  return wxEmptyString;
142  case enumGISFeatureDataset:
143  {
144  wxGISEnumVectorDatasetType eSubType = (wxGISEnumVectorDatasetType)SubType;
145  switch (eSubType)
146  {
147  case enumVecESRIShapefile:
148  return wxString(wxT("ESRI Shapefile"));
149  case enumVecMapinfoTab:
150  case enumVecMapinfoMif:
151  return wxString(wxT("MapInfo File"));
152  case enumVecKML:
153  case enumVecKMZ:
154  return wxString(wxT("LIBKML"));
155  case enumVecDXF:
156  return wxString(wxT("DXF"));
157  case enumVecPostGIS:
158  return wxString(wxT("PostgreSQL"));
159  case enumVecGML:
160  return wxString(wxT("GML"));
161  case enumVecWFS:
162  return wxString(wxT("WFS"));
163  case enumVecMem:
164  return wxString(wxT("Memory"));
165  case enumVecGeoJSON:
166  return wxString(wxT("GeoJSON"));
167  case enumVecCSV:
168  return wxString(wxT("CSV"));
169  case enumVecSXF:
170  return wxString(wxT("SXF"));
171  }
172  }
173  break;
174  case enumGISTable:
175  {
176  wxGISEnumTableType eSubType = (wxGISEnumTableType)SubType;
177  switch (eSubType)
178  {
179  case enumTableDBF:
180  return wxString(wxT("ESRI Shapefile"));
181  case enumTableMapinfoTab:
182  case enumTableMapinfoMif:
183  return wxString(wxT("MapInfo File"));
184  case enumTableCSV:
185  return wxString(wxT("CSV"));
186  case enumTablePostgres:
187  return wxString(wxT("PostgreSQL"));
188  case enumTableODS:
189  return wxString(wxT("ODS"));
190  case enumTableXLS:
191  return wxString(wxT("XLS"));
192  case enumTableXLSX:
193  return wxString(wxT("XLSX"));
194  case enumTableUnknown:
195  case enumTableQueryResult:
196  return wxEmptyString;
197  }
198  }
199  break;
200  case enumGISRasterDataset:
201  {
202  wxGISEnumRasterDatasetType eSubType = (wxGISEnumRasterDatasetType)SubType;
203  switch (eSubType)
204  {
205  case enumRasterBmp:
206  return wxString(wxT("BMP"));
207  case enumRasterTiff:
208  return wxString(wxT("GTiff"));
209  case enumRasterJpeg:
210  return wxString(wxT("JPEG"));
211  case enumRasterImg:
212  return wxString(wxT("HFA"));
213  case enumRasterPng:
214  return wxString(wxT("PNG"));
215  case enumRasterGif:
216  return wxString(wxT("GIF"));
217  case enumRasterSAGA:
218  return wxString(wxT("SAGA"));
219  case enumRasterTil:
220  return wxString(wxT("TIL"));
221  case enumRasterVRT:
222  return wxString(wxT("VRT"));
223  case enumRasterWMS:
224  case enumRasterWMSTMS:
225  return wxString(wxT("WMS"));
226  case enumRasterPostGIS:
227  return wxString(wxT("PostGISRaster"));
228  }
229  }
230  break;
231  case enumGISContainer:
232  default:
233  return wxEmptyString;
234  }
235  return wxEmptyString;
236 }
237 
238 
239 WXDLLIMPEXP_GIS_DS bool DeleteDir(const CPLString &sPath, ITrackCancel* const pTrackCancel = NULL);
240 WXDLLIMPEXP_GIS_DS bool MoveDir(const CPLString &sPathFrom, const CPLString &sPathTo, long mode, ITrackCancel* const pTrackCancel = NULL);
241 WXDLLIMPEXP_GIS_DS bool CopyDir(const CPLString &sPathFrom, const CPLString &sPathTo, long mode, ITrackCancel* const pTrackCancel = NULL);
242 WXDLLIMPEXP_GIS_DS bool CreateDir(const CPLString &sPath, long mode = 0755, ITrackCancel* const pTrackCancel = NULL);
243 WXDLLIMPEXP_GIS_DS bool DeleteFile(const CPLString &sPath, ITrackCancel* const pTrackCancel = NULL);
244 WXDLLIMPEXP_GIS_DS bool RenameFile(const CPLString &sOldPath, const CPLString &sNewPath, ITrackCancel* const pTrackCancel = NULL);
245 WXDLLIMPEXP_GIS_DS bool CopyFile(const CPLString &sSrcPath, const CPLString &sDestPath, ITrackCancel* const pTrackCance = NULL);
246 WXDLLIMPEXP_GIS_DS bool MoveFile(const CPLString &sSrcPath, const CPLString &sDestPath, ITrackCancel* const pTrackCancel = NULL);
247 WXDLLIMPEXP_GIS_DS wxFontEncoding GetEncodingFromCpg(const CPLString &sPath);
248 WXDLLIMPEXP_GIS_DS wxFontEncoding ToFontEncoding(const CPLString &soCodePage);
249 //WXDLLIMPEXP_GIS_DS CPLString GetEncodingName(wxFontEncoding eEncoding);
250 WXDLLIMPEXP_GIS_DS wxString ClearExt(const wxString &sPath);
251 WXDLLIMPEXP_GIS_DS bool IsFileHidden(const CPLString &sPath);
252 WXDLLIMPEXP_GIS_DS wxString CheckUniqName(const CPLString &sPath, const wxString &sName, const wxString &sExt, int nCounter = 0);
253 WXDLLIMPEXP_GIS_DS CPLString CheckUniqPath(const CPLString &sPath, const CPLString &sName, bool bIsFolder = false, const CPLString &sAdd = "_copy", int nCounter = 0);
254 WXDLLIMPEXP_GIS_DS CPLString GetUniqPath(const CPLString &szOriginalFullPath, const CPLString &szNewPath, const CPLString &szNewName);
255 WXDLLIMPEXP_GIS_DS CPLString Transliterate(const char* str);
256 WXDLLIMPEXP_GIS_DS CPLString GetExtension(const CPLString &sPath, const CPLString &sName = "");
257 WXDLLIMPEXP_GIS_DS wxString GetConvName(const CPLString &szPath, bool bIsPath = true);
A TrackCancel interface class.
Definition: core.h:144