ToolMap
Loading...
Searching...
No Matches
tmgisdata.h
1/***************************************************************************
2 tmgisdata.h
3 Main class for dealing with GIS data
4 -------------------
5 copyright : (C) 2007 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17// comment doxygen
18
19#ifndef _TM_GISDATA_H_
20#define _TM_GISDATA_H_
21
22// For compilers that support precompilation, includes "wx/wx.h".
23#include <wx/wxprec.h>
24
25// Include wxWidgets' headers
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include <wx/filename.h> // for dealing with filename class
31
32#include "../core/tmarraysize.h" // for wxArrayRealPoints
33#include "gdal_priv.h" // GDAL ACCES C++
34#include "geos_c.h" // GEOS accessing
35#include "ogrsf_frmts.h" // OGR accessing
36#include "tmgisscale.h" // for dealing with scale and real rectangle.
37#include "tmlayerproperties.h" // for GIS spatial types and tmLayerProperties
38
39class tmCoordConvert;
40
41/***************************************************************************/
48class tmGISData : public wxObject {
49 private:
50 static bool m_LogOn;
51 wxString m_ShortFileName;
52 wxString m_FullFileName;
53 tmCoordConvert* m_CoordConvert;
54
55 void InitMemberValue();
56
57 protected:
58 wxString GetMinimalBoundingRectangleAsHtml(int iprecision = 2);
59
60 int m_ClassType;
61
62 public:
63 tmGISData();
64
65 ~tmGISData();
66
67 // get type of class
68 int GetDataType() {
69 return m_ClassType;
70 }
71
72 void SetCoordConvert(tmCoordConvert* coordconvert) {
73 m_CoordConvert = coordconvert;
74 }
75
76 tmCoordConvert* GetCoordConvert() {
77 return m_CoordConvert;
78 }
79
80 // static functions for init
81 static void InitGISDrivers(bool bRaster = TRUE, bool bVector = TRUE);
82
83 static wxString GetAllSupportedGISFormatsWildcards();
84
85 static wxArrayString GetAllSupportedGISFormatsExtensions();
86
87 static tmGISData* CreateGISBasedOnType(const int& gis_format_index);
88
89 static tmGISData* CreateGISBasedOnExt(const wxString& extension);
90
91 // load layer
92 static tmGISData* LoadLayer(tmLayerProperties* layerprop);
93
94 static void EnableLogging(bool enable = true) {
95 m_LogOn = enable;
96 }
97
98 static bool IsLoggingEnabled() {
99 return m_LogOn;
100 }
101
102 // gis function
103 virtual bool Open(const wxString& filename, bool bReadWrite = TRUE);
104
105 virtual bool Close() {
106 return false;
107 }
108
109 virtual tmRealRect GetMinimalBoundingRectangle() {
110 return tmRealRect(0, 0, 0, 0);
111 }
112
113 virtual TM_GIS_SPATIAL_TYPES GetSpatialType() {
114 return LAYER_ERR;
115 }
116
117 // misc function
118 wxString GetShortFileName() {
119 return m_ShortFileName;
120 }
121
122 wxString GetFullFileName() {
123 return m_FullFileName;
124 }
125
126 // metadata functions
127 virtual wxString GetMetaDataAsHtml() {
128 return wxEmptyString;
129 }
130
131 virtual wxString GetDataSizeAsHtml(int iPrecision = 2) {
132 return wxEmptyString;
133 }
134
135 // search function
136 virtual wxArrayLong* SearchData(const tmRealRect& rect, int type) {
137 return nullptr;
138 }
139
140 virtual wxArrayLong* GetAllData() {
141 return nullptr;
142 }
143
144 virtual bool GetSnapCoord(const wxRealPoint& clickpt, double buffersize, wxArrayRealPoints& snapppts,
145 int snaptype) {
146 return false;
147 }
148
149 virtual bool IsPointSnapped(const wxRealPoint& point, int snaptype, long excludeoid = wxNOT_FOUND) {
150 return false;
151 }
152
153 virtual bool CreateSpatialIndex(GDALProgressFunc progress, void* pfProgressData) {
154 return false;
155 }
156
157 virtual int IsRaster() {
158 return wxNOT_FOUND;
159 }
160};
161
162#endif
Definition tmcoordconvert.h:33
Main class for dealing with GIS data.
Definition tmgisdata.h:48
static tmGISData * CreateGISBasedOnType(const int &gis_format_index)
Create an object of the specified format.
Definition tmgisdata.cpp:144
~tmGISData()
Destructor.
Definition tmgisdata.cpp:44
tmGISData()
Constructor.
Definition tmgisdata.cpp:35
static tmGISData * LoadLayer(tmLayerProperties *layerprop)
Call this function for loading a layer.
Definition tmgisdata.cpp:221
static wxString GetAllSupportedGISFormatsWildcards()
Return all supported formats.
Definition tmgisdata.cpp:97
static wxArrayString GetAllSupportedGISFormatsExtensions()
Returning all extensions in an array string.
Definition tmgisdata.cpp:116
virtual bool Open(const wxString &filename, bool bReadWrite=TRUE)
Generic open code.
Definition tmgisdata.cpp:179
wxString GetMinimalBoundingRectangleAsHtml(int iprecision=2)
Get Minimal bounding rectangle as html.
Definition tmgisdata.cpp:195
static void InitGISDrivers(bool bRaster=TRUE, bool bVector=TRUE)
Init the GDAL / OGR driver.
Definition tmgisdata.cpp:69
Storing object of layer type.
Definition tmlayerproperties.h:47
Class representing real rectangle.
Definition tmgisscale.h:44