TdkPersistenceService Class Reference
[The Services Module]

Implements high level functions to manage a database connections pool. More...

#include <TdkPersistenceService.h>

List of all members.

Static Public Member Functions

static void setReferenceScale (TdkObjectGID themeGID)
static void getStringAttrValues (const std::string dbKey, const std::string layerName, const std::string tableName, const std::string attrName, std::vector< std::string > &attrValues)
static void getStringAttrValues (const std::string dbKey, const std::string layerName, const std::string tableName, std::vector< std::string > attrNames, std::vector< std::vector< std::string > > &attrValues)
static std::string getAttrQrySQL (std::string dbKey, const std::string tableName, const std::string attrName, const std::string value)
static void getAttributeList (const TdkObjectGID &layerGID, const unsigned int &attrTableIndex, TeAttributeList &attrList)
static void importObjectData (const TdkObjectGID &layerGID, const TePointSet &points, const TeTable &attTable, const int &autoIdent, const int &identIndex)
static void importObjectData (const TdkObjectGID &layerGID, const TeLineSet &lines, const TeTable &attTable, const int &autoIdent, const int &identIndex)
static void importObjectData (const TdkObjectGID &layerGID, const TePolygonSet &polygons, const TeTable &attTable, const int &autoIdent, const int &identIndex)
static void importObjectData (const TdkObjectGID &layerGID, const TeTextSet &texts, const TeTable &attTable, const int &autoIdent, const int &identIndex)
TDK Database Model
static void createThemePropertiesTable (TeDatabase *db)
 Creates the theme properties table (tdk_theme_properties).
static void createViewPropertiesTable (TeDatabase *db)
 Creates the map properties table (tdk_view_properties).
static void createRasterPropertiesTable (TeDatabase *db)
 Creates the raster file properties table (tdk_rastefile_properties).
static void createTemplatesTable (TeDatabase *db)
 Creates the tdk templates table (tdk_templates).
static void createTemplateObjectsTable (TeDatabase *db)
 Creates the tdk template objects table (tdk_template_objects).
static bool checkIntegrity (TeDatabase *db)
 Checks if the table relations are right.
static void createDatabaseModel (TeDatabase *db)
 Creates the conceptual model (terralib and TDK tables).
static void createDatabaseModel (const TdkConDescriptor &desc)
 Creates a new database and initializes it with the terralib model.
static void insertDatabaseModel (const TdkConDescriptor &desc)
 Inserts the terralib model into an existing database.
static bool hasModelTables (TeDatabase *db)
 Returns true if the conceptual model (terralib and TDK tables) is complete.
static bool hasModelTables (const TdkConDescriptor &desc)
static void restoreDatabaseModel (TeDatabase *db)
 Restores the conceptual model (terralib and TDK tables).
The database connection methods
static bool isConnected (TeDatabase *db)
 Returns true if the database is connected.
static bool open (TeDatabase *db, bool verifyVersion=true)
 If the database is connected loads the basic data (all the projects).
static bool connectFromDesc (TeDatabase *db, const TdkConDescriptor &desc)
 Connects the database based on the descriptor data.
static bool close (TeDatabase *db)
 Close the database connection.
TDK database version
static bool createVersionTable (TeDatabase *db)
static bool updateVersionStamp (TeDatabase *db, const string &DBversion)
static bool loadVersionStamp (TeDatabase *db, std::string &version)
static bool updateDatabaseVersion (TeDatabase *db)
static void updateDatabaseVersion (const TdkConDescriptor &desc)
Import/Export data services
static bool insertTableFromDBF (const std::string &dbfFileName, std::string dbKey)
 Creates a table and fill it based on a DBF file.
static bool linkAttrTables (TdkObjectGID &objectGID, std::string linkTableName, std::string linkAttrName, std::string refTableName="", std::string refLinkAttrName="")
 Links attribute tables to a layer.
static bool unlinkAttrTables (TdkObjectGID &objectGID, std::string tableName)
 Unlinks layer attribute tables.
static void importDatabase (TeDatabase *dbFrom, TeDatabase *dbTo)
static int exportShape (TdkObjectGID collectionGID, std::string shpFileName, bool shpFilenameOverwrite=false, std::string attrTableName="")
 Exports a layer (or theme) in a TerraLib database to a shapefile.
static void exportShape (TdkObjectGID &collectionGID, TdkObjectGIDVector &exportedObjectsGIDs, std::string shpFileName, std::string attrTableName="")
 Exports some objects of the a layer (or theme) in a TerraLib database to a shapefile.
static TdkObjectGID importShape (std::string layerName, std::string dbKey, std::string shapeFileName, TeProjection *projection, std::string linkColumn="", bool importDBF=true, int chunkSize=1000)
static TdkObjectGID importRasterFile (std::string layerName, std::string dbKey, std::string rasterFilename, TeProjection *projection)
static void importRasterFile (TdkLayer *layer, TeRaster *raster)
static TdkObjectGID importRaster (std::string layerName, std::string dbDescriptorKey, std::string imageFilename, TeProjection *projection, TeBox *pos, unsigned int blockDim=512, TeRasterParams::TeRasterCompressionMode compress=TeRasterParams::TeZLib, int nlevels=0)
static TdkObjectGID importRaster (std::string layerName, std::string dbDescriptorKey, std::string imageFilename, TeProjection *projection, TeBox *pos, unsigned int blockWDim=512, unsigned int blockHDim=512, TeRasterParams::TeRasterCompressionMode compress=TeRasterParams::TeZLib, int nlevels=0)
static TdkObjectGID linkShapeFile (std::string layerName, std::string dbDescriptorKey, std::string shpFilename, TeProjection *projection=new TeNoProjection())
static bool importGeoCode (std::string tableName, std::string layerName, std::string selectedXlist, std::string selectedYlist, std::string dbKey, TeProjection *projection)
static const ::string computeRelativePath (const::string absPath, const ::string dbDescriptorKey)
Load/Insert/Update methods
static void loadFullData (std::string dbKey)
 Loads all the database data.
static void factoryRegistration (TdkObjectType typeId, TdkObjectFactoryFunction func)
 To save, in the object factory, a constructor function for one given object class.
static bool hasFactory (TdkObjectType typeId)
static TdkObjectgetObject (const TdkObjectGID &objectGID, TdkLoadParams &params)
 Returns the object in cache.
static TdkObjectgetObject (const TdkObjectGID &objectGID)
static TdkObjectgetObject (TeDatabase *db, TdkObjectType objectType, std::string name, TdkLoadParams &params)
static TdkObjectgetObject (std::string name, TdkObjectType objectType, std::string dbKey)
 Find object by name. Returns instances of TdkLayer, TdkTheme, TdkView or TdkProject.
static TdkObjectgetObject (std::string name, TdkObjectType objectType, std::string dbKey, TdkLoadParams &params)
static void unloadObject (TdkObjectGID &gid)
static void updateAttrObjectPosOperation (TdkObjectGID &gid)
static bool insertObject (TdkObject *object, TdkPersistenceParams &params)
static bool insertObject (TdkObject *object)
static bool insertObjects (TdkObjectVector &objects, TdkPersistenceParams &params)
static bool insertObjects (TdkObjectVector &objects)
static bool loadObject (TdkObject *object, TdkLoadParams &params)
static bool loadObject (TdkObject *object)
static bool updateObject (TdkObject *object, TdkPersistenceParams &params)
static bool updateObject (TdkObject *object)
static void deleteObject (const TdkObjectGID &objectGID, bool deleteObject_=true)
static void deleteObject (const TdkObjectGID &objectGID, TdkPersistenceParams &params, bool deleteObject_=true)
static bool loadObjectSet (TeDatabase *db, TdkObjectType objectType, TdkLoadParams &params, const std::string user="")
static bool deleteChildren (TdkObjectCollection *col, TdkEventHandlerVector &objects, TdkPersistenceParams &params)
static bool insertChildren (TeDatabase *db, TdkObjectCollection *col, TdkEventHandlerVector &objects, TdkPersistenceParams &params)
static bool loadChildren (TdkObjectCollection *coll)
static bool loadChildren (TdkObjectCollection *coll, TdkLoadParams &params)
static bool loadChildrenGIDs (TdkObjectCollection *coll)
static bool loadChildrenGIDs (TdkObjectCollection *coll, TdkLoadParams &params)
static bool insertThemeGroup (TeDatabase *db, TeViewTree *tree)
static bool insertThemeGroup (const std::string dbKey, TeViewTree *tree)
static TdkObjectGID createView (std::string viewName, int dbInd, TeProjection *projection, bool isVisible=true)
 Creates a new view with the given name and inserts it in the database.
static TdkObjectGID createLayer (std::string layerName, int dbInd, TeProjection *projection, TeGeomRep geomTypes=TeGEOMETRYNONE)
 Creates a new layer with the given name and inserts it in the database.
static void updateViewTree (TeViewTree *viewTree, std::string descKey)
static void updateViewTree (TeViewTree *viewTree, std::string descKey, TdkPersistenceParams &params)
static TeProjection * loadProjection (int projId, std::string dbKey)
static TeProjection * loadProjection (int projId, int dbIndx)
static void cleanup (const TdkConDescriptor &desc)
Legend services
static void changeNodeView (std::string nodeName, TdkObjectGID srcViewGID, TdkObjectGID destViewGID, std::string dbKey)
 Moves the node from the source view to the destination view.
static void changeNodeView (int nodeId, std::string srcViewName, std::string destViewName, std::string dbKey)
static void changeNodeView (int nodeId, TdkView *srcView, TdkView *destView)
static void saveNodePriority (TeViewNode *node, std::string dbKey)
static bool isActiveGroup (int groupId, TdkObjectGID &viewId)
 Returns true if any theme in the group (tree) is active, otherwise returns false.
static bool isActiveGroup (TeViewTree *tree)
 Returns true if any theme in the tree is active, otherwise returns false.
static void setThemeVisibility (TdkObjectGID &themeGID, int visibility)
 Sets the theme visibility. If the theme is visible load the visualization attributes otherwise clean the theme cache.
static bool generateThematicLegend (TdkObjectGID &themeId, std::string tableName, std::string attrName, TeGroupingMode groupMode, int slicesNum, std::string func, bool &generateNullValues, TeLegendEntryVector &legends)
 Creates a legend based on the theme values.
static void applyThematic (TdkObjectGID &themeId, std::string tableName, std::string attrName, TeGroupingMode groupMode, std::string func, bool generateNullValues, TeLegendEntryVector &legends, TdkPersistenceParams &params)
 Set the grouping and the legend of the theme, and could save it in the database.
static void applyThematic (TdkObjectGID &themeId, std::string tableName, std::string attrName, TeGroupingMode groupMode, std::string func, bool generateNullValues, TeLegendEntryVector &legends)
Multi resolution
Multi resolution services

static void generalizeLayer (TdkObjectGID &layerGID, int simplificationLevelsNum, double minError, double maxError, int indexingLevels, TdkIndexingType indexingType=_TDK_AREA_INDEXING)
 Generalizes the layer geometries (lines and polygons).
static void agregateLayer (TdkObjectGID &layerGID)
 Agregates the layer geometries (points).
static void deleteStrategy (TdkObjectGID &layerId, int strategyId)
Style Library
Style Library services

static bool createStyleTable (TeDatabase *db, std::string tabName)
static bool createStyleModelTables (TeDatabase *db)
static bool createStyleVisualTable (TeDatabase *db, bool createRelations=true)
static bool insertVisual (TeDatabase *db, TeLegendEntry *legend, TeGeomRep rep)
static TdkStylegetStyle (TeDatabasePortal *portal)
static void insertStyleLibrary (TdkStyleLibrary *lib, string dbKey)
static bool insertStyleLibrary (TeDatabase *db, const std::string libName)
static bool loadStyleLibrary (TdkStyleLibrary *lib, std::string dbKey)
 Loads the style library data by the given id or name.
static bool loadStyleLibrary (TeDatabase *db, TdkStyleLibrary *lib)
static void loadStyleLibraries (TdkStyleLibraryVector &libs, std::string dbKey)
static void loadStyleLibraries (TeDatabase *db, TdkStyleLibraryVector &libs)
static void updateStyleLibrary (TdkStyleLibrary *lib, std::string dbKey)
static void updateStyleLibrary (TeDatabase *db, TdkStyleLibrary *lib)
static void deleteStyle (int styleLibraryId, int libId, std::string dbKey)
static void deleteStyle (TeDatabase *db, const std::string tableName, int libId)
static void insertStyle (int styleLibraryId, TdkStyle &style, std::string dbKey)
static bool insertStyle (TeDatabase *db, const std::string &table, TdkStyle &style)
static void updateStyle (int styleLibraryId, TdkStyle &style, std::string dbKey)
static bool updateStyle (TeDatabase *db, const std::string &table, TdkStyle &style)
static void insertImageStyle (std::string styleLibName, std::string styleName, std::string &imagefile, std::string dbKey)
static void deleteStyleLibrary (int libId, std::string dbKey)
static void deleteStyleLibrary (TeDatabase *db, int libId)
static void loadImage (TdkStyle *st, std::string &fname)
static void insertOwnLegendsFromStyleLibrary (int themeId, std::string styleLibName, std::string dbKey)
 Inserts in the database theme own legends based on the given style library.
static void getOwnLegendsIds (int themeId, std::string dbKey, std::vector< int > &legendIds)
 Gets theme own legends ids.
TeDatabase extensions
static void dropDBTable (std::string dbTableName, std::string dbKey)
 Deletes a database table (don�t delete the terralib model tables).
static void dropDBView (std::string dbViewName, std::string dbKey)
 Deletes a database table view.
static bool deleteGeometry (TeDatabase *db, const string &table, int geomId)
 Removes a geometry from the given table.
static bool deleteThemeGroup (TeDatabase *db, int themeId)
 Extends the TeDatabase::deleteThemeGroup, to delete the tdk theme properties.
static TeViewTree * loadViewTree (TeDatabase *db, TdkView *view, int theme_id, TdkLoadParams &params)
 Re implements the TeDatabase::loadViewTree, loading only the basic attributes of the themes (node_type, theme_id, name, parent_id, priority, enable_visibility, enable_activation).
static bool updateViewTree (TeDatabase *db, TeViewTree *tree, TdkPersistenceParams &params)
 Re implements the TeDatabase::updateViewTree, update the tdk view tree properties and updates only the theme that needed be updated.

Static Protected Member Functions

static bool rollbackImportShape (std::string layerName, std::string dbKey)
 To recover the database status if the import shapefile fail.
static bool loadLayerSet (TeDatabase *db, TdkLoadParams &params)
static bool loadViewSet (TeDatabase *db, const std::string user, TdkLoadParams &params)
static bool loadProjectSet (TeDatabase *db, TdkLoadParams &params)
Style tables
static void setStyleTableAttributes (TeAttributeList &attrList)
static void setStyleTable (TeTable &table, const std::string &tableName)
Shapefile representation tables
static bool createShapeGeometry (TeDatabase *db, const string &tableName)
static bool insertShapeGeometry (TeDatabase *db, const string &tableName, const string &objectId, const string &shpfilename)

Friends

class TdkCache


Detailed Description

Implements high level functions to manage a database connections pool.


Member Function Documentation

void TdkPersistenceService::setStyleTableAttributes ( TeAttributeList &  attrList  )  [static, protected]

void TdkPersistenceService::setStyleTable ( TeTable &  table,
const std::string &  tableName 
) [static, protected]

bool TdkPersistenceService::createShapeGeometry ( TeDatabase *  db,
const string &  tableName 
) [static, protected]

bool TdkPersistenceService::insertShapeGeometry ( TeDatabase *  db,
const string &  tableName,
const string &  objectId,
const string &  shpfilename 
) [static, protected]

bool TdkPersistenceService::rollbackImportShape ( std::string  layerName,
std::string  dbKey 
) [static, protected]

To recover the database status if the import shapefile fail.

bool TdkPersistenceService::loadLayerSet ( TeDatabase *  db,
TdkLoadParams params 
) [static, protected]

bool TdkPersistenceService::loadViewSet ( TeDatabase *  db,
const std::string  user,
TdkLoadParams params 
) [static, protected]

bool TdkPersistenceService::loadProjectSet ( TeDatabase *  db,
TdkLoadParams params 
) [static, protected]

void TdkPersistenceService::createThemePropertiesTable ( TeDatabase *  db  )  [static]

Creates the theme properties table (tdk_theme_properties).

void TdkPersistenceService::createViewPropertiesTable ( TeDatabase *  db  )  [static]

Creates the map properties table (tdk_view_properties).

void TdkPersistenceService::createRasterPropertiesTable ( TeDatabase *  db  )  [static]

Creates the raster file properties table (tdk_rastefile_properties).

void TdkPersistenceService::createTemplatesTable ( TeDatabase *  db  )  [static]

Creates the tdk templates table (tdk_templates).

void TdkPersistenceService::createTemplateObjectsTable ( TeDatabase *  db  )  [static]

Creates the tdk template objects table (tdk_template_objects).

bool TdkPersistenceService::checkIntegrity ( TeDatabase *  db  )  [static]

Checks if the table relations are right.

void TdkPersistenceService::createDatabaseModel ( TeDatabase *  db  )  [static]

Creates the conceptual model (terralib and TDK tables).

void TdkPersistenceService::createDatabaseModel ( const TdkConDescriptor desc  )  [static]

Creates a new database and initializes it with the terralib model.

Creates a new database driver based on a given descriptor. Inserts the driver in the pool and initializes the terralib-viewer model. The driver will be available in the pool to future access.

Parameters:
desc The database descriptor.

void TdkPersistenceService::insertDatabaseModel ( const TdkConDescriptor desc  )  [static]

Inserts the terralib model into an existing database.

Creates a new database driver based on a given descriptor. Inserts the driver in the pool and initializes the terralib-viewer model. The driver will be available in the pool to future access.

Parameters:
desc The database descriptor.

bool TdkPersistenceService::hasModelTables ( TeDatabase *  db  )  [static]

Returns true if the conceptual model (terralib and TDK tables) is complete.

bool TdkPersistenceService::hasModelTables ( const TdkConDescriptor desc  )  [static]

void TdkPersistenceService::restoreDatabaseModel ( TeDatabase *  db  )  [static]

Restores the conceptual model (terralib and TDK tables).

static bool TdkPersistenceService::isConnected ( TeDatabase *  db  )  [static]

Returns true if the database is connected.

bool TdkPersistenceService::open ( TeDatabase *  db,
bool  verifyVersion = true 
) [static]

If the database is connected loads the basic data (all the projects).

bool TdkPersistenceService::connectFromDesc ( TeDatabase *  db,
const TdkConDescriptor desc 
) [static]

Connects the database based on the descriptor data.

bool TdkPersistenceService::close ( TeDatabase *  db  )  [static]

Close the database connection.

bool TdkPersistenceService::createVersionTable ( TeDatabase *  db  )  [static]

bool TdkPersistenceService::updateVersionStamp ( TeDatabase *  db,
const string &  DBversion 
) [static]

bool TdkPersistenceService::loadVersionStamp ( TeDatabase *  db,
std::string &  version 
) [static]

bool TdkPersistenceService::updateDatabaseVersion ( TeDatabase *  db  )  [static]

void TdkPersistenceService::updateDatabaseVersion ( const TdkConDescriptor desc  )  [static]

static bool TdkPersistenceService::insertTableFromDBF ( const std::string &  dbfFileName,
std::string  dbKey 
) [static]

Creates a table and fill it based on a DBF file.

Parameters:
dbfFileName The DBF file path.
dbKy The database descriptor

bool TdkPersistenceService::linkAttrTables ( TdkObjectGID objectGID,
std::string  linkTableName,
std::string  linkAttrName,
std::string  refTableName = "",
std::string  refLinkAttrName = "" 
) [static]

Links attribute tables to a layer.

Each table, whose name is given, will be link to the layer.

Parameters:
objectGID The layer object id.
linkTableName Attribute table name
linkAttrName The link attribute, if it is empty a "object_id_" column, filled with the reference values, will be added to the table
refTableName A layer attribute table. The table to link has not column equivalent with the layer object ids
refLinkAttrName The link attribute of the reference table

bool TdkPersistenceService::unlinkAttrTables ( TdkObjectGID objectGID,
std::string  tableName 
) [static]

Unlinks layer attribute tables.

Each table, whose name is given, will be off of the layer. This is useful because the attributes tables that were linked with the layer will be deleted of the database when the layer will.

Parameters:
objectGID The layer object id.
tableName Attribute table name.

void TdkPersistenceService::importDatabase ( TeDatabase *  dbFrom,
TeDatabase *  dbTo 
) [static]

int TdkPersistenceService::exportShape ( TdkObjectGID  collectionGID,
std::string  shpFileName,
bool  shpFilenameOverwrite = false,
std::string  attrTableName = "" 
) [static]

Exports a layer (or theme) in a TerraLib database to a shapefile.

Parameters:
collectionGID The collection global id (layer or theme)
shpFileName Name of the output shapefile
shpFilenameOverwrite If is true, the shpFileName can be overwritten
attrTableName Name of the attribute table to be exported. If is empty will be created a DBF with an object ids column (ID).
Returns:
-1 if the shpFileName exists, 1 if the data was successfully exported and O otherwise.

void TdkPersistenceService::exportShape ( TdkObjectGID collectionGID,
TdkObjectGIDVector exportedObjectsGIDs,
std::string  shpFileName,
std::string  attrTableName = "" 
) [static]

Exports some objects of the a layer (or theme) in a TerraLib database to a shapefile.

Parameters:
collectionGID The collection global id (layer or theme)
exportedObjectsGIDs Vector with the object ids
shpFileName Name of the output shapefile
attrTableName Name of the attribute table to be exported. If is empty will be created a DBF with an object ids column (ID).
Returns:
-1 if the shpFileName exists, 1 if the data was successfully exported and O otherwise.

TdkObjectGID TdkPersistenceService::importShape ( std::string  layerName,
std::string  dbKey,
std::string  shapeFileName,
TeProjection *  projection,
std::string  linkColumn = "",
bool  importDBF = true,
int  chunkSize = 1000 
) [static]

Imports a shapefile to a new layer

Parameters:
layerName the new layer name
dbKey the database descriptor
shpFileName shapefile file name
projection the new layer projection
linkColumn Column that is the link between attributes and geometries
importDBF If is true import the geometries and attributes, otherwise only import the geometries
chunkSize the number of objects in memory before save them in the layer
Returns:
The global id of the new created layer, the object id will be 0 if the layer was not created.

TdkObjectGID TdkPersistenceService::importRasterFile ( std::string  layerName,
std::string  dbKey,
std::string  rasterFilename,
TeProjection *  projection 
) [static]

void TdkPersistenceService::importRasterFile ( TdkLayer layer,
TeRaster *  raster 
) [static]

TdkObjectGID TdkPersistenceService::importRaster ( std::string  layerName,
std::string  dbDescriptorKey,
std::string  imageFilename,
TeProjection *  projection,
TeBox *  pos,
unsigned int  blockDim = 512,
TeRasterParams::TeRasterCompressionMode  compress = TeRasterParams::TeZLib,
int  nlevels = 0 
) [static]

Import a image file to a new layer

Parameters:
layerName the new layer name
dbDescriptorKey the database descriptor
imageFilename image file name
projection of the image if it comes without projection
box position of the image if comes without position
blockDim dimension of the blocks stored at the database
compress compression used to store the image data
nlevels number of multi resolution levels stored
Returns:
The global id of the new created layer, the object id will be 0 if the layer was not created.

TdkObjectGID TdkPersistenceService::importRaster ( std::string  layerName,
std::string  dbDescriptorKey,
std::string  imageFilename,
TeProjection *  projection,
TeBox *  pos,
unsigned int  blockWDim = 512,
unsigned int  blockHDim = 512,
TeRasterParams::TeRasterCompressionMode  compress = TeRasterParams::TeZLib,
int  nlevels = 0 
) [static]

TdkObjectGID TdkPersistenceService::linkShapeFile ( std::string  layerName,
std::string  dbDescriptorKey,
std::string  shpFilename,
TeProjection *  projection = new TeNoProjection() 
) [static]

bool TdkPersistenceService::importGeoCode ( std::string  tableName,
std::string  layerName,
std::string  selectedXlist,
std::string  selectedYlist,
std::string  dbKey,
TeProjection *  projection 
) [static]

find id in columns

const ::string TdkPersistenceService::computeRelativePath ( const ::string  absPath,
const ::string  dbDescriptorKey 
) [static]

Given a file name with its complete absolute path returns its complete name relative to the database path if possible

Parameters:
abs_path absolute path and filename
dbDescriptorKey database key from which to compute the relative path
Returns:
the filename and path relative to the database if possible

void TdkPersistenceService::loadFullData ( std::string  dbKey  )  [static]

Loads all the database data.

Loads projects, maps, views, layers, themes and the themes children (geometry, tip attribute and thematic attribute).

Parameters:
desc The database descriptor.

void TdkPersistenceService::factoryRegistration ( TdkObjectType  typeId,
TdkObjectFactoryFunction  func 
) [static]

To save, in the object factory, a constructor function for one given object class.

Parameters:
typeName The object class name.
func The constructor function.

bool TdkPersistenceService::hasFactory ( TdkObjectType  typeId  )  [static]

TdkObject * TdkPersistenceService::getObject ( const TdkObjectGID objectGID,
TdkLoadParams params 
) [static]

Returns the object in cache.

TdkObject * TdkPersistenceService::getObject ( const TdkObjectGID objectGID  )  [static]

TdkObject * TdkPersistenceService::getObject ( TeDatabase *  db,
TdkObjectType  objectType,
std::string  name,
TdkLoadParams params 
) [static]

TdkObject * TdkPersistenceService::getObject ( std::string  name,
TdkObjectType  objectType,
std::string  dbKey 
) [static]

Find object by name. Returns instances of TdkLayer, TdkTheme, TdkView or TdkProject.

TdkObject * TdkPersistenceService::getObject ( std::string  name,
TdkObjectType  objectType,
std::string  dbKey,
TdkLoadParams params 
) [static]

void TdkPersistenceService::unloadObject ( TdkObjectGID gid  )  [static]

void TdkPersistenceService::updateAttrObjectPosOperation ( TdkObjectGID gid  )  [static]

bool TdkPersistenceService::insertObject ( TdkObject object,
TdkPersistenceParams params 
) [static]

bool TdkPersistenceService::insertObject ( TdkObject object  )  [static]

bool TdkPersistenceService::insertObjects ( TdkObjectVector objects,
TdkPersistenceParams params 
) [static]

bool TdkPersistenceService::insertObjects ( TdkObjectVector objects  )  [static]

bool TdkPersistenceService::loadObject ( TdkObject object,
TdkLoadParams params 
) [static]

bool TdkPersistenceService::loadObject ( TdkObject object  )  [static]

bool TdkPersistenceService::updateObject ( TdkObject object,
TdkPersistenceParams params 
) [static]

bool TdkPersistenceService::updateObject ( TdkObject object  )  [static]

void TdkPersistenceService::deleteObject ( const TdkObjectGID objectGID,
bool  deleteObject_ = true 
) [static]

void TdkPersistenceService::deleteObject ( const TdkObjectGID objectGID,
TdkPersistenceParams params,
bool  deleteObject_ = true 
) [static]

bool TdkPersistenceService::loadObjectSet ( TeDatabase *  db,
TdkObjectType  objectType,
TdkLoadParams params,
const std::string  user = "" 
) [static]

bool TdkPersistenceService::deleteChildren ( TdkObjectCollection col,
TdkEventHandlerVector objects,
TdkPersistenceParams params 
) [static]

bool TdkPersistenceService::insertChildren ( TeDatabase *  db,
TdkObjectCollection col,
TdkEventHandlerVector objects,
TdkPersistenceParams params 
) [static]

bool TdkPersistenceService::loadChildren ( TdkObjectCollection coll  )  [static]

bool TdkPersistenceService::loadChildren ( TdkObjectCollection coll,
TdkLoadParams params 
) [static]

bool TdkPersistenceService::loadChildrenGIDs ( TdkObjectCollection coll  )  [static]

bool TdkPersistenceService::loadChildrenGIDs ( TdkObjectCollection coll,
TdkLoadParams params 
) [static]

bool TdkPersistenceService::insertThemeGroup ( TeDatabase *  db,
TeViewTree *  tree 
) [static]

bool TdkPersistenceService::insertThemeGroup ( const std::string  dbKey,
TeViewTree *  tree 
) [static]

static TdkObjectGID TdkPersistenceService::createView ( std::string  viewName,
int  dbInd,
TeProjection *  projection,
bool  isVisible = true 
) [static]

Creates a new view with the given name and inserts it in the database.

Parameters:
viewName The name of the view.
dbInd The database descriptor.
projection The view projection.

TdkObjectGID TdkPersistenceService::createLayer ( std::string  layerName,
int  dbInd,
TeProjection *  projection,
TeGeomRep  geomTypes = TeGEOMETRYNONE 
) [static]

Creates a new layer with the given name and inserts it in the database.

If it will not have any layer with the given name, creates a new layer with this name and inserts it in the database.

Parameters:
layerName The name of the layer.
dbInd The database descriptor.
geometryTypes The types of the geometry that the layer will have.
projection The layer projection.

static void TdkPersistenceService::updateViewTree ( TeViewTree *  viewTree,
std::string  descKey 
) [static]

void TdkPersistenceService::updateViewTree ( TeViewTree *  viewTree,
std::string  descKey,
TdkPersistenceParams params 
) [static]

TeProjection * TdkPersistenceService::loadProjection ( int  projId,
std::string  dbKey 
) [static]

TeProjection * TdkPersistenceService::loadProjection ( int  projId,
int  dbIndx 
) [static]

void TdkPersistenceService::cleanup ( const TdkConDescriptor desc  )  [static]

void TdkPersistenceService::changeNodeView ( std::string  nodeName,
TdkObjectGID  srcViewGID,
TdkObjectGID  destViewGID,
std::string  dbKey 
) [static]

Moves the node from the source view to the destination view.

Parameters:
nodeId The node id.
srcViewName The source view name.
destViewName The destination view name.
dbKey The database key.

void TdkPersistenceService::changeNodeView ( int  nodeId,
std::string  srcViewName,
std::string  destViewName,
std::string  dbKey 
) [static]

void TdkPersistenceService::changeNodeView ( int  nodeId,
TdkView srcView,
TdkView destView 
) [static]

void TdkPersistenceService::saveNodePriority ( TeViewNode *  node,
std::string  dbKey 
) [static]

bool TdkPersistenceService::isActiveGroup ( int  groupId,
TdkObjectGID viewId 
) [static]

Returns true if any theme in the group (tree) is active, otherwise returns false.

Parameters:
groupId The group id
viewId The group view global id

bool TdkPersistenceService::isActiveGroup ( TeViewTree *  tree  )  [static]

Returns true if any theme in the tree is active, otherwise returns false.

Parameters:
tree The tree node

void TdkPersistenceService::setThemeVisibility ( TdkObjectGID themeGID,
int  visibility 
) [static]

Sets the theme visibility. If the theme is visible load the visualization attributes otherwise clean the theme cache.

Parameters:
themeGID The theme global id
visibility The new theme visibility value

bool TdkPersistenceService::generateThematicLegend ( TdkObjectGID themeId,
std::string  tableName,
std::string  attrName,
TeGroupingMode  groupMode,
int  slicesNum,
std::string  func,
bool &  generateNullValues,
TeLegendEntryVector &  legends 
) [static]

Creates a legend based on the theme values.

Parameters:
themeId The theme global identificator
tableName Name of the attribute table
attrName Name of the thematic attribute
groupMode Thematic type (TeUniqueValue - by values, TeEqualSteps - equals values steps, TeQuantil - ??)
slicesNum The slice number, if thematic type was TeEqualSteps or TeQuantil
generateNullValues true to generate a legend to null values
legends the generated legend.

void TdkPersistenceService::applyThematic ( TdkObjectGID themeId,
std::string  tableName,
std::string  attrName,
TeGroupingMode  groupMode,
std::string  func,
bool  generateNullValues,
TeLegendEntryVector &  legends,
TdkPersistenceParams params 
) [static]

Set the grouping and the legend of the theme, and could save it in the database.

Parameters:
themeId The theme global identificator
tableName Name of the attribute table (to set the grouping)
attrName Name of the thematic attribute (to set the grouping)
groupMode Thematic type (to set the grouping)
legends The legend to set the theme legend

void TdkPersistenceService::applyThematic ( TdkObjectGID themeId,
std::string  tableName,
std::string  attrName,
TeGroupingMode  groupMode,
std::string  func,
bool  generateNullValues,
TeLegendEntryVector &  legends 
) [static]

void TdkPersistenceService::generalizeLayer ( TdkObjectGID layerGID,
int  simplificationLevelsNum,
double  minError,
double  maxError,
int  indexingLevels,
TdkIndexingType  indexingType = _TDK_AREA_INDEXING 
) [static]

Generalizes the layer geometries (lines and polygons).

Parameters:
layerGID The layer global identificator
simplificationLevelsNum Levels of geometries simplification
minError Min error value
maxError Max error value
indexingLevels Levels of geometries indexing
indexingType Type of index

void TdkPersistenceService::agregateLayer ( TdkObjectGID layerGID  )  [static]

Agregates the layer geometries (points).

Parameters:
layerGID The layer global identificator
maxNumObjectsQuad Max number of objects by quadrant (Quadtree alg)

void TdkPersistenceService::deleteStrategy ( TdkObjectGID layerId,
int  strategyId 
) [static]

void TdkPersistenceService::setReferenceScale ( TdkObjectGID  themeGID  )  [static]

void TdkPersistenceService::getStringAttrValues ( const std::string  dbKey,
const std::string  layerName,
const std::string  tableName,
const std::string  attrName,
std::vector< std::string > &  attrValues 
) [static]

void TdkPersistenceService::getStringAttrValues ( const std::string  dbKey,
const std::string  layerName,
const std::string  tableName,
std::vector< std::string >  attrNames,
std::vector< std::vector< std::string > > &  attrValues 
) [static]

std::string TdkPersistenceService::getAttrQrySQL ( std::string  dbKey,
const std::string  tableName,
const std::string  attrName,
const std::string  value 
) [static]

bool TdkPersistenceService::createStyleTable ( TeDatabase *  db,
std::string  tabName 
) [static]

bool TdkPersistenceService::createStyleModelTables ( TeDatabase *  db  )  [static]

bool TdkPersistenceService::createStyleVisualTable ( TeDatabase *  db,
bool  createRelations = true 
) [static]

static bool TdkPersistenceService::insertVisual ( TeDatabase *  db,
TeLegendEntry *  legend,
TeGeomRep  rep 
) [static]

TdkStyle * TdkPersistenceService::getStyle ( TeDatabasePortal *  portal  )  [static]

void TdkPersistenceService::insertStyleLibrary ( TdkStyleLibrary lib,
string  dbKey 
) [static]

\

Parameters:
library name
database descriptor key
Returns:
error message

bool TdkPersistenceService::insertStyleLibrary ( TeDatabase *  db,
const std::string  libName 
) [static]

static bool TdkPersistenceService::loadStyleLibrary ( TdkStyleLibrary lib,
std::string  dbKey 
) [static]

Loads the style library data by the given id or name.

Parameters:
lib The style library to fill
dbKey Database descriptor
Returns:
true if the library exists, otherwise returns false

bool TdkPersistenceService::loadStyleLibrary ( TeDatabase *  db,
TdkStyleLibrary lib 
) [static]

static void TdkPersistenceService::loadStyleLibraries ( TdkStyleLibraryVector libs,
std::string  dbKey 
) [static]

void TdkPersistenceService::loadStyleLibraries ( TeDatabase *  db,
TdkStyleLibraryVector libs 
) [static]

static void TdkPersistenceService::updateStyleLibrary ( TdkStyleLibrary lib,
std::string  dbKey 
) [static]

void TdkPersistenceService::updateStyleLibrary ( TeDatabase *  db,
TdkStyleLibrary lib 
) [static]

static void TdkPersistenceService::deleteStyle ( int  styleLibraryId,
int  libId,
std::string  dbKey 
) [static]

void TdkPersistenceService::deleteStyle ( TeDatabase *  db,
const std::string  tableName,
int  libId 
) [static]

void TdkPersistenceService::insertStyle ( int  styleLibraryId,
TdkStyle style,
std::string  dbKey 
) [static]

bool TdkPersistenceService::insertStyle ( TeDatabase *  db,
const std::string &  table,
TdkStyle style 
) [static]

void TdkPersistenceService::updateStyle ( int  styleLibraryId,
TdkStyle style,
std::string  dbKey 
) [static]

bool TdkPersistenceService::updateStyle ( TeDatabase *  db,
const std::string &  table,
TdkStyle style 
) [static]

void TdkPersistenceService::insertImageStyle ( std::string  styleLibName,
std::string  styleName,
std::string &  imagefile,
std::string  dbKey 
) [static]

static void TdkPersistenceService::deleteStyleLibrary ( int  libId,
std::string  dbKey 
) [static]

void TdkPersistenceService::deleteStyleLibrary ( TeDatabase *  db,
int  libId 
) [static]

void TdkPersistenceService::loadImage ( TdkStyle st,
std::string &  fname 
) [static]

void TdkPersistenceService::insertOwnLegendsFromStyleLibrary ( int  themeId,
std::string  styleLibName,
std::string  dbKey 
) [static]

Inserts in the database theme own legends based on the given style library.

Parameters:
themeId The theme identificator
styleLibName Style library name
dbKey The database descriptor key

void TdkPersistenceService::getOwnLegendsIds ( int  themeId,
std::string  dbKey,
std::vector< int > &  legendIds 
) [static]

Gets theme own legends ids.

Parameters:
themeId The theme identificator
dbKey The database descriptor key
legendIds The own legends id vector

void TdkPersistenceService::dropDBTable ( std::string  dbTableName,
std::string  dbKey 
) [static]

Deletes a database table (don�t delete the terralib model tables).

void TdkPersistenceService::dropDBView ( std::string  dbViewName,
std::string  dbKey 
) [static]

Deletes a database table view.

bool TdkPersistenceService::deleteGeometry ( TeDatabase *  db,
const string &  table,
int  geomId 
) [static]

Removes a geometry from the given table.

Parameters:
db The database driver
table The geometry table name
geomId The geom id

bool TdkPersistenceService::deleteThemeGroup ( TeDatabase *  db,
int  themeId 
) [static]

Extends the TeDatabase::deleteThemeGroup, to delete the tdk theme properties.

Parameters:
db The database driver
themeId The group id

TeViewTree * TdkPersistenceService::loadViewTree ( TeDatabase *  db,
TdkView view,
int  theme_id,
TdkLoadParams params 
) [static]

Re implements the TeDatabase::loadViewTree, loading only the basic attributes of the themes (node_type, theme_id, name, parent_id, priority, enable_visibility, enable_activation).

Parameters:
db The database driver
themeId The group id

bool TdkPersistenceService::updateViewTree ( TeDatabase *  db,
TeViewTree *  tree,
TdkPersistenceParams params 
) [static]

Re implements the TeDatabase::updateViewTree, update the tdk view tree properties and updates only the theme that needed be updated.

Parameters:
db The database driver
tree The view tree pointer
params The persistence params

void TdkPersistenceService::getAttributeList ( const TdkObjectGID layerGID,
const unsigned int &  attrTableIndex,
TeAttributeList &  attrList 
) [static]

void TdkPersistenceService::importObjectData ( const TdkObjectGID layerGID,
const TePointSet &  points,
const TeTable &  attTable,
const int &  autoIdent,
const int &  identIndex 
) [static]

void TdkPersistenceService::importObjectData ( const TdkObjectGID layerGID,
const TeLineSet &  lines,
const TeTable &  attTable,
const int &  autoIdent,
const int &  identIndex 
) [static]

void TdkPersistenceService::importObjectData ( const TdkObjectGID layerGID,
const TePolygonSet &  polygons,
const TeTable &  attTable,
const int &  autoIdent,
const int &  identIndex 
) [static]

void TdkPersistenceService::importObjectData ( const TdkObjectGID layerGID,
const TeTextSet &  texts,
const TeTable &  attTable,
const int &  autoIdent,
const int &  identIndex 
) [static]


Friends And Related Function Documentation

friend class TdkCache [friend]


The documentation for this class was generated from the following files:
Generated on Fri Jun 15 16:54:48 2007 for TDK by  doxygen 1.5.2