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

Public Member Functions

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 TM_GIS_SPATIAL_TYPES GetSpatialType ()
 
virtual bool SetSpatialFilter (tmRealRect filter, int type)
 
virtual bool SetAttributeFilter (const wxString &query)
 
virtual wxRealPoint * GetNextDataLine (int &nbvertex, long &oid, bool &isOver)
 
virtual OGRFeature * GetNextFeature ()
 
virtual bool ResetReading ()
 
virtual wxRealPoint * GetNextDataPoint (long &oid, bool &isOver)
 
virtual int GetNextDataPolygonInfo (long &oid)
 
virtual wxRealPoint * GetNextDataPolygon (int currentring, int &nbvertex)
 
virtual OGRFeature * GetFeatureByOID (long oid)
 
virtual long AddGeometry (OGRGeometry *Geom, const long &oid, int layertype=wxNOT_FOUND)
 
virtual bool UpdateGeometry (OGRGeometry *geom, const long &oid)
 
virtual bool SplitGeometry (OGRGeometryCollection *gCol, const long &oid, wxArrayLong &AddedIds, int layertype)
 Save splitted geometry to file.
 
virtual OGRGeometryCollection * GetGeometryColByOID (wxArrayLong *OIDs)
 
virtual void CloseGeometry ()
 
virtual OGRGeometry * GetNextGeometry (bool restart, long &oid)
 
virtual bool DeleteFile (const wxString &layername)
 
virtual int GetCount ()
 
virtual int GetFieldsCount ()
 
virtual bool GetFieldsName (wxArrayString &Fields, long oid=wxNOT_FOUND)
 
virtual bool GetFieldsValue (wxArrayString &values, long oid)
 
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 wxArrayLong * SearchIntersectingGeometry (OGRGeometry *intersectinggeom)
 
virtual int IsRaster ()
 
- Public Member Functions inherited from tmGISData
 tmGISData ()
 Constructor.
 
 ~tmGISData ()
 Destructor.
 
int GetDataType ()
 
void SetCoordConvert (tmCoordConvert *coordconvert)
 
tmCoordConvertGetCoordConvert ()
 
virtual bool Open (const wxString &filename, bool bReadWrite=TRUE)
 Generic open code.
 
virtual bool Close ()
 
virtual tmRealRect GetMinimalBoundingRectangle ()
 
wxString GetShortFileName ()
 
wxString GetFullFileName ()
 
virtual wxString GetMetaDataAsHtml ()
 
virtual wxString GetDataSizeAsHtml (int iPrecision=2)
 
virtual wxArrayLong * SearchData (const tmRealRect &rect, int type)
 
virtual wxArrayLong * GetAllData ()
 
virtual bool GetSnapCoord (const wxRealPoint &clickpt, double buffersize, wxArrayRealPoints &snapppts, int snaptype)
 
virtual bool IsPointSnapped (const wxRealPoint &point, int snaptype, long excludeoid=wxNOT_FOUND)
 
virtual bool CreateSpatialIndex (GDALProgressFunc progress, void *pfProgressData)
 

Static Public Member Functions

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

virtual wxString GetTableName (TOC_GENERIC_NAME type)
 
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.
 

Static Protected Member Functions

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)
 

Additional Inherited Members

- Protected Attributes inherited from tmGISData
int m_ClassType
 

Member Function Documentation

◆ AddGeometry()

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

Reimplemented in tmGISDataVectorMYSQL, and tmGISDataVectorSHP.

◆ CheckGEOSCrosses()

bool tmGISDataVector::CheckGEOSCrosses ( GEOSGeom *  g1,
GEOSGeom *  g2 
)
protected

Check for crossing (not bounding box)

This function may be used for ensuring that a geometry really crosses another one

Note
Needs GEOS library
Parameters
g1GEOS geometry
g2GEOS geometry
Returns
true if g2 really crosses g1.
Author
Lucien Schreiber (c) CREALP 2008
Date
10 February 2009

◆ CheckGEOSIntersection()

bool tmGISDataVector::CheckGEOSIntersection ( GEOSGeom *  rect,
GEOSGeom *  object 
)
protected

Compute real GEOS intersection (not bounding box)

This function may be used for ensuring that a geometry really intersects another one

Note
Needs GEOS library
Parameters
rectGEOS geometry of intersecting rectangle
objectGEOS geometry of object
Returns
true if object really intersects rect.
Author
Lucien Schreiber (c) CREALP 2008
Date
31 October 2008

◆ CreateGEOSGeometry() [1/2]

GEOSGeom tmGISDataVector::CreateGEOSGeometry ( const tmRealRect rect)
protected

Create a GEOS geometry.

This function may be used for creating a GEOS compatible geometry from an real rectangle

Note
Needs GEOS library
Warning
Don't forget to destroy Object returned with : GEOSGeom_destroy(GEOSGeometry* g)
Parameters
rectA tmRealRect object
Returns
Valid GEOS object or nullptr if an error occur. Don't forget to destroy the returned object with GEOSGeom_destroy(GEOSGeometry* g);
Author
Lucien Schreiber (c) CREALP 2008
Date
31 October 2008

◆ CreateGEOSGeometry() [2/2]

GEOSGeom tmGISDataVector::CreateGEOSGeometry ( OGRGeometry *  geom)
protected

Create a GEOS geometry.

This function may be used for creating a GEOS compatible geometry from an OGR object

Note
Needs GEOS library
Warning
Don't forget to destroy Object returned with : GEOSGeom_destroy(GEOSGeometry* g)
Parameters
geomA valid OGR geometry
Returns
Valid GEOS object or nullptr if an error occur. Don't forget to destroy the returned object with GEOSGeom_destroy(GEOSGeometry* g);
Author
Lucien Schreiber (c) CREALP 2008
Date
31 October 2008

◆ CreateOGRGeometry()

OGRGeometry * tmGISDataVector::CreateOGRGeometry ( const tmRealRect rect)
static

Create a OGR geometry.

Parameters
rectobject of type : tmRealRect
Returns
return an OGRgeometry or null
Author
Lucien Schreiber (c) CREALP 2008
Date
31 October 2008

◆ CutLineAtVertex()

bool tmGISDataVector::CutLineAtVertex ( long  oid,
const wxRealPoint &  clickedpt,
int  searchRadius,
int  layertype 
)

Cut line in two at specified point.

Parameters
oidOID of the line to cut
clickedptthe coordinate of the clicked point (real)
searchradiusSerching vertex in this radius
layertypeType of the layer.
Returns
true if succeed, false otherwise
Author
Lucien Schreiber (c) CREALP 2009
Date
06 February 2009

◆ CutLineGeometry()

bool tmGISDataVector::CutLineGeometry ( OGRLineString *  line1,
OGRLineString *  line2,
OGRMultiLineString &  res1,
OGRMultiLineString &  res2 
)

Cut two lines where they intesects.

Parameters
line1The first passed line for intersection
line2The second line passed for intersection
res1Resulting multi-lines for first passed lines
res2Resulting multi-lines for second passed line
Returns
true if the function works.
Author
Lucien Schreiber (c) CREALP 2009
Date
10 February 2009

◆ CutLineMultiple()

bool tmGISDataVector::CutLineMultiple ( OGRLineString *  linetocut,
OGRMultiLineString *  cutlines,
OGRMultiLineString &  results 
)

Cut one line with multiple line.

Parameters
linetocutThe line to cut
cutlinesLines used for cutting
resultsall resulting lines
Returns
true if operation succeed, false otherwise
Author
Lucien Schreiber (c) CREALP 2009
Date
12 February 2009

◆ GetBeginEndInterseciton()

bool tmGISDataVector::GetBeginEndInterseciton ( OGRGeometry *  geometry,
OGRGeometry *  buffer,
wxArrayRealPoints &  points 
)
protected

Search if a Begin/End vertex intersect the passed geometry.

This function is very close to the tmGISDataVector::GetVertexIntersection but search only for begin / end vertex. So it works only for lines

Parameters
geometryA valid geometry (line ONLY)
bufferThe buffer for intersection
Returns
the vertex intersecting the geometry (dont forget to delete) or null if nothing found
Author
Lucien Schreiber (c) CREALP 2009
Date
29 January 2009

◆ GetCount()

virtual int tmGISDataVector::GetCount ( )
inlinevirtual

Reimplemented in tmGISDataVectorMYSQL, and tmGISDataVectorSHP.

◆ GetFeatureByOID()

virtual OGRFeature * tmGISDataVector::GetFeatureByOID ( long  oid)
inlinevirtual

Reimplemented in tmGISDataVectorMYSQL.

◆ GetFieldsCount()

virtual int tmGISDataVector::GetFieldsCount ( )
inlinevirtual

Reimplemented in tmGISDataVectorSHP.

◆ GetFieldsMetadata()

wxString tmGISDataVector::GetFieldsMetadata ( )

Formating fields info into html string.

Returns
The html compliant string
Author
Lucien Schreiber (c) CREALP 2008
Date
23 October 2008

◆ GetFieldsName()

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

Reimplemented in tmGISDataVectorSHP.

◆ GetGeometryColByOID()

virtual OGRGeometryCollection * tmGISDataVector::GetGeometryColByOID ( wxArrayLong *  OIDs)
inlinevirtual

Reimplemented in tmGISDataVectorMYSQL.

◆ GetSpatialType()

virtual TM_GIS_SPATIAL_TYPES tmGISDataVector::GetSpatialType ( )
inlinevirtual

Reimplemented from tmGISData.

Reimplemented in tmGISDataVectorMYSQL.

◆ GetVertexIntersection()

bool tmGISDataVector::GetVertexIntersection ( OGRGeometry *  geometry,
OGRGeometry *  buffer,
wxArrayRealPoints &  points 
)
protected

Search if a vertex intersect the passed geometry.

Check for all geometry (point, lines, polygon) if a vertex intersect the passed geometry. If true this vertex is returned

Parameters
geometryA valid geometry (point, line, polygon)
bufferThe buffer for intersection
Returns
the vertex intersecting the geometry (dont forget to delete) or null if nothing found
Author
Lucien Schreiber (c) CREALP 2009
Date
29 January 2009

◆ InsertVertex()

OGRLineString * tmGISDataVector::InsertVertex ( OGRGeometry *  pointbuffer,
wxRealPoint  ptclicked,
OGRLineString *  line,
int &  inseredvertex 
)

Insert a vertex in a passed line.

Parameters
pointbufferthe buffer (polygon) intersecting the line
ptclickedthe coordinate of the clicked point
linethe line
inseredvertexreturn the number of the inserted vertex
Returns
The new line with the inserted vertex (caller should delete the returned Geometry)
Author
Lucien Schreiber (c) CREALP 2009
Date
06 February 2009

◆ InsertVertexMultiple()

OGRLineString * tmGISDataVector::InsertVertexMultiple ( OGRLineString *  line,
OGRMultiPoint *  vertex,
const wxArrayInt &  point_pos 
)

Insert multiple vertex into line.

This function insert vertex at the right place into a line, based on where intersect the vertex to insert.

Parameters
linethe passed geometry
vertexan OGRMultiPoint structure containing all vertex to insert
point_posindex where the vertex are to be insered
Returns
The modified line with inserted vertex (must be destroyed by caller)
Author
Lucien Schreiber (c) CREALP 2009
Date
10 February 2009

◆ IsRaster()

virtual int tmGISDataVector::IsRaster ( )
inlinevirtual

Reimplemented from tmGISData.

◆ LinesMerge()

bool tmGISDataVector::LinesMerge ( OGRMultiLineString *  linetomerge,
OGRGeometry **  linemerged 
)

Merge lines.

Parameters
linetomergelines to merge
linemergedthe resulting geometry if function return true.
Returns
true if merging was successfull, false otherwise
Author
Lucien Schreiber (c) CREALP 2009
Date
27 February 2009

◆ SafeCreateFromGEOS()

OGRGeometry * tmGISDataVector::SafeCreateFromGEOS ( GEOSGeom  geosGeom)
staticprotected

Safe conversion function.

Parameters
geosGeomThe GEOSGeom to convert
Returns
A valid OGRGeometry or nullptr if an error occur
Author
Lucien Schreiber (c) CREALP 2008
Date
15 January 2009

◆ SafeIntersection()

OGRGeometry * tmGISDataVector::SafeIntersection ( OGRGeometry *  geom1,
OGRGeometry *  geom2 
)
staticprotected

Compute intersection.

This function try to bypass the Intersection() bug of GDAL by using GEOS directly

Parameters
geom1The geometry to intersect
geom2the geometry intersecting
Returns
A valid OGRLineString or nullptr
Author
Lucien Schreiber (c) CREALP 2008
Date
18 November 2008

◆ SafeUnion()

OGRGeometry * tmGISDataVector::SafeUnion ( OGRGeometry *  union1,
OGRGeometry *  line 
)
staticprotected

Compute Union.

This function try to bypass the Union() bug of GDAL by using GEOS directly

Parameters
union1The multi-line string
lineThe line to intersect
Returns
A valid OGRLineString or nullptr
Author
Lucien Schreiber (c) CREALP 2008
Date
18 November 2008

◆ SearchIntersectingGeometry()

virtual wxArrayLong * tmGISDataVector::SearchIntersectingGeometry ( OGRGeometry *  intersectinggeom)
inlinevirtual

Reimplemented in tmGISDataVectorMYSQL.

◆ SetSpatialFilter()

virtual bool tmGISDataVector::SetSpatialFilter ( tmRealRect  filter,
int  type 
)
inlinevirtual

Reimplemented in tmGISDataVectorMYSQL.

◆ SplitGeometry()

bool tmGISDataVector::SplitGeometry ( OGRGeometryCollection *  gCol,
const long &  oid,
wxArrayLong &  AddedIds,
int  layertype 
)
virtual

Save splitted geometry to file.

The first geometry is updated, others are added into database.

Parameters
gColthe collection of geometries to update
oidthe oid
AddedIdsAll IDs added.
layertypeone of the TOC_GENERIC_NAME values
Returns
true if all operations are successfull
Author
Lucien Schreiber (c) CREALP 2009
Date
11 February 2009

◆ UpdateGeometry()

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

Reimplemented in tmGISDataVectorMYSQL.


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