19#ifndef _TM_GISDATAVECTOR_H_
20#define _TM_GISDATAVECTOR_H_
33const int tmGISVECTOR_OFFSET = 4;
35enum tmGISDATA_VECTOR_TYPES {
36 tmGIS_VECTOR_SHAPEFILE = tmGISVECTOR_OFFSET,
40static wxString tmGISDATA_VECTOR_TYPE_WILDCARDS[] = {wxTRANSLATE(
"Esri's shapefiles (*.shp)|*.shp"),
41 wxTRANSLATE(
"MySQL geometric table (*.MYD)|*.MYD")};
43static wxString tmGISDATA_VECTOR_TYPE_EXTENSION[] = {
51 bool ComputeLineLineIntersection(OGRLineString* line, OGRLineString* intersection,
const wxArrayInt& vertexindex,
52 OGRMultiPoint& resultpos);
54 bool SplitLinesAtVertex(OGRLineString* line,
const wxArrayInt& splitpos, OGRMultiLineString& splitedline);
56 OGRLineString* GetLineWithIntersection(OGRLineString* line, OGRLineString* intersection,
57 wxArrayInt& insertedvertex);
59 OGRLineString* GetLineWithIntersection(OGRLineString* line, OGRMultiLineString* multiline,
60 wxArrayInt& intertedvertex);
63 virtual wxString GetTableName(TOC_GENERIC_NAME type) {
83 static OGRGeometry* SafeBuffer(OGRGeometry* ogrgeom,
int size);
85 static OGRGeometry*
SafeIntersection(OGRGeometry* geom1, OGRGeometry* geom2);
87 static OGRGeometry*
SafeUnion(OGRGeometry* union1, OGRGeometry* line);
89 static OGRGeometry* CreateOGRGeometry(
const wxRealPoint& pt);
98 static void InitGISDriversVector();
100 static wxString GetAllVectorGISFormatsWildcards();
102 static tmGISDataVector* CreateGISVectorBasedOnType(
const int& gis_format_index);
104 static tmGISDataVector* CreateGISVectorBasedOnExt(
const wxString& extension);
106 static OGRGeometry* CreateOGRGeometry(
const tmRealRect& rect);
108 OGRLineString*
InsertVertex(OGRGeometry* pointbuffer, wxRealPoint ptclicked, OGRLineString* line,
111 OGRLineString*
InsertVertexMultiple(OGRLineString* line, OGRMultiPoint* vertex,
const wxArrayInt& point_pos);
114 virtual TM_GIS_SPATIAL_TYPES GetSpatialType() {
115 return LAYER_SPATIAL_UNKNOWN;
119 virtual bool SetSpatialFilter(
tmRealRect filter,
int type) {
123 virtual bool SetAttributeFilter(
const wxString& query) {
127 virtual wxRealPoint* GetNextDataLine(
int& nbvertex,
long& oid,
bool& isOver) {
131 virtual OGRFeature* GetNextFeature() {
135 virtual bool ResetReading() {
139 virtual wxRealPoint* GetNextDataPoint(
long& oid,
bool& isOver) {
143 virtual int GetNextDataPolygonInfo(
long& oid) {
147 virtual wxRealPoint* GetNextDataPolygon(
int currentring,
int& nbvertex) {
151 virtual OGRFeature* GetFeatureByOID(
long oid) {
155 virtual long AddGeometry(OGRGeometry* Geom,
const long& oid,
int layertype = wxNOT_FOUND) {
159 virtual bool UpdateGeometry(OGRGeometry* geom,
const long& oid) {
163 virtual bool SplitGeometry(OGRGeometryCollection* gCol,
const long& oid, wxArrayLong& AddedIds,
int layertype);
165 virtual OGRGeometryCollection* GetGeometryColByOID(wxArrayLong* OIDs) {
169 virtual void CloseGeometry() {
174 virtual OGRGeometry* GetNextGeometry(
bool restart,
long& oid) {
179 virtual bool DeleteFile(
const wxString& layername) {
184 virtual int GetCount() {
189 virtual int GetFieldsCount() {
193 virtual bool GetFieldsName(wxArrayString& Fields,
long oid = wxNOT_FOUND) {
197 virtual bool GetFieldsValue(wxArrayString& values,
long oid) {
205 bool CutLineAtVertex(
long oid,
const wxRealPoint& clickedpt,
int searchRadius,
int layertype);
210 bool CutLineGeometry(OGRLineString* line1, OGRLineString* line2, OGRMultiLineString& res1,
211 OGRMultiLineString& res2);
213 bool CutLineMultiple(OGRLineString* linetocut, OGRMultiLineString* cutlines, OGRMultiLineString& results);
216 bool LinesMerge(OGRMultiLineString* linetomerge, OGRGeometry** linemerged);
219 virtual wxArrayLong* SearchIntersectingGeometry(OGRGeometry* intersectinggeom) {
223 virtual int IsRaster() {
Definition tmgisdatavector.h:48
bool CheckGEOSIntersection(GEOSGeom *rect, GEOSGeom *object)
Compute real GEOS intersection (not bounding box)
Definition tmgisdatavector.cpp:104
bool CutLineMultiple(OGRLineString *linetocut, OGRMultiLineString *cutlines, OGRMultiLineString &results)
Cut one line with multiple line.
Definition tmgisdatavector.cpp:585
static OGRGeometry * SafeIntersection(OGRGeometry *geom1, OGRGeometry *geom2)
Compute intersection.
Definition tmgisdatavector.cpp:368
static OGRGeometry * SafeUnion(OGRGeometry *union1, OGRGeometry *line)
Compute Union.
Definition tmgisdatavector.cpp:407
bool GetBeginEndInterseciton(OGRGeometry *geometry, OGRGeometry *buffer, wxArrayRealPoints &points)
Search if a Begin/End vertex intersect the passed geometry.
Definition tmgisdatavector.cpp:269
bool CheckGEOSCrosses(GEOSGeom *g1, GEOSGeom *g2)
Check for crossing (not bounding box)
Definition tmgisdatavector.cpp:121
bool CutLineGeometry(OGRLineString *line1, OGRLineString *line2, OGRMultiLineString &res1, OGRMultiLineString &res2)
Cut two lines where they intesects.
Definition tmgisdatavector.cpp:542
bool GetVertexIntersection(OGRGeometry *geometry, OGRGeometry *buffer, wxArrayRealPoints &points)
Search if a vertex intersect the passed geometry.
Definition tmgisdatavector.cpp:200
wxString GetFieldsMetadata()
Formating fields info into html string.
Definition tmgisdatavector.cpp:67
virtual bool SplitGeometry(OGRGeometryCollection *gCol, const long &oid, wxArrayLong &AddedIds, int layertype)
Save splitted geometry to file.
Definition tmgisdatavector.cpp:786
static OGRGeometry * SafeCreateFromGEOS(GEOSGeom geom)
Safe conversion function.
Definition tmgisdatavector.cpp:307
bool CutLineAtVertex(long oid, const wxRealPoint &clickedpt, int searchRadius, int layertype)
Cut line in two at specified point.
Definition tmgisdatavector.cpp:453
GEOSGeom CreateGEOSGeometry(OGRGeometry *geom)
Create a GEOS geometry.
Definition tmgisdatavector.cpp:141
OGRLineString * InsertVertexMultiple(OGRLineString *line, OGRMultiPoint *vertex, const wxArrayInt &point_pos)
Insert multiple vertex into line.
Definition tmgisdatavector.cpp:950
OGRLineString * InsertVertex(OGRGeometry *pointbuffer, wxRealPoint ptclicked, OGRLineString *line, int &inseredvertex)
Insert a vertex in a passed line.
Definition tmgisdatavector.cpp:893
bool LinesMerge(OGRMultiLineString *linetomerge, OGRGeometry **linemerged)
Merge lines.
Definition tmgisdatavector.cpp:989
Main class for dealing with GIS data.
Definition tmgisdata.h:48
Class representing real rectangle.
Definition tmgisscale.h:44