TerraLib 4.1
E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/qt/TeApplicationUtils.cpp File Reference
#include "TeApplicationUtils.h"
#include "../../kernel/TeSlice.h"
#include "../../kernel/TeDatabase.h"
#include "../../utils/TeDatabaseUtils.h"
#include "../../utils/TeColorUtils.h"
#include "../../stat/TeKernelParams.h"
#include "../../kernel/TeExternalTheme.h"
#include <errno.h>

Functions

void TeGroupByUniqueValue (vector< string > &vec, TeAttrDataType tipo, vector< TeSlice > &result, int precision)
bool createAppThemeTable (TeDatabase *db, bool integrity, const string &tableName)
bool populateAppThemeTable (TeDatabase *db, const string &tableName)
bool deleteAppTheme (TeDatabase *db, TeAbstractTheme *theme, const string &tableName)
bool createMediaTable (TeDatabase *db, const string &tname)
bool createLayerMediaTable (TeDatabase *db, int layerId, const string &tname)
bool insertMedia (TeDatabase *db, const string &tableName, string &fileName, const string &description, const string &type, bool blob)
bool insertMediaObjLayer (TeDatabase *db, TeLayer *layer, const string &objectId, const string &mediaName, const string &mediaTable)
bool setDefaultMedia (TeDatabase *db, TeLayer *layer, const string &objectId, const string &mediaName, const string &mediaTable)
bool updateMediaDescription (TeDatabase *db, const string &mediaName, const string &mediaTable, const string &desc)
bool insertInfo2Blob (TeDatabase *db, int layerId, const string &tableName, const string &fileName, const string &type)
 Inserts a new general information of a layer or database.
string getInfoBlob2TemporaryFile (TeDatabase *db, int layerId, const string &tableName, string &type)
 read blob and copy to temporary file
bool createChartParamsTable (TeDatabase *db, bool integrity)
bool updateGridColor (TeDatabase *db, int themeId, TeObjectSelectionMode sel, TeColor &color)
bool createKernelMetadataTable (TeDatabase *db)
bool insertKernelMetadata (TeDatabase *db, TeKernelParams &kernelPar)
bool updateKernelMetadata (TeDatabase *db, TeKernelParams &kernelPar)
bool loadKernelParams (TeDatabase *db, int supThemeId, const string &supTableName, const string &supAttrName, TeKernelParams &KernelPar)
bool loadKernelParams (TeDatabase *db, int layerId, TeKernelParams &KernelPar)
int createTeLayerMetadata (TeDatabase *db)
int createTeTableMetadata (TeDatabase *db)
bool deleteTextVisual (TeLayer *layer)
string deletePointedObjects (TeTheme *theme, TeBox &box)
string insertObjectIntoCollection (TeTheme *theme, TeCoord2D p, string newId, string newTId)
bool createGPMMetadataTable (TeDatabase *db, const bool &integrity)
bool createNeighbourhoodTable (TeDatabase *db, const string &tableName)
bool deleteGPMTable (TeDatabase *db, const int &themeId, const int &gpmId)
 Delete the generalized proximity matrix of a theme - neighbourhoodTable and metadata.
bool loadAppTheme (TeDatabase *db, TeAppTheme *theme, const string &tableName)
bool insertAppTheme (TeDatabase *db, TeAppTheme *appTheme, const string &tableName)
bool updateAppTheme (TeDatabase *db, TeAppTheme *appTheme, const string &tableName)
bool insertChartParams (TeDatabase *db, TeAppTheme *theme)
bool deleteChartParams (TeDatabase *db, TeAppTheme *theme)
bool locatePieBar (TeDatabase *db, TeAppTheme *theme, TeCoord2D pt, double delta)
bool loadChartParams (TeDatabase *db, TeAppTheme *theme)
bool updatePieBarLocation (TeDatabase *db, TeAppTheme *theme, TeCoord2D pt)
bool updatePointLocation (TeDatabase *db, TeAppTheme *theme, TeCoord2D pt)
bool generateCountLegends (TeAppTheme *appTheme, string table, string field)
 generate Count legends
void changeObjectStatus (ObjectInfo &info, string &uniqueId, string mode, int pointed)
bool saveObjectStatus (TeAppTheme *appTheme, set< string > &objectSet, map< string, ObjectInfo > &objectMap)
TeStatisticType getStatisticFromString (const string &s)
void getVisual (TeAppTheme *appTheme, TeGeomRep geomRep, map< string, TeVisual > &objVisualMap, set< string > &oidSet, bool allObjects)
template<>
TeCoord2D calculateLabelPosition (const TePolygonSet &geomSet)
bool getMiddleLine (TeLine2D line, TeCoord2D &p)
template<>
TeCoord2D calculateLabelPosition (const TeLine2D &geomSet)
bool saveCentroidLabel (TeDatabase *db, const TePolygonSet &polys, const std::string &collTable)
bool getNextObject (TeDatabasePortal *portal, TePolygonSet &polys, TePolygon &nextPoly)
bool generateTextUsingCentroid (TeTheme *theme, const std::string &objectId)
 This function generates the position of text labels.

Function Documentation

template<>
TeCoord2D calculateLabelPosition ( const TePolygonSet geomSet)
template<>
TeCoord2D calculateLabelPosition ( const TeLine2D geomSet)
void changeObjectStatus ( ObjectInfo info,
string uniqueId,
string  mode,
int  pointed 
)
bool deleteChartParams ( TeDatabase db,
TeAppTheme theme 
)

Deletes the chart parameters of a theme in the database

Parameters:
dbpointer do a TerraLib database
themepointer to a theme as defined by TerraView
string deletePointedObjects ( TeTheme theme,
TeBox box 
)

Delete the objects of a layer that are pointed in a theme

Parameters:
themepointer to the extended theme were the objects are pointed
boxto return the bounding box that contains the objects that were deleted
Returns:
the error message of the database when the function fails
bool deleteTextVisual ( TeLayer layer)

Removes tables that contains the visual of texts associated to a layer

Parameters:
layerpointer do a TerraLib layer
bool generateCountLegends ( TeAppTheme appTheme,
string  table,
string  field 
)

generate Count legends

bool generateTextUsingCentroid ( TeTheme theme,
const std::string objectId = "" 
)

This function generates the position of text labels.

It calculates the label position using the center of geometry box. This coordinate is calculated as follows:

  • If the geometry is a polygon, the label is located at the polygon box center. If this coordinate isn't within the polygon, recalcultates coordinate. The new label position will be the polygon centroid.
  • If the polygon has islands, the label position will be located within the polygon with greater area.
  • If the geometry is a line, the label is located ate the line box center. If this coordinate isn't located at the line, recalculates the coordinate. The new label position will be the center point of the line.
  • If the geometry is a point, the label will be the point.
Parameters:
themeThe theme to generate labels positions.
objectIdObject identifier. This parameter is used, if the label position must be generated for a particular object.
Returns:
True if everything is ok, false if something fails.
bool getMiddleLine ( TeLine2D  line,
TeCoord2D p 
)
bool getNextObject ( TeDatabasePortal portal,
TePolygonSet polys,
TePolygon nextPoly 
)
TeStatisticType getStatisticFromString ( const string s)
void getVisual ( TeAppTheme appTheme,
TeGeomRep  geomRep,
map< string, TeVisual > &  objVisualMap,
set< string > &  oidSet,
bool  allObjects 
)
bool insertAppTheme ( TeDatabase db,
TeAppTheme theme,
const string tableName = "te_theme_application" 
)

Saves the parameters of an extended theme

Parameters:
dba pointer to a TerraLib database
themepointer to an instance of an extended theme
tableNamename of the table that persists the extended theme
bool insertChartParams ( TeDatabase db,
TeAppTheme theme 
)

Saves in the database the color parameters associated to a theme

Parameters:
dbpointer do a TerraLib database
themepointer to a theme as defined by TerraView
string insertObjectIntoCollection ( TeTheme theme,
TeCoord2D  p,
string  newId,
string  newTId = "" 
)

Inserts a new object into a theme

Parameters:
themepointer to a theme (the object is already in the layer)
plabels position location
newIdthe identifier of the object
newTIdthe identifier of the instance of the object (for temporal objects)
bool loadAppTheme ( TeDatabase db,
TeAppTheme theme,
const string tableName = "te_theme_application" 
)

Loads the parameters of an extended theme

Parameters:
dba pointer to a TerraLib database
themepointer to an instance of an extended theme
tableNamename of the table that persists the extended theme
bool loadChartParams ( TeDatabase db,
TeAppTheme theme 
)

Loads the charts parameters associated to a theme

Parameters:
dbpointer do a TerraLib database
themepointer to a theme as defined by TerraView
bool locatePieBar ( TeDatabase db,
TeAppTheme theme,
TeCoord2D  pt,
double  delta 
)

Verifies if there is a pie/bar char around a given location, for a given theme and select it

Parameters:
dbpointer do a TerraLib database
themepointer to a theme as defined by TerraView
pta location
deltaa tolerance around the location
bool saveCentroidLabel ( TeDatabase db,
const TePolygonSet polys,
const std::string collTable 
)
bool saveObjectStatus ( TeAppTheme appTheme,
set< string > &  objectSet,
map< string, ObjectInfo > &  objectMap 
)
void TeGroupByUniqueValue ( vector< string > &  vec,
TeAttrDataType  tipo,
vector< TeSlice > &  result,
int  precision 
)
bool updateAppTheme ( TeDatabase db,
TeAppTheme theme,
const string tableName = "te_theme_application" 
)

Updates the parameters of an extended theme

Parameters:
dba pointer to a TerraLib database
themepointer to an instance of an extended theme
tableNamename of the table that persists the extended theme
bool updatePieBarLocation ( TeDatabase db,
TeAppTheme theme,
TeCoord2D  pt 
)

Updates the location of the selected pie/bar chart of a theme

Parameters:
dbpointer do a TerraLib database
themepointer to a theme as defined by TerraView
ptthe new location for the chart
bool updatePointLocation ( TeDatabase db,
TeAppTheme theme,
TeCoord2D  pt 
)

Updates the location of selected object of an extended theme with TePoint geometry

Parameters:
dbpointer do a TerraLib database
themepointer to an extended theme
ptnew location of the point
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines