ToolMap
Loading...
Searching...
No Matches
tmgisdatavectorshp.h
1/***************************************************************************
2 tmgisdatavectorshp.h
3 class for dealing with vector SHP 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_GISDATAVECTOR_SHP_H_
20#define _TM_GISDATAVECTOR_SHP_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 "gdal_alg.h"
31#include "gdal_priv.h"
32#include "ogr_api.h"
33#include "ogrsf_frmts.h"
34#include "tmgisdatavector.h"
35
37 protected:
38 GDALDataset* m_Datasource;
39 OGRLayer* m_Layer;
40 GDALDataset* m_RasterizeDataset;
41 OGRFeature* m_Feature;
42 int m_polyTotalRings;
43 int m_MultiFeaturesIterator;
44 int m_MultiFeaturesOid;
45
46 public:
48
50
51 // implementing viĀ±rtual function
52 virtual bool Open(const wxString& filename, bool bReadWrite = FALSE);
53
54 virtual bool Close();
55
56 virtual tmRealRect GetMinimalBoundingRectangle();
57
58 virtual TM_GIS_SPATIAL_TYPES GetSpatialType();
59
60 // virtual function for getting data & drawing
61 virtual bool SetSpatialFilter(tmRealRect filter, int type);
62
63 virtual bool SetAttributeFilter(const wxString& query);
64
65 virtual wxRealPoint* GetNextDataLine(int& nbvertex, long& oid, bool& isOver);
66
67 virtual wxRealPoint* GetNextDataPoint(long& oid, bool& isOver);
68
69 virtual int GetNextDataPolygonInfo(long& oid);
70
71 virtual wxRealPoint* GetNextDataPolygon(int currentring, int& nbvertex);
72
73 virtual OGRPolygon* GetNextDataOGRPolygon(long& oid);
74
75 virtual OGRFeature* GetNextFeature();
76
77 virtual bool ResetReading();
78
79 virtual OGRFeature* GetFeatureByOID(long oid);
80
81 bool SelectFeatureByOID(long oid);
82
83 virtual OGRGeometry* GetNextGeometry(bool restart, long& oid);
84
85 OGRLayer* GetLayerRef() {
86 return m_Layer;
87 }
88
89 // virtual function for metadata
90 virtual wxString GetMetaDataAsHtml();
91
92 virtual wxString GetDataSizeAsHtml(int iPrecision = 2);
93
94 // count
95 virtual int GetCount();
96
97 // fields functions
98 virtual int GetFieldsCount();
99
100 virtual bool GetFieldsName(wxArrayString& Fields, long oid = wxNOT_FOUND);
101
102 virtual bool GetFieldsValue(wxArrayString& values, long oid);
103
104 bool GetDistinctFieldsValue(const wxString& fieldname, wxArrayString& values);
105
106 // searching data
107 virtual wxArrayLong* SearchData(const tmRealRect& rect, int type);
108
109 virtual wxArrayLong* GetAllData();
110
111 virtual bool GetSnapCoord(const wxRealPoint& clickpt, double buffersize, wxArrayRealPoints& snapppts, int snaptype);
112
113 // creating file & fields
114 virtual bool CreateFile(const wxFileName& filename, int type);
115
116 virtual bool AddFieldText(const wxString& fieldname, int size);
117
118 virtual bool AddFieldNumeric(const wxString& fieldname, bool isfloat = false);
119
120 virtual bool AddFieldDate(const wxString& fieldname);
121
122 virtual long AddGeometry(OGRGeometry* Geom, const long& oid, int layertype = wxNOT_FOUND);
123
124 virtual bool SetNextFeature(bool resetreading = false);
125
126 virtual bool SetFieldValue(const wxString& value, int fieldtype, int iindex);
127
128 virtual long GetActualOID();
129
130 virtual void SetActualOID(long oid);
131
132 virtual bool UpdateFeature();
133
134 virtual void CloseGeometry();
135
136 virtual bool GetFieldNumeric(const wxString& fieldname, int& fieldvalue);
137
138 virtual bool SetFieldNumeric(const wxString& fieldname, int fieldvalue);
139
140 // bool CreateSpatialIndex(int indexdepth = wxNOT_FOUND);
141 bool ExecuteSQLQuery(const wxString& query);
142
143 long GetFeatureIDIntersectedBy(OGRGeometry* geometry);
144
145 long GetFeatureIDIntersectedOnRaster(OGRPoint* geometry);
146
147 bool Rasterize(double rasterizefactor);
148
149 void RemoveRasterizeFile();
150
151 virtual bool DeleteFile(const wxString& layername);
152
153 virtual bool CreateSpatialIndex(GDALProgressFunc progress, void* pfProgressData);
154
155 virtual bool CopyToFile(const wxFileName& filename, const wxString& drivername, bool overwrite);
156};
157
159 private:
160 public:
162
164
165 virtual bool CreateFile(const wxFileName& filename, int type);
166};
167
168#endif
Definition tmgisdatavectorshp.h:158
virtual bool CreateFile(const wxFileName &filename, int type)
Create the shp on the disk.
Definition tmgisdatavectorshp.cpp:1447
Definition tmgisdatavectorshp.h:36
virtual long GetActualOID()
Return the actual OID.
Definition tmgisdatavectorshp.cpp:979
virtual bool CreateFile(const wxFileName &filename, int type)
Create the shp on the disk.
Definition tmgisdatavectorshp.cpp:777
virtual wxArrayLong * GetAllData()
Get OID of all features back from the shapefile.
Definition tmgisdatavectorshp.cpp:752
virtual int GetCount()
Counting features in layer.
Definition tmgisdatavectorshp.cpp:544
virtual bool GetFieldsName(wxArrayString &Fields, long oid=wxNOT_FOUND)
Getting fields name.
Definition tmgisdatavectorshp.cpp:634
virtual long AddGeometry(OGRGeometry *Geom, const long &oid, int layertype=wxNOT_FOUND)
Add a geometry in the shapefile.
Definition tmgisdatavectorshp.cpp:924
virtual wxArrayLong * SearchData(const tmRealRect &rect, int type)
Search spatial data.
Definition tmgisdatavectorshp.cpp:716
virtual bool AddFieldNumeric(const wxString &fieldname, bool isfloat=false)
Add int field to the Shp.
Definition tmgisdatavectorshp.cpp:874
virtual bool SetFieldValue(const wxString &value, int fieldtype, int iindex)
Add value into a field.
Definition tmgisdatavectorshp.cpp:1013
virtual void SetActualOID(long oid)
Set the OID for the current Feature.
Definition tmgisdatavectorshp.cpp:997
virtual bool SetNextFeature(bool resetreading=false)
Move to next feature.
Definition tmgisdatavectorshp.cpp:957
virtual OGRPolygon * GetNextDataOGRPolygon(long &oid)
Get the actual feature as polygon.
Definition tmgisdatavectorshp.cpp:527
virtual bool AddFieldDate(const wxString &fieldname)
Add date field to the Shp.
Definition tmgisdatavectorshp.cpp:899
virtual wxString GetMetaDataAsHtml()
Get Metadata information well formated.
Definition tmgisdatavectorshp.cpp:561
virtual int GetFieldsCount()
Get the number of fields.
Definition tmgisdatavectorshp.cpp:620
virtual bool UpdateFeature()
Update the actual feature.
Definition tmgisdatavectorshp.cpp:1080
virtual bool AddFieldText(const wxString &fieldname, int size)
Add text fields to the Shp.
Definition tmgisdatavectorshp.cpp:848
virtual bool GetSnapCoord(const wxRealPoint &clickpt, double buffersize, wxArrayRealPoints &snapppts, int snaptype)
Get snapping coordinate.
Definition tmgisdatavectorshp.cpp:1137
virtual wxString GetDataSizeAsHtml(int iPrecision=2)
Getting Data size.
Definition tmgisdatavectorshp.cpp:587
virtual bool Open(const wxString &filename, bool bReadWrite=FALSE)
Generic open code.
Definition tmgisdatavectorshp.cpp:48
Definition tmgisdatavector.h:48
Class representing real rectangle.
Definition tmgisscale.h:44