ToolMap
|
Public Member Functions | |
bool | CreateLangDefData () |
bool | TableExist (const wxString &tablename) |
int | OpenTMDatabase (const wxString &pathname) |
bool | CreateTMDatabase (PrjDefMemManage *pPrjDefinition) |
bool | IsProjectDataDefined () |
Check if project data are defined. | |
bool | SetProjectData (PrjDefMemManage *pPrjDefinition) |
bool | GetProjectData (PrjDefMemManage *pPrjDefinition) |
Retrieve basic project data. | |
bool | InitProjectWithStartingWizard (PrjDefMemManage *pPrjDefinition) |
int | GetDatabaseToolMapVersion () |
bool | SetProjectExportData (int iExportType, const wxString &spath) |
bool | SetProjectLastExported (const wxArrayString &layers) |
bool | SetProjectBackupPath (const wxString &spath) |
int | GetProjectExportData (int &iExportType, wxString &spath) |
Get the export data from the database. | |
wxArrayString | GetProjectLastExported () |
int | GetProjectBackupPath (wxString &spath) |
Get the backup path from the database. | |
bool | AddLayer (ProjectDefMemoryLayers *myLayer) |
bool | AddLayerPolygonDefaultBorder (ProjectDefMemoryLayers *myLayer) |
Add border default value for polygons layer. | |
void | SetActiveLayerId (ProjectDefMemoryLayers *myLayer) |
int | GetActiveLayerId () |
int | GetNextLayer (ProjectDefMemoryLayers *myLayer) |
bool | UpdateLayer (ProjectDefMemoryLayers *myLayer, wxString &sSqlSentence) |
Prepare statement for updating layer. | |
bool | DeleteLayer (const wxArrayLong &deletelist, PrjDefMemManage *projectdef, wxString &sSqlSentence) |
Prepare statement for deleting layer(s) | |
int | GetLayerID (TOC_GENERIC_NAME layertype) |
Return the layer ID based on layer type. | |
bool | AddObject (ProjectDefMemoryObjects *myObject, int DBlayerIndex=-1) |
bool | EditObject (ProjectDefMemoryObjects *myObject) |
Insert or update an object. | |
bool | DataBaseGetNextResultAsObject (ProjectDefMemoryObjects *object, int ilayertype) |
int | DeleteMultipleObjects (PrjDefMemManage *pProjet) |
void | DeleteLayersObjects (int iLayer, wxString &sSqlSentence) |
Delete all objects from a layer. | |
bool | LoadLayerObjects (ProjectDefMemoryLayers *layer) |
bool | AddField (ProjectDefMemoryFields *myField) |
bool | GetFields (PrjMemFieldArray &fieldarray, ProjectDefMemoryLayers *actuallayer) |
Get all fields for specified layer. | |
int | GetFieldsFromDB (PrjDefMemManage *myPrj) |
Fill an existing project with fields. | |
bool | UpdateField (ProjectDefMemoryFields *myField, int iLayer, wxString &sSqlSentence) |
Prepare statement for updating fields. | |
bool | DeleteField (wxArrayString &myFields, int iLayer, wxString &sSqlSentence) |
Prepare statement for deleting. | |
bool | DeleteFields (int iLayer) |
bool | GetObjectListByLayerType (int ilayertype, bool bOrder=FALSE) |
Retrive objects from the object table. | |
wxArrayString | GetLayerNameByType (int ilayertype) |
Return list of layers name for selected type. | |
long | GetNextScaleValue (long &DBindex, bool bFirst) |
bool | EditScale (ProjectDefMemoryScale *myScaleObj) |
int | DeleteMultipleScales (PrjDefMemManage *pProjet) |
bool | SetRank (ListGenReport *list, int icol, const wxString &stable, const wxString &sfield, bool bStringType=FALSE, const wxString &rankfield=_T("RANK")) |
Update a rank field. | |
bool | SetScaleRank (ScaleList *list, int icol, const wxString &stable, const wxString &sfield, const wxString &rankfield=_T("RANK")) |
Update a rank field for scale table. | |
PrjDefMemManage * | GetProjectDataFromDB () |
bool | UpdateDataBaseProject (PrjDefMemManage *pProjDef) |
Update database. | |
bool | InitTOCGenericLayers () |
Init the TOC. | |
tmLayerProperties * | GetNextTOCEntry (bool userelativepath) |
Get entry from the TOC. | |
long | AddTOCLayer (tmLayerProperties *item) |
Add TOC item to the database. | |
bool | RemoveTOCLayer (const long &itemid) |
Delete a TOC item from the database. | |
void | PrepareTOCStatusUpdate (wxString &sentence, tmLayerProperties *item, int itemRank=0, const wxString &symbology=wxEmptyString) |
bool | GetNextQueries (long &qid, wxString &name, wxString &description, bool bfirst) |
Get all queries. | |
bool | GetQueriesById (const long &qid, int &target, wxString &name, wxString &description) |
Get a queries by ID. | |
bool | EditQueries (int target, const wxString &name, const wxString &description, long qid=-1) |
Edit or add a query. | |
bool | DeleteQuery (long qid) |
Delete a query. | |
bool | GetNextShortcutByLayerType (int layer_type, wxString &key, wxString &description, bool bFirstLoop) |
Load shortcut from the DB based on layer type. | |
bool | GetAllUnusedShortcuts (wxArrayString &keylist) |
Get All unused shortcut key. | |
bool | GetNextShortCutObject (long &shortcutid, const int &key, bool bFirstLoop) |
Get checked values for given shortcut key. | |
bool | EditShortcut (int shortcutkey, const wxString &description, const wxArrayLong &types) |
Append or edit a shortcut. | |
bool | DeleteShortcut (int shortcutkey) |
Delete specified shortcut. | |
bool | GetNextShortcutFull (bool bFirstLoop, int &layertype, int &key, wxString &description, long &shortcutvalue) |
Get Full informations for shortcuts. | |
bool | GetNextSnapping (long &lid, wxString &layername, int &snapstatus, bool bfirstloop) |
Get the snapping from database. | |
bool | GetValidLayersForSnapping (wxArrayLong &lids, wxArrayString &lnames) |
Get all layers valid for snapping. | |
bool | AddLayersSnapping (const wxArrayLong &lids, int snappingstatus) |
Save new snapping layers into database. | |
bool | DeleteLayerSnapping (int layersid) |
Delete a snapping layer from the database. | |
bool | SaveSnappingAllStatus (tmSnappingMemory *snapmemory) |
Save snapping status to the database. | |
bool | SetSnappingTolerence (int iTolerence) |
Save the tolerence into database. | |
int | GetSnappingTolerence () |
Get the tolerence from the database. | |
bool | GeometryDelete (wxArrayLong *selected, int layertype) |
Delete geometry from the database. | |
long | GeometrySave (OGRGeometry *geometry, int layertype) |
bool | GeometryUpdate (OGRGeometry *geometry, long oid, int layertype) |
OGRGeometry * | GeometryLoad (long oid, int layertype) |
bool | DeleteAttribution (wxArrayLong *selected, int layertype) |
Delete attribution from the database. | |
wxArrayLong | GetObjectsFromFeature (long selectedfeature, int layertype) |
long | GetSelectedLayerId (long ojectid) |
bool | DeleteAdvancedAttribution (long selectedobject, long selectedlayerid) |
bool | SaveBezierSettings (BezierSettingsData *data) |
bool | LoadBezierSettings (BezierSettingsData *data) |
Public Member Functions inherited from DataBase | |
DataBase (const wxString &errmsgpath=wxEmptyString) | |
bool | DataBaseCreateNew (const wxString &datadir, const wxString &name) |
bool | DataBaseOpen (const wxString &datadir, const wxString &name) |
Open a mysql / mariadb database This function performs the following work: | |
bool | DataBaseDelete () |
wxString | DataBaseGetName () |
wxString | DataBaseGetPath () |
wxString | DataBaseGetSize (int precision=2, const wxString &failmsg=_("Not available")) |
wxString | DataBaseGetLastError () |
bool | DataBaseThreadInit () |
Init internal variables for new thread. | |
void | DataBaseThreadEnd () |
End internal variables for new thread. | |
bool | DataBaseQueryNoResults (const wxString &query, bool logerror=true) |
bool | DataBaseQuery (const wxString &query, bool logerror=true) |
int | DataBaseQueriesNumber (const wxString &query) |
long | DataBaseGetLastInsertedID () |
long | DataBaseGetAffectedRows () |
bool | DataBaseHasResults () |
void | DataBaseClearResults () |
bool | DataBaseGetResultSize (unsigned int *pcols, long *prows) |
bool | DataBaseGetNextResult (wxString &result) |
bool | DataBaseGetNextResult (wxArrayString &results) |
bool | DataBaseGetNextResult (long &result) |
bool | DataBaseGetNextResult (wxArrayLong &results) |
bool | DataBaseGetNextResult (wxDouble &result) |
bool | DataBaseGetNextResult (wxArrayDouble &results) |
bool | DataBaseGetNextRowResult (MYSQL_ROW &row, tmArrayULong &lengths) |
bool | DataBaseGetResults (wxArrayString &results) |
bool | DataBaseGetResults (wxArrayLong &results) |
bool | DataBaseGetResults (wxArrayDouble &results) |
bool | DataBaseGetResults (DataBaseResult *results) |
Static Public Member Functions | |
static bool | ConvertPath (wxString &path) |
Static Public Member Functions inherited from DataBase | |
static wxString | DataBaseGetVersion () |
static bool | DataBaseStringEscapeQuery (const wxString &query, wxString &results) |
bool DataBaseTM::AddLayerPolygonDefaultBorder | ( | ProjectDefMemoryLayers * | myLayer | ) |
Add border default value for polygons layer.
myLayer | pointer to a valid ProjectDefMemoryLayers object |
bool DataBaseTM::AddLayersSnapping | ( | const wxArrayLong & | lids, |
int | snappingstatus | ||
) |
Save new snapping layers into database.
This function add into the database one or more layers used for snapping.
lids | ids of the layers to add |
long DataBaseTM::AddTOCLayer | ( | tmLayerProperties * | item | ) |
Add TOC item to the database.
Called when a new layer is added.
item | The item to add to the database |
bool DataBaseTM::DeleteAttribution | ( | wxArrayLong * | selected, |
int | layertype | ||
) |
Delete attribution from the database.
selected | An array of selected values. Caller must destroy the object. This function doesn't take ownership of the object |
layertype | one of the TOC_GENERIC_NAME values (must be < TOC_NAME_NOT_GENERIC) |
bool DataBaseTM::DeleteField | ( | wxArrayString & | myFields, |
int | iLayer, | ||
wxString & | sSqlSentence | ||
) |
Prepare statement for deleting.
This prepare the SQL statement for deleting fields stored into the PrjDefMemManage::m_StoreDeleteFields.
myFields | the array containing the name of the fields we want to delete |
iLayer | the zero based layer index of the fields (Number used for table name) |
sSqlSentence | The string we filled with the issued SQL sentence |
bool DataBaseTM::DeleteLayer | ( | const wxArrayLong & | deletelist, |
PrjDefMemManage * | projectdef, | ||
wxString & | sSqlSentence | ||
) |
Prepare statement for deleting layer(s)
This append to the sentence the SQL code for deleting all layers which have their IDs stored into the deletelist array. This function operate on the TABLE_NAME_LAYERS table.
deletelist | A wxArrayLong containing all ID we want to delete |
sSqlSentence | SQL sentence which will be modified with the new delete statement |
bool DataBaseTM::DeleteLayerSnapping | ( | int | layersid | ) |
Delete a snapping layer from the database.
layersid | the layers ID (TOC_ID field in prj_snapping table) |
void DataBaseTM::DeleteLayersObjects | ( | int | iLayer, |
wxString & | sSqlSentence | ||
) |
Delete all objects from a layer.
Delete all objects belonging to a layers. May be used when one try to delete a layer. This function dosen't delete the table but issued a sentence for this purpose.
iLayer | Index of the layer (Starts at 1 in MySQL) |
sSqlSentence | The sentence for storing the SQL sentence issued in the function |
bool DataBaseTM::DeleteQuery | ( | long | qid | ) |
Delete a query.
qid | id of the query to delete |
bool DataBaseTM::DeleteShortcut | ( | int | shortcutkey | ) |
Delete specified shortcut.
shortcutkey | the shortcut ID used (1.... 12) |
bool DataBaseTM::EditObject | ( | ProjectDefMemoryObjects * | myObject | ) |
Insert or update an object.
This function insert or update an object in the database depending of the myObject->m_Object_ID value : bigger or egal to 0 means to update and smaller than 0 means to insert
myObject | parameter of the object to modify into the DB |
bool DataBaseTM::EditQueries | ( | int | target, |
const wxString & | name, | ||
const wxString & | description, | ||
long | qid = -1 |
||
) |
Edit or add a query.
target | Int of the target (allowed values : TOC_GENERIC_NAME) |
name | Name of the query |
description | SQL code of the query |
qid | ID of the query for modification or -1 for adding query |
bool DataBaseTM::EditShortcut | ( | int | shortcutkey, |
const wxString & | description, | ||
const wxArrayLong & | types | ||
) |
Append or edit a shortcut.
shortcutkey | the index of the selected shortcut (1...12) |
description | Description used for the shortcut |
types | Array of integer containing the types of objects |
bool DataBaseTM::GeometryDelete | ( | wxArrayLong * | selected, |
int | layertype | ||
) |
Delete geometry from the database.
selected | An array of selected values. Caller must destroy the object. This function doesn't take ownership of the object |
layertype | one of the TOC_GENERIC_NAME values (must be < TOC_NAME_NOT_GENERIC) |
bool DataBaseTM::GetAllUnusedShortcuts | ( | wxArrayString & | keylist | ) |
Get All unused shortcut key.
All shortcut allready assigned (F1... F12) aren't returned into array.
keylist | wxArrayString will be filled with unused shortcut key |
bool DataBaseTM::GetFields | ( | PrjMemFieldArray & | fieldarray, |
ProjectDefMemoryLayers * | actuallayer | ||
) |
Get all fields for specified layer.
fieldarray | This array contain all fields for specified layer |
actuallayer | the layer for wich to retreive fields |
int DataBaseTM::GetFieldsFromDB | ( | PrjDefMemManage * | myPrj | ) |
Fill an existing project with fields.
The myPrj parameter must point to a existing project in memory. containing all layers. This function will add all fields into this project
myPrj | Pointer to an existing PrjDefMemManage containing all layers |
int DataBaseTM::GetLayerID | ( | TOC_GENERIC_NAME | layertype | ) |
Return the layer ID based on layer type.
This function works only for following "unique" layers :
layertype | One of the TOC_GENERIC_NAME values, see above |
wxArrayString DataBaseTM::GetLayerNameByType | ( | int | ilayertype | ) |
Return list of layers name for selected type.
This function returns all layers name corresponding to a layer type. Layer type are defined there : PRJDEF_LAYERS_TYPE
ilayertype | one of the PRJDEF_LAYERS_TYPE |
bool DataBaseTM::GetNextQueries | ( | long & | qid, |
wxString & | name, | ||
wxString & | description, | ||
bool | bfirst | ||
) |
Get all queries.
Return all queries one after the other. Call this function recursivelly for getting all queries.
qid | return the ID of the query |
name | return the name of the query |
description | return the description of the query |
bfirst | set to true during the first call for creating the MySQL statement |
bool DataBaseTM::GetNextShortcutByLayerType | ( | int | layer_type, |
wxString & | key, | ||
wxString & | description, | ||
bool | bFirstLoop | ||
) |
Load shortcut from the DB based on layer type.
layer_type | The layer type, valid values are :
|
key | A wxString containing The key (F1...F12) |
description | A wxString containing the shortcut description |
bFirstLoop | Indicate if we are running the first loop. |
bool DataBaseTM::GetNextShortcutFull | ( | bool | bFirstLoop, |
int & | layertype, | ||
int & | key, | ||
wxString & | description, | ||
long & | shortcutvalue | ||
) |
Get Full informations for shortcuts.
This function is used for storing shortcuts into memory.
bFirstLoop | set to true if this is the first loop (issue the query) |
layertype | get the layer type (see PRJDEF_LAYERS_TYPE) |
key | get the shortcut key (as int, between 1-12) |
description | get the shortcut description |
shortcutvalue | get the shortcut value |
bool DataBaseTM::GetNextShortCutObject | ( | long & | shortcutid, |
const int & | key, | ||
bool | bFirstLoop | ||
) |
Get checked values for given shortcut key.
shortcutid | ID checked corresponding to the key shortcut |
key | the shortcut key we are searching values for (F1....F12), values are : (1-12) |
bFirstLoop | true during the first loop (do the query) and should be set to false otherwise |
bool DataBaseTM::GetNextSnapping | ( | long & | lid, |
wxString & | layername, | ||
int & | snapstatus, | ||
bool | bfirstloop | ||
) |
Get the snapping from database.
lid | return the layer id (CONTENT_ID of prj_toc table) |
layername | return the layer name |
snapstatus | return the snapping status 0 = no snapping, 1 = Snapping for vertex, 2 = Snapping for Begin/End (only for lines) |
bfirstloop | set to true if the first loop to issue the query |
tmLayerProperties * DataBaseTM::GetNextTOCEntry | ( | bool | userelativepath | ) |
Get entry from the TOC.
This function returns all entry from the TOC one by one. Only one request is issued and then each time this function is called the next layer is returned
bool DataBaseTM::GetObjectListByLayerType | ( | int | ilayertype, |
bool | bOrder = FALSE |
||
) |
Retrive objects from the object table.
This functions may be called for getting all objects from within a layer type. This is used by the "Object definition dialog" but also by the "Attribution window".
ilayertype | the zero based type of layer, see PRJDEF_LAYERS_TYPE |
bOrder | Return the result in the "RANK" order if set to TRUE |
int DataBaseTM::GetProjectBackupPath | ( | wxString & | spath | ) |
Get the backup path from the database.
Retrive the Backup path type from the database
spath | This variable will be filled with the backup path from the database if return value is different of PATH_EMPTY |
bool DataBaseTM::GetProjectData | ( | PrjDefMemManage * | pPrjDefinition | ) |
Retrieve basic project data.
This may be used for filling a PrjDefMemManage object with basic data from project such as Project name, path, units,... In facts all stuff from the Project Definition dialog (except the spatial model)
pPrjDefinition | a pointer to an existing PrjDefMemManage object, will be used for storing project data (path, name,...) |
int DataBaseTM::GetProjectExportData | ( | int & | iExportType, |
wxString & | spath | ||
) |
Get the export data from the database.
Retrive the Export path and the export type from the database
iExportType | This value will be modified with one of the PRJDEF_EXPORT_TYPE. |
spath | This variable will be filled with the spath if return value is different of PATH_EMPTY |
bool DataBaseTM::GetQueriesById | ( | const long & | qid, |
int & | target, | ||
wxString & | name, | ||
wxString & | description | ||
) |
Get a queries by ID.
Return the corresponding queries based on ID.
qid | MySQL id of the searched queries |
target | : one of the TOC_GENERIC_NAME value indicating to wich layers the queries is dedicated to. |
name | return the query name |
description | return the query description |
int DataBaseTM::GetSnappingTolerence | ( | ) |
Get the tolerence from the database.
bool DataBaseTM::GetValidLayersForSnapping | ( | wxArrayLong & | lids, |
wxArrayString & | lnames | ||
) |
Get all layers valid for snapping.
This function returns all layers that are :
lids | An array filled with list of arrays id |
lnames | An array filled with list of arrays name |
bool DataBaseTM::InitProjectWithStartingWizard | ( | PrjDefMemManage * | pPrjDefinition | ) |
adding layers, and for each layer add object and fields related to this layer
bool DataBaseTM::InitTOCGenericLayers | ( | ) |
Init the TOC.
This function fill the TOC with generic layers which are :
bool DataBaseTM::IsProjectDataDefined | ( | ) |
Check if project data are defined.
This function check the existance of a line into the PRJ_SETTINGS table.
bool DataBaseTM::RemoveTOCLayer | ( | const long & | itemid | ) |
Delete a TOC item from the database.
Called when a layer is removed.
itemid | database ID of the item to remove |
bool DataBaseTM::SaveSnappingAllStatus | ( | tmSnappingMemory * | snapmemory | ) |
Save snapping status to the database.
snapmemory | a valid tmSnappingMemory object |
bool DataBaseTM::SetRank | ( | ListGenReport * | list, |
int | icol, | ||
const wxString & | stable, | ||
const wxString & | sfield, | ||
bool | bStringType = FALSE , |
||
const wxString & | rankfield = _T("RANK") |
||
) |
Update a rank field.
This may be used to update a rank field using items from a ListGenReport. This way we can store the order of items wanted by the end user
list | a pointer to a ListGenReport object containing items |
icol | specify the column of interest in the list (zero based index) |
stable | the name of the table in which we want to add rank values |
sfield | the field name for the field containing values of the selected column (icol) |
bStringType | TRUE if the column store textual values, FALSE otherwise. In fact this function prepend brackets if TRUE for dealing with strings with spaces (Default is FALSE) |
rankfield | Name of the field where we want to update the rank (Default is field "RANK") this field must be of type integer |
bool DataBaseTM::SetScaleRank | ( | ScaleList * | list, |
int | icol, | ||
const wxString & | stable, | ||
const wxString & | sfield, | ||
const wxString & | rankfield = _T("RANK") |
||
) |
Update a rank field for scale table.
This function is a specialized function of DataBaseTM::SetRank() used to update rank for scale table (because of scale table store only long values but displays 1: before the scale value
list | a pointer to a ScaleList object containing items |
icol | specify the column of interest in the list (zero based index) |
stable | the name of the table in which we want to add rank values |
sfield | the field name for the field containing values of the selected column (icol) |
rankfield | Name of the field where we want to update the rank (Default is field "RANK") this field must be of type integer |
bool DataBaseTM::SetSnappingTolerence | ( | int | iTolerence | ) |
Save the tolerence into database.
iTolerence | The tolerence |
bool DataBaseTM::UpdateDataBaseProject | ( | PrjDefMemManage * | pProjDef | ) |
Update database.
This function update the project's data. This is a "clever" function, only modified data is changed
pProjDef | Object of type PrjDefMemManage containing new project values. |
bool DataBaseTM::UpdateField | ( | ProjectDefMemoryFields * | myField, |
int | iLayer, | ||
wxString & | sSqlSentence | ||
) |
Prepare statement for updating fields.
This function prepare the SQL sentence used for updating the fields. The main concept is the ProjectDefMemoryFields::m_FieldID :
myField | a ProjectDefMemoryFields object containing all the field data |
iLayer | The layer index the field belong to. |
sSqlSentence | the string containing the SQL sentence we want to modify |
bool DataBaseTM::UpdateLayer | ( | ProjectDefMemoryLayers * | myLayer, |
wxString & | sSqlSentence | ||
) |
Prepare statement for updating layer.
This function return the prepared SQL statement for updating or inserting data into the TABLE_NAME_LAYERS.
myLayer | pointer to a ProjectDefMemoryLayers object with new data. In case of modification the m_LayerID member must be set correctly |
sSqlSentence | reference to a wxString in which we are going to put the issued sentence |