ToolMap
Loading...
Searching...
No Matches
tmGISDataVectorMYSQL Class Reference
Inheritance diagram for tmGISDataVectorMYSQL:
tmGISDataVector tmGISData

Public Member Functions

void SetProject (PrjDefMemManage *prj)
 
virtual bool Open (const wxString &filename, bool bReadWrite=FALSE)
 Generic open code.
 
virtual tmRealRect GetMinimalBoundingRectangle ()
 
virtual TM_GIS_SPATIAL_TYPES GetSpatialType ()
 Getting Data Spatial type.
 
virtual bool SetSpatialFilter (tmRealRect filter, int type)
 Set a spatial filter for geometric data.
 
virtual wxRealPoint * GetNextDataLine (int &nbvertex, long &oid, bool &isOver)
 
virtual wxRealPoint * GetNextDataPoint (long &oid, bool &isOver)
 
OGRPoint * GetNextDataPointWithAttrib (long &oid, wxArrayString &values)
 
virtual OGRLineString * GetNextDataLine (long &oid)
 
virtual OGRPoint * GetOGRNextDataPoint (long &oid)
 
virtual OGRFeature * GetFeatureByOID (long oid)
 Get the geometry for specified oid.
 
virtual long AddGeometry (OGRGeometry *Geom, const long &oid, int layertype=wxNOT_FOUND)
 Add geometry into database.
 
virtual bool UpdateGeometry (OGRGeometry *geom, const long &oid)
 Update the geometry for specified OID.
 
virtual OGRGeometryCollection * GetGeometryColByOID (wxArrayLong *OIDs)
 Get all geometries passed as array.
 
virtual OGRGeometry * GetNextGeometry (bool restart, long &oid)
 
virtual wxString GetMetaDataAsHtml ()
 Get Metadata information well formated.
 
virtual wxString GetDataSizeAsHtml (int iPrecision=2)
 Getting Database size.
 
virtual int GetFieldsCount ()
 
virtual bool GetFieldsName (wxArrayString &Fields, long oid=wxNOT_FOUND)
 
virtual bool GetFieldsValue (wxArrayString &values, long oid)
 
virtual int GetCount ()
 Getting number of features.
 
virtual wxArrayLong * SearchData (const tmRealRect &rect, int type)
 Search spatial data.
 
virtual wxArrayLong * GetAllData ()
 Get All OID back from the MySQL layer.
 
virtual wxArrayLong * SearchIntersectingGeometry (OGRGeometry *intersectinggeom)
 Search data for intersection.
 
virtual bool GetSnapCoord (const wxRealPoint &clickpt, double buffersize, wxArrayRealPoints &snapppts, int snaptype)
 Get snapping coordinate.
 
virtual bool IsPointSnapped (const wxRealPoint &point, int snaptype, long excludeoid=wxNOT_FOUND)
 
- Public Member Functions inherited from tmGISDataVector
OGRLineString * InsertVertex (OGRGeometry *pointbuffer, wxRealPoint ptclicked, OGRLineString *line, int &inseredvertex)
 Insert a vertex in a passed line.
 
OGRLineString * InsertVertexMultiple (OGRLineString *line, OGRMultiPoint *vertex, const wxArrayInt &point_pos)
 Insert multiple vertex into line.
 
virtual bool SetAttributeFilter (const wxString &query)
 
virtual OGRFeature * GetNextFeature ()
 
virtual bool ResetReading ()
 
virtual int GetNextDataPolygonInfo (long &oid)
 
virtual wxRealPoint * GetNextDataPolygon (int currentring, int &nbvertex)
 
virtual bool SplitGeometry (OGRGeometryCollection *gCol, const long &oid, wxArrayLong &AddedIds, int layertype)
 Save splitted geometry to file.
 
virtual void CloseGeometry ()
 
virtual bool DeleteFile (const wxString &layername)
 
wxString GetFieldsMetadata ()
 Formating fields info into html string.
 
bool CutLineAtVertex (long oid, const wxRealPoint &clickedpt, int searchRadius, int layertype)
 Cut line in two at specified point.
 
bool CutLineGeometry (OGRLineString *line1, OGRLineString *line2, OGRMultiLineString &res1, OGRMultiLineString &res2)
 Cut two lines where they intesects.
 
bool CutLineMultiple (OGRLineString *linetocut, OGRMultiLineString *cutlines, OGRMultiLineString &results)
 Cut one line with multiple line.
 
bool LinesMerge (OGRMultiLineString *linetomerge, OGRGeometry **linemerged)
 Merge lines.
 
virtual int IsRaster ()
 
- Public Member Functions inherited from tmGISData
 tmGISData ()
 Constructor.
 
 ~tmGISData ()
 Destructor.
 
int GetDataType ()
 
void SetCoordConvert (tmCoordConvert *coordconvert)
 
tmCoordConvertGetCoordConvert ()
 
virtual bool Close ()
 
wxString GetShortFileName ()
 
wxString GetFullFileName ()
 
virtual bool CreateSpatialIndex (GDALProgressFunc progress, void *pfProgressData)
 

Static Public Member Functions

static void SetDataBaseHandle (DataBaseTM *db)
 
static DataBaseTMGetDataBaseHandle ()
 
- Static Public Member Functions inherited from tmGISDataVector
static void InitGISDriversVector ()
 
static wxString GetAllVectorGISFormatsWildcards ()
 
static tmGISDataVectorCreateGISVectorBasedOnType (const int &gis_format_index)
 
static tmGISDataVectorCreateGISVectorBasedOnExt (const wxString &extension)
 
static OGRGeometry * CreateOGRGeometry (const tmRealRect &rect)
 Create a OGR geometry.
 
- Static Public Member Functions inherited from tmGISData
static void InitGISDrivers (bool bRaster=TRUE, bool bVector=TRUE)
 Init the GDAL / OGR driver.
 
static wxString GetAllSupportedGISFormatsWildcards ()
 Return all supported formats.
 
static wxArrayString GetAllSupportedGISFormatsExtensions ()
 Returning all extensions in an array string.
 
static tmGISDataCreateGISBasedOnType (const int &gis_format_index)
 Create an object of the specified format.
 
static tmGISDataCreateGISBasedOnExt (const wxString &extension)
 
static tmGISDataLoadLayer (tmLayerProperties *layerprop)
 Call this function for loading a layer.
 
static void EnableLogging (bool enable=true)
 
static bool IsLoggingEnabled ()
 

Protected Member Functions

bool CheckGeometryFields (const wxString &tablename)
 
OGRGeometry * CreateDataBaseGeometry (MYSQL_ROW &row, const tmArrayULong &row_lengths, int geometry_col=0)
 
long GetOid (MYSQL_ROW &row, const int &col)
 Get object ID from MYSQL row results.
 
virtual wxString GetTableName (TOC_GENERIC_NAME type)
 
- Protected Member Functions inherited from tmGISDataVector
bool CheckGEOSIntersection (GEOSGeom *rect, GEOSGeom *object)
 Compute real GEOS intersection (not bounding box)
 
bool CheckGEOSCrosses (GEOSGeom *g1, GEOSGeom *g2)
 Check for crossing (not bounding box)
 
GEOSGeom CreateGEOSGeometry (OGRGeometry *geom)
 Create a GEOS geometry.
 
GEOSGeom CreateGEOSGeometry (const tmRealRect &rect)
 Create a GEOS geometry.
 
bool GetVertexIntersection (OGRGeometry *geometry, OGRGeometry *buffer, wxArrayRealPoints &points)
 Search if a vertex intersect the passed geometry.
 
bool GetBeginEndInterseciton (OGRGeometry *geometry, OGRGeometry *buffer, wxArrayRealPoints &points)
 Search if a Begin/End vertex intersect the passed geometry.
 
- Protected Member Functions inherited from tmGISData
wxString GetMinimalBoundingRectangleAsHtml (int iprecision=2)
 Get Minimal bounding rectangle as html.
 

Additional Inherited Members

- Static Protected Member Functions inherited from tmGISDataVector
static OGRGeometry * SafeCreateFromGEOS (GEOSGeom geom)
 Safe conversion function.
 
static OGRGeometry * SafeBuffer (OGRGeometry *ogrgeom, int size)
 
static OGRGeometry * SafeIntersection (OGRGeometry *geom1, OGRGeometry *geom2)
 Compute intersection.
 
static OGRGeometry * SafeUnion (OGRGeometry *union1, OGRGeometry *line)
 Compute Union.
 
static OGRGeometry * CreateOGRGeometry (const wxRealPoint &pt)
 
- Protected Attributes inherited from tmGISData
int m_ClassType
 

Member Function Documentation

◆ AddGeometry()

long tmGISDataVectorMYSQL::AddGeometry ( OGRGeometry *  Geom,
const long &  oid,
int  layertype = wxNOT_FOUND 
)
virtual

Add geometry into database.

Parameters
GeomThe Geometry to Add
oidNo oid may be specified for MySQL, it's auto-incremented
layertypeOne of the TOC_GENERIC_NAME
Returns
OID of last inserted item or -1 if an errror occur
Author
Lucien Schreiber (c) CREALP 2009
Date
06 February 2009

Reimplemented from tmGISDataVector.

◆ GetAllData()

wxArrayLong * tmGISDataVectorMYSQL::GetAllData ( )
virtual

Get All OID back from the MySQL layer.

Author
Lucien Schreiber (c) CREALP 2009
Date
31 March 2009

Reimplemented from tmGISData.

◆ GetCount()

int tmGISDataVectorMYSQL::GetCount ( )
virtual

Getting number of features.

Returns
Number of feature in the layer
Author
Lucien Schreiber (c) CREALP 2008
Date
23 October 2008

Reimplemented from tmGISDataVector.

◆ GetDataSizeAsHtml()

wxString tmGISDataVectorMYSQL::GetDataSizeAsHtml ( int  iPrecision = 2)
virtual

Getting Database size.

Return the size of the database

Returns
Human readable and html compliant string containing data size
Author
Lucien Schreiber (c) CREALP 2008
Date
23 October 2008

Reimplemented from tmGISData.

◆ GetFeatureByOID()

OGRFeature * tmGISDataVectorMYSQL::GetFeatureByOID ( long  oid)
virtual

Get the geometry for specified oid.

Parameters
oidThe OID of the searched feature
Returns
A valid OGRGeometry (caller must delete the returned geometry) or nullptr if an error occur
Author
Lucien Schreiber (c) CREALP 2009
Date
06 February 2009

Reimplemented from tmGISDataVector.

◆ GetFieldsCount()

int tmGISDataVectorMYSQL::GetFieldsCount ( )
virtual

Reimplemented from tmGISDataVector.

◆ GetFieldsName()

bool tmGISDataVectorMYSQL::GetFieldsName ( wxArrayString &  Fields,
long  oid = wxNOT_FOUND 
)
virtual

Reimplemented from tmGISDataVector.

◆ GetFieldsValue()

bool tmGISDataVectorMYSQL::GetFieldsValue ( wxArrayString &  values,
long  oid 
)
virtual

Reimplemented from tmGISDataVector.

◆ GetGeometryColByOID()

OGRGeometryCollection * tmGISDataVectorMYSQL::GetGeometryColByOID ( wxArrayLong *  OIDs)
virtual

Get all geometries passed as array.

Parameters
OIDsList of all OIDs for getting geometries
Returns
All geometries as a geometry collection or nullptr if an error occur user should delete the returned geometries after use.
Author
Lucien Schreiber (c) CREALP 2009
Date
27 February 2009

Reimplemented from tmGISDataVector.

◆ GetMetaDataAsHtml()

wxString tmGISDataVectorMYSQL::GetMetaDataAsHtml ( )
virtual

Get Metadata information well formated.

Returns
An html string to be displayed in the properties dialog
Author
Lucien Schreiber (c) CREALP 2008
Date
22 October 2008

Reimplemented from tmGISData.

◆ GetMinimalBoundingRectangle()

tmRealRect tmGISDataVectorMYSQL::GetMinimalBoundingRectangle ( )
virtual

Reimplemented from tmGISData.

◆ GetNextDataLine()

wxRealPoint * tmGISDataVectorMYSQL::GetNextDataLine ( int &  nbvertex,
long &  oid,
bool &  isOver 
)
virtual

Reimplemented from tmGISDataVector.

◆ GetNextDataPoint()

wxRealPoint * tmGISDataVectorMYSQL::GetNextDataPoint ( long &  oid,
bool &  isOver 
)
virtual

Reimplemented from tmGISDataVector.

◆ GetNextGeometry()

OGRGeometry * tmGISDataVectorMYSQL::GetNextGeometry ( bool  restart,
long &  oid 
)
virtual

Reimplemented from tmGISDataVector.

◆ GetOid()

long tmGISDataVectorMYSQL::GetOid ( MYSQL_ROW &  row,
const int &  col 
)
protected

Get object ID from MYSQL row results.

Parameters
rowAdress of a row MySQL result
colThe zero based index of the column in which are stored the OID
Returns
the object OID or 0 if an error occured
Author
Lucien Schreiber (c) CREALP 2008
Date
30 October 2008

◆ GetSnapCoord()

bool tmGISDataVectorMYSQL::GetSnapCoord ( const wxRealPoint &  clickpt,
double  buffersize,
wxArrayRealPoints &  snapppts,
int  snaptype 
)
virtual

Get snapping coordinate.

Return, if found, the closest existing coordinate for snapping

Parameters
clickptThe real coordinate of the clicked point
iBufferthe size of the buffer in map unit
snapptthe returned snapping coordinate if function return true
snaptypethe type of snapping : tmSNAPPING_BEGIN_END or tmSNAPPING_VERTEX
Returns
true if a snapping coordinate was found, false otherwise
Author
Lucien Schreiber (c) CREALP 2009
Date
29 January 2009

Reimplemented from tmGISData.

◆ GetSpatialType()

TM_GIS_SPATIAL_TYPES tmGISDataVectorMYSQL::GetSpatialType ( )
virtual

Getting Data Spatial type.

Returns
One of the TM_GIS_SPATIAL_TYPES values :
  • LAYER_SPATIAL_LINE
  • LAYER_SPATIAL_POINT
  • LAYER_SPATIAL_POLYGON
  • LAYER_ERR
Author
Lucien Schreiber (c) CREALP 2008
Date
23 October 2008

Reimplemented from tmGISDataVector.

◆ GetTableName()

wxString tmGISDataVectorMYSQL::GetTableName ( TOC_GENERIC_NAME  type)
protectedvirtual

Reimplemented from tmGISDataVector.

◆ IsPointSnapped()

bool tmGISDataVectorMYSQL::IsPointSnapped ( const wxRealPoint &  point,
int  snaptype,
long  excludeoid = wxNOT_FOUND 
)
virtual

Reimplemented from tmGISData.

◆ Open()

bool tmGISDataVectorMYSQL::Open ( const wxString &  filename,
bool  bReadWrite = FALSE 
)
virtual

Generic open code.

Mainly init member values used by all GIS class

Parameters
filenamepath and name of the GIS data to open
bReadWriteShould we open the dataset for r/w operations ?
Returns
Allways TRUE
Author
Lucien Schreiber (c) CREALP 2008
Date
14 July 2008

Reimplemented from tmGISData.

◆ SearchData()

wxArrayLong * tmGISDataVectorMYSQL::SearchData ( const tmRealRect rect,
int  type 
)
virtual

Search spatial data.

Parameters
rectReal rectangle for searching data
typeLayertype see tmLayerProperties
Returns
An array containing OID of data found or nullptr if nothing found
Note
This function needs GEOS to ensure that real intersection is computed
Author
Lucien Schreiber (c) CREALP 2008
Date
29 October 2008

Reimplemented from tmGISData.

◆ SearchIntersectingGeometry()

wxArrayLong * tmGISDataVectorMYSQL::SearchIntersectingGeometry ( OGRGeometry *  intersectinggeom)
virtual

Search data for intersection.

Search in all dataset for objects intersecting the passed geometry. First we specify a rectangle (for spatial filter) and then we search with GEOS inside the results

Parameters
intersectinggeomThe geometry we search for intersection
Returns
Adress of an array of OID, or nullptr if nothing found
Author
Lucien Schreiber (c) CREALP 2009
Date
09 February 2009

Reimplemented from tmGISDataVector.

◆ SetSpatialFilter()

bool tmGISDataVectorMYSQL::SetSpatialFilter ( tmRealRect  filter,
int  type 
)
virtual

Set a spatial filter for geometric data.

This function sets a Geometric filter and ask the database for all data inside this filter

Parameters
filterthe desired spatial filter
typeone of the TOC_GENERIC_NAME, used to get the database table name
Returns
TRUE if the query works
Author
Lucien Schreiber (c) CREALP 2008
Date
09 September 2008

Reimplemented from tmGISDataVector.

◆ UpdateGeometry()

bool tmGISDataVectorMYSQL::UpdateGeometry ( OGRGeometry *  geom,
const long &  oid 
)
virtual

Update the geometry for specified OID.

Parameters
geomThe Geometry to Add
oidThe OID we want to update
Returns
true if the geometry was added successfull
Author
Lucien Schreiber (c) CREALP 2009
Date
06 February 2009

Reimplemented from tmGISDataVector.


The documentation for this class was generated from the following files: