| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

Classes | Functions
E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/qt/TeApplicationUtils.h File Reference

This contains some utilitary functions to deal with TerraLib databases. More...

`#include "TeAppTheme.h"`
`#include "../../kernel/TeVisual.h"`
`#include "../../kernel/TeDatabase.h"`
`#include "../../kernel/TeGeneralizedProxMatrix.h"`
`#include "../../kernel/TeDefines.h"`
`#include <string>`
`#include <vector>`
`#include <set>`

Go to the source code of this file.

## Classes

struct | ObjectInfo

## Functions

TL_DLL bool | createAppThemeTable (TeDatabase *db, bool integrity=false, const string &tableName="te_theme_application")
TL_DLL bool | populateAppThemeTable (TeDatabase *db, const string &tableName="te_theme_application")
TL_DLL bool | deleteAppTheme (TeDatabase *db, TeAbstractTheme *theme, const string &tableName="te_theme_application")
TL_DLL bool | createMediaTable (TeDatabase *db, const string &tname)
TL_DLL bool | createLayerMediaTable (TeDatabase *db, int layerId, const string &tname)
TL_DLL bool | insertMedia (TeDatabase *db, const string &tableName, string &fileName, const string &description, const string &type, bool blob=true)
TL_DLL bool | insertMediaObjLayer (TeDatabase *db, TeLayer *layer, const string &objectId, const string &mediaName, const string &mediaTable)
TL_DLL bool | setDefaultMedia (TeDatabase *db, TeLayer *layer, const string &objectId, const string &mediaName, const string &mediaTable)
TL_DLL bool | updateMediaDescription (TeDatabase *db, const string &mediaName, const string &mediaTable, const string &desc)
TL_DLL 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.
TL_DLL string | getInfoBlob2TemporaryFile (TeDatabase *db, int layerId, const string &tableName, string &type)
| read blob and copy to temporary file
TL_DLL bool | createChartParamsTable (TeDatabase *db, bool integrity=false)
TL_DLL bool | updateGridColor (TeDatabase *db, int themeId, TeObjectSelectionMode sel, TeColor &color)
TL_DLL bool | createKernelMetadataTable (TeDatabase *db)
TL_DLL bool | insertKernelMetadata (TeDatabase *db, TeKernelParams &kernelPar)
TL_DLL bool | updateKernelMetadata (TeDatabase *db, TeKernelParams &kernelPar)
TL_DLL bool | loadKernelParams (TeDatabase *db, int supThemeId, const string &supTableName, const string &supAttrName, TeKernelParams &KernelPar)
TL_DLL bool | loadKernelParams (TeDatabase *db, int LayerId, TeKernelParams &KernelPar)
TL_DLL int | createTeLayerMetadata (TeDatabase *db)
TL_DLL int | createTeTableMetadata (TeDatabase *db)
TL_DLL bool | deleteTextVisual (TeLayer *layer)
TL_DLL string | deletePointedObjects (TeTheme *theme, TeBox &box)
TL_DLL string | insertObjectIntoCollection (TeTheme *theme, TeCoord2D p, string newId, string newTId="")
TL_DLL bool | createGPMMetadataTable (TeDatabase *db, const bool &integrity=true)
TL_DLL bool | createNeighbourhoodTable (TeDatabase *db, const string &tableName)
template<typename set >
bool | insertGPM (TeDatabase *db, TeGeneralizedProxMatrix< set > *gpm, vector< string > &objs)
template<typename set >
bool | loadDefaultGPM (TeDatabase *db, const int &themeId, TeGeneralizedProxMatrix< set > *&gpm)
TL_DLL bool | deleteGPMTable (TeDatabase *db, const int &themeId, const int &gpmId=-1)
| Delete the generalized proximity matrix of a theme - neighbourhoodTable and metadata.
TL_DLL bool | loadAppTheme (TeDatabase *db, TeAppTheme *theme, const string &tableName="te_theme_application")
TL_DLL bool | insertAppTheme (TeDatabase *db, TeAppTheme *theme, const string &tableName="te_theme_application")
TL_DLL bool | updateAppTheme (TeDatabase *db, TeAppTheme *theme, const string &tableName="te_theme_application")
TL_DLL bool | insertChartParams (TeDatabase *db, TeAppTheme *theme)
TL_DLL bool | deleteChartParams (TeDatabase *db, TeAppTheme *theme)
TL_DLL bool | locatePieBar (TeDatabase *db, TeAppTheme *theme, TeCoord2D pt, double delta)
TL_DLL bool | loadChartParams (TeDatabase *db, TeAppTheme *theme)
TL_DLL bool | updatePieBarLocation (TeDatabase *db, TeAppTheme *theme, TeCoord2D pt)
TL_DLL bool | updatePointLocation (TeDatabase *db, TeAppTheme *theme, TeCoord2D pt)
TL_DLL bool | generateCountLegends (TeAppTheme *theme, string table, string field)
| generate Count legends
TL_DLL void | changeObjectStatus (ObjectInfo &info, string &uniqueId, string mode, int pointed=1)
TL_DLL bool | saveObjectStatus (TeAppTheme *theme, set< string > &objectSet, map< string, ObjectInfo > &objectMap)
TL_DLL TeStatisticType | getStatisticFromString (const string &s)
TL_DLL void | getVisual (TeAppTheme *theme, TeGeomRep geomRep, map< string, TeVisual > &objVisualMap, set< string > &oidSet, bool allObjects)
template<typename T1 >
TeCoord2D | calculateLabelPosition (const T1 &geomSet)
template<>
TeCoord2D | calculateLabelPosition (const TePolygonSet &geomSet)
template<>
TeCoord2D | calculateLabelPosition (const TeLine2D &geomSet)
TL_DLL bool | getNextObject (TeDatabasePortal *portal, TePolygonSet &polys, TePolygon &nextPoly)
TL_DLL bool | generateTextUsingCentroid (TeTheme *theme, const std::string &objectId="")
| This function generates the position of text labels.

## Detailed Description

This contains some utilitary functions to deal with TerraLib databases.

## Function Documentation

template<typename T1 >

TeCoord2D calculateLabelPosition | ( | const T1 & | geomSet | ) |

template<>

TeCoord2D calculateLabelPosition | ( | const TePolygonSet & | geomSet | ) |

template<>

TeCoord2D calculateLabelPosition | ( | const TeLine2D & | geomSet | ) |

TL_DLL void changeObjectStatus | ( | ObjectInfo & | info,
|  | string & | uniqueId,
|  | string | mode,
|  | int | pointed = `1`
| ) |  |

TL_DLL bool deleteChartParams | ( | TeDatabase * | db,
|  | TeAppTheme * | theme
| ) |  |

Deletes the chart parameters of a theme in the database

Parameters:

  db | pointer do a TerraLib database
  theme | pointer to a theme as defined by TerraView

TL_DLL string deletePointedObjects | ( | TeTheme * | theme,
|  | TeBox & | box
| ) |  |

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

Parameters:

  theme | pointer to the extended theme were the objects are pointed
  box | to return the bounding box that contains the objects that were deleted

Returns:
  the error message of the database when the function fails

TL_DLL bool deleteTextVisual | ( | TeLayer * | layer | ) |

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

Parameters:

  layer | pointer do a TerraLib layer

TL_DLL bool generateCountLegends | ( | TeAppTheme * | theme,
|  | string | table,
|  | string | field
| ) |  |

generate Count legends

TL_DLL 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:

  theme | The theme to generate labels positions.
  objectId | Object 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.

TL_DLL bool getNextObject | ( | TeDatabasePortal * | portal,
|  | TePolygonSet & | polys,
|  | TePolygon & | nextPoly
| ) |  |

TL_DLL TeStatisticType getStatisticFromString | ( | const string & | s | ) |

TL_DLL void getVisual | ( | TeAppTheme * | theme,
|  | TeGeomRep | geomRep,
|  | map< string, TeVisual > & | objVisualMap,
|  | set< string > & | oidSet,
|  | bool | allObjects
| ) |  |

TL_DLL bool insertAppTheme | ( | TeDatabase * | db,
|  | TeAppTheme * | theme,
|  | const string & | tableName = `"te_theme_application"`
| ) |  |

Saves the parameters of an extended theme

Parameters:

  db | a pointer to a TerraLib database
  theme | pointer to an instance of an extended theme
  tableName | name of the table that persists the extended theme

TL_DLL bool insertChartParams | ( | TeDatabase * | db,
|  | TeAppTheme * | theme
| ) |  |

Saves in the database the color parameters associated to a theme

Parameters:

  db | pointer do a TerraLib database
  theme | pointer to a theme as defined by TerraView

TL_DLL string insertObjectIntoCollection | ( | TeTheme * | theme,
|  | TeCoord2D | p,
|  | string | newId,
|  | string | newTId = `""`
| ) |  |

Inserts a new object into a theme

Parameters:

  theme | pointer to a theme (the object is already in the layer)
  p | labels position location
  newId | the identifier of the object
  newTId | the identifier of the instance of the object (for temporal objects)

TL_DLL bool loadAppTheme | ( | TeDatabase * | db,
|  | TeAppTheme * | theme,
|  | const string & | tableName = `"te_theme_application"`
| ) |  |

Loads the parameters of an extended theme

Parameters:

  db | a pointer to a TerraLib database
  theme | pointer to an instance of an extended theme
  tableName | name of the table that persists the extended theme

TL_DLL bool loadChartParams | ( | TeDatabase * | db,
|  | TeAppTheme * | theme
| ) |  |

Loads the charts parameters associated to a theme

Parameters:

  db | pointer do a TerraLib database
  theme | pointer to a theme as defined by TerraView

TL_DLL 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:

  db | pointer do a TerraLib database
  theme | pointer to a theme as defined by TerraView
  pt | a location
  delta | a tolerance around the location

TL_DLL bool saveObjectStatus | ( | TeAppTheme * | theme,
|  | set< string > & | objectSet,
|  | map< string, ObjectInfo > & | objectMap
| ) |  |

TL_DLL bool updateAppTheme | ( | TeDatabase * | db,
|  | TeAppTheme * | theme,
|  | const string & | tableName = `"te_theme_application"`
| ) |  |

Updates the parameters of an extended theme

Parameters:

  db | a pointer to a TerraLib database
  theme | pointer to an instance of an extended theme
  tableName | name of the table that persists the extended theme

TL_DLL bool updatePieBarLocation | ( | TeDatabase * | db,
|  | TeAppTheme * | theme,
|  | TeCoord2D | pt
| ) |  |

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

Parameters:

  db | pointer do a TerraLib database
  theme | pointer to a theme as defined by TerraView
  pt | the new location for the chart

TL_DLL bool updatePointLocation | ( | TeDatabase * | db,
|  | TeAppTheme * | theme,
|  | TeCoord2D | pt
| ) |  |

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

Parameters:

  db | pointer do a TerraLib database
  theme | pointer to an extended theme
  pt | new location of the point

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines