TeTheme Class Reference

#include <TeTheme.h>

Inheritance diagram for TeTheme:

TeAbstractTheme TeViewNode TeExternalTheme

Detailed Description

A TeTheme represents a collection of objects selected from a TeLayer. This selection is based on restrictions that can be non-spatial (e.g. POP > 10000), spatial (e.g. "inside box(0,0,100,100) or temporal. The most simple selection is "all" objects of a layer.
A TeTheme contains the list of attribute tables of the layer used by a theme.
A TeTheme contains the visual presentation parameters for the objects that contains, for all of its geometrical representations.
A TeTheme can store the parameters associated to how to separate its objects in groups.
A TeTheme can store parameters associated to the creation of individual graphs on its objects (e.g. pie bars that relate two or more of its attributes).
A TeTheme store the range of scales within it should be visible.
See also:
TeView TeTable
Examples:

createSTElementSetFromTheme.cpp, createTheme.cpp, querierFromTheme.cpp, querierGroupChronon.cpp, querierGroupElement.cpp, querierGroupSpatialRest.cpp, querierWithSpatialRestBox.cpp, querierWithSpatialRestGeometry.cpp, rasterSlicing.cpp, and themeGrouping.cpp.

Definition at line 54 of file TeTheme.h.


Attribute Tables

A theme can use one or more attribute tables of the layer that gives its data.

These methods are related to the manipulation of these tables.

virtual void addThemeTable (string tableName)
 Add a new attribute table to a theme.
virtual bool addThemeTable (TeTable &table)
 Add a new attribute table to a theme.
virtual vector
< string > & 
aliasVector ()
 Returns the alias vector of the names of the theme tables.
virtual
TeAttrTableVector
attrTables ()
 Returns the list of attribute tables used by this theme.
virtual void clearAttList ()
 Clears the list of attributes associated to the theme tables.
virtual void clearAttTableVector ()
 Clears the list of attribute tables used by this theme.
virtual void clearNumAttList ()
 Clears the list of numerical attributes associated to the theme tables.
virtual string getAttribute (unsigned int i)
 Returns the full name of the i-th attribute resulting of the join of all attribute tables associated to the theme tables.
virtual bool getAttTables (TeAttrTableVector &attrs, TeAttrTableType attType=TeAllAttrTypes)
 Returns a vector of attribute tables, of a specific type, used by this theme.
virtual bool getTable (TeTable &table, const string tableName)
 Returns a representation of an attribute table given name.
virtual string getTableName (const string &attrName)
 Returns the the name of an attribute table that contains a given attribute.
virtual bool getTemporalTable (TeTable &table)
 Returns the temporal attribute table of the theme (TeEvent or TeFixedGeomDynAttr).
virtual bool isIndex (unsigned int i)
 Check if the name of the i-th attribute resulting of the join of all attribute tables is an index or not.
virtual bool isThemeTable (string tableName)
 Verify if an attribute table is part of a theme.
virtual bool isThemeTable (int tableId)
 Verify if an attribute table is part of a theme.
virtual void loadAliasVector ()
 fill aliasVector_
virtual void loadAttrLists ()
 Refresh list of attributes of all the theme tables.
virtual bool loadThemeTables ()
 Loads the theme tables in the database.
virtual bool removeThemeTable (unsigned int index)
 Removes an attribute table from the list of tables of a theme.
virtual bool setAttTables (TeAttrTableVector &attrs)
 Sets the entire list of attribute tables used by this theme.
virtual TeAttributeList sqlAttList ()
 Returns the list of attributes of theme tables.
virtual string sqlFrom ()
 Returns a SQL FROM CLAUSE that gives access to all attribute tables used by this theme.
virtual string sqlJoin ()
 Returns a SQL JOIN statement to reach to all attribute tables used by this theme.
virtual TeAttributeList sqlNumAttList ()
 Returns the list of numerical attributes of the theme tables.
virtual stringsqlWhere ()
 Returns the string containing the SQL WHERE clause.

Restrictions

Methods related to the restrictions over the theme used to generate this theme

virtual void attributeRest (const string &s)
 Sets the attribute restriction (where clause) used to generate the theme.
virtual string attributeRest ()
 Returns the attribute restriction (where clause) used to generate the theme.
virtual void boxRestriction (TeBox &b)
 Sets the box associated with the spatial restriction.
virtual TeBox boxRestriction ()
 Returns the box associated with the spatial restriction.
virtual void geomRepRestriction (TeGeomRep &rep)
 Sets the geometry representation of the theme which will be considered in the spatial restriction.
virtual TeGeomRep geomRepRestriction ()
 Returns the geometry representation of the theme which will be considered in the spatial restriction.
virtual void geomRestriction (TeGeometry *g)
 Sets a pointer to the geometry associated with the spatial restriction.
virtual TeGeometrygeomRestriction ()
 Returns a pointer to the geometry associated with the spatial restriction.
virtual bool hasAttrRest ()
 Returns if there is an attribute restriction.
virtual bool hasRestriction ()
 Verifies if this theme has any kind of restrictions.
virtual void hasSpatialRest (bool a)
 Sets the flag that indicates that there is a spatial restriction.
virtual bool hasSpatialRest ()
 Returns TRUE if this theme has a spatial restriction.
virtual bool hasTemporalRest ()
 Returns TRUE if there is a temporal restriction defined in the theme.
virtual void spatialRelation (TeSpatialRelation s)
 Sets the spatial relation (e.g WITHIN, COVERED BY, etc.) associate to the spatial restriction.
virtual TeSpatialRelation spatialRelation ()
 Returns the spatial relation (e.g WITHIN, COVERED BY, etc.) associate to the spatial restriction.
virtual void spatialRest (const string &s)
 Sets the spatial restriction used to generate the theme.
virtual string spatialRest ()
 Returns the spatial restriction used to generate the theme.
virtual void temporalRest (const string &t)
 Sets the temporal restriction used to generate the theme.
virtual string temporalRest ()
 Returns the temporal restriction used to generate the theme.

Box

Methods related to the bounding box of a theme

virtual TeBoxbox ()
 Returns the theme box.
virtual TeBoxgetThemeBox ()
 Returns the theme box.
virtual void setThemeBox (const TeBox &box)
 Sets the theme box.

Collection

Methods related to the materialization in the database of the theme as a collection of objects

virtual bool buildCollection (std::string objectId="", const bool &sincronize=true)
 Build the theme collection: materializes the selection described in the theme in a collection table.
virtual void collectionAuxTable (string name)
 Sets the name of the collection auxiliary table.
virtual string collectionAuxTable ()
 Returns the name of the collection auxiliary table.
virtual void collectionTable (const string &s)
 Sets the name of a table used to store the ids of the objects belonging to the theme.
virtual string collectionTable ()
 Returns the name of a table used to store the ids of the objects belonging to the theme.
virtual bool createCollectionAuxTable ()
 Create the auxiliar collection table used to represent objects with multiple versions in time.
virtual bool generateLabelPositions (const std::string &objectId="")
 Generates a optimized position (x,y) in the spatial extention of each object to position label ou graphs.
virtual void loadTablesJoin (const string &geomTable="")
 Fills the sqlGridJoin_ and sqlGridFrom_ statements according to the status of the database.
virtual bool populateCollectionAux (std::string objectId="")
 Populate the auxiliar collection table used to represent objects with multiple versions in time.
virtual string sqlGridFrom (const string &geomTable="")
 Returns a FROM clause of a SQL statement to get attributes of the theme objects, the attributes of the collection table, and the attributes of the extended collection table.
virtual string sqlGridJoin ()
 Returns a SQL JOIN statement to get all the attributes of the theme objects, the attributes of the collection table, and the attributes of the extended collection table.

Grouping

Methods related to grouping of objects of the theme.

Each group is represented by a specific presentation visual called legend. An slice represents the range of values of an attribute that characterizes a group.

virtual bool buildGrouping (const TeGrouping &g, vector< TeSlice > &slices)
 Save grouping parameters in memory passing an arbitrary set of slices.
virtual void cleanLegend ()
 Clear the vector of legends.
virtual TeSliceVector getSlices ()
 Returns the slices associated to the grouping of the theme.
virtual void grouping (const TeGrouping &g)
 Sets a grouping associated to the theme.
virtual TeGroupinggrouping ()
 Returns a grouping associated the theme.
virtual
TeLegendEntryVector
legend ()
 Returns the vector of legends of the theme.
virtual void resetGrouping ()
 Clear the existing grouping of objects of this theme.
virtual bool setGroupingVisual (int n, TeGeomRepVisualMap &vismap)
 Sets the visual of the n-th group of the theme.
virtual bool setGroupingVisual (int n, TeVisual *visual, TeGeomRep rep)
 Sets the visual associated to a geometric representation in the n-th group of the theme.

Grouping

Methods related to grouping of objects of the theme.

virtual bool buildGrouping (const TeGrouping &g, TeChronon chr, vector< map< string, string > > &mapObjValVec)
 Save the grouping parameters in memory when there is chronon.
virtual bool buildGrouping (const TeGrouping &g, TeSelectedObjects selectedObjects=TeAll, vector< double > *dValuesVec=0)
 Save the grouping parameters in memory when there is no chronon.
virtual bool deleteGrouping ()
 Delete grouping.
virtual bool saveGrouping (TeSelectedObjects selectedObjects=TeAll)
 Build the grouping and associate each object to its group in the collection table.
virtual bool saveLegendInCollection (TeSelectedObjects selectedObjects=TeAll, std::string objectId="")
 Save the theme grouping legends in the collection table.
virtual void setLegendsForObjects ()
 Set the legend id for each object of the theme.
virtual void setOwnLegendsForObjects ()
 Set the own legend id for each object of the theme.

Legends

Legends are also used to define presentation characteristics of the objets of the theme that aren't grouped, according to some specific characteristics (such as being pointed, being queried, among others).

virtual TeLegendEntrydefaultLegend ()
 Returns the default legend of the objects of the theme.
virtual void defaultLegend (TeLegendEntry &leg)
 Sets a default legend of the objects of the theme.
virtual map< string,
int > & 
getObjLegendMap ()
 Returns the map of legend ids associated to each object.
virtual map< string,
int > & 
getObjOwnLegendMap ()
 Returns the map of legend ids associated to each object.
virtual void legend (TeLegendEntry &leg)
 Sets a legend for the theme objects.
virtual TeLegendEntryoutOfCollectionLegend ()
 Returns the legend of the layer objects that are not selected in this layer.
virtual void outOfCollectionLegend (TeLegendEntry &leg)
 Sets a legend for objects of the layer that weren't selected in this theme.
virtual TeLegendEntrypointingLegend ()
 Returns the legend of the theme objects selected by pointing.
virtual void pointingLegend (TeLegendEntry &leg)
 Sets a legend for the theme objects selected by pointing.
virtual TeLegendEntryqueryAndPointingLegend ()
 Returns the legend of the theme objects selected by query and pointing.
virtual void queryAndPointingLegend (TeLegendEntry &leg)
 Sets a legend for the theme objects selected by query and pointing.
virtual TeLegendEntryqueryLegend ()
 Returns the legend of the theme objects selected by a query.
virtual void queryLegend (TeLegendEntry &leg)
 Sets a legend for the theme objects selected by a query.
virtual void setVisualDefault (TeVisual *visual, TeGeomRep rep)
 Sets the visual of the default legend for a specific geometrical representation.
virtual void setVisualOutOfCollection (TeVisual *visual, TeGeomRep rep)
 Sets the visual of the non-selected objects legend for a specific geometrical representation.
virtual void setVisualPointing (TeVisual *visual, TeGeomRep rep)
 Sets the visual of the pointed objects legend for a specific geometrical representation.
virtual void setVisualQuery (TeVisual *visual, TeGeomRep rep)
 Sets the visual of the queried objects legend for a specific geometrical representation.
virtual void setVisualQueryAndPointing (TeVisual *visual, TeGeomRep rep)
 Sets the visual of the queried and pointed objects legend for a specific geometrical representation.
virtual void setVisualWithoutDataConnection (TeVisual *visual, TeGeomRep rep)
 Sets the visual of the without-attributes objects legend for a specific geometrical representation.
virtual TeLegendEntrywithoutDataConnectionLegend ()
 Returns the legend of objects that have geometries but not descriptive attributes.
virtual void withoutDataConnectionLegend (TeLegendEntry &leg)
 Sets a legend for objects that have geometries but not descriptive attributes.

Layer

Methods related to the layer that gives origin to this theme.

virtual TeProjectiongetThemeProjection ()
 Returns a pointer to a projection that is the spatial reference for the objects of this theme: same as of its layer.
virtual TeLayerlayer ()
 Returns a pointer to the layer from which the theme get its objects.
virtual void layer (TeLayer *layer)
 Sets the layer that is the source of objects of the theme.
virtual void layerId (int i)
 Sets the id of the source layer.
virtual int layerId ()
 Returns the id of the source layer.

Visibility/Status

Methods related to the visibility/status of the theme and its components: graphs, geometrical representations of the objects, grouping.

const boolisAvailable () const
bool isEditable () const
virtual void setAvailability (const bool &avaiability)
void setEditable (const bool &editable)
virtual void visibility (int v)
 Sets whether the theme should be visible and/or active.
virtual int visibility ()
 Returns a status of a theme.
virtual int visibleGeoRep ()
 Returns the geometrical representations of the theme that are visible.
virtual int visibleRep ()
 Returns the components or representations of the theme that are visible.
virtual void visibleRep (int rep)
 Sets the components or representations of the theme that are visible.

Locate geometries

Returns the geometry(ies) of the theme given coordinate

virtual bool locateCell (TeCoord2D &pt, TeCell &c, const double &tol=0.0)
virtual bool locateLine (TeCoord2D &pt, TeLine2D &line, const double &tol=0.0)
virtual bool locatePoint (TeCoord2D &pt, TePoint &point, const double &tol=0.0)
virtual bool locatePolygon (TeCoord2D &pt, TePolygon &polygon, const double &tol=0.0)
virtual bool locatePolygonSet (TeCoord2D &pt, double tol, TePolygonSet &polygons)

Scale

Methods related to the range of scales where this theme should be visible

virtual void maxScale (double s)
 Sets the maximum scale in which the theme is visible.
virtual double maxScale ()
 Returns the maximum scale in which the theme is visible.
virtual void minScale (double s)
 Sets the minimum scale in which the theme is visible.
virtual double minScale ()
 Returns the minimum scale in which the theme is visible.

Raster Visual

Methods to deal with the visual presentation of the raster representations

virtual void rasterVisual (TeRasterTransform *r)
 Sets the visual presentation of raster geometry.
virtual
TeRasterTransform
rasterVisual ()
 Returns the visual presentation of raster geometry.
virtual void removeRasterVisual ()
 Removes the visual presentation of the raster.

Public Member Functions

virtual void add (TeViewNode *, const bool &=true)
 Inserts a new child in the tree hierachy. Fails if the object is a leaf.
virtual void clearItemStatus ()
 Set the status of the items to the default state.
virtual void clearObjectSet ()
 Clear the set containing the objects of the theme.
virtual void clearObjStatus ()
 Set the status of the objects to the default state.
virtual TeViewNodeclone ()
 Clones the object.
TeAbstractThemecopyTo (TeDatabase *outputDatabase, TeView *view, const std::string &renameTo="", const int &orderIndex=-1)
 Copies the theme to the given database, inside the given view and with the (optionall) given new name.
virtual void createRasterVisual (TeRaster *rst=0)
 Creates an appropriate visual presentation to the raster of the theme.
virtual void draw ()
 Draws a node.
virtual TeTime getCreationTime () const
 Gets the creation time of the theme.
virtual map< string,
int > & 
getItemStatusMap ()
 Return the map containing the status of the items.
virtual vector< stringgetItemVector (const set< string > &oidSet)
 Get the set of items corresponding to the set of objects.
virtual vector< stringgetItemVector (TeSelectedObjects selectedObjects)
 Get the set of items corresponding to the object selection criteria.
virtual unsigned int getNumberOfObjects ()
 Get the number of objects acessible by this theme.
virtual int getNumLayerObjects ()
 Return the number of objects of the layer.
virtual set< stringgetObjects (const vector< string > &itemVec)
 Get the set of objects corresponding to the list of items.
virtual set< stringgetObjects (TeSelectedObjects selectedObjects=TeAll)
 Get the set of objects corresponding to the object selection criteria.
virtual map< string,
int > & 
getObjStatusMap ()
 Return the map containing the status of the objects.
virtual int getProductId () const
virtual bool hasObjectsWithoutGeometries (TeGeomRep geomRep)
 Verifies if there are objects without geometries of a specific geometry representation.
virtual void id (int i)
 Sets the identification of a node.
virtual int id ()
 Returns the identification of a node.
virtual void invertObjectStatus ()
 Invert the pointing status of the objects.
virtual bool isUpdated ()
 Checks if the theme is update. If FALSE, the theme may be not be updated.
virtual void moveDown ()
 Moves a node down in the tree structure.
virtual void moveUp ()
 Moves a node up in the tree structure.
virtual void name (const string &s)
 Sets the name of a node.
virtual string name ()
 Returns the name of a node.
virtual bool operator< (const TeAbstractTheme &r) const
 Returns TRUE if a theme has lower priority than another.
TeThemeoperator= (const TeTheme &other)
 Assignment operator.
virtual TeViewNodeparent ()
 Returns a pointer to a parent node.
virtual void parentId (int i)
 Sets the identification of the parent node.
virtual int parentId ()
 Returns the identifier of a node parent.
virtual void priority (int i)
 Sets the priority of a node.
virtual int priority () const
 Returns the priority of a node.
virtual TeViewNoderemove (const string &)
 Remove an existing child identified by its name from the tree hierarchy.
virtual TeViewNoderemoveID (int)
 Remove an existing child identified by its id from the tree hierarchy.
virtual bool removeObjectsWithoutGeometries (TeGeomRep geomRep)
 Removes the objects without geometries of a specific geometry representation.
virtual void removePointingColor ()
 Remove the pointing color.
virtual void removeQueryColor ()
 Remove the query color.
virtual TeViewNoderetrieve (int)
 Retrieve a node identified by its identifier from the tree structure.
virtual bool save ()
 Save the the theme parameters in the database.
virtual bool saveMetadata (TeDatabase *)
 Save the theme metadata in database. In this case, this metadata is saved by TeDatabase.
virtual void setCreationTime (const TeTime &creationTime)
 Sets in memory the creation time of the theme.
virtual void setObjectsToDefaultStatus ()
 Set the objects to the default status.
virtual void setParent (TeViewNode *)
 Sets the parent node. The abstract theme does not have parent node.
virtual void setSpatialRest (TeGeometry *geom, TeGeomRep rep=TeGEOMETRYNONE, TeSpatialRelation relation=TeWITHIN)
 Sets the spatial restriction to be a spatial relation with a geometry.
virtual void setSpatialRest (TeBox &box, TeGeomRep rep=TeGEOMETRYNONE, TeSpatialRelation relation=TeWITHIN)
 Sets the spatial restriction to be a spatial relation with a box.
virtual void setStatus (vector< string > &oidVec, vector< string > &itemVec, int status)
 the status
virtual void setStatusForItemsAddedByPointing (vector< string > &itemVec)
 Set the status for the additional set of items that were pointed.
virtual void setStatusForItemsAddedByQuerying (set< string > &oidSet, vector< string > &uidVec)
 Set the status for the additional set of items that were queried.
virtual void setStatusForItemsFilteredByQuerying (set< string > &oidSet, vector< string > &uidVec)
 Set the status for the set of items that were filtered by a query operation.
virtual void setStatusForItemsToggled (set< string > &oidSet, vector< string > &itemVec)
 the status for the items that were toggled
virtual void setStatusForNewItemsPointed (vector< string > &itemVec)
 Set the status for the new set of items that were pointed.
virtual void setStatusForNewItemsQueried (set< string > &oidSet, vector< string > &uidVec)
 Set the status for the new set of items that were queried.
virtual void setStatusForNewObjectsPointed (set< string > &oidSet)
 Set the status for the new set of objects that were pointed.
virtual void setStatusForObjectsAddedByPointing (set< string > &oidSet)
 Set the status for the additional set of objects that were pointed.
virtual void setStatusForObjectToggled (string oid)
 Set the status for the objects that were toggled.
void setUsingCollection (const bool &usingCollection)
 Tells if it necessary to build a collection.
virtual void sort ()
 Sorts the node.
virtual string sqlWhereRestrictions (TeRepresentation *rep=0)
 Returns the clause WHERE derived from the combination of all restricitions (spatial, attribute and temporal).
virtual void swap (unsigned int, unsigned int)
 Swaps nodes.
int temporaryRepresentation (void)
 Return the visible temporary representation.
void temporaryRepresentation (int rep)
 Set the visible temporary representation.
void temporaryVisibility (short state)
 set the temporary state of theme
short temporaryVisibility (void)
 return the temporary state of theme
 TeTheme (const TeTheme &other)
 Copy constructor.
 TeTheme (const TeViewNodeParams &params)
 Constructor.
 TeTheme (const string &name="", TeLayer *layer=0, TeViewNode *parent=0, const int &view=0, const int &id=0)
 Constructor.
virtual void type (const int &t)
 Sets the node type.
virtual int type ()
 Returns the node type.
virtual void updateThemeBox (const TeBox &)
 Updates the bounding box of a theme (in the database).
virtual void updateThemeBox ()
 Refreshes the bounding box of a theme according to its representation.
virtual bool updateThemeCreationTime (TeDatabase *database)
 Updates the creation in memory and in the database.
virtual int view ()
 Returns the view identification of a node.
virtual void view (int viewId)
 Sets the view identification of a node.
virtual void viewNodeParams (TeViewNodeParams &p)
virtual
TeViewNodeParams
viewNodeParams ()
 ~TeTheme ()
 Destructor.

Static Public Member Functions

static TeViewNodeDefaultObject ()

Protected Member Functions

virtual bool afterCopyThemeTo (TeAbstractTheme *absThemeCopy, TeDatabase *outputDatabase)
 Should be reimplemented if some functions for the theme copy need to be done after the theme was saved on its new location. This method will be called after the theme is saved in the database.
virtual bool beforeCopyThemeTo (TeAbstractTheme *absThemeCopy, TeDatabase *outputDatabase)
 Should be reimplemented to set all the parameters and pre-requisites necessaries to copy a theme to the given database. This method will be called before the theme is saved in the database.
virtual bool buildGrouping (TeDatabase *db, const TeGrouping &g, TeChronon chr, vector< map< string, string > > &mapObjValVec)
 Save the grouping parameters in memory when there is chronon.
virtual bool buildGrouping (TeDatabase *db, const TeGrouping &g, TeSelectedObjects selectedObjects=TeAll, vector< double > *dValuesVec=0)
 Save the grouping parameters in memory when there is no chronon.
virtual bool createCollectionAuxTable (TeDatabase *db)
 Create the auxiliar collection table used to represent objects with multiple versions in time.
virtual bool eraseMetadata (TeDatabase *)
 Erase the theme metadata in database. In this case, this metadata is erased by TeDatabase.
virtual bool loadMetadata (TeDatabase *)
 Load the theme metadata from database. In this case, this metadata is loaded by TeDatabase.
virtual void loadThemeTablesJoin ()
 Fill the sqlJoin_ and sqlFrom_.
virtual void moveDown (TeViewNode *)
virtual void moveUp (TeViewNode *)
virtual bool populateCollection (std::string objectId="", const bool &sincronize=true)
 Populate the collection table based in the theme restrictions.
virtual bool saveGrouping (TeDatabase *db, TeSelectedObjects selectedObjects=TeAll)
 Build the grouping and associate each object to its group in the collection table.
virtual bool saveLegendInCollection (TeDatabase *db, TeSelectedObjects selectedObjects=TeAll, std::string objectId="")
 Save the theme grouping legends in the collection table.

Protected Attributes

vector< stringaliasVector_
 vector of alias to the attribute tables that are used more than once
TeAttrTableVector attTableVector_
 list of attribute tables of the theme
TeBox boxRest_
string collectionAuxTable_
string collectionTable_
TeTime creationTime_
 Stores the creation time of the theme.
TeLegendEntry defaultLegend_
int enableVisibility_
string generateAttributeRest_
string generateSpatialRest_
string generateTemporalRest_
TeGeomRep geomRepRest_
TeGeometrygeomRest_
TeGrouping grouping_
bool hasSpatialRes_
bool isAvailable_
 Theme source can be accessed.
bool isEditable_
 Theme can be edited.
map< string, int > itemStatusMap_
 Status of the item (concatenation of the unique names of each theme table).
TeLayerlayer_
 Pointer to the layer that gives origin to this theme.
int layerId_
 Layer id.
TeLegendEntryVector legend_
double maxScale_
double minScale_
int numLayerObjects_
 Number of objects of the layer.
set< stringobjectSet_
 A set containing the theme objects.
map< string, int > objLegendMap_
map< string, int > objOwnLegendMap_
map< string, int > objStatusMap_
 Status of the object.
TeLegendEntry outOfCollectionLegend_
TeLegendEntry pointingLegend_
TeLegendEntry queryAndPointingLegend_
TeLegendEntry queryLegend_
TeRasterTransformrasterVisual_
 visual of raster
TeSpatialRelation spatialRelation_
TeAttributeList sqlAttList_
 List containing all the attributes of the theme tables.
string sqlFrom_
 clause FROM: join with the theme tables and collection table
string sqlGridFrom_
 clause FROM: join with the theme tables and auxiliar collection table
string sqlGridJoin_
 clause SELECT and FROM: join with the theme tables and auxiliar collection table
string sqlJoin_
 clause SELECT and FROM: join with the theme tables and collection table
TeAttributeList sqlNumAttList_
 List containing only the numeric attributes of the theme tables.
string sqlWhere_
 string containing the WHERE clause
int temporaryRepresentation_
short temporaryVisibility_
TeBox themeBox_
bool useCollection_
TeViewNodeParams viewNodeParams_
 Node parameters.
int visibleRep_
TeLegendEntry withoutDataConnectionLegend_

Constructor & Destructor Documentation

TeTheme::TeTheme ( const string name = "",
TeLayer layer = 0,
TeViewNode parent = 0,
const int &  view = 0,
const int &  id = 0 
)

Definition at line 35 of file TeTheme.cpp.

References TeLayer::box(), TeLayer::database(), TeLayer::id(), TeAbstractTheme::isEditable_, layer_, layerId_, and TeAbstractTheme::themeBox_.

Referenced by clone(), TeExternalTheme::loadMetadata(), TeExternalTheme::setRemoteTheme(), TeExportLayerToShapefile(), and TeExportShapefile().

00036                 : TeAbstractTheme(name, parent, view, id, TeTHEME),
00037                 layer_(layer),
00038         useCollection_(true)
00039 {
00040         //layer id
00041         if(layer)
00042         {
00043                 layerId_ = layer->id();
00044                 if (layer_->database())
00045                         themeBox_ = layer_->box();
00046         }
00047         else
00048                 layerId_ = -1;
00049 
00050         isEditable_ = true;
00051 }

TeTheme::TeTheme ( const TeViewNodeParams params  ) 

Definition at line 53 of file TeTheme.cpp.

References TeAbstractTheme::isEditable_.

00053                                                : TeAbstractTheme(params),       layer_(0), layerId_(-1),
00054 useCollection_(true)
00055 {
00056         isEditable_ = true;
00057 }

TeTheme::TeTheme ( const TeTheme other  ) 

Definition at line 61 of file TeTheme.cpp.

References aliasVector_, attTableVector_, collectionAuxTable_, collectionTable_, TeAbstractTheme::isEditable_, layer_, layerId_, sqlAttList_, sqlFrom_, sqlGridFrom_, sqlGridJoin_, sqlJoin_, sqlNumAttList_, and useCollection_.

00061                                       :
00062         TeAbstractTheme(other)
00063 {
00064         layerId_ = other.layerId_;
00065         layer_ = other.layer_;      //the same layer pointer
00066         collectionTable_ = other.collectionTable_;
00067         collectionAuxTable_ = other.collectionAuxTable_;
00068 
00069         attTableVector_ = other.attTableVector_;
00070         sqlFrom_ =  other.sqlFrom_;
00071         sqlJoin_ = other.sqlGridJoin_;
00072         sqlGridFrom_ = other.sqlGridFrom_;
00073         sqlGridJoin_ = other.sqlGridJoin_;
00074         aliasVector_ = other.aliasVector_;
00075         sqlAttList_ = other.sqlAttList_;
00076         sqlNumAttList_ = other.sqlNumAttList_;
00077 
00078     useCollection_ = other.useCollection_;
00079 
00080     isEditable_ = true;
00081 }

TeTheme::~TeTheme (  ) 

Definition at line 85 of file TeTheme.cpp.

References aliasVector_, clearAttList(), clearAttTableVector(), collectionAuxTable_, collectionTable_, sqlAttList_, sqlFrom_, sqlGridFrom_, sqlGridJoin_, sqlJoin_, and sqlNumAttList_.

00086 {
00087         clearAttTableVector();
00088         clearAttList();
00089         collectionTable_.clear();
00090         collectionAuxTable_.clear();
00091         sqlFrom_.clear();
00092         sqlJoin_.clear();
00093         sqlGridFrom_.clear();
00094         sqlGridJoin_.clear();
00095         aliasVector_.clear();
00096         sqlAttList_.clear();
00097         sqlNumAttList_.clear();
00098 }


Member Function Documentation

virtual void TeViewNode::add ( TeViewNode ,
const bool = true 
) [inline, virtual, inherited]

Reimplemented in TeViewTree.

Definition at line 137 of file TeViewNode.h.

Referenced by updateNodesTrees().

00137 {}

void TeTheme::addThemeTable ( string  tableName  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 774 of file TeTheme.cpp.

References addThemeTable().

00775 {
00776         TeTable table(tableName);
00777         addThemeTable(table);
00778 }

bool TeTheme::addThemeTable ( TeTable table  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 720 of file TeTheme.cpp.

References attTableVector_, collectionAuxTable_, loadAliasVector(), loadAttrLists(), loadTablesJoin(), TeTable::name(), TeTable::tableType(), TeAttrEvent, TeAttrExternal, TeAttrMedia, TeAttrStatic, TeDynGeomDynAttr, TeFixedGeomDynAttr, and TeViewNode::type().

Referenced by addThemeTable(), TeExternalTheme::addThemeTable(), TeDatabase::loadThemeTable(), save(), and updateDB20To30().

00721 {
00722         bool result = true;
00723         TeAttrTableType type = inputTable.tableType();
00724 
00725         if(inputTable.name() == collectionAuxTable_)
00726         {
00727                 loadTablesJoin();
00728                 return false;
00729         }
00730 
00731         if (type == TeAttrMedia)
00732                 return false;
00733 
00734         if(type != TeAttrStatic)
00735         {
00736                 bool hasTemporal = false;
00737                 bool hasExtern = false;
00738 
00739                 TeAttrTableVector::iterator it = attTableVector_.begin();
00740                 while(it!=attTableVector_.end())
00741                 {
00742                         //temporal
00743                         if( (it->tableType()==TeAttrEvent) ||
00744                                 (it->tableType()==TeFixedGeomDynAttr) ||
00745                                 (it->tableType()==TeDynGeomDynAttr))
00746                                 hasTemporal = true;
00747 
00748                         //extern
00749                         if((it->tableType())==TeAttrExternal)
00750                                 hasExtern = true;
00751 
00752                         ++it;
00753                 }
00754 
00755                 if( ((type==TeAttrEvent) ||
00756                         (type==TeFixedGeomDynAttr) ||
00757                         (type==TeDynGeomDynAttr)) && (hasTemporal || hasExtern))
00758                         result = false;
00759                 else if ((type==TeAttrExternal) && hasTemporal)
00760                         result = false;
00761         }
00762 
00763         if(!result)
00764                 return false;
00765 
00766         attTableVector_.push_back(inputTable);
00767         loadAliasVector();
00768         loadAttrLists();
00769         loadTablesJoin();
00770         return true;
00771 }

bool TeTheme::afterCopyThemeTo ( TeAbstractTheme absThemeCopy,
TeDatabase outputDatabase 
) [protected, virtual]

Reimplemented from TeAbstractTheme.

Definition at line 2608 of file TeTheme.cpp.

References TeAbstractTheme::afterCopyThemeTo(), collectionAuxTable(), collectionTable(), TeLayer::database(), layer(), populateCollection(), populateCollectionAux(), saveLegendInCollection(), TeDatabase::tableExist(), and TeNoGrouping.

02609 {
02610 //Chama a funcao de copia da classe pai
02611         if(TeAbstractTheme::afterCopyThemeTo(absThemeCopy, outputDatabase) == false)
02612         {
02613                 return false;
02614         }
02615 
02616 //Teste se o tema eh realmente um TeTheme
02617         TeTheme* themeCopy = dynamic_cast<TeTheme*>(absThemeCopy);
02618         if(themeCopy == 0)
02619         {
02620                 return false;
02621         }
02622 
02623 //Preenche as tabelas de colecao
02624         TeDatabase* inputDatabase = this->layer()->database();
02625 
02626         if(inputDatabase->tableExist(this->collectionTable()) && outputDatabase->tableExist(themeCopy->collectionTable()))
02627         {
02628                 /*if(!TeCopyTable(inputDatabase, this->collectionTable(), outputDatabase, themeCopy->collectionTable()))
02629                 {
02630                         return false;
02631                 }*/
02632                 if(themeCopy->populateCollection("", false) == false)
02633                 {
02634                         return false;
02635                 }
02636         }
02637         if(inputDatabase->tableExist(this->collectionAuxTable()) && outputDatabase->tableExist(themeCopy->collectionAuxTable()))
02638         {
02639                 if(themeCopy->populateCollectionAux() == false)
02640                 {
02641                         return false;
02642                 }
02643         }
02644 
02645 //Salva a legenda na colecao
02646         if(this->grouping().groupMode_ != TeNoGrouping)
02647         {
02648                 if(!themeCopy->saveLegendInCollection())
02649                 {
02650                         return false;
02651                 }
02652         }
02653 
02654         return true;
02655 }

virtual vector<string>& TeTheme::aliasVector (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 270 of file TeTheme.h.

Referenced by TeExternalTheme::aliasVector(), and populateCollectionAux().

00270 { return aliasVector_; }

virtual void TeAbstractTheme::attributeRest ( const string s  )  [inline, virtual, inherited]

Definition at line 218 of file TeAbstractTheme.h.

virtual string TeAbstractTheme::attributeRest (  )  [inline, virtual, inherited]

Examples:
createSTElementSetFromTheme.cpp, and createTheme.cpp.

Definition at line 215 of file TeAbstractTheme.h.

Referenced by TeDatabasePortal::getTheme(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), main(), sqlWhereRestrictions(), TeCopyDatabase(), TeExportMIF(), TeExportShapefile(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00215 { return generateAttributeRest_; }

virtual TeAttrTableVector& TeTheme::attrTables (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 208 of file TeTheme.h.

Referenced by TeDatabase::alterTableInfoInMemory(), TeExternalTheme::attrTables(), TeAppTheme::concatTableName(), deletePointedObjects(), fillColumnCombo(), getItemVector(), TeAppTheme::getTableIndexFromField(), hasObjectsWithoutGeometries(), TeQuerierDBStr3::initPortal(), TeQuerierDBStr2::initPortal(), TeExternalTheme::loadThemeTables(), TeQuerierDB::sqlFrom(), TeCellStatistics(), TeCopyDatabase(), TeCopyViewNode(), and TeCreateThemeFromTheme().

00209         {       return attTableVector_; }

bool TeTheme::beforeCopyThemeTo ( TeAbstractTheme absThemeCopy,
TeDatabase outputDatabase 
) [protected, virtual]

Reimplemented from TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 2577 of file TeTheme.cpp.

References TeAbstractTheme::beforeCopyThemeTo(), collectionAuxTable(), collectionTable(), layer(), TeDatabase::layerMap(), and TeViewNode::name().

Referenced by TeExternalTheme::beforeCopyThemeTo().

02578 {
02579         if(TeAbstractTheme::beforeCopyThemeTo(absThemeCopy, outputDatabase) == false)
02580         {
02581                 return false;
02582         }
02583 
02584         TeTheme* themeCopy = dynamic_cast<TeTheme*>(absThemeCopy);
02585         if(themeCopy == 0)
02586         {
02587                 return false;
02588         }
02589 
02590         themeCopy->collectionTable("");
02591         themeCopy->collectionAuxTable("");
02592 
02593         TeLayerMap& layerMap = outputDatabase->layerMap();
02594         TeLayerMap::iterator it = layerMap.begin();
02595         while(it != layerMap.end())
02596         {
02597                 if(themeCopy->name() == it->second->name())
02598                 {
02599                         themeCopy->layer(it->second);
02600                         break;
02601                 }
02602                 ++it;
02603         }
02604 
02605         return true;
02606 }

virtual TeBox& TeAbstractTheme::box (  )  [inline, virtual, inherited]

Definition at line 496 of file TeAbstractTheme.h.

Referenced by TeSTEventSet::buildImpl(), TeSTElementSet::buildImpl(), TeSTEventSet::buildKdTree(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), populateCollection(), TeBaseSTInstanceSet< GeometryType, TimeType, InstanceType >::TeBaseSTInstanceSet(), TeExportQuerierToMIF(), TeSHPPolygonDecode(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00497         {       return themeBox_; }

virtual void TeAbstractTheme::boxRestriction ( TeBox b  )  [inline, virtual, inherited]

Definition at line 254 of file TeAbstractTheme.h.

00254 {boxRest_ = b;}

virtual TeBox TeAbstractTheme::boxRestriction (  )  [inline, virtual, inherited]

Definition at line 251 of file TeAbstractTheme.h.

Referenced by sqlWhereRestrictions().

00251 { return boxRest_;}

bool TeTheme::buildCollection ( std::string  objectId = "",
const bool sincronize = true 
) [virtual]

Examples:
createTheme.cpp.

Definition at line 289 of file TeTheme.cpp.

References populateCollection(), and populateCollectionAux().

Referenced by main(), and TeCopyDatabase().

00290 {
00291         if(id()==0)
00292                 return false;
00293 
00294         if(!populateCollection(objectId, sincronize))
00295                 return false;
00296 
00297         if(!populateCollectionAux(objectId))
00298                 return false;
00299 
00300         return true;
00301 }

bool TeAbstractTheme::buildGrouping ( const TeGrouping g,
vector< TeSlice > &  slices 
) [virtual, inherited]

Examples:
rasterSlicing.cpp.

Definition at line 455 of file TeAbstractTheme.cpp.

References TeLegendEntry::group(), TeAbstractTheme::grouping_, TeAbstractTheme::legend(), TeAbstractTheme::legend_, and TeLegendEntry::theme().

Referenced by TeAbstractTheme::afterCopyThemeTo(), and main().

00456 {
00457         grouping_ = g;
00458         legend_.clear(); 
00459         
00460         for(unsigned int j=0; j<slices.size(); j++)
00461         {
00462                 TeLegendEntry legend(slices[j]);
00463                 legend.group(j);
00464                 legend.theme(id());
00465                 legend_.push_back(legend);
00466         }       
00467         return true;
00468 }

bool TeTheme::buildGrouping ( TeDatabase db,
const TeGrouping g,
TeChronon  chr,
vector< map< string, string > > &  mapObjValVec 
) [protected, virtual]

Definition at line 487 of file TeTheme.cpp.

References TeSlice::count_, TeQuerier::fetchInstance(), TeSlice::from_, TeQuerier::getNumTimeFrames(), TeBaseSTInstance< GeometryType, TimeType >::getPropertyValue(), TeLegendEntry::group(), TeGrouping::groupAttribute_, TeGrouping::groupFunction_, TeAbstractTheme::grouping_, TeGrouping::groupMaxVal_, TeGrouping::groupMinVal_, TeGrouping::groupMode_, TeGrouping::groupNullAttr_, TeGrouping::groupNumSlices_, TeGrouping::groupPrecision_, TeGrouping::groupStdDev_, layer_, TeAbstractTheme::legend(), TeAbstractTheme::legend_, TeQuerier::loadInstances(), TeAttributeRep::name_, TeRasterParams::nBands(), TeBaseSTInstance< GeometryType, TimeType >::objectId(), TeRaster::params(), TeLayer::raster(), TeQuerierParams::setParams(), Te2String(), TeCOUNT, TeEqualSteps, TeGroupByEqualStep(), TeGroupByQuantil(), TeGroupByStdDev(), TeGroupByUniqueValue(), TeINT, TeMAXFLOAT, TeMAXVALUE, TeMEAN, TeMINFLOAT, TeMINVALUE, TeNOCHRONON, TeNOSTATISTIC, TeQuantil, TeRasterSlicing, TeStdDeviation, TeSTRING, TeSUM, TeUniqueValue, TeLegendEntry::theme(), TeAttributeRep::type_, TeRasterParams::vmax_, and TeRasterParams::vmin_.

00488 {
00489         if(!db || chr == TeNOCHRONON)
00490                 return false;
00491 
00492         grouping_ = g;
00493 
00494         unsigned int i;
00495         vector<TeSlice> slices;
00496         vector<double> dValues;  //inputvect
00497         vector<string> sValues; //svec
00498         double mean, sum;
00499         mean = sum = 0.;
00500         int     nullValues = 0;
00501         string val;
00502 
00503         if (grouping_.groupMode_ == TeRasterSlicing)
00504         {
00505                 int b = atoi(grouping_.groupAttribute_.name_.c_str());
00506                 if (!layer_->raster() ||
00507                         b < 0 ||
00508                         b > layer_->raster()->params().nBands() ||
00509                         grouping_.groupNumSlices_ <= 0)
00510                         return false;
00511 
00512                 if (grouping_.groupMaxVal_ == TeMINFLOAT)
00513                         grouping_.groupMaxVal_ = layer_->raster()->params().vmax_[b];
00514 
00515                 if (grouping_.groupMinVal_ == TeMAXFLOAT)
00516                         grouping_.groupMinVal_ = layer_->raster()->params().vmin_[b];
00517 
00518                 TeGroupByEqualStep(grouping_.groupMinVal_, grouping_.groupMaxVal_,
00519                         grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
00520         }
00521         else
00522         {
00523                 string func;
00524                 TeStatisticType statType = TeNOSTATISTIC;
00525                 if (grouping_.groupMode_ == TeUniqueValue && grouping_.groupAttribute_.type_ == TeSTRING)
00526                         func = "MIN";
00527                 else
00528                         func = grouping_.groupFunction_;
00529 
00530                 if (func == "MIN")
00531                         statType = TeMINVALUE;
00532                 else if (func == "MAX")
00533                         statType = TeMAXVALUE;
00534                 else if (func == "MEAN")
00535                         statType = TeMEAN;
00536                 else if (func == "SUM")
00537                         statType = TeSUM;
00538                 else if (func == "COUNT")
00539                         statType = TeCOUNT;
00540 
00541                 // Set the flag that indicates the geometries must not be loaded
00542                 bool loadGeometries = false;
00543 
00544                 // Insert the attributes in a multimap that relates the attribute
00545                 // representation and its statistic type
00546                 TeGroupingAttr attrMMap;
00547                 pair<TeAttributeRep, TeStatisticType> attr1 (
00548                         TeAttributeRep(grouping_.groupAttribute_), statType);
00549                 attrMMap.push_back(attr1);
00550 
00551                 // Set querier parameters
00552                 TeQuerierParams querierParams(loadGeometries, attrMMap);
00553                 querierParams.setParams(this, chr);
00554 
00555                 TeQuerier querier(querierParams);
00556 
00557                 // Load instances based on the querier parameters given
00558                 int numFrames = querier.getNumTimeFrames();
00559                 TeSTInstance sti;
00560                 string objId;
00561                 TePropertyVector vec;
00562                 mapObjValVec.resize(numFrames);
00563 
00564                 for (int frame = 0; frame < numFrames; ++frame)
00565                 {
00566                         if (querier.loadInstances(frame) == false)
00567                                 continue;
00568 
00569                         // Traverse all the instances
00570                         while(querier.fetchInstance(sti))
00571                         {
00572                                 objId = sti.objectId();
00573                                 sti.getPropertyValue(val, 0);
00574 
00575                                 dValues.push_back(atof(val.c_str()));
00576                                 sValues.push_back(val);
00577                                 map<string, string>& objValMap = mapObjValVec[frame];
00578                                 objValMap.insert(make_pair(objId, val));
00579                         }
00580                 }
00581 
00582                 if(grouping_.groupMode_== TeEqualSteps)
00583                         TeGroupByEqualStep(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
00584                 else if(grouping_.groupMode_== TeQuantil)
00585                         TeGroupByQuantil(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
00586                 else if(grouping_.groupMode_== TeStdDeviation)
00587                 {
00588                         string m = Te2String(mean);
00589                         TeGroupByStdDev(dValues.begin(), dValues.end(), grouping_.groupStdDev_, slices, m, grouping_.groupPrecision_);
00590                 }
00591                 else if(grouping_.groupMode_== TeUniqueValue)
00592                 {
00593                         if(grouping_.groupFunction_ == "COUNT")
00594                                 TeGroupByUniqueValue(sValues, TeINT, slices, grouping_.groupPrecision_);
00595                         else
00596                                 TeGroupByUniqueValue(sValues, grouping_.groupAttribute_.type_, slices, grouping_.groupPrecision_);
00597                 }
00598         }
00599 
00600         if(grouping_.groupNullAttr_ && nullValues > 0)
00601         {
00602                 TeSlice ps;
00603                 ps.count_ = nullValues;
00604                 ps.from_ = "Missing Data";
00605                 slices.push_back(ps);
00606                 grouping_.groupNumSlices_ = slices.size() - 1;
00607         }
00608         else
00609                 grouping_.groupNumSlices_ = slices.size();
00610 
00611         legend_.clear();
00612         for(i=0; i<slices.size(); ++i)
00613         {
00614                 TeLegendEntry legend(slices[i]);
00615                 legend.group(i);
00616                 legend.theme(id());
00617                 legend_.push_back(legend);
00618         }
00619 
00620         return true;
00621 }

bool TeTheme::buildGrouping ( TeDatabase db,
const TeGrouping g,
TeSelectedObjects  selectedObjects = TeAll,
vector< double > *  dValuesVec = 0 
) [protected, virtual]

Definition at line 311 of file TeTheme.cpp.

References collectionTable(), TeSlice::count_, TeDatabasePortal::fetchRow(), TeSlice::from_, TeDatabasePortal::getData(), TeDatabase::getPortal(), TeLegendEntry::group(), TeGrouping::groupAttribute_, TeGrouping::groupFunction_, TeAbstractTheme::grouping_, TeGrouping::groupMaxVal_, TeGrouping::groupMinVal_, TeGrouping::groupMode_, TeGrouping::groupNormAttribute_, TeGrouping::groupNullAttr_, TeGrouping::groupNumSlices_, TeGrouping::groupPrecision_, TeGrouping::groupStdDev_, layer_, TeAbstractTheme::legend(), TeAbstractTheme::legend_, TeAttributeRep::name_, TeRasterParams::nBands(), TeRaster::params(), TeDatabasePortal::query(), TeLayer::raster(), sqlGridFrom(), Te2String(), TeAll, TeEqualSteps, TeGroupByEqualStep(), TeGroupByQuantil(), TeGroupByStdDev(), TeGroupByUniqueValue(), TeGrouped, TeINT, TeMAXFLOAT, TeMINFLOAT, TeNotGrouped, TeNotSelectedByPointing, TeNotSelectedByQuery, TeQuantil, TeRasterSlicing, TeSelectedByPointing, TeSelectedByQuery, TeStdDeviation, TeUniqueValue, TeLegendEntry::theme(), TeAttributeRep::type_, TeRasterParams::vmax_, and TeRasterParams::vmin_.

00312 {
00313         if(!db)
00314                 return false;
00315         grouping_ = g;
00316         unsigned int i;
00317         vector<TeSlice> slices;
00318         int     nullValues = 0;
00319         if (grouping_.groupMode_ == TeRasterSlicing)
00320         {
00321                 int b = atoi(grouping_.groupAttribute_.name_.c_str());
00322                 if (!layer_->raster() ||
00323                         b < 0 ||
00324                         b > layer_->raster()->params().nBands() ||
00325                         grouping_.groupNumSlices_ <= 0)
00326                         return false;
00327 
00328                 if (grouping_.groupMaxVal_ == TeMINFLOAT)
00329                         grouping_.groupMaxVal_ = layer_->raster()->params().vmax_[b];
00330 
00331                 if (grouping_.groupMinVal_ == TeMAXFLOAT)
00332                         grouping_.groupMinVal_ = layer_->raster()->params().vmin_[b];
00333 
00334                 TeGroupByEqualStep(grouping_.groupMinVal_, grouping_.groupMaxVal_,
00335                         grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
00336         }
00337         else
00338         {
00339         if(grouping_.groupAttribute_.name_.empty())
00340                         return false;
00341 
00342                 //verify what the objects will be considered
00343                 string  input;
00344                 if(selectedObjects == TeSelectedByPointing)
00345                 {
00346                         input = " WHERE (grid_status = 1 OR grid_status = 3";
00347                         input += " OR (grid_status is null AND (c_object_status = 1 OR c_object_status = 3)))";
00348                 }
00349                 else if(selectedObjects == TeNotSelectedByPointing)
00350                 {
00351                         input = " WHERE (grid_status = 0 OR grid_status = 2";
00352                         input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 2)))";
00353                 }
00354                 else if(selectedObjects == TeSelectedByQuery)
00355                 {
00356                         input = " WHERE (grid_status = 2 OR grid_status = 3";
00357                         input += " OR (grid_status is null AND (c_object_status = 2 OR c_object_status = 3)))";
00358                 }
00359                 else if(selectedObjects == TeNotSelectedByQuery)
00360                 {
00361                         input = " WHERE (grid_status = 0 OR grid_status = 1";
00362                         input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 1)))";
00363                 }
00364                 else if(selectedObjects == TeGrouped)
00365                 {
00366                         input = " WHERE c_legend_id <> 0";
00367                 }
00368                 else if(selectedObjects == TeNotGrouped)
00369                 {
00370                         input = " WHERE c_legend_id = 0";
00371                 }
00372 
00373                 TeDatabasePortal* portal = db->getPortal();
00374                 string query;
00375                 bool normal = false;
00376                 string aggrFunc = "";
00377                 if(grouping_.groupFunction_.empty())
00378                         aggrFunc = " MIN";
00379                 else
00380                         aggrFunc = grouping_.groupFunction_;
00381 
00382                 if(grouping_.groupNormAttribute_.empty())
00383                 {
00384                         query = " SELECT "+ aggrFunc +"("+ grouping_.groupAttribute_.name_ +")";
00385                 }
00386                 else
00387                 {
00388                         query = " SELECT "+ aggrFunc +"("+ grouping_.groupAttribute_.name_ +") / "+ aggrFunc +"("+ grouping_.groupNormAttribute_ + ")";
00389                         normal = true;
00390                 }
00391                 query += sqlGridFrom();
00392 
00393                 if(selectedObjects != TeAll)
00394                         query += input;
00395                 query += " GROUP BY " + collectionTable() + ".c_object_id";
00396                 if(!portal->query(query) || !portal->fetchRow())
00397                 {
00398                         delete portal;
00399                         return false;
00400                 }
00401                 vector<double> dValues;  //inputvect
00402                 vector<string> sValues; //svec
00403                 double mean, sum;
00404                 mean = sum = 0.;
00405                 do
00406                 {
00407                         string val = portal->getData(0);
00408                         string valNorm = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
00409 
00410                         if (!val.empty())
00411                         {
00412                                 if(grouping_.groupMode_== TeUniqueValue)
00413                                 {
00414                                         if(normal)
00415                                                 sValues.push_back(valNorm);
00416                                         else
00417                                                 sValues.push_back(val);
00418                                 }
00419                                 else
00420                                 {
00421                                         dValues.push_back(atof(valNorm.c_str()));
00422                                         sum += atof(valNorm.c_str());
00423                                 }
00424 
00425                         }
00426                         else
00427                                 nullValues++;
00428                 }while(portal->fetchRow());
00429 
00430                 delete portal;
00431 
00432                 if(dValues.empty() && sValues.empty())
00433                         return false;
00434 
00435                 if(grouping_.groupMode_== TeEqualSteps)
00436                         TeGroupByEqualStep(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
00437                 else if(grouping_.groupMode_== TeQuantil)
00438                         TeGroupByQuantil(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
00439                 else if(grouping_.groupMode_== TeStdDeviation)
00440                 {
00441                         string m = Te2String(mean);
00442                         TeGroupByStdDev(dValues.begin(), dValues.end(), grouping_.groupStdDev_, slices, m, grouping_.groupPrecision_);
00443                 }
00444                 else if(grouping_.groupMode_== TeUniqueValue)
00445                 {
00446                         if(grouping_.groupFunction_ == "COUNT")
00447                                 TeGroupByUniqueValue(sValues, TeINT, slices, grouping_.groupPrecision_);
00448                         else
00449                                 TeGroupByUniqueValue(sValues, grouping_.groupAttribute_.type_, slices, grouping_.groupPrecision_);
00450                 }
00451 
00452                 if (dValuesVec)
00453                 {
00454                         for (i = 0; i < dValues.size(); ++i)
00455                                 dValuesVec->push_back(dValues[i]);
00456                 }
00457         }
00458         if(grouping_.groupNullAttr_ && nullValues > 0)
00459         {
00460                 TeSlice ps;
00461                 ps.count_ = nullValues;
00462                 ps.from_ = "Missing Data";
00463                 slices.push_back(ps);
00464                 grouping_.groupNumSlices_ = slices.size() - 1;
00465         }
00466         else
00467                 grouping_.groupNumSlices_ = slices.size();
00468 
00469         legend_.clear();
00470         for(i=0; i<slices.size(); ++i)
00471         {
00472                 TeLegendEntry legend(slices[i]);
00473                 legend.group(i);
00474                 legend.theme(id());
00475                 legend_.push_back(legend);
00476         }
00477         return true;
00478 }

bool TeTheme::buildGrouping ( const TeGrouping g,
TeChronon  chr,
vector< map< string, string > > &  mapObjValVec 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 481 of file TeTheme.cpp.

References buildGrouping(), TeLayer::database(), and layer_.

00482 {
00483         return buildGrouping(layer_->database(), g, chr, mapObjValVec);
00484 }

bool TeTheme::buildGrouping ( const TeGrouping g,
TeSelectedObjects  selectedObjects = TeAll,
vector< double > *  dValuesVec = 0 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Examples:
themeGrouping.cpp.

Definition at line 304 of file TeTheme.cpp.

References TeLayer::database(), and layer_.

Referenced by buildGrouping(), main(), and TeCopyDatabase().

00306 {
00307         return buildGrouping(layer_->database(), g, selectedObjects, dValuesVec);
00308 }

void TeAbstractTheme::cleanLegend (  )  [virtual, inherited]

Definition at line 395 of file TeAbstractTheme.cpp.

References TeAbstractTheme::legend_.

Referenced by TeDatabase::loadLegend(), TeAbstractTheme::operator=(), TeAbstractTheme::TeAbstractTheme(), and TeAbstractTheme::~TeAbstractTheme().

00396 {
00397    while (legend_.size())     
00398    {
00399        legend_[0].clear();
00400        legend_.erase(legend_.begin());
00401    }
00402    legend_.clear(); 
00403 }

virtual void TeTheme::clearAttList (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 252 of file TeTheme.h.

Referenced by TeExternalTheme::clearAttList(), and ~TeTheme().

00252 {sqlAttList_.clear();}

virtual void TeTheme::clearAttTableVector (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 221 of file TeTheme.h.

Referenced by TeExternalTheme::clearAttTableVector(), loadThemeTables(), and ~TeTheme().

00222         {       attTableVector_.clear();        }

virtual void TeAbstractTheme::clearItemStatus (  )  [inline, virtual, inherited]

Definition at line 524 of file TeAbstractTheme.h.

00525         { itemStatusMap_.clear(); }

virtual void TeTheme::clearNumAttList (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 258 of file TeTheme.h.

Referenced by TeExternalTheme::clearNumAttList().

00258 {sqlNumAttList_.clear();}

virtual void TeAbstractTheme::clearObjectSet (  )  [inline, virtual, inherited]

Definition at line 508 of file TeAbstractTheme.h.

00509         { objectSet_.clear(); }

virtual void TeAbstractTheme::clearObjStatus (  )  [inline, virtual, inherited]

Definition at line 520 of file TeAbstractTheme.h.

00521         { objStatusMap_.clear(); }

TeViewNode * TeTheme::clone (  )  [virtual]

Reimplemented from TeViewNode.

Reimplemented in TeExternalTheme.

Definition at line 127 of file TeTheme.cpp.

References TeTheme().

Referenced by TeExternalTheme::clone().

00128 {
00129         TeTheme* theme = new TeTheme();
00130         *theme = *this;
00131         return theme;
00132 }

virtual void TeTheme::collectionAuxTable ( string  name  )  [inline, virtual]

Definition at line 126 of file TeTheme.h.

virtual string TeTheme::collectionAuxTable (  )  [inline, virtual]

Definition at line 123 of file TeTheme.h.

Referenced by afterCopyThemeTo(), beforeCopyThemeTo(), TeTemporalSeries::buildFrameIntervals(), TeExternalTheme::copyRemoteCollection(), deletePointedObjects(), generateItemsInClauseVec(), getItems(), getObject2ItemsMap(), getObjects(), TeQtGLWidget::getValues(), TeQtGrid::init(), TeQuerierDBStr1::initGeomPortal(), TeQuerierDBStr1::initPortal(), insertObjectIntoCollection(), TeExternalTheme::loadObjectLegendMap(), plotPieBars(), removeObjectsWithoutGeometries(), save(), TeExternalTheme::save(), TeQtGLWidget::selectFromHexaedro(), TeQuerierDB::sqlFrom(), TeCopyThemeToLayer(), TeCreateThemeFromTheme(), TeExportLayerToCSV(), TeExportLayerToMIF(), TeExportLayerToShapefile(), TeExportMIF(), TeExportShapefile(), TeExportSPR(), and updateDB20To30().

00123 { return collectionAuxTable_; }

virtual void TeTheme::collectionTable ( const string s  )  [inline, virtual]

Definition at line 120 of file TeTheme.h.

00120 { collectionTable_ = s; }

virtual string TeTheme::collectionTable (  )  [inline, virtual]

Definition at line 117 of file TeTheme.h.

Referenced by afterCopyThemeTo(), beforeCopyThemeTo(), buildGrouping(), TeExternalTheme::buildGrouping(), TeExternalTheme::copyRemoteCollection(), countNumGeometries(), deletePointedObjects(), generateCountLegends(), generateItemsInClauseVec(), TeSQLite::generateLabelPositions(), TePostgreSQL::generateLabelPositions(), TePostGIS::generateLabelPositions(), TeOracleSpatial::generateLabelPositions(), TeOCIOracle::generateLabelPositions(), TeMySQL::generateLabelPositions(), TeFirebird::generateLabelPositions(), TeDatabase::generateLabelPositions(), TeSqlServerSpatial::generateLabelPositions(), TeSqlServer::generateLabelPositions(), TeOracle::generateLabelPositions(), generateLablesForPolygonal(), generateTextUsingCentroid(), getItems(), getObject2ItemsMap(), getObjects(), TeDatabase::getThemeBox(), TeQtGLWidget::getValues(), getWhereBox(), hasObjectsWithoutGeometries(), TeQtGrid::init(), TeQuerierDBStr3::initPortal(), TeQuerierDBStr2::initPortal(), TeQuerierDBStr1::initPortal(), insertObjectIntoCollection(), TeDatabase::loadLineSet(), TeExternalTheme::loadObjectLegendMap(), TeDatabase::loadPointSet(), TePostGIS::loadPolygonSet(), TeOracleSpatial::loadPolygonSet(), TeDatabase::loadPolygonSet(), locateCell(), locateLine(), locatePoint(), locatePolygon(), locatePolygonSet(), TeAppTheme::locateText(), plotPieBars(), populateCollectionAux(), removeObjectsWithoutGeometries(), save(), TeExternalTheme::save(), TeExternalTheme::saveLegendInCollection(), TeQtGLWidget::selectFromHexaedro(), TeQuerierDB::sqlFrom(), TeCellStatistics(), TeCopyThemeToLayer(), TeCreateCells(), TeCreateThemeFromTheme(), TeExportLayerToCSV(), TeExportLayerToMIF(), TeExportLayerToShapefile(), TeExportMIF(), TeExportShapefile(), TeExportSPR(), TeGeoOpAggregation(), TePlotFrame(), TePlotObjects(), TePlotSelectedObjects(), updateDB20To30(), and updateDB320To3201().

00117 { return collectionTable_; }

TeAbstractTheme * TeAbstractTheme::copyTo ( TeDatabase outputDatabase,
TeView view,
const std::string renameTo = "",
const int &  orderIndex = -1 
) [inherited]

Definition at line 1331 of file TeAbstractTheme.cpp.

References TeView::add(), TeAbstractTheme::afterCopyThemeTo(), TeAbstractTheme::beforeCopyThemeTo(), TeDatabase::beginTransaction(), TeViewNode::clone(), TeDatabase::commitTransaction(), TeView::id(), TeViewNode::id(), TeViewNode::name(), TeDatabase::rollbackTransaction(), TeAbstractTheme::save(), and TeViewNode::view().

Referenced by TeCopyViewNode().

01332 {
01333         TeAbstractTheme* newTheme = (TeAbstractTheme*) clone();
01334         
01335         newTheme->id(0);
01336         newTheme->view(view->id());
01337                 
01338         if(renameTo.empty() == false)
01339         {
01340                 newTheme->name(renameTo);
01341         }
01342 
01343         if(outputDatabase->beginTransaction() == false)
01344         {
01345                 delete newTheme;
01346                 return 0;
01347         }
01348 
01349         if(beforeCopyThemeTo(newTheme, outputDatabase) == false)
01350         {
01351                 delete newTheme;
01352                 outputDatabase->rollbackTransaction();
01353                 return 0;
01354         }
01355 
01356         if(newTheme->save() == false)
01357         {
01358                 delete newTheme;
01359                 outputDatabase->rollbackTransaction();
01360                 return 0;
01361         }
01362 
01363         if(afterCopyThemeTo(newTheme, outputDatabase) == false)
01364         {
01365                 delete newTheme;
01366                 outputDatabase->rollbackTransaction();
01367                 return 0;
01368         }
01369 
01370         if(outputDatabase->commitTransaction() == false)
01371         {
01372                 delete newTheme;
01373                 outputDatabase->rollbackTransaction();
01374                 return 0;
01375         }
01376 
01377         view->add(newTheme);
01378 
01379         return newTheme;
01380 }

bool TeTheme::createCollectionAuxTable ( TeDatabase db  )  [protected, virtual]

Definition at line 972 of file TeTheme.cpp.

References attTableVector_, collectionAuxTable_, collectionTable_, TeDatabase::createIndex(), TeDatabase::createTable(), TeDatabase::execute(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDatabase::tableExist(), Te2String(), TeAttrExternal, TeFixedGeomDynAttr, TeINT, TeSTRING, and TeAttributeRep::type_.

00973 {
00974         unsigned int i, j;
00975         bool status;
00976         vector<string> indexes;
00977 
00978         if(!db)
00979                 return false;
00980 
00981         if(!db->tableExist(collectionTable_))
00982                 return false;
00983 
00984         if(db->tableExist(collectionAuxTable_))
00985         {
00986                 status = db->execute("DROP TABLE " + collectionAuxTable_);
00987                 if(db->tableExist(collectionAuxTable_))
00988                 {
00989                         if(!status)
00990                                 return false;
00991                 }
00992         }
00993 
00994         TeAttributeList attList;
00995 
00996         TeAttribute at;
00997         at.rep_.type_ = TeSTRING;
00998         at.rep_.numChar_ = 50;
00999         at.rep_.name_ = "object_id";
01000         attList.push_back(at);
01001 
01002         j = 0;
01003         for (i = 0; i < attTableVector_.size(); ++i)
01004         {
01005                 if (attTableVector_[i].tableType() == TeAttrExternal ||
01006                         attTableVector_[i].tableType() == TeFixedGeomDynAttr)
01007                 {
01008 //descobre o tipo do dado que sera linkado
01009                         for(unsigned int k = 0; k < attTableVector_[i].attributeList().size(); ++k)
01010                         {
01011                                 if(attTableVector_[i].attributeList()[k].rep_.name_ == attTableVector_[i].uniqueName())
01012                                 {
01013                                         at.rep_.type_ = attTableVector_[i].attributeList()[k].rep_.type_;
01014                                         at.rep_.numChar_ = attTableVector_[i].attributeList()[k].rep_.numChar_;
01015                                         break;
01016                                 }
01017                         }
01018 
01019                         at.rep_.name_ = "aux" + Te2String(j++);
01020                         attList.push_back(at);
01021                         indexes.push_back(at.rep_.name_);
01022                 }
01023         }
01024 
01025         at.rep_.isPrimaryKey_ = true;
01026         at.rep_.numChar_ = 0;
01027         at.rep_.name_ = "unique_id";
01028         at.rep_.isAutoNumber_ = true;
01029         at.rep_.type_ = TeINT;
01030         attList.push_back(at);
01031 
01032         at.rep_.name_ = "grid_status";
01033         at.rep_.isPrimaryKey_ = false;
01034         at.rep_.isAutoNumber_ = false;
01035         at.rep_.numChar_ = 0;
01036         attList.push_back(at);
01037 
01038         status = db->createTable(collectionAuxTable_, attList);
01039         if(!status)
01040                 return false;
01041 
01042         string idxName = "te_idx_caux"+ Te2String(this->id());
01043 
01044         //create index to object_id
01045         db->createIndex(collectionAuxTable_, idxName+"_objId", "object_id");
01046 
01047         for(unsigned int i=0; i<indexes.size(); ++i)
01048                 db->createIndex(collectionAuxTable_, idxName+"_"+indexes[i], indexes[i]);
01049 
01050         return true;
01051 }

bool TeTheme::createCollectionAuxTable (  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 966 of file TeTheme.cpp.

References TeLayer::database(), and layer_.

Referenced by TeExternalTheme::createCollectionAuxTable(), save(), TeExternalTheme::save(), and updateDB20To30().

00967 {
00968         return createCollectionAuxTable(layer_->database());
00969 }

void TeTheme::createRasterVisual ( TeRaster rst = 0  )  [virtual]

Reimplemented from TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 237 of file TeTheme.cpp.

References TeRasterTransform::Band2Band(), TeVisual::color(), TeRasterParams::dataType_, TeAbstractTheme::defaultLegend_, TeRasterTransform::generateLUT(), TeGrouping::groupAttribute_, TeAbstractTheme::grouping_, TeGrouping::groupMode_, layer_, TeAbstractTheme::legend_, TeRasterTransform::LUT2ThreeBand(), TeRasterParams::lutr_, TeRasterTransform::Mono2ThreeBand(), TeAttributeRep::name_, TeRasterParams::nBands(), TeRasterTransform::Pallete2ThreeBand(), TeRaster::params(), TeRasterParams::photometric_, TeLayer::raster(), TeAbstractTheme::rasterVisual_, TeRasterTransform::setLinearTransfParameters(), TeRasterTransform::setLutSize(), TeRasterTransform::setSrcBand(), TeRasterTransform::setTransfFunction(), TeRasterParams::TePallete, TePOLYGONS, TeRasterSlicing, TeUNSIGNEDCHAR, TeRasterTransform::ThreeBand2RGB(), TeAbstractTheme::visibleRep_, TeLegendEntry::visual(), TeRasterParams::vmax_, and TeRasterParams::vmin_.

Referenced by TePlotFrame(), and TePlotObjects().

00238 {
00239         if (rasterVisual_)
00240                 delete rasterVisual_;
00241 
00242         if (!rst)
00243                 rst = layer_->raster();
00244 
00245         if (!rst)
00246                 return;
00247 
00248         rasterVisual_ = new TeRasterTransform();
00249 
00250         if (rst->params().photometric_[0] == TeRasterParams::TePallete)  // raster palette -> uses its palette
00251         {
00252                 rasterVisual_->setTransfFunction(&TeRasterTransform::Pallete2ThreeBand);
00253                 rasterVisual_->setLutSize(rst->params().lutr_.size());
00254                 return;
00255         }
00256 
00257         if (visibleRep_ & 0x40000000  &&                // sliced raster -> generate the
00258                 grouping_.groupMode_ == TeRasterSlicing)        // appropriate palette
00259         {
00260                 int band = atoi(grouping_.groupAttribute_.name_.c_str());
00261                 rasterVisual_->setSrcBand(band);
00262                 if (rst->params().dataType_[band] != TeUNSIGNEDCHAR)
00263                         rasterVisual_->generateLUT(legend_, 1024, defaultLegend_.visual(TePOLYGONS)->color());
00264                 else
00265                         rasterVisual_->generateLUT(legend_, 256, defaultLegend_.visual(TePOLYGONS)->color());
00266                 rasterVisual_->setTransfFunction(&TeRasterTransform::LUT2ThreeBand);
00267                 return;
00268         }
00269 
00270         if (rst->params().dataType_[0] != TeUNSIGNEDCHAR)// non unsigned char -> generate linear transformation
00271         {
00272                 std::vector<double>::const_iterator minIt = min_element(rst->params().vmin_.begin(), rst->params().vmin_.end());
00273                 std::vector<double>::const_iterator maxIt = max_element(rst->params().vmax_.begin(), rst->params().vmax_.end());
00274 
00275                 rasterVisual_->setLinearTransfParameters(*minIt, *maxIt , 0, 255);
00276         }
00277 
00278         if (rst->params().nBands() == 1)
00279                 rasterVisual_->setTransfFunction(&TeRasterTransform::Mono2ThreeBand);
00280         else if (rst->params().nBands() == 3)
00281                 rasterVisual_->setTransfFunction(&TeRasterTransform::ThreeBand2RGB);
00282         else
00283                 rasterVisual_->setTransfFunction(&TeRasterTransform::Band2Band);
00284 }

virtual TeLegendEntry& TeAbstractTheme::defaultLegend (  )  [inline, virtual, inherited]

Definition at line 383 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId().

00384         { return defaultLegend_; }

virtual void TeAbstractTheme::defaultLegend ( TeLegendEntry leg  )  [inline, virtual, inherited]

Examples:
rasterSlicing.cpp.

Definition at line 379 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId(), generateCountLegends(), getVisual(), getVisualRemote(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), main(), plotTexts(), setTextAttributes(), TeCopyDatabase(), TeQtGLWidget::TeQtGLWidget(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00380         { defaultLegend_ = leg; }

static TeViewNode* TeViewNode::DefaultObject (  )  [inline, static, inherited]

Definition at line 239 of file TeViewNode.h.

00240         {       return 0; }

bool TeTheme::deleteGrouping (  )  [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 946 of file TeTheme.cpp.

References TeLayer::database(), db, TeDatabase::deleteLegend(), TeDatabase::execute(), layer_, TeAbstractTheme::resetGrouping(), and Te2String().

00947 {
00948         TeDatabase* db = layer_->database();
00949         if(!db)
00950                 return false;
00951 
00952         resetGrouping();
00953 
00954         //delete te_legend table
00955         if(!db->deleteLegend (this->id()))
00956                 return false;
00957 
00958         //delete te_grouping table
00959         string sql = "DELETE FROM te_grouping WHERE theme_id= "+ Te2String(this->id());
00960         db->execute (sql);
00961 
00962         return true;
00963 }

virtual void TeViewNode::draw (  )  [inline, virtual, inherited]

Reimplemented in TeViewTree.

Definition at line 234 of file TeViewNode.h.

Referenced by TeViewTree::draw().

00234 {}

virtual bool TeTheme::eraseMetadata ( TeDatabase  )  [inline, protected, virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 407 of file TeTheme.h.

00407 { return true; } 

bool TeTheme::generateLabelPositions ( const std::string objectId = ""  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 1274 of file TeTheme.cpp.

References TeLayer::database(), db, TeDatabase::generateLabelPositions(), and layer().

Referenced by TeCopyDatabase().

01275 {
01276         TeDatabase* db = layer()->database();
01277         if(!db)
01278                 return false;
01279 
01280         return (db->generateLabelPositions(this, objectId));
01281 }

virtual void TeAbstractTheme::geomRepRestriction ( TeGeomRep rep  )  [inline, virtual, inherited]

Definition at line 266 of file TeAbstractTheme.h.

00266 { geomRepRest_ = rep; }

virtual TeGeomRep TeAbstractTheme::geomRepRestriction (  )  [inline, virtual, inherited]

Definition at line 263 of file TeAbstractTheme.h.

Referenced by TeQuerierDBStr1::loadInstances(), and sqlWhereRestrictions().

00263 { return geomRepRest_; }

virtual void TeAbstractTheme::geomRestriction ( TeGeometry g  )  [inline, virtual, inherited]

Definition at line 260 of file TeAbstractTheme.h.

00260 {geomRest_ = g;}

virtual TeGeometry* TeAbstractTheme::geomRestriction (  )  [inline, virtual, inherited]

Definition at line 257 of file TeAbstractTheme.h.

Referenced by sqlWhereRestrictions().

00257 { return geomRest_;}

string TeTheme::getAttribute ( unsigned int  i  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 837 of file TeTheme.cpp.

References attTableVector_.

Referenced by TeExternalTheme::getAttribute(), and isIndex().

00838 {
00839         unsigned int i;
00840         unsigned int sumCols = 0, tableCol;
00841         bool found = false;
00842         for (i = 0; i < attTableVector_.size(); ++i)
00843         {
00844                 TeAttributeList& attrList = attTableVector_[i].attributeList();
00845                 if (pos < (sumCols + attrList.size()))
00846                 {
00847                         if (i == 0)
00848                                 tableCol = pos;
00849                         else
00850                                 tableCol = pos - sumCols;
00851                         found = true;
00852                         break;
00853                 }
00854                 sumCols += attrList.size();
00855         }
00856 
00857         if (found == false)
00858                 return "";
00859 
00860         TeAttributeList& attrList = attTableVector_[i].attributeList();
00861         string attrName = attTableVector_[i].name() + "." + attrList[tableCol].rep_.name_;
00862         return attrName;
00863 }

bool TeTheme::getAttTables ( TeAttrTableVector attrs,
TeAttrTableType  attType = TeAllAttrTypes 
) [virtual]

Reimplemented in TeExternalTheme.

Definition at line 624 of file TeTheme.cpp.

References attTableVector_, and TeAllAttrTypes.

Referenced by TeTemporalSeries::buildFrameIntervals(), fillColumnCombo(), TeExternalTheme::getAttTables(), getItemVector(), getObjects(), TeQtGrid::init(), TeQuerierDBStr1::initGeomPortal(), TeQuerierDBStr1::initPortal(), TeQtGrid::initPortal(), TeQuerierDBStr3::numElemInstances(), TeQuerierDBStr1::numElemInstances(), TeDatabase::removeThemeTable(), TeCopyThemeToLayer(), TeGeoOpNearestNeighbour(), TeGeoOpOverlayIntersection(), and TeDatabase::updateThemeTable().

00625 {
00626         TeAttrTableVector::iterator it = attTableVector_.begin();
00627         while (it != attTableVector_.end())
00628         {
00629                 if ((attType == TeAllAttrTypes) || ((*it).tableType() == attType))
00630                         attrs.push_back((*it));
00631                 ++it;
00632         }
00633         return (!attrs.empty());
00634 }

TeTime TeAbstractTheme::getCreationTime (  )  const [virtual, inherited]

Definition at line 1292 of file TeAbstractTheme.cpp.

References TeAbstractTheme::creationTime_.

Referenced by TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

01293 {
01294         return creationTime_;
01295 }

virtual map<string, int>& TeAbstractTheme::getItemStatusMap (  )  [inline, virtual, inherited]

Definition at line 528 of file TeAbstractTheme.h.

Referenced by getItemVector(), TeQtGrid::init(), TeQtGrid::promotePointedObjectsSlot(), and TeQtGrid::promoteQueriedObjectsSlot().

00529         { return itemStatusMap_; }

vector< string > TeTheme::getItemVector ( const set< string > &  oidSet  )  [virtual]

Implements TeAbstractTheme.

Definition at line 2438 of file TeTheme.cpp.

References attrTables(), TeLayer::database(), db, TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), generateInClauses(), TeDatabase::getConcatFieldsExpression(), TeDatabasePortal::getData(), TeDatabase::getPortal(), layer(), TeDatabasePortal::query(), and sqlFrom().

02439 {
02440         vector<string> itemVec;
02441         vector<TeTable> tableVec = attrTables();
02442         set<string>::const_iterator it;
02443         unsigned int i;
02444 
02445         if (tableVec.size() == 1)
02446         {
02447                 for (it = oidSet.begin(); it != oidSet.end(); ++it)
02448                         itemVec.push_back(*it);
02449                 return itemVec;
02450         }
02451 
02452         // Set the expression that represents the concatenation
02453         // of the unique names of each theme table
02454         string concatIndexStr;
02455         vector<string> indexVec;
02456         TeDatabase* db = layer()->database();
02457         for (i = 0; i < tableVec.size(); ++i)
02458                 indexVec.push_back(tableVec[i].name() + "." + tableVec[i].uniqueName());
02459 
02460         concatIndexStr = db->getConcatFieldsExpression(indexVec);
02461 
02462         vector<string> queryVec;
02463         string query;
02464 
02465 
02466         set<string>::const_iterator itB = oidSet.begin();
02467         set<string>::const_iterator itE = oidSet.end();
02468         vector<string> inClauseVec = generateInClauses(itB, itE, db);
02469         for (i = 0; i < inClauseVec.size(); ++i)
02470         {
02471                 query = "SELECT " + tableVec[i].name() + "." + tableVec[i].uniqueName();
02472                 query += ", " + concatIndexStr + sqlFrom() + " WHERE ";
02473                 query += tableVec[i].name() + "." + tableVec[i].uniqueName() + " IN " + inClauseVec[i];
02474                 queryVec.push_back(query);
02475         }
02476 
02477         TeDatabasePortal* portal = db->getPortal();
02478         for (i = 0; i < queryVec.size(); ++i)
02479         {
02480                 if (i != 0)
02481                         portal->freeResult();
02482 
02483                 if(portal->query(queryVec[i]) == false)
02484                 {
02485                         delete portal;
02486                         return itemVec;
02487                 }
02488 
02489                 while(portal->fetchRow())
02490                         itemVec.push_back(portal->getData(1));
02491         }
02492 
02493         delete portal;
02494         return itemVec;
02495 }

vector< string > TeTheme::getItemVector ( TeSelectedObjects  selectedObjects  )  [virtual]

Implements TeAbstractTheme.

Definition at line 2306 of file TeTheme.cpp.

References TeLayer::database(), db, TeDatabasePortal::fetchRow(), getAttTables(), TeDatabasePortal::getData(), TeAbstractTheme::getItemStatusMap(), getObjects(), TeAbstractTheme::getObjLegendMap(), TeDatabase::getPortal(), layer(), TeDatabasePortal::query(), sqlFrom(), TeAll, TeDEFAULT, TeGrouped, TeNotGrouped, TeNotSelectedByPointing, TeNotSelectedByQuery, TePOINTED, TePOINTED_QUERIED, TeQUERIED, TeSelectedByPointing, TeSelectedByPointingOrQuery, and TeSelectedByQuery.

02307 {
02308         vector<string> itemVec;
02309 
02310         //======================================================================================
02311         //Get all the items
02312         vector<string> allItemVec;
02313         string item;
02314         unsigned int i;
02315 
02316         if (selectedObjects == TeAll || selectedObjects == TeNotSelectedByPointing ||
02317                 selectedObjects == TeNotSelectedByQuery)
02318         {
02319                 vector<TeTable> tableVec;
02320                 getAttTables(tableVec);
02321 
02322                 string q = "SELECT ";
02323                 for (i = 0; i < tableVec.size(); ++i)
02324                 {
02325                         if (i != 0)
02326                                 q += ",";
02327                         q += tableVec[i].uniqueName();
02328                 }
02329                 q += sqlFrom();
02330 
02331                 TeDatabase* db = layer()->database();
02332                 TeDatabasePortal* portal = db->getPortal();
02333 
02334                 if (portal->query(q) == false)
02335                 {
02336                         delete portal;
02337                         return itemVec;
02338                 }
02339 
02340                 while(portal->fetchRow())
02341                 {
02342                         item = portal->getData(tableVec[0].uniqueName());
02343                         for (i = 1; i < tableVec.size(); ++i)
02344                                 item += portal->getData(tableVec[i].uniqueName());
02345                         allItemVec.push_back(item);
02346                 }
02347 
02348                 delete portal;
02349         }
02350 
02351         //======================================================================================
02352         // Get the items according to the selectedObjects variable
02353         map<string, int>& itemStatusMap = getItemStatusMap();
02354         map<string, int>::iterator it;
02355 
02356         if (selectedObjects == TeAll)
02357                 return allItemVec;
02358         else if(selectedObjects == TeSelectedByPointing)
02359         {
02360                 for (it = itemStatusMap.begin(); it != itemStatusMap.end(); ++it)
02361                 {
02362                         item = it->first;
02363                         if (itemStatusMap[item] == TePOINTED || itemStatusMap[item] == TePOINTED_QUERIED)
02364                                 itemVec.push_back(item);
02365                 }
02366         }
02367         else if(selectedObjects == TeNotSelectedByPointing)
02368         {
02369                 for (i = 0; i < allItemVec.size(); ++i)
02370                 {
02371                         item = allItemVec[i];
02372                         if (itemStatusMap[item] == TeDEFAULT || itemStatusMap[item] == TeQUERIED)
02373                                 itemVec.push_back(item);
02374 
02375                         if (itemStatusMap[item] == TeDEFAULT)
02376                                 itemStatusMap.erase(item);
02377                 }
02378         }
02379         else if(selectedObjects == TeSelectedByQuery)
02380         {
02381                 for (it = itemStatusMap.begin(); it != itemStatusMap.end(); ++it)
02382                 {
02383                         item = it->first;
02384                         if (itemStatusMap[item] == TeQUERIED || itemStatusMap[item] == TePOINTED_QUERIED)
02385                                 itemVec.push_back(item);
02386                 }
02387         }
02388         else if(selectedObjects == TeNotSelectedByQuery)
02389         {
02390                 for (i = 0; i < allItemVec.size(); ++i)
02391                 {
02392                         item = allItemVec[i];
02393                         if (itemStatusMap[item] == TeDEFAULT || itemStatusMap[item] == TePOINTED)
02394                                 itemVec.push_back(item);
02395 
02396                         if (itemStatusMap[item] == TeDEFAULT)
02397                                 itemStatusMap.erase(item);
02398                 }
02399         }
02400         else if(selectedObjects == TeGrouped)
02401         {
02402                 set<string> oidSet;
02403                 map<string, int>& objLegendMap = getObjLegendMap();
02404                 for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
02405                 {
02406                         string oid = it->first;
02407                         if (objLegendMap[oid] != 0)
02408                                 oidSet.insert(oid);
02409                 }
02410 
02411                 itemVec = getItemVector(oidSet);
02412         }
02413         else if(selectedObjects == TeNotGrouped)
02414         {
02415                 set<string> oidSet = getObjects();
02416                 map<string, int>& objLegendMap = getObjLegendMap();
02417                 for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
02418                         oidSet.erase(it->first);
02419 
02420                 itemVec = getItemVector(oidSet);
02421         }
02422         else if(selectedObjects == TeSelectedByPointingOrQuery )
02423         {
02424                 for (it = itemStatusMap.begin(); it != itemStatusMap.end(); ++it)
02425                 {
02426                         item = it->first;
02427                         if( (itemStatusMap[item] == TePOINTED ) ||
02428                           (itemStatusMap[item] == TeQUERIED ) ) {
02429 
02430                                 itemVec.push_back(item);
02431                         }
02432                 }
02433         }
02434 
02435         return itemVec;
02436 }

unsigned int TeTheme::getNumberOfObjects (  )  [virtual]

Implements TeAbstractTheme.

Definition at line 2549 of file TeTheme.cpp.

References TeLayer::database(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), TeDatabase::getPortal(), layer(), TeDatabasePortal::query(), and sqlFrom().

02550 {
02551         int numRows = 0;
02552         string s = "SELECT COUNT(*) " + this->sqlFrom();
02553         TeDatabasePortal* portal = this->layer()->database()->getPortal();
02554         if(portal->query(s) && portal->fetchRow() )
02555         {
02556                 numRows = atoi(portal->getData(0));
02557         }
02558         delete portal;
02559         return numRows;
02560 }

virtual int TeAbstractTheme::getNumLayerObjects (  )  [inline, virtual, inherited]

Definition at line 512 of file TeAbstractTheme.h.

00513         { return numLayerObjects_; }

set< string > TeTheme::getObjects ( const vector< string > &  itemVec  )  [virtual]

Implements TeAbstractTheme.

Definition at line 2498 of file TeTheme.cpp.

References TeLayer::database(), db, TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), generateInClauses(), getAttTables(), TeDatabase::getConcatFieldsExpression(), TeDatabasePortal::getData(), TeDatabase::getPortal(), layer(), TeDatabasePortal::query(), and sqlFrom().

02499 {
02500         set<string> oidSet;
02501 
02502         unsigned int i;
02503         TeDatabase* db = layer()->database();
02504 
02505         // Get the vector of tables of the theme
02506         vector<TeTable> tableVec;
02507         getAttTables(tableVec);
02508 
02509         vector<string> indexVec;
02510         for (i = 0; i < tableVec.size(); ++i)
02511                 indexVec.push_back(tableVec[i].name() + "." + tableVec[i].uniqueName());
02512 
02513         string concatIndexStr = db->getConcatFieldsExpression(indexVec);
02514 
02515         std::vector<string>::const_iterator itemVec_it_begin( itemVec.begin() );
02516         std::vector<string>::const_iterator itemVec_it_end( itemVec.end() );
02517 
02518         vector<string> inClauseVec = generateInClauses( itemVec_it_begin,
02519     itemVec_it_end, db);
02520 
02521         vector<string> queryVec;
02522         string selectClause = "SELECT " + concatIndexStr + ", ";
02523         selectClause += tableVec[0].name() + "." + tableVec[0].uniqueName() + " " + sqlFrom();
02524 
02525         for (i = 0; i < inClauseVec.size(); ++i)
02526         {
02527                 string query = selectClause + " WHERE " + concatIndexStr + " IN " + inClauseVec[i];
02528                 queryVec.push_back(query);
02529         }
02530 
02531         TeDatabasePortal *portal = db->getPortal();
02532         for (i = 0; i < queryVec.size(); ++i)
02533         {
02534                 if (i != 0)
02535                         portal->freeResult();
02536 
02537                 if (portal->query(queryVec[i]))
02538                 {
02539                         while (portal->fetchRow())
02540                                 oidSet.insert(portal->getData(1));
02541                 }
02542         }
02543         delete portal;
02544 
02545         return oidSet;
02546 }

set< string > TeTheme::getObjects ( TeSelectedObjects  selectedObjects = TeAll  )  [virtual]

Implements TeAbstractTheme.

Definition at line 2190 of file TeTheme.cpp.

References attTableVector_, TeLayer::database(), db, TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), TeAbstractTheme::getObjLegendMap(), TeDatabase::getPortal(), TeLayer::hasGeometry(), layer_, TeAbstractTheme::objectSet_, TeAbstractTheme::objStatusMap_, TeDatabasePortal::query(), sqlFrom(), TeAll, TeGrouped, TeNotGrouped, TeNotSelectedByPointing, TeNotSelectedByQuery, TePOINTED, TePOINTED_QUERIED, TeQUERIED, TeRASTER, TeSelectedByPointing, TeSelectedByPointingAndQuery, TeSelectedByPointingOrQuery, and TeSelectedByQuery.

Referenced by getItemVector(), and getVisual().

02191 {
02192         if (selectedObjects == TeAll)
02193         {
02194                 if (objectSet_.empty() == false)
02195                         return objectSet_;
02196                 else
02197                 {
02198                         if (attTableVector_.empty())
02199                                 return set<string>();
02200 
02201                         // Set the new set of objects
02202                         if (layer_->hasGeometry(TeRASTER) == false)
02203                         {
02204                                 TeDatabase *db = layer_->database();
02205                                 TeDatabasePortal* portal = db->getPortal();
02206 
02207                                 string q = "SELECT " + attTableVector_[0].name() + "." + attTableVector_[0].uniqueName() + sqlFrom();
02208                                 if (portal->query(q) == false)
02209                                 {
02210                                         delete portal;
02211                                         return set<string>();
02212                                 }
02213 
02214                                 while (portal->fetchRow())
02215                                         objectSet_.insert(portal->getData(0));
02216 
02217                                 delete portal;
02218                                 return objectSet_;
02219                         }
02220                 }
02221         }
02222 
02223         set<string> oidSet;
02224         map<string, int>::iterator it;
02225         string oid;
02226 
02227         if (selectedObjects == TeSelectedByPointing)
02228         {
02229                 for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
02230                 {
02231                         oid = it->first;
02232                         if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
02233                                 oidSet.insert(oid);
02234                 }
02235         }
02236         else if (selectedObjects == TeNotSelectedByPointing)
02237         {
02238                 oidSet = getObjects();
02239                 for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
02240                 {
02241                         oid = it->first;
02242                         if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
02243                                 oidSet.erase(oid);
02244                 }
02245         }
02246         else if (selectedObjects == TeSelectedByQuery)
02247         {
02248                 for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
02249                 {
02250                         oid = it->first;
02251                         if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
02252                                 oidSet.insert(oid);
02253                 }
02254         }
02255         else if (selectedObjects == TeNotSelectedByQuery)
02256         {
02257                 oidSet = getObjects();
02258                 for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
02259                 {
02260                         oid = it->first;
02261                         if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
02262                                 oidSet.erase(oid);
02263                 }
02264         }
02265         else if(selectedObjects == TeGrouped)
02266         {
02267                 map<string, int>& objLegendMap = getObjLegendMap();
02268                 for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
02269                 {
02270                         string oid = it->first;
02271                         if (objLegendMap[oid] != 0)
02272                                 oidSet.insert(oid);
02273                 }
02274         }
02275         else if(selectedObjects == TeNotGrouped)
02276         {
02277                 oidSet = getObjects();
02278                 map<string, int>& objLegendMap = getObjLegendMap();
02279                 for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
02280                         oidSet.erase(it->first);
02281         }
02282         else if(selectedObjects == TeSelectedByPointingOrQuery)
02283         {
02284                 oidSet = getObjects();
02285                 for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
02286                 {
02287                         oid = it->first;
02288                         if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED)
02289                                 oidSet.insert(oid);
02290                 }
02291         }
02292         else if(selectedObjects == TeSelectedByPointingAndQuery )
02293         {
02294                 oidSet = getObjects();
02295                 for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
02296                 {
02297                         oid = it->first;
02298                         if (objStatusMap_[oid] == TePOINTED_QUERIED )
02299                                 oidSet.insert(oid);
02300                 }
02301         }
02302 
02303         return oidSet;
02304 }

virtual map<string, int>& TeAbstractTheme::getObjLegendMap (  )  [inline, virtual, inherited]

Definition at line 449 of file TeAbstractTheme.h.

Referenced by getItemVector(), getObjects(), getVisual(), and getVisualRemote().

00450         { return objLegendMap_; }

virtual map<string, int>& TeAbstractTheme::getObjOwnLegendMap (  )  [inline, virtual, inherited]

Definition at line 453 of file TeAbstractTheme.h.

Referenced by getVisual(), and getVisualRemote().

00454         { return objOwnLegendMap_; }

virtual map<string, int>& TeAbstractTheme::getObjStatusMap (  )  [inline, virtual, inherited]

Definition at line 516 of file TeAbstractTheme.h.

Referenced by getVisual(), getVisualRemote(), TeQtGrid::init(), TeQtGrid::promotePointedObjectsSlot(), and TeQtGrid::promoteQueriedObjectsSlot().

00517         { return objStatusMap_; }

virtual int TeViewNode::getProductId (  )  const [inline, virtual, inherited]

Definition at line 242 of file TeViewNode.h.

Referenced by generateItemsInClauseVec(), getItems(), TeAppTheme::getLocalCollectionTable(), TeAppTheme::getLocalDatabase(), getObject2ItemsMap(), getObjects(), TeAppTheme::getSourceTheme(), getVisualRemote(), getWhereBox(), TeQtGrid::init(), TeAppTheme::operator=(), plotPieBars(), TeQtGrid::promotePointedObjectsSlot(), TeQtGrid::promoteQueriedObjectsSlot(), TeAppTheme::TeAppTheme(), TePlotObjects(), and TePlotSelectedObjects().

00243         {       return viewNodeParams_.nodeType_; }

TeSliceVector TeAbstractTheme::getSlices (  )  [virtual, inherited]

Definition at line 499 of file TeAbstractTheme.cpp.

References TeAbstractTheme::legend_.

00500 {
00501         TeSliceVector sliceVec;
00502         for(unsigned int x=0; x<legend_.size(); ++x)
00503         {
00504                 TeSlice slice = legend_[x].slice();
00505                 sliceVec.push_back (slice);
00506         }
00507         return sliceVec;
00508 }

bool TeTheme::getTable ( TeTable table,
const string  tableName 
) [virtual]

Reimplemented in TeExternalTheme.

Definition at line 637 of file TeTheme.cpp.

References attTableVector_, and TeViewNode::name().

Referenced by TeExternalTheme::getTable(), and isIndex().

00638 {
00639         unsigned int i;
00640         for (i = 0; i < attTableVector_.size(); ++i)
00641         {
00642                 if (attTableVector_[i].name() == tableName)
00643                 {
00644                         table = attTableVector_[i];
00645                         return true;
00646                 }
00647         }
00648         return false;
00649 }

string TeTheme::getTableName ( const string attrName  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 920 of file TeTheme.cpp.

References attTableVector_.

Referenced by TeExternalTheme::getTableName().

00921 {
00922         string tableName;
00923         size_t pos = attrName.find(".");
00924 
00925         if (pos != string::npos)
00926                 return tableName = attrName.substr(0, pos);
00927 
00928         for (unsigned int i = 0; i < attTableVector_.size(); ++i)
00929         {
00930                 TeAttributeList& attrList = attTableVector_[i].attributeList();
00931                 for (unsigned j = 0; j < attrList.size(); ++j)
00932                 {
00933                         if (attrList[j].rep_.name_ == attrName)
00934                         {
00935                                 tableName = attTableVector_[i].name();
00936                                 return tableName;
00937                         }
00938                 }
00939         }
00940 
00941         return tableName;
00942 }

bool TeTheme::getTemporalTable ( TeTable table  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 652 of file TeTheme.cpp.

References attTableVector_, TeAttrEvent, and TeFixedGeomDynAttr.

Referenced by TeTemporalSeries::buildFrameIntervals(), TeExternalTheme::getTemporalTable(), and TeQuerierDBStr1::initPortal().

00653 {
00654         TeAttrTableVector::iterator it = attTableVector_.begin();
00655         while (it != attTableVector_.end())
00656         {
00657                 if (((*it).tableType() == TeAttrEvent) || ((*it).tableType() == TeFixedGeomDynAttr))
00658                 {
00659                         table = (*it);
00660                         return true;
00661                 }
00662                 ++it;
00663         }
00664         return false;
00665 }

virtual TeBox& TeAbstractTheme::getThemeBox (  )  [inline, virtual, inherited]

Definition at line 488 of file TeAbstractTheme.h.

Referenced by TeAppTheme::boundingBox(), TeViewTree::box(), populateCollection(), TeFillCellDistanceOperation(), TeMinimumDistanceLinesStrategy::TeMinimumDistanceLinesStrategy(), TeMinimumDistancePointsStrategy::TeMinimumDistancePointsStrategy(), and TeMinimumDistancePolygonsStrategy::TeMinimumDistancePolygonsStrategy().

00489         {       return themeBox_; }

TeProjection * TeTheme::getThemeProjection (  )  [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 2569 of file TeTheme.cpp.

References layer_, and TeLayer::projection().

02570 {
02571         if (layer_)
02572                 return layer_->projection();
02573         else
02574                 return 0;
02575 }

virtual void TeAbstractTheme::grouping ( const TeGrouping g  )  [inline, virtual, inherited]

Definition at line 347 of file TeAbstractTheme.h.

00348         { grouping_ = g; }

virtual TeGrouping& TeAbstractTheme::grouping (  )  [inline, virtual, inherited]

Examples:
rasterSlicing.cpp.

Definition at line 344 of file TeAbstractTheme.h.

Referenced by TeAbstractTheme::afterCopyThemeTo(), TeExternalTheme::createLegendMapId(), generateCountLegends(), TeAppTheme::getLegendTitleAlias(), getVisual(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), main(), TeCopyDatabase(), TeQtThemeItem::updateAlias(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00344 { return grouping_; }

virtual bool TeAbstractTheme::hasAttrRest (  )  [inline, virtual, inherited]

Reimplemented in TeExternalTheme.

Definition at line 221 of file TeAbstractTheme.h.

Referenced by sqlWhereRestrictions().

00221 { return (!generateAttributeRest_.empty());}

bool TeTheme::hasObjectsWithoutGeometries ( TeGeomRep  geomRep  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 2043 of file TeTheme.cpp.

References attrTables(), collectionTable(), TeLayer::database(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), TeDatabase::getPortal(), layer(), TeDatabasePortal::query(), TeLayer::tableName(), TeAttrExternal, TeAttrMedia, and TeGeocodingData.

Referenced by TeExternalTheme::hasObjectsWithoutGeometries().

02044 {
02045         if(!layer() || !layer()->database())
02046                 return true;
02047 
02048         //get the geometry table
02049         string geomTable = layer()->tableName(geomRep);
02050         if(geomTable.empty())
02051                 return true;
02052 
02053         TeDatabasePortal* portal = layer()->database()->getPortal();
02054         if(!portal)
02055                 return true;
02056 
02057         //Verify the collection table or attribute tables
02058         if(layer()->database()->tableExist(collectionTable()))
02059         {
02060                 string s = " SELECT COUNT(*) ";
02061                 s+= " FROM "+  collectionTable();
02062                 s+= " WHERE NOT EXISTS ";
02063                 s+= " (SELECT * FROM "+ geomTable;
02064                 s+= " WHERE "+ collectionTable() +".c_object_id ";
02065                 s+= " = "+ geomTable +".object_id ) ";
02066 
02067                 if(!portal->query(s) || !portal->fetchRow())
02068                 {
02069                         delete portal;
02070                         return true;
02071                 }
02072 
02073                 int numObjs = atoi(portal->getData(0));
02074                 if(numObjs>0)
02075                 {
02076                         delete portal;
02077                         return true;
02078                 }
02079         }
02080         else
02081         {
02082                 //for each static table
02083                 for(unsigned int i=0; i<this->attrTables().size(); ++i)
02084                 {
02085                         if(     this->attrTables()[i].tableType() == TeAttrExternal ||
02086                                 this->attrTables()[i].tableType() == TeAttrMedia ||
02087                                 this->attrTables()[i].tableType() == TeGeocodingData)
02088                                 continue;
02089 
02090                         string s = " SELECT COUNT(*) ";
02091                         s+= " FROM "+  attrTables()[i].name();
02092                         s+= " WHERE NOT EXISTS ";
02093                         s+= " (SELECT * FROM "+ geomTable;
02094                         s+= " WHERE "+ attrTables()[i].name() +"."+ attrTables()[i].linkName();
02095                         s+= " = "+ geomTable +".object_id ) ";
02096 
02097                         if(!portal->query(s) || !portal->fetchRow())
02098                         {
02099                                 delete portal;
02100                                 return true;
02101                         }
02102 
02103                         int numObjs = atoi(portal->getData(0));
02104                         if(numObjs>0)
02105                         {
02106                                 delete portal;
02107                                 return true;
02108                         }
02109                 }
02110         }
02111 
02112         delete portal;
02113         return false;
02114 }

virtual bool TeAbstractTheme::hasRestriction (  )  [inline, virtual, inherited]

Reimplemented in TeExternalTheme.

Definition at line 211 of file TeAbstractTheme.h.

Referenced by TeCellStatistics().

00211                                       { return (!(generateAttributeRest_.empty() || 
00212                                                                           generateTemporalRest_.empty()) && hasSpatialRes_); }

virtual void TeAbstractTheme::hasSpatialRest ( bool  a  )  [inline, virtual, inherited]

Definition at line 248 of file TeAbstractTheme.h.

00248 {hasSpatialRes_ = a;}

virtual bool TeAbstractTheme::hasSpatialRest (  )  [inline, virtual, inherited]

Reimplemented in TeExternalTheme.

Definition at line 245 of file TeAbstractTheme.h.

Referenced by TeQuerierDBStr1::loadInstances(), and sqlWhereRestrictions().

00245 { return hasSpatialRes_;}

virtual bool TeAbstractTheme::hasTemporalRest (  )  [inline, virtual, inherited]

Reimplemented in TeExternalTheme.

Definition at line 230 of file TeAbstractTheme.h.

Referenced by sqlWhereRestrictions().

00230 { return (!generateTemporalRest_.empty());}

virtual void TeViewNode::id ( int  i  )  [inline, virtual, inherited]

Definition at line 188 of file TeViewNode.h.

00188 { viewNodeParams_.id_ = i; }

virtual int TeViewNode::id (  )  [inline, virtual, inherited]

Definition at line 185 of file TeViewNode.h.

Referenced by TeAbstractTheme::beforeCopyThemeTo(), TeAbstractTheme::copyTo(), deleteAppTheme(), TeOCIOracle::deleteLayer(), TeDatabase::deleteLayer(), TeSqlServer::deleteLayer(), TeOracle::deleteLayer(), deletePointedObjects(), TeExternalTheme::eraseMetadata(), TeViewTree::find(), generateCountLegends(), TeAppTheme::getLegendTitleAlias(), TeAppTheme::getPieBarAlias(), TeDatabasePortal::getTheme(), TeQtViewsListView::getThemeItem(), TeDatabasePortal::getViewTree(), insertAppTheme(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeSQLite::insertThemeGroup(), TePostgreSQL::insertThemeGroup(), TeOCIOracle::insertThemeGroup(), TeMySQL::insertThemeGroup(), TeFirebird::insertThemeGroup(), TeOracle::insertThemeGroup(), TeAdo::insertThemeGroup(), TeDatabase::insertThemeTable(), TeSQLite::insertViewTree(), TePostgreSQL::insertViewTree(), TeOCIOracle::insertViewTree(), TeMySQL::insertViewTree(), TeFirebird::insertViewTree(), TeOracle::insertViewTree(), TeAdo::insertViewTree(), TeDatabase::loadExternalThemes(), TeDatabase::loadLegend(), TeExternalTheme::loadMetadata(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadThemeTable(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeDatabase::loadViewTree(), TeAppTheme::removeAlias(), TeAppTheme::removeAllAlias(), TeViewTree::removeID(), TeQtViewsListView::removeThemeItem(), TeDatabase::removeThemeTable(), TeSFSTheme::saveMetadata(), TeExternalTheme::saveMetadata(), TeAppTheme::setAlias(), TeViewNode::setParent(), TeCopyThemeToLayer(), TeCopyView(), TeCopyViewNode(), TeCreateThemeFromTheme(), TeProxMatrixOpenNetworkStrategy2::TeProxMatrixOpenNetworkStrategy2(), TeQtThemeItem::updateAlias(), updateAppTheme(), updateDB20To30(), updateDB320To3201(), TeFirebird::updateTheme(), TeDatabase::updateTheme(), TeDatabase::updateThemeTable(), and TeDatabase::updateViewTree().

00185 { return viewNodeParams_.id_; }

void TeAbstractTheme::invertObjectStatus (  )  [virtual, inherited]

Definition at line 1213 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getItemVector(), TeAbstractTheme::getObjects(), TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

01214 {
01215         unsigned int i;
01216         string oid, uid;
01217         set<string> objInvToPointedStatusSet;   // objects to be inverted to the pointed status
01218         set<string> objInvToDefaultStatusSet;   // objects to be inverted to the default status
01219         vector<string> defaultVec;
01220         map<string, int>::iterator mapIt;
01221         set<string>::const_iterator setIt;
01222 
01223         // Get all the theme objects
01224         const set<string>& oidSet = getObjects();
01225 
01226         // Get the objects that are pointed, queried, or pointed and queried
01227         // and put their status to the default status, and get the objects
01228         // that are in the default status and put them in the pointed status
01229         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
01230         {
01231                 oid = *setIt;
01232                 if (objStatusMap_[oid] == TeDEFAULT)
01233                 {
01234                         objStatusMap_[oid] = TePOINTED;
01235                         objInvToPointedStatusSet.insert(oid);
01236                 }
01237                 else if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TeQUERIED ||
01238                              objStatusMap_[oid] == TePOINTED_QUERIED)
01239                 {
01240                         defaultVec.push_back(oid);
01241                         objInvToDefaultStatusSet.insert(oid);
01242                 }
01243         }
01244 
01245         for (i = 0; i < defaultVec.size(); ++i)
01246                 objStatusMap_.erase(defaultVec[i]);
01247 
01248         // Set the status for the uids according the status of their objects
01249         vector<string> uidVec = getItemVector(objInvToPointedStatusSet);
01250         for (i = 0; i < uidVec.size(); ++i)
01251                 itemStatusMap_[uidVec[i]] = TePOINTED;
01252 
01253         uidVec = getItemVector(objInvToDefaultStatusSet);
01254         for (i = 0; i < uidVec.size(); ++i)
01255                 itemStatusMap_.erase(uidVec[i]);
01256 }

const bool & TeAbstractTheme::isAvailable (  )  const [inherited]

Definition at line 371 of file TeAbstractTheme.cpp.

References TeAbstractTheme::isAvailable_.

Referenced by TeViewTree::box().

00372 {
00373         return isAvailable_;
00374 }

bool TeAbstractTheme::isEditable (  )  const [inherited]

Returns:

Definition at line 376 of file TeAbstractTheme.cpp.

References TeAbstractTheme::isEditable_.

00377 {
00378         return isEditable_;
00379 }

bool TeTheme::isIndex ( unsigned int  i  )  [virtual]

Definition at line 866 of file TeTheme.cpp.

References getAttribute(), getTable(), and TeTable::uniqueName().

00867 {
00868         string fullAttrName = getAttribute(pos);
00869         if (fullAttrName.empty() == true)
00870                 return false;
00871 
00872         size_t idx = fullAttrName.find(".");
00873         string tableName = fullAttrName.substr(0, idx);
00874         string attrName = fullAttrName.substr(idx+1);
00875 
00876         // Get the representation of a table given an attribute name
00877         TeTable table;
00878         if (getTable(table, tableName) == false)
00879                 return false;
00880 
00881         // Check if the attribute is index or not
00882         if(table.uniqueName() == attrName)
00883                 return true;
00884 
00885         return false;
00886 }

bool TeTheme::isThemeTable ( string  tableName  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 905 of file TeTheme.cpp.

References attTableVector_, isThemeTable(), and TeViewNode::name().

00906 {
00907         bool isThemeTable = false;
00908         for (unsigned int i = 0; i < attTableVector_.size(); ++i)
00909         {
00910                 if (attTableVector_[i].name() == tableName)
00911                 {
00912                         isThemeTable = true;
00913                         break;
00914                 }
00915         }
00916         return isThemeTable;
00917 }

bool TeTheme::isThemeTable ( int  tableId  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 889 of file TeTheme.cpp.

References attTableVector_.

Referenced by isThemeTable(), and TeExternalTheme::isThemeTable().

00890 {
00891         bool isThemeTable = false;
00892         unsigned int i;
00893         for (i = 0; i < attTableVector_.size(); ++i)
00894         {
00895                 if (attTableVector_[i].id() == tableId)
00896                 {
00897                         isThemeTable = true;
00898                         break;
00899                 }
00900         }
00901         return isThemeTable;
00902 }

bool TeTheme::isUpdated (  )  [virtual]

Reimplemented from TeAbstractTheme.

Definition at line 1053 of file TeTheme.cpp.

References TeLayer::getEditionTime(), layer(), NULL, and TeLayer::reloadLayerEditionTime().

01054 {
01055         if(layer() == NULL)
01056         {
01057                 return false;
01058         }
01059         layer()->reloadLayerEditionTime();
01060 
01061         if(this->getCreationTime() < layer()->getEditionTime())
01062         {
01063                 return false;
01064         }
01065         return true;
01066 }

virtual TeLayer* TeTheme::layer (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 94 of file TeTheme.h.

Referenced by afterCopyThemeTo(), generateLabelPositions(), getItemVector(), getNumberOfObjects(), getObjects(), hasObjectsWithoutGeometries(), isUpdated(), loadAttrLists(), loadThemeTables(), locateCell(), locateLine(), locatePoint(), locatePolygon(), locatePolygonSet(), populateCollection(), removeObjectsWithoutGeometries(), save(), saveLegendInCollection(), setSpatialRest(), and sqlWhereRestrictions().

00094 { return layer_; }

void TeTheme::layer ( TeLayer layer  )  [virtual]

Parameters:
layer a pointer to a TeLayer

Reimplemented in TeExternalTheme.

Definition at line 135 of file TeTheme.cpp.

References TeLayer::id(), layer_, and layerId_.

Referenced by beforeCopyThemeTo(), TeExternalTheme::beforeCopyThemeTo(), TeTemporalSeries::buildFrameIntervals(), TeExternalTheme::buildGrouping(), TeProxMatrixKeepInBothTopologyStrategy::Construct(), TeProxMatrixChooseOneTopologyStrategy::Construct(), TeProxMatrixLocalTopologyStrategy::Construct(), TeProxMatrixNearestNeighbourStrategy::Construct(), TeProxMatrixLocalAdjacencyStrategy::Construct(), TeExternalTheme::copyRemoteCollection(), countNumGeometries(), TeExternalTheme::createRasterVisual(), TeOCIOracle::deleteLayer(), TeDatabase::deleteLayer(), TeSqlServer::deleteLayer(), TeOracle::deleteLayer(), deletePointedObjects(), TeGTM::exportGTM(), generateCountLegends(), generateItemsInClauseVec(), TeSQLite::generateLabelPositions(), TePostgreSQL::generateLabelPositions(), TePostGIS::generateLabelPositions(), TeOracleSpatial::generateLabelPositions(), TeOCIOracle::generateLabelPositions(), TeMySQL::generateLabelPositions(), TeFirebird::generateLabelPositions(), TeDatabase::generateLabelPositions(), TeSqlServerSpatial::generateLabelPositions(), TeSqlServer::generateLabelPositions(), TeOracle::generateLabelPositions(), generateLablesForPolygonal(), generateTextUsingCentroid(), TeQuerierDB::geometryRep(), TeAppTheme::getLegendTitleAlias(), TeAppTheme::getPieBarAlias(), TeAppTheme::getTextVisual(), TeDatabase::getThemeBox(), TeExternalTheme::getThemeProjection(), getVisual(), getWhereBox(), TeQtGrid::init(), TeQuerierDBStr1::initGeomPortal(), TeQuerierDBStr3::initPortal(), TeQuerierDBStr2::initPortal(), TeQuerierDBStr1::initPortal(), insertBoundaryCells(), insertObjectIntoCollection(), TeQuerierDB::layer(), TeExternalTheme::layer(), TeQuerierDBStr1::loadInstances(), TeDatabase::loadLineSet(), TeExternalTheme::loadMetadata(), TeDatabase::loadPointSet(), TePostGIS::loadPolygonSet(), TeOracleSpatial::loadPolygonSet(), TeDatabase::loadPolygonSet(), TeAppTheme::locateText(), TeQuerierDBStr3::numElemInstances(), TeQuerierDBStr1::numElemInstances(), objBoxInCanvas(), plotPieBars(), TeAppTheme::removeAlias(), TeAppTheme::removeAllAlias(), TeExternalTheme::saveLegendInCollection(), TeExternalTheme::saveMetadata(), TeAppTheme::setAlias(), TeQuerierParams::setParams(), TeExternalTheme::setRemoteTheme(), TeQuerierParams::setSpatialRest(), TeQuerierDB::sqlFrom(), TeQuerierDB::sqlWhereRestrictions(), TeBuildKDTree(), TeCellInterpolate(), TeCellStatistics(), TeCopyDatabase(), TeCopyThemeToLayer(), TeCreateCells(), TeCreateThemeFromTheme(), TeExportLayerToCSV(), TeExportLayerToMIF(), TeExportLayerToShapefile(), TeExportMIF(), TeExportQuerierToMIF(), TeExportQuerierToShapefile(), TeExportShapefile(), TeExportSPR(), TeExportThemeToMIF(), TeExportThemeToSPRING(), TeGeoOpAdd(), TeGeoOpAggregation(), TeGeoOpAssignByLocationCollect(), TeGeoOpAssignDataLocationDistribute(), TeGeoOpBuffer(), TeGeoOpNearestNeighbour(), TeGeoOpOverlayDifference(), TeGeoOpOverlayIntersection(), TeGeoOpOverlayUnion(), TePlotFrame(), TePlotObjects(), TePlotSelectedObjects(), TePlotTexts(), TeQtGLWidget::TeQtGLWidget(), TeRasterInterpolate(), TeQtThemeItem::updateAlias(), updateDB320To3201(), and TeQtGrid::writeCell().

00136 {
00137         layer_ = layer;
00138         if (layer)
00139         {
00140                 layerId_ = layer->id();
00141 //              themeBox_ = layer_->box();
00142         }
00143 }

virtual void TeTheme::layerId ( int  i  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 84 of file TeTheme.h.

00085         {       layerId_ = i; }

virtual int TeTheme::layerId (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 80 of file TeTheme.h.

Referenced by TeDatabase::loadThemeTable().

00081         {       return layerId_; }

void TeAbstractTheme::legend ( TeLegendEntry leg  )  [virtual, inherited]

Definition at line 425 of file TeAbstractTheme.cpp.

References TeAbstractTheme::defaultLegend_, TeLegendEntry::group(), TeAbstractTheme::legend_, TeAbstractTheme::outOfCollectionLegend_, TeAbstractTheme::pointingLegend_, TeAbstractTheme::queryAndPointingLegend_, TeAbstractTheme::queryLegend_, and TeAbstractTheme::withoutDataConnectionLegend_.

00426 {
00427         if(leg.group() == -6)   // queried and pointed objects visual
00428                 queryAndPointingLegend_ = leg;
00429         else if(leg.group() == -5)      // queried objects visual
00430                 queryLegend_ = leg;
00431         else if (leg.group() == -4)
00432                 pointingLegend_ = leg;
00433         else if (leg.group() == -3)
00434                 defaultLegend_ = leg;
00435         else if (leg.group() == -2)
00436                 withoutDataConnectionLegend_ = leg;
00437         else if (leg.group() == -1)
00438                 outOfCollectionLegend_ = leg;
00439         else if (leg.group() > -1)
00440                 legend_.push_back (leg);
00441 }

virtual TeLegendEntryVector& TeAbstractTheme::legend (  )  [inline, virtual, inherited]

Definition at line 351 of file TeAbstractTheme.h.

Referenced by TeAbstractTheme::afterCopyThemeTo(), buildGrouping(), TeExternalTheme::buildGrouping(), TeAbstractTheme::buildGrouping(), TeExternalTheme::createLegendMapId(), TeDatabase::deleteLegend(), TeDatabase::deleteTheme(), TeSqlServer::deleteTheme(), generateCountLegends(), TeAppTheme::getLegendTitleAlias(), TeQuerierDBStr3::initPortal(), TeQuerierDBStr2::initPortal(), TeQuerierDBStr1::initPortal(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeCopyDatabase(), TeGeoOpAggregation(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00351 { return legend_; }

void TeTheme::loadAliasVector (  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 1233 of file TeTheme.cpp.

References aliasVector_, attTableVector_, TeTable::name(), TeTable::tableType(), Te2String(), and TeAttrExternal.

Referenced by addThemeTable(), TeDatabase::alterTableInfoInMemory(), TeExternalTheme::loadAliasVector(), removeThemeTable(), and setAttTables().

01234 {
01235         unsigned int i, count;
01236         TeTable table;
01237         multimap<string, int> tableMMap;
01238 
01239         aliasVector_.clear();
01240 
01241         for (i = 0; i < attTableVector_.size(); ++i)
01242         {
01243                 table = attTableVector_[i];
01244 
01245                 if (table.tableType() != TeAttrExternal)
01246                         aliasVector_.push_back(table.name());
01247                 else
01248                 {
01249                         count = tableMMap.count(table.name());
01250                         if (count == 0)
01251                                 aliasVector_.push_back(table.name());
01252                         else
01253                                 aliasVector_.push_back(table.name() + "_" + Te2String(count));
01254 
01255                         tableMMap.insert(multimap<string,int>::value_type(table.name(), ++count));
01256                 }
01257         }
01258 }

void TeTheme::loadAttrLists (  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 1463 of file TeTheme.cpp.

References aliasVector_, TeTable::attributeList(), attTableVector_, TeLayer::database(), db, TeDatabase::getAttributeList(), layer(), TeTable::name(), sqlAttList_, sqlNumAttList_, TeINT, and TeREAL.

Referenced by addThemeTable(), TeDatabase::alterTableInfoInMemory(), TeExternalTheme::loadAttrLists(), removeThemeTable(), and setAttTables().

01464 {
01465         // Set the new list of attributes of all the theme tables and its new numerical list,
01466         unsigned int i, j, count;
01467         TeTable table;
01468         multimap<string, int> attrMMap;
01469         string attrName;
01470 
01471         sqlAttList_.clear();
01472         sqlNumAttList_.clear();
01473 
01474         if (layer() == 0)
01475                 return;
01476         TeDatabase *db = layer()->database();
01477 
01478         for (i = 0; i < attTableVector_.size(); ++i)
01479         {
01480                 table = attTableVector_[i];
01481                 // Set the map of attribute names
01482                 if(table.attributeList().empty())
01483                         db->getAttributeList(table.name(), table.attributeList());
01484 
01485                 for (j = 0; j < table.attributeList().size(); ++j)
01486                 {
01487                         attrName = table.attributeList()[j].rep_.name_;
01488                         count = attrMMap.count(attrName);
01489                         attrMMap.insert(multimap<string,int>::value_type(attrName, ++count));
01490                 }
01491         }
01492 
01493         // Set the list of attribute names that contains all the attribute names
01494         // of the theme tables
01495         for (i = 0; i < attTableVector_.size(); ++i)
01496         {
01497                 table = attTableVector_[i];
01498                 TeAttributeList attrList=table.attributeList();
01499                 if(attrList.empty())
01500                         db->getAttributeList(table.name(), attrList);
01501                 for (j = 0; j < attrList.size(); ++j)
01502                 {
01503                         attrName = attrList[j].rep_.name_;
01504                         count = attrMMap.count(attrName);
01505                         if (count == 1)
01506                                 attrList[j].rep_.name_ = attrName;
01507                         else
01508                                 attrList[j].rep_.name_ = aliasVector_[i] + "." + attrName;
01509 
01510                         sqlAttList_.push_back(attrList[j]);
01511                 }
01512         }
01513 
01514         // Set the list of attribute names that contains all the numeric attribute names
01515         // of the theme tables
01516         for(i = 0; i < sqlAttList_.size(); ++i)
01517         {
01518                 if(sqlAttList_[i].rep_.type_ == TeREAL || sqlAttList_[i].rep_.type_ == TeINT)
01519                         sqlNumAttList_.push_back(sqlAttList_[i]);
01520         }
01521 }

virtual bool TeTheme::loadMetadata ( TeDatabase  )  [inline, protected, virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 404 of file TeTheme.h.

00404 { return true; } 

void TeTheme::loadTablesJoin ( const string geomTable = ""  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 1284 of file TeTheme.cpp.

References aliasVector_, attTableVector_, collectionAuxTable_, collectionTable_, TeTable::linkName(), loadThemeTablesJoin(), TeTable::name(), TeTable::setLinkName(), TeTable::setTableType(), TeTable::setUniqueName(), sqlGridFrom_, sqlGridJoin_, TeTable::tableType(), Te2String(), TeAttrEvent, TeAttrExternal, TeAttrMedia, TeAttrStatic, and TeTable::uniqueName().

Referenced by addThemeTable(), TeDatabase::alterTableInfoInMemory(), TeExternalTheme::loadTablesJoin(), removeThemeTable(), setAttTables(), and sqlGridFrom().

01285 {
01286         unsigned int i, count;
01287         multimap<string, int> tableMMap;
01288     TeTable table;
01289     bool hasExternalTable = false;
01290 
01291     // Set the new sqlGridFrom_ clause and the new sqlGridJoin_ string
01292     sqlGridFrom_.clear();
01293     sqlGridJoin_.clear();
01294 
01295     TeAttrTableVector tableVec;
01296     vector<string>    aliasVec;
01297 
01298     if(!geomTable.empty())
01299     {
01300         TeTable table;
01301         table.name(geomTable);
01302         table.setLinkName("object_id");
01303         table.setUniqueName("object_id");
01304         table.setTableType(TeAttrStatic);
01305         tableVec.push_back(table);
01306 
01307         for(i=0; i<attTableVector_.size(); ++i)
01308             tableVec.push_back(attTableVector_[i]);
01309 
01310         aliasVec.push_back(geomTable);
01311         for(i=0; i<aliasVector_.size(); ++i)
01312             aliasVec.push_back(aliasVector_[i]);
01313     }
01314     else
01315     {
01316         tableVec = attTableVector_;
01317         aliasVec = aliasVector_;
01318     }
01319 
01320     //verify if there is external table
01321     for (i = 0; i < tableVec.size(); ++i)
01322     {
01323         if (tableVec[i].tableType() == TeAttrExternal)
01324         {
01325             hasExternalTable = true;
01326             break;
01327         }
01328     }
01329 
01330     if(!collectionAuxTable_.empty())
01331     {
01332         sqlGridFrom_ = " FROM ";
01333 
01334         for (i = 0; i <= tableVec.size(); ++i)
01335             sqlGridFrom_ += "(";
01336 
01337         sqlGridFrom_ += collectionAuxTable_;
01338         sqlGridJoin_ = "SELECT ";
01339 
01340         if(hasExternalTable)
01341             sqlGridFrom_ += " RIGHT JOIN "+ collectionTable_;
01342         else
01343             sqlGridFrom_ += " LEFT JOIN "+ collectionTable_;
01344 
01345         sqlGridFrom_ += " ON "+ collectionAuxTable_ +".object_id = "+ collectionTable_ +".c_object_id )";
01346 
01347         int numAux = 0;
01348         for (i = 0; i < tableVec.size(); ++i)
01349         {
01350             table = tableVec[i];
01351             if ((table.tableType()==TeAttrStatic) || (table.tableType()==TeAttrMedia) || (table.tableType()==TeAttrEvent))
01352             {
01353                 sqlGridFrom_ += " LEFT JOIN " + aliasVec[i];
01354                 sqlGridFrom_ += " ON " + collectionTable_ +".c_object_id = " + aliasVec[i] + "." + table.linkName() +")";
01355             }
01356             else if (table.tableType() == TeAttrExternal)
01357             {
01358                                 count = tableMMap.count(table.name());
01359                                 if (count == 0)
01360                                         sqlGridFrom_ += " LEFT JOIN " + aliasVec[i];
01361                                 else
01362                                         sqlGridFrom_ += " LEFT JOIN " + table.name() + " AS " + aliasVec[i];
01363 
01364                                 tableMMap.insert(multimap<string,int>::value_type(table.name(), ++count));
01365                 sqlGridFrom_ += " ON " + collectionAuxTable_ + ".aux" + Te2String(numAux++) +" = "+ aliasVec[i] +"."+ table.uniqueName() +")";
01366             }
01367             else
01368             {
01369                 sqlGridFrom_ += " LEFT JOIN " + aliasVec[i];
01370                 sqlGridFrom_ += " ON " + collectionAuxTable_ + ".aux" + Te2String(numAux++) +" = "+ aliasVec[i] +"."+ table.uniqueName() +")";
01371             }
01372 
01373             sqlGridJoin_ += aliasVec[i] + ".*,";
01374         }
01375 
01376         sqlGridJoin_ += collectionTable_ + ".*, " +  collectionAuxTable_ + ".* " + sqlGridFrom_;
01377     }
01378 
01379         loadThemeTablesJoin();
01380  }

bool TeTheme::loadThemeTables (  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 710 of file TeTheme.cpp.

References clearAttTableVector(), TeLayer::database(), db, layer(), and TeDatabase::loadThemeTable().

Referenced by TeExternalTheme::loadThemeTables().

00711 {
00712         clearAttTableVector();
00713         TeDatabase* db = this->layer()->database();
00714         if(!db)
00715                 return false;
00716         return (db->loadThemeTable(this));
00717 }

void TeTheme::loadThemeTablesJoin (  )  [protected, virtual]

Definition at line 1382 of file TeTheme.cpp.

References aliasVector_, attTableVector_, collectionTable_, TeTable::linkName(), TeTable::name(), TeTable::relatedAttribute(), TeTable::relatedTableName(), sqlFrom_, sqlJoin_, TeTable::tableType(), and TeAttrExternal.

Referenced by loadTablesJoin(), and populateCollectionAux().

01383 {
01384         unsigned int i, count;
01385         multimap<string, int> tableMMap;
01386         TeTable table;
01387 
01388         // Set the new from clause and the new join string
01389         sqlFrom_.clear();
01390         sqlJoin_.clear();
01391 
01392         sqlFrom_ = " FROM ";
01393         sqlJoin_ = "SELECT ";
01394 
01395         if (collectionTable_.empty() == false)
01396         {
01397                 for (i = 0; i < attTableVector_.size(); ++i)
01398                         sqlFrom_ += "(";
01399                 sqlFrom_ += collectionTable_;
01400 
01401                 for (i = 0; i < attTableVector_.size(); ++i)
01402                 {
01403                         table = attTableVector_[i];
01404                         if (table.tableType() != TeAttrExternal)
01405                         {
01406                                 sqlFrom_ += " LEFT JOIN " + aliasVector_[i];
01407                                 sqlFrom_ += " ON " + collectionTable_ + ".c_object_id = " + aliasVector_[i] + "." + table.linkName() + ")";
01408                         }
01409                         else
01410                         {
01411                                 count = tableMMap.count(table.name());
01412                                 if (count == 0)
01413                                         sqlFrom_ += " LEFT JOIN " + aliasVector_[i];
01414                                 else
01415                                         sqlFrom_ += " LEFT JOIN " + table.name() + " AS " + aliasVector_[i];
01416 
01417                                 tableMMap.insert(multimap<string,int>::value_type(table.name(), ++count));
01418 
01419                                 sqlFrom_ += " ON " + table.relatedTableName() + "." + table.relatedAttribute() + " = ";
01420                                 sqlFrom_ +=  aliasVector_[i] + "." + table.linkName() + ")";
01421                         }
01422 
01423                         sqlJoin_ += aliasVector_[i] + ".*,";
01424                 }
01425 
01426                 sqlJoin_ += collectionTable_ + ".*" + sqlFrom_;
01427         }
01428         else
01429         {
01430                 if (attTableVector_.size() == 1)
01431                 {
01432                         table = attTableVector_[0];
01433                         sqlFrom_ += table.name();
01434                         sqlJoin_ = "SELECT " + table.name() + ".*" + sqlFrom_;
01435                 }
01436                 else
01437                 {
01438                         for (i = 0; i < attTableVector_.size() - 1; ++i)
01439                                 sqlFrom_ += "(";
01440 
01441                         TeTable firstTable = attTableVector_[0];
01442                         sqlFrom_ += firstTable.name();
01443                         sqlJoin_ += firstTable.name() + ".*,";
01444                         for (i = 1; i < attTableVector_.size(); ++i)
01445                         {
01446                                 table = attTableVector_[i];
01447                                 sqlFrom_ += " LEFT JOIN " + aliasVector_[i];
01448                                 sqlFrom_ += " ON " + firstTable.name() + "." + firstTable.linkName() + " = " + aliasVector_[i] + "." + table.linkName() + ")";
01449 
01450                                 if (i == attTableVector_.size() - 1)
01451                                         sqlJoin_ += aliasVector_[i] + ".*";
01452                                 else
01453                                         sqlJoin_ += aliasVector_[i] + ".*,";
01454                         }
01455 
01456                         sqlJoin_ += sqlFrom_;
01457                 }
01458         }
01459         return;
01460 }

bool TeTheme::locateCell ( TeCoord2D pt,
TeCell c,
const double &  tol = 0.0 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 1216 of file TeTheme.cpp.

References collectionTable(), layer(), sqlFrom(), TeLayer::tableName(), and TeCELLS.

Referenced by TeExternalTheme::locateCell().

01217 {
01218         if (!layer()->database() || collectionTable().empty())
01219                 return false;
01220 
01221         string geomTable = layer()->tableName(TeCELLS);
01222         string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
01223         sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
01224 
01225         if(!layer()->database()->locateCell(sqlFrom, pt, cell, tol))
01226                 return false;
01227 
01228         return true;
01229 }

bool TeTheme::locateLine ( TeCoord2D pt,
TeLine2D line,
const double &  tol = 0.0 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 1184 of file TeTheme.cpp.

References collectionTable(), layer(), sqlFrom(), TeLayer::tableName(), and TeLINES.

Referenced by TeExternalTheme::locateLine().

01185 {
01186         if (!layer()->database() || collectionTable().empty())
01187                 return false;
01188 
01189         string geomTable = layer()->tableName(TeLINES);
01190         string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
01191         sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
01192 
01193         if(!layer()->database()->locateLine(sqlFrom, pt, line, tol))
01194                 return false;
01195 
01196         return true;
01197 }

bool TeTheme::locatePoint ( TeCoord2D pt,
TePoint point,
const double &  tol = 0.0 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 1200 of file TeTheme.cpp.

References collectionTable(), layer(), sqlFrom(), TeLayer::tableName(), and TePOINTS.

Referenced by TeExternalTheme::locatePoint().

01201 {
01202         if (!layer()->database() || collectionTable().empty())
01203                 return false;
01204 
01205         string geomTable = layer()->tableName(TePOINTS);
01206         string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
01207         sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
01208 
01209         if(!layer()->database()->locatePoint(sqlFrom, pt, point, tol))
01210                 return false;
01211 
01212         return true;
01213 }

bool TeTheme::locatePolygon ( TeCoord2D pt,
TePolygon polygon,
const double &  tol = 0.0 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 1151 of file TeTheme.cpp.

References collectionTable(), layer(), sqlFrom(), TeLayer::tableName(), and TePOLYGONS.

Referenced by TeExternalTheme::locatePolygon().

01152 {
01153         if (!layer()->database() || collectionTable().empty())
01154                 return false;
01155 
01156         string geomTable = layer()->tableName(TePOLYGONS);
01157         string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
01158         sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
01159 
01160         if(!layer()->database()->locatePolygon(sqlFrom, pt, polygon, tol))
01161                 return false;
01162 
01163         return true;
01164 }

bool TeTheme::locatePolygonSet ( TeCoord2D pt,
double  tol,
TePolygonSet polygons 
) [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 1168 of file TeTheme.cpp.

References collectionTable(), layer(), sqlFrom(), TeLayer::tableName(), and TePOLYGONS.

Referenced by TeExternalTheme::locatePolygonSet().

01169 {
01170         if (!layer()->database() || collectionTable().empty())
01171                 return false;
01172 
01173         string geomTable = layer()->tableName(TePOLYGONS);
01174         string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
01175         sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
01176 
01177         if(!layer()->database()->locatePolygonSet(sqlFrom, pt, tol, polygons))
01178                 return false;
01179 
01180         return true;
01181 }

virtual void TeAbstractTheme::maxScale ( double  s  )  [inline, virtual, inherited]

Definition at line 203 of file TeAbstractTheme.h.

00203 { maxScale_ = s; }

virtual double TeAbstractTheme::maxScale (  )  [inline, virtual, inherited]

Definition at line 200 of file TeAbstractTheme.h.

Referenced by TeDatabasePortal::getTheme(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), plotPieBars(), TePlotFrame(), TePlotObjects(), TePlotSelectedObjects(), TePlotTexts(), TePlotTextWV(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00200 { return maxScale_; }

virtual void TeAbstractTheme::minScale ( double  s  )  [inline, virtual, inherited]

Definition at line 197 of file TeAbstractTheme.h.

00197 { minScale_ = s; }

virtual double TeAbstractTheme::minScale (  )  [inline, virtual, inherited]

Definition at line 194 of file TeAbstractTheme.h.

Referenced by TeDatabasePortal::getTheme(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), plotPieBars(), TePlotFrame(), TePlotObjects(), TePlotSelectedObjects(), TePlotTexts(), TePlotTextWV(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00194 { return minScale_; }

virtual void TeViewNode::moveDown ( TeViewNode  )  [inline, protected, virtual, inherited]

Reimplemented in TeViewTree.

Definition at line 255 of file TeViewNode.h.

00255 {}

virtual void TeViewNode::moveDown (  )  [inline, virtual, inherited]

Definition at line 218 of file TeViewNode.h.

00219         {
00220                 if (viewNodeParams_.myParent_)
00221                         viewNodeParams_.myParent_->moveDown (this);
00222         }

virtual void TeViewNode::moveUp ( TeViewNode  )  [inline, protected, virtual, inherited]

Reimplemented in TeViewTree.

Definition at line 254 of file TeViewNode.h.

00254 {}

virtual void TeViewNode::moveUp (  )  [inline, virtual, inherited]

Definition at line 211 of file TeViewNode.h.

00212         {
00213                 if (viewNodeParams_.myParent_)
00214                         viewNodeParams_.myParent_->moveUp (this);
00215         }

virtual void TeViewNode::name ( const string s  )  [inline, virtual, inherited]

Definition at line 193 of file TeViewNode.h.

00193 { viewNodeParams_.name_ = s; }

virtual string TeViewNode::name (  )  [inline, virtual, inherited]

Definition at line 191 of file TeViewNode.h.

Referenced by beforeCopyThemeTo(), TeExternalTheme::clone(), TeAbstractTheme::copyTo(), fillThemeCombo(), TeViewTree::find(), TeView::get(), TeExternalTheme::getRemoteThemeName(), getTable(), TeDatabasePortal::getTheme(), TeDatabasePortal::getViewTree(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeSQLite::insertThemeGroup(), TePostgreSQL::insertThemeGroup(), TeOCIOracle::insertThemeGroup(), TeMySQL::insertThemeGroup(), TeFirebird::insertThemeGroup(), TeOracle::insertThemeGroup(), TeAdo::insertThemeGroup(), TeSQLite::insertViewTree(), TePostgreSQL::insertViewTree(), TeOCIOracle::insertViewTree(), TeMySQL::insertViewTree(), TeFirebird::insertViewTree(), TeOracle::insertViewTree(), TeAdo::insertViewTree(), isThemeTable(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), loadViewSetAndThemeGroups(), plotPieBars(), plotTexts(), plotTextWV(), TeViewTree::remove(), TeCopyDatabase(), TeCreateThemeFromTheme(), TeExportThemeToCSV(), TeExportThemeToMIF(), TeExportThemeToShapefile(), TeExportThemeToSPRING(), TeFillCellNonSpatialOperation(), TeFindTheme(), TeGeoOpOverlayDifference(), TeGeoOpOverlayIntersection(), TeFirebird::updateTheme(), TeDatabase::updateTheme(), and TeDatabase::updateViewTree().

00191 { return viewNodeParams_.name_; }

virtual bool TeAbstractTheme::operator< ( const TeAbstractTheme r  )  const [inline, virtual, inherited]

Definition at line 504 of file TeAbstractTheme.h.

References TeViewNodeParams::priority_, and TeViewNode::viewNodeParams_.

TeTheme & TeTheme::operator= ( const TeTheme other  ) 

Definition at line 101 of file TeTheme.cpp.

References aliasVector_, attTableVector_, collectionAuxTable_, collectionTable_, layer_, layerId_, sqlAttList_, sqlFrom_, sqlGridFrom_, sqlGridJoin_, sqlJoin_, sqlNumAttList_, and useCollection_.

00102 {
00103         if ( this != &other )
00104         {
00105                 TeAbstractTheme* absTheme = (TeAbstractTheme*)this;
00106                 absTheme->operator=(other);
00107                 layerId_ = other.layerId_;
00108                 layer_ = other.layer_;      //the same layer pointer
00109 
00110                 collectionTable_ = other.collectionTable_;
00111                 collectionAuxTable_ = other.collectionAuxTable_;
00112 
00113                 attTableVector_ = other.attTableVector_;
00114                 sqlFrom_ =  other.sqlFrom_;
00115                 sqlJoin_ = other.sqlGridJoin_;
00116                 sqlGridFrom_ = other.sqlGridFrom_;
00117                 sqlGridJoin_ = other.sqlGridJoin_;
00118                 aliasVector_ = other.aliasVector_;
00119                 sqlAttList_ = other.sqlAttList_;
00120                 sqlNumAttList_ = other.sqlNumAttList_;
00121 
00122         useCollection_ = other.useCollection_;
00123         }
00124         return *this;
00125 }

virtual TeLegendEntry& TeAbstractTheme::outOfCollectionLegend (  )  [inline, virtual, inherited]

Definition at line 396 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId().

00397         { return outOfCollectionLegend_; } 

virtual void TeAbstractTheme::outOfCollectionLegend ( TeLegendEntry leg  )  [inline, virtual, inherited]

Useful when is necessary to see the theme in the context of the layer

Definition at line 392 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeCopyDatabase(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00393         { outOfCollectionLegend_ = leg;}

virtual TeViewNode* TeViewNode::parent (  )  [inline, virtual, inherited]

Definition at line 157 of file TeViewNode.h.

Referenced by TeViewTree::moveBottom(), and TeViewTree::moveTop().

00158         { return viewNodeParams_.myParent_; }

virtual void TeViewNode::parentId ( int  i  )  [inline, virtual, inherited]

Definition at line 170 of file TeViewNode.h.

00171         {
00172                 if (viewNodeParams_.myParent_)
00173                         viewNodeParams_.myParent_->id(i);
00174                 viewNodeParams_.myParentId_ = i;
00175         }

virtual int TeViewNode::parentId (  )  [inline, virtual, inherited]

Definition at line 161 of file TeViewNode.h.

Referenced by TeAbstractTheme::beforeCopyThemeTo(), TeDatabasePortal::getTheme(), TeDatabasePortal::getViewTree(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeOCIOracle::insertThemeGroup(), TeOracle::insertThemeGroup(), TeAdo::insertThemeGroup(), TeSQLite::insertViewTree(), TePostgreSQL::insertViewTree(), TeOCIOracle::insertViewTree(), TeMySQL::insertViewTree(), TeFirebird::insertViewTree(), TeOracle::insertViewTree(), TeAdo::insertViewTree(), loadViewSetAndThemeGroups(), updateNodesTrees(), TeFirebird::updateTheme(), TeDatabase::updateTheme(), and TeDatabase::updateViewTree().

00162         {
00163                 if (viewNodeParams_.myParent_)
00164                         return viewNodeParams_.myParent_->id(); 
00165                 else
00166                         return viewNodeParams_.myParentId_;
00167         }

virtual TeLegendEntry& TeAbstractTheme::pointingLegend (  )  [inline, virtual, inherited]

Definition at line 421 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId().

00422         { return pointingLegend_; }

virtual void TeAbstractTheme::pointingLegend ( TeLegendEntry leg  )  [inline, virtual, inherited]

Definition at line 417 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId(), getVisual(), getVisualRemote(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeCopyDatabase(), TeQtGLWidget::TeQtGLWidget(), updateDB20To30(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00418         { pointingLegend_ = leg; }

bool TeTheme::populateCollection ( std::string  objectId = "",
const bool sincronize = true 
) [protected, virtual]

Reimplemented in TeExternalTheme.

Definition at line 1919 of file TeTheme.cpp.

References TeLayer::attrTables(), attTableVector_, TeAbstractTheme::box(), TeAbstractTheme::boxRest_, collectionTable_, TeLayer::database(), db, TeDatabase::dbmsName(), TeDatabase::errorNum(), TeDatabase::execute(), TeAbstractTheme::generateAttributeRest_, TeAbstractTheme::generateTemporalRest_, TeRepresentation::geomRep_, TeAbstractTheme::geomRepRest_, TeAbstractTheme::geomRest_, TeDatabase::getSQLBoxWhere(), TeAbstractTheme::getThemeBox(), TeAbstractTheme::hasSpatialRes_, initParse(), TeSingleton< TePrecision >::instance(), TeBox::isValid(), layer(), layer_, TePrecision::setPrecision(), TeDatabase::spatialRelation(), TeAbstractTheme::spatialRelation_, sqlFrom(), sqlWhere(), tableJoin(), TeLayer::tableName(), TeGetPrecision(), TeTEXT, TeAbstractTheme::themeBox_, TeLayer::vectRepres(), and yyparse().

Referenced by afterCopyThemeTo(), and buildCollection().

01920 {
01921         TeDatabase* db = layer_->database();
01922         if(!db || collectionTable_.empty())
01923                 return false;
01924 
01925         if(attTableVector_.empty())
01926                 attTableVector_ = layer_->attrTables();
01927 
01928         bool useSincronize = sincronize;
01929 
01930         TeRepresPointerVector& represVec = layer_->vectRepres();
01931         for (unsigned int i = 0; i < represVec.size(); ++i)
01932         {
01933                 TeRepresentation* rep = represVec[i];
01934                 if(rep->geomRep_ == TeTEXT)
01935                         continue;
01936 
01937                 string geomTable = layer_->tableName(rep->geomRep_);
01938 
01939                 string sqlSelect, sqlFrom, sqlWhere;
01940 
01941                 sqlSelect = " SELECT DISTINCT "+ geomTable +".object_id ";
01942                 if(!generateAttributeRest_.empty() || !generateTemporalRest_.empty())
01943                 {
01944                         sqlFrom = tableJoin(attTableVector_, geomTable, "object_id");
01945                 }
01946                 else
01947                 {
01948                         sqlFrom = " " + geomTable;
01949                 }
01950 
01951                 if(useSincronize == true)
01952                 {
01953                         sqlWhere  = " WHERE NOT EXISTS (SELECT * FROM " + collectionTable_;
01954                         sqlWhere += " WHERE "+ collectionTable_ +".c_object_id = "+ geomTable +".object_id )";
01955                         sqlWhere += " AND " + geomTable + ".object_id IS NOT NULL ";
01956                 }
01957                 else
01958                 {
01959                         sqlWhere += " WHERE " + geomTable + ".object_id IS NOT NULL ";
01960                         useSincronize = true; //se tiver mais de uma representacao, o segundo join nao pode repetir valores ja inseridos
01961                 }
01962 
01963                 //attribute restriction
01964                 if(!generateAttributeRest_.empty())
01965                         sqlWhere += " AND ("+ generateAttributeRest_ +" )";
01966 
01967                 //temporal restriction
01968                 if(!generateTemporalRest_.empty())
01969                 {
01970                         string sqlTemp;
01971                         initParse(generateTemporalRest_, db);
01972 
01973                         if(!yyparse(sqlTemp))  //0: accept  1: reject
01974                                 sqlWhere += " AND "+ sqlTemp;
01975                         else
01976                                 return false;
01977                 }
01978 
01979                 TeKeys objs;
01980 
01981                 //spatial restriction
01982                 if(hasSpatialRes_)
01983                 {
01984                         if(boxRest_.isValid())
01985                         {
01986                                 TeBox box = boxRest_;
01987                                 sqlWhere += " AND "+ db->getSQLBoxWhere(box, geomRepRest_, geomTable);
01988                         }
01989                         else if (geomRest_)
01990                         {
01991                                 TePrecision::instance().setPrecision(TeGetPrecision(layer()->projection()));
01992 
01993                                 if(db->spatialRelation(geomTable, geomRepRest_, geomRest_, objs, spatialRelation_))
01994                                 {
01995                                         string obs;
01996                                         for(unsigned int i=0; i<objs.size(); i++)
01997                                         {
01998                                                 if(i!=0)
01999                                                         obs += ",";
02000                                                 obs += "'"+ objs[i] +"'";
02001                                         }
02002 
02003                                         sqlWhere += " AND "+ geomTable +".object_id IN ("+ obs +")";
02004                                 }
02005                         }
02006                 }
02007 
02008                 //populate the collection table
02009                 string popule;
02010                 popule = " INSERT INTO "+ collectionTable_ +" (c_object_id) ";
02011                 popule += sqlSelect +" FROM "+ sqlFrom + sqlWhere;
02012                 if (!objectId.empty())
02013                 {
02014                         if (sqlWhere.length())
02015                                 popule += " AND ";
02016                         popule += geomTable +".object_id='" +objectId+ "'";
02017                 }
02018 
02019                 if (!db->execute(popule))
02020                 {
02021                         //Treats an error in the MySQL database system
02022                         //Error: 1062 SQLSTATE: 23000 (ER_DUP_ENTRY)
02023                         //Message: Duplicate entry '%s' for key %d
02024                         if(db->dbmsName() != "MySQL" || db->errorNum()!=1062)
02025                 return false;
02026                 }
02027         }
02028 
02029 //      int defaultLegend = defaultLegend_.id();
02030         string popule = "UPDATE " + collectionTable_;
02031         popule += " SET c_legend_id=0, c_legend_own=0, c_object_status=0 ";
02032 
02033         if (!objectId.empty())
02034                 popule += " WHERE c_object_id='"+objectId+"'";
02035 
02036         if (!db->execute(popule))
02037                 return false;
02038 
02039         themeBox_= getThemeBox();
02040         return true;
02041 }

bool TeTheme::populateCollectionAux ( std::string  objectId = ""  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 1069 of file TeTheme.cpp.

References aliasVector(), attTableVector_, collectionAuxTable_, collectionTable(), collectionTable_, TeLayer::database(), db, TeDatabase::execute(), TeAbstractTheme::generateAttributeRest_, TeAbstractTheme::generateTemporalRest_, initParse(), layer_, loadThemeTablesJoin(), sqlFrom(), Te2String(), TeAttrExternal, TeDynGeomDynAttr, TeFixedGeomDynAttr, and yyparse().

Referenced by afterCopyThemeTo(), buildCollection(), TeCreateThemeFromTheme(), and updateDB20To30().

01070 {
01071         TeDatabase* db = layer_->database();
01072         if((!db) || (collectionTable_.empty()) || (collectionAuxTable_.empty()))
01073                 return false;
01074 
01075         string whereClause;
01076 
01077         whereClause = " WHERE 1=1 ";
01078 
01079         // Populate the collection auxiliary table
01080         string ins = "INSERT INTO " + collectionAuxTable_ + " (object_id";
01081     unsigned int i, j;
01082         j = 0;
01083         for (i = 0; i < attTableVector_.size(); ++i)
01084         {
01085                 if (attTableVector_[i].tableType() == TeAttrExternal ||
01086                         attTableVector_[i].tableType() == TeFixedGeomDynAttr)
01087                         ins += ", aux" + Te2String(j++);
01088         }
01089 
01090         ins += ", grid_status) SELECT c_object_id";
01091         for (i = 0; i < attTableVector_.size(); ++i)
01092         {
01093                 if (attTableVector_[i].tableType() == TeAttrExternal ||
01094                         attTableVector_[i].tableType() == TeFixedGeomDynAttr)
01095                         ins += "," + aliasVector()[i] + "." + attTableVector_[i].uniqueName();
01096         }
01097 
01098         ins += ",c_object_status";
01099 
01100         //attribute restriction
01101         if(!generateAttributeRest_.empty())
01102                 whereClause += " AND "+ generateAttributeRest_;
01103 
01104         //temporal restriction
01105         if(!generateTemporalRest_.empty())
01106         {
01107                 string sqlTemp;
01108                 initParse(generateTemporalRest_, db);
01109 
01110                 if(!yyparse(sqlTemp))  //0: accept  1: reject
01111                         whereClause += " AND "+ sqlTemp;
01112                 else
01113                         return false;
01114         }
01115 
01116         //spatial restriction is already stored in the collection table
01117 
01118         bool usaTemporal = false;
01119         for (i = 0; i < attTableVector_.size(); ++i)
01120         {
01121                 if (attTableVector_[i].tableType() == TeFixedGeomDynAttr ||
01122                         attTableVector_[i].tableType() == TeDynGeomDynAttr)
01123                         usaTemporal = true;
01124         }
01125         loadThemeTablesJoin();
01126         string result = "";
01127         if(!generateAttributeRest_.empty() || !generateTemporalRest_.empty() || attTableVector_.size() > 1)
01128         {
01129                 result = ins + sqlFrom() + whereClause + " ";
01130         }
01131         else
01132         {
01133                 result = ins + " FROM " + collectionTable() + " " + whereClause + " ";
01134         }
01135         if (!objectId.empty() && !whereClause.empty())
01136                 result += " AND c_object_id = '"+objectId+"'";
01137         if (!db->execute(result))
01138                 return false;
01139 
01140         if(usaTemporal) // filter collection table
01141         {
01142                 string s = "DELETE FROM " + collectionTable_ + " WHERE c_object_id NOT IN";
01143                 s += " (SELECT DISTINCT object_id FROM " + collectionAuxTable_ + ")";
01144                 return(db->execute(s));
01145         }
01146         return true;
01147 }

virtual void TeViewNode::priority ( int  i  )  [inline, virtual, inherited]

Definition at line 198 of file TeViewNode.h.

00198 { viewNodeParams_.priority_ = i; }

virtual int TeViewNode::priority (  )  const [inline, virtual, inherited]

Definition at line 196 of file TeViewNode.h.

Referenced by TeViewTree::add(), TeViewTree::assertsPriorities(), TeDatabasePortal::getTheme(), TeDatabasePortal::getViewTree(), TeViewTree::insertFront(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeSQLite::insertThemeGroup(), TePostgreSQL::insertThemeGroup(), TeOCIOracle::insertThemeGroup(), TeMySQL::insertThemeGroup(), TeFirebird::insertThemeGroup(), TeOracle::insertThemeGroup(), TeAdo::insertThemeGroup(), TeSQLite::insertViewTree(), TePostgreSQL::insertViewTree(), TeOCIOracle::insertViewTree(), TeMySQL::insertViewTree(), TeFirebird::insertViewTree(), TeOracle::insertViewTree(), TeAdo::insertViewTree(), loadViewSetAndThemeGroups(), TeViewTree::sort(), TeQtThemeItem::TeQtThemeItem(), updateNodesTrees(), TeFirebird::updateTheme(), TeDatabase::updateTheme(), and TeDatabase::updateViewTree().

00196 { return viewNodeParams_.priority_; }

virtual TeLegendEntry& TeAbstractTheme::queryAndPointingLegend (  )  [inline, virtual, inherited]

Definition at line 445 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId().

00446         { return queryAndPointingLegend_; }

virtual void TeAbstractTheme::queryAndPointingLegend ( TeLegendEntry leg  )  [inline, virtual, inherited]

Definition at line 441 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId(), getVisual(), getVisualRemote(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), updateDB20To30(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00442         { queryAndPointingLegend_ = leg; }

virtual TeLegendEntry& TeAbstractTheme::queryLegend (  )  [inline, virtual, inherited]

Definition at line 433 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId().

00434         { return queryLegend_; }

virtual void TeAbstractTheme::queryLegend ( TeLegendEntry leg  )  [inline, virtual, inherited]

Definition at line 429 of file TeAbstractTheme.h.

Referenced by TeExternalTheme::createLegendMapId(), getVisual(), getVisualRemote(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeCopyDatabase(), updateDB20To30(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00430         { queryLegend_ = leg; }

virtual void TeAbstractTheme::rasterVisual ( TeRasterTransform r  )  [inline, virtual, inherited]

Definition at line 472 of file TeAbstractTheme.h.

00473         { rasterVisual_ = r; } 

virtual TeRasterTransform* TeAbstractTheme::rasterVisual (  )  [inline, virtual, inherited]

Definition at line 468 of file TeAbstractTheme.h.

Referenced by TeDatabase::deleteTheme(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TePlotFrame(), and TePlotObjects().

00469         { return rasterVisual_; }

virtual TeViewNode* TeViewNode::remove ( const string  )  [inline, virtual, inherited]

Fails if the object is a leaf Should be used in conjunction with a delete

Reimplemented in TeViewTree.

Definition at line 151 of file TeViewNode.h.

Referenced by TeViewTree::remove().

00151 { return 0; }

virtual TeViewNode* TeViewNode::removeID ( int   )  [inline, virtual, inherited]

Fails if the object is a leaf Should be used in conjunction with a delete

Reimplemented in TeViewTree.

Definition at line 144 of file TeViewNode.h.

Referenced by TeViewTree::removeID().

00144 { return 0; }

bool TeTheme::removeObjectsWithoutGeometries ( TeGeomRep  geomRep  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 2116 of file TeTheme.cpp.

References collectionAuxTable(), collectionTable(), layer(), and TeLayer::tableName().

Referenced by TeExternalTheme::removeObjectsWithoutGeometries().

02117 {
02118         if(!layer() || !layer()->database() || !layer()->database()->tableExist(collectionTable()))
02119                 return true;
02120 
02121         //get the geometry table
02122         string geomTable = layer()->tableName(geomRep);
02123         if(geomTable.empty())
02124                 return true;
02125 
02126         string del = " DELETE FROM "+ collectionTable();
02127         del += " WHERE NOT EXISTS ";
02128         del += " (SELECT * FROM "+ geomTable;
02129         del += " WHERE "+ collectionTable() +".c_object_id = ";
02130         del += geomTable +".object_id) ";
02131 
02132         if(!layer()->database()->execute(del))
02133                 return false;
02134 
02135         del = " DELETE FROM "+ collectionAuxTable();
02136         del += " WHERE NOT EXISTS ";
02137         del += " (SELECT * FROM "+ geomTable;
02138         del += " WHERE "+ collectionAuxTable() +".object_id = ";
02139         del += geomTable +".object_id) ";
02140 
02141         if(!layer()->database()->execute(del))
02142                 return false;
02143 
02144         return true;
02145 }

void TeAbstractTheme::removePointingColor (  )  [virtual, inherited]

Definition at line 1141 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

Referenced by TeQtGrid::removePointingColorSlot().

01142 {
01143         unsigned int i;
01144         string oid, uid;
01145         vector<string> defaultVec;
01146         map<string, int>::iterator mapIt;
01147 
01148         // Remove the pointed status for the objects
01149         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
01150         {
01151                 oid = mapIt->first;
01152                 if (objStatusMap_[oid] == TePOINTED)
01153                         defaultVec.push_back(oid);
01154                 else if (objStatusMap_[oid] == TePOINTED_QUERIED)
01155                         objStatusMap_[oid] = TeQUERIED;
01156         }
01157 
01158         for (i = 0; i < defaultVec.size(); ++i)
01159                 objStatusMap_.erase(defaultVec[i]);
01160 
01161         // Remove the pointed status for the uids
01162         defaultVec.clear();
01163         for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
01164         {
01165                 uid = mapIt->first;
01166                 if (itemStatusMap_[uid] == TePOINTED)
01167                         defaultVec.push_back(uid);
01168                 else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
01169                         itemStatusMap_[uid] = TeQUERIED;
01170         }
01171 
01172         for (i = 0; i < defaultVec.size(); ++i)
01173                 itemStatusMap_.erase(defaultVec[i]);
01174 }

void TeAbstractTheme::removeQueryColor (  )  [virtual, inherited]

Definition at line 1177 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

Referenced by TeQtGrid::removeQueryColorSlot().

01178 {
01179         unsigned int i;
01180         string oid, uid;
01181         vector<string> defaultVec;
01182         map<string, int>::iterator mapIt;
01183 
01184         // Remove the pointed status for the objects
01185         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
01186         {
01187                 oid = mapIt->first;
01188                 if (objStatusMap_[oid] == TeQUERIED)
01189                         defaultVec.push_back(oid);
01190                 else if (objStatusMap_[oid] == TePOINTED_QUERIED)
01191                         objStatusMap_[oid] = TePOINTED;
01192         }
01193 
01194         for (i = 0; i < defaultVec.size(); ++i)
01195                 objStatusMap_.erase(defaultVec[i]);
01196 
01197         // Remove the pointed status for the uids
01198         defaultVec.clear();
01199         for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
01200         {
01201                 uid = mapIt->first;
01202                 if (itemStatusMap_[uid] == TeQUERIED)
01203                         defaultVec.push_back(uid);
01204                 else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
01205                         itemStatusMap_[uid] = TePOINTED;
01206         }
01207 
01208         for (i = 0; i < defaultVec.size(); ++i)
01209                 itemStatusMap_.erase(defaultVec[i]);
01210 }

void TeAbstractTheme::removeRasterVisual (  )  [virtual, inherited]

Definition at line 386 of file TeAbstractTheme.cpp.

References TeAbstractTheme::rasterVisual_.

Referenced by TeAbstractTheme::resetGrouping().

00387 { 
00388         if (rasterVisual_)
00389         {
00390                 delete rasterVisual_;
00391                 rasterVisual_ = 0;
00392         }
00393 }

bool TeTheme::removeThemeTable ( unsigned int  index  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 821 of file TeTheme.cpp.

References attTableVector_, loadAliasVector(), loadAttrLists(), and loadTablesJoin().

Referenced by TeExternalTheme::removeThemeTable().

00822 {
00823         if (index > (attTableVector_.size() - 1))
00824                 return false;
00825 
00826         TeAttrTableVector::iterator it;
00827         it = attTableVector_.begin() + index;
00828 
00829         attTableVector_.erase(it);
00830         loadAliasVector();
00831         loadAttrLists();
00832         loadTablesJoin();
00833         return true;
00834 }

void TeAbstractTheme::resetGrouping (  )  [virtual, inherited]

Examples:
themeGrouping.cpp.

Definition at line 444 of file TeAbstractTheme.cpp.

References TeAbstractTheme::grouping_, TeGrouping::groupMode_, TeAbstractTheme::legend_, TeAbstractTheme::rasterVisual_, TeAbstractTheme::removeRasterVisual(), TeNoGrouping, and TeRasterSlicing.

Referenced by deleteGrouping(), TeExternalTheme::deleteGrouping(), and main().

00445 {
00446         if((grouping_.groupMode_ == TeRasterSlicing) && rasterVisual_)
00447                         this->removeRasterVisual();
00448 
00449         grouping_.groupMode_ = TeNoGrouping;
00450         legend_.clear();
00451         return;
00452 }

virtual TeViewNode* TeViewNode::retrieve ( int   )  [inline, virtual, inherited]

Definition at line 154 of file TeViewNode.h.

00154 { return 0; }

bool TeTheme::save (  )  [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Examples:
createTheme.cpp.

Definition at line 2148 of file TeTheme.cpp.

References addThemeTable(), collectionAuxTable(), collectionTable(), collectionTable_, createCollectionAuxTable(), TeDatabase::createCollectionTable(), TeLayer::database(), db, TeDatabase::deleteTheme(), TeDatabase::insertTheme(), layer(), Te2String(), and useCollection_.

Referenced by main(), TeCopyDatabase(), and TeCreateThemeFromTheme().

02149 {
02150         TeDatabase* db = layer()->database();
02151         if(!db)
02152                 return false;
02153 
02154         //insert theme in database
02155         if(id()==0)
02156         {
02157                 if(!db->insertTheme(this)) //updateThemeTable
02158                 {
02159                         db->deleteTheme(this->id());
02160                         return false;
02161                 }
02162         }
02163 
02164     if(useCollection_)
02165     {
02166             //collection table
02167             if(collectionTable().empty())
02168                     collectionTable("te_collection_"+ Te2String(id()));
02169 
02170             if(!db->createCollectionTable(collectionTable_))
02171             {
02172                     db->deleteTheme(this->id());
02173                     return false;
02174             }
02175 
02176             //collection aux table
02177             collectionAuxTable(collectionTable() + "_aux");
02178             addThemeTable(collectionAuxTable());
02179 
02180             if(!createCollectionAuxTable())
02181             {
02182                     db->deleteTheme(this->id());
02183                     return false;
02184             }
02185     }
02186 
02187         return true;
02188 }

bool TeTheme::saveGrouping ( TeDatabase db,
TeSelectedObjects  selectedObjects = TeAll 
) [protected, virtual]

Definition at line 674 of file TeTheme.cpp.

References TeDatabase::deleteLegend(), TeDatabase::execute(), TeAbstractTheme::grouping_, TeGrouping::groupMode_, TeDatabase::insertGrouping(), TeAbstractTheme::legend_, setLegendsForObjects(), Te2String(), TeNoGrouping, TeDatabase::updateLegend(), and TeAbstractTheme::visibleRep_.

00675 {
00676         if(!db)
00677                 return false;
00678 
00679         vector<TeLegendEntry> legVec = legend_;
00680 
00681         // Delete the theme grouping(if any) from the database
00682         if(db->deleteLegend(id()) == false)
00683                 return false;
00684 
00685         if(grouping_.groupMode_ == TeNoGrouping)
00686                 return true;
00687 
00688         // Insert the new grouping
00689         if(db->insertGrouping(id(), grouping_) == false)
00690                 return false;
00691 
00692         legend_ = legVec;
00693         // Update (insert) the new legends
00694         if (db->updateLegend(legend_) == false)
00695                 return false;
00696 
00697         setLegendsForObjects();
00698 
00699         if(legend_.size())
00700                 visibleRep_ = visibleRep_ | 0x40000000;
00701         else
00702                 visibleRep_ = visibleRep_ | 0xbfffffff;
00703         string upVis = "UPDATE te_theme SET visible_rep=" + Te2String(visibleRep_) + " WHERE theme_id=" + Te2String(id());
00704         return (db->execute(upVis));
00705 
00706         return true;
00707 }

bool TeTheme::saveGrouping ( TeSelectedObjects  selectedObjects = TeAll  )  [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Examples:
themeGrouping.cpp.

Definition at line 668 of file TeTheme.cpp.

References TeLayer::database(), and layer_.

Referenced by main(), TeExternalTheme::saveGrouping(), and TeCopyDatabase().

00669 {
00670         return saveGrouping(layer_->database(), selectedObjects);
00671 }

bool TeTheme::saveLegendInCollection ( TeDatabase db,
TeSelectedObjects  selectedObjects = TeAll,
std::string  objectId = "" 
) [protected, virtual]

Reimplemented in TeExternalTheme.

Definition at line 1698 of file TeTheme.cpp.

References collectionTable_, TeAbstractTheme::defaultLegend_, TeDatabase::escapeSequence(), TeDatabase::execute(), TeDatabasePortal::fetchRow(), TeLegendEntry::from(), TeDatabasePortal::getData(), TeDatabase::getPortal(), TeGrouping::groupAttribute_, TeGrouping::groupFunction_, TeAbstractTheme::grouping_, TeGrouping::groupMode_, TeGrouping::groupNormAttribute_, TeGrouping::groupNullAttr_, TeGrouping::groupPrecision_, TeLegendEntry::id(), TeAbstractTheme::legend_, TeAttributeRep::name_, TeDatabasePortal::query(), sqlGridFrom(), Te2String(), TeAll, TeGrouped, TeINT, TeNoGrouping, TeNotGrouped, TeNotSelectedByPointing, TeNotSelectedByQuery, TeREAL, TeSelectedByPointing, TeSelectedByQuery, TeUniqueValue, TeLegendEntry::to(), TeViewNode::type(), TeAttributeRep::type_, and TeAbstractTheme::visibleRep_.

01699 {
01700         unsigned int i;
01701         if(!db || grouping_.groupMode_ == TeNoGrouping)
01702                 return false;
01703 
01704         TeAttrDataType          type = grouping_.groupAttribute_.type_;
01705         TeLegendEntryVector legVec = legend_;
01706         string                  groupingAttr = grouping_.groupAttribute_.name_;
01707 
01708         string input;
01709         if(selectedObjects == TeSelectedByPointing)
01710         {
01711                 input = " WHERE (grid_status = 1 OR grid_status = 3";
01712                 input += " OR (grid_status IS NULL AND (c_object_status = 1 OR c_object_status = 3)))";
01713         }
01714         else if(selectedObjects == TeNotSelectedByPointing)
01715         {
01716                 input = " WHERE (grid_status = 0 OR grid_status = 2";
01717                 input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 2)))";
01718         }
01719         else if(selectedObjects == TeSelectedByQuery)
01720         {
01721                 input = " WHERE (grid_status = 2 OR grid_status = 3";
01722                 input += " OR (grid_status is null AND (c_object_status = 2 OR c_object_status = 3)))";
01723         }
01724         else if(selectedObjects == TeNotSelectedByQuery)
01725         {
01726                 input = " WHERE (grid_status = 0 OR grid_status = 1";
01727                 input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 1)))";
01728         }
01729         else if(selectedObjects == TeGrouped)
01730                 input = " WHERE c_legend_id <> 0";
01731         else if(selectedObjects == TeNotGrouped)
01732                 input = " WHERE c_legend_id = 0";
01733 
01734 
01735         string func;
01736         if(grouping_.groupFunction_.empty())
01737                 func = " MIN";
01738         else
01739                 func = grouping_.groupFunction_;
01740 
01741         if(grouping_.groupFunction_ == "COUNT")
01742                 type = TeINT;
01743 
01744         string query = "SELECT MIN(" + collectionTable_ + ".c_object_id)";
01745         if(grouping_.groupNormAttribute_.empty())
01746                 query += ", "+ func +"(" + groupingAttr + ")" + sqlGridFrom();
01747         else
01748                 query += ", "+ func +"(" + groupingAttr + ") / "+ func +"(" + grouping_.groupNormAttribute_ + ")" + sqlGridFrom();
01749 
01750         if(selectedObjects != TeAll)
01751                 query += input;
01752 
01753         query += " GROUP BY " + collectionTable_ + ".c_object_id";
01754 
01755         map<int, vector<string> > legMap;
01756 
01757         TeDatabasePortal* portal = db->getPortal();
01758         if(portal->query(query) == false)
01759         {
01760                 delete portal;
01761                 return false;
01762         }
01763 
01764         vector<string> idVec;
01765         vector<string> nullIdVec;
01766         vector<string> valVec;
01767         while(portal->fetchRow())
01768         {
01769                 string val = portal->getData(1);
01770                 string oid = portal->getData(0);
01771                 if (val.empty() == false)
01772                 {
01773                         idVec.push_back(oid);
01774                         valVec.push_back(val);
01775                 }
01776                 else
01777                         nullIdVec.push_back(oid);
01778         }
01779         if (grouping_.groupMode_ == TeUniqueValue)
01780         {
01781                 unsigned int j = 0;
01782                 while( j < idVec.size())
01783                 {
01784                         string val = valVec[j];
01785                         string oid = idVec[j];
01786                         if(type == TeREAL)
01787                         {
01788                                 double a = atof(val.c_str());
01789                                 val = Te2String(a, grouping_.groupPrecision_);
01790                         }
01791                         else if(type == TeINT)
01792                         {
01793                                 int a = atoi(val.c_str());
01794                                 val = Te2String(a);
01795                         }
01796 
01797                         unsigned int siz = legend_.size();
01798                         if(grouping_.groupNullAttr_ && nullIdVec.size() > 0)
01799                                 --siz;
01800                         for(i=0; i < siz; i++)
01801                         {
01802                                 TeLegendEntry& leg = legend_[i];
01803                                 if(val == leg.from())
01804                                 {
01805                                         legMap[leg.id()].push_back(oid);
01806                                         break;
01807                                 }
01808                         }
01809                         j++;
01810                 }
01811         }
01812         else
01813         {
01814                 unsigned int j = 0;
01815                 while(j < idVec.size())
01816                 {
01817                         string val = valVec[j];
01818                         string oid = idVec[j];
01819                         if(type == TeREAL)
01820                         {
01821                                 double a = atof(val.c_str());
01822                                 val = Te2String(a, grouping_.groupPrecision_);
01823                         }
01824 
01825                         unsigned int siz = legend_.size();
01826                         if(grouping_.groupNullAttr_ && !nullIdVec.empty())
01827                --siz;
01828                         for(i=0; i < siz; i++)
01829                         {
01830                                 TeLegendEntry& leg = legend_[i];
01831                                 int f = leg.from().find("mean");
01832                                 if(f >= 0)
01833                                         continue;
01834                                 double dval = atof(val.c_str());
01835                                 double dfrom = atof(leg.from().c_str());
01836                                 double dto = atof(leg.to().c_str());
01837                                 if(i < legend_.size()-1)
01838                                 {
01839                                         if(dval >= dfrom && dval < dto)
01840                                         {
01841                                                 legMap[leg.id()].push_back(oid);
01842                                                 break;
01843                                         }
01844                                 }
01845                                 else
01846                                 {
01847                                         if(dval >= dfrom && dval <= dto)
01848                                         {
01849                                                 legMap[leg.id()].push_back(oid);
01850                                                 break;
01851                                         }
01852                                 }
01853                         }
01854                         j++;
01855                 }
01856         }
01857         delete portal;
01858 
01859         int legId = defaultLegend_.id();
01860         if (grouping_.groupNullAttr_)
01861                 legId = legend_[legend_.size()-1].id();
01862         for(i = 0; i < nullIdVec.size(); ++i)
01863         {
01864                 string oid = nullIdVec[i];
01865                 legMap[legId].push_back(oid);
01866         }
01867 
01868         vector<string> svec;
01869         map<int, vector<string> > :: iterator it = legMap.begin();
01870         while(it != legMap.end())
01871         {
01872         // --- Generate In Clauses ----
01873                 unsigned int i, j, k, size, chunkSize = 200, nChunks;
01874                 string inClause;
01875                 size = it->second.size();
01876                 if (size % chunkSize)
01877                         nChunks = size / chunkSize + 1;
01878                 else
01879                         nChunks = size / chunkSize;
01880 
01881                 j = 0;
01882                 for (k = 0; k < nChunks; ++k)
01883                 {
01884                         i = 0;
01885                         inClause = "(";
01886                         while (j < size && i < chunkSize)
01887                         {
01888                                 inClause += "'" + db->escapeSequence(it->second[j]) + "',";
01889                                 i++;
01890                                 j++;
01891                         }
01892                         inClause[inClause.size() - 1] = ')';
01893                         svec.push_back(inClause);
01894                 }
01895 
01896                 //--- generateInClause
01897 
01898                 for(i=0; i<svec.size(); ++i)
01899                 {
01900                         string up = "UPDATE " + collectionTable_ + " SET c_legend_id = " + Te2String(it->first);
01901                         up += " WHERE c_object_id IN " + svec[i];
01902                         if (!objectId.empty())
01903                                 up += " AND c_object_id='"+objectId+"'";
01904                         if(db->execute(up) == false)
01905                                 continue;
01906                 }
01907                 it++;
01908                 svec.clear();
01909         }
01910         if(legend_.size())
01911                 visibleRep_ = visibleRep_ | 0x40000000;
01912         else
01913                 visibleRep_ = visibleRep_ | 0xbfffffff;
01914         string upVis = "UPDATE te_theme SET visible_rep=" + Te2String(visibleRep_) + " WHERE theme_id=" + Te2String(id());
01915         return (db->execute(upVis));
01916 }

bool TeTheme::saveLegendInCollection ( TeSelectedObjects  selectedObjects = TeAll,
std::string  objectId = "" 
) [virtual]

Reimplemented in TeExternalTheme.

Examples:
themeGrouping.cpp.

Definition at line 1692 of file TeTheme.cpp.

References layer().

Referenced by afterCopyThemeTo(), and main().

01693 {
01694         return saveLegendInCollection(layer()->database(), selectedObjects, objectId);
01695 }

virtual bool TeTheme::saveMetadata ( TeDatabase  )  [inline, virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 333 of file TeTheme.h.

00333 { return true; } 

bool TeTheme::setAttTables ( TeAttrTableVector attrs  )  [virtual]

Reimplemented in TeExternalTheme.

Examples:
createSTElementSetFromTheme.cpp, and createTheme.cpp.

Definition at line 781 of file TeTheme.cpp.

References attTableVector_, collectionAuxTable_, loadAliasVector(), loadAttrLists(), loadTablesJoin(), TeAttrEvent, TeAttrExternal, TeAttrMedia, TeDynGeomDynAttr, and TeFixedGeomDynAttr.

Referenced by main(), TeQuerierParams::operator=(), TeExternalTheme::setAttTables(), TeQuerierParams::setParams(), TeCopyDatabase(), TeCopyViewNode(), TeCreateThemeFromTheme(), TeExportLayerToCSV(), TeExportLayerToMIF(), TeExportLayerToShapefile(), TeExportMIF(), TeExportShapefile(), TeExportSPR(), TeFillCellAggregateOperation(), TeFillCellNonSpatialOperation(), and TeQuerierParams::TeQuerierParams().

00782 {
00783         attTableVector_.clear();
00784         int countTemporal = 0;
00785         int countExtern = 0;
00786         bool result = true;
00787 
00788         TeAttrTableVector::iterator it = attrs.begin();
00789         while(it!=attrs.end())
00790         {
00791                 //temporal
00792                 if( (it->tableType()==TeAttrEvent) ||
00793                         (it->tableType()==TeFixedGeomDynAttr) ||
00794                         (it->tableType()==TeDynGeomDynAttr))
00795                         ++countTemporal;
00796 
00797                 //extern
00798                 if(it->tableType()==TeAttrExternal)
00799                         ++countExtern;
00800 
00801                 if( (it->tableType()==TeAttrMedia)     ||
00802                         (countTemporal>0 && countExtern>0) ||
00803                         (countTemporal>1) ||
00804                         (it->name() == collectionAuxTable_) )
00805                 {
00806                         result = false;
00807                 }
00808                 else
00809                 {
00810                         attTableVector_.push_back(*it);
00811                         loadAliasVector();
00812                         loadAttrLists();
00813                         loadTablesJoin();
00814                 }
00815                 ++it;
00816         }
00817         return result;
00818 }

void TeAbstractTheme::setAvailability ( const bool avaiability  )  [virtual, inherited]

Definition at line 366 of file TeAbstractTheme.cpp.

References TeAbstractTheme::isAvailable_.

00367 {
00368         isAvailable_ = availability;
00369 }

void TeAbstractTheme::setCreationTime ( const TeTime creationTime  )  [virtual, inherited]

Definition at line 1297 of file TeAbstractTheme.cpp.

References TeAbstractTheme::creationTime_.

Referenced by TeDatabasePortal::getTheme().

01298 {
01299         creationTime_ = creationTime;
01300 }

void TeAbstractTheme::setEditable ( const bool editable  )  [inherited]

Parameters:
editable 

Definition at line 381 of file TeAbstractTheme.cpp.

References TeAbstractTheme::isEditable_.

00382 {
00383         isEditable_ = editable;
00384 }

bool TeAbstractTheme::setGroupingVisual ( int  n,
TeGeomRepVisualMap vismap 
) [virtual, inherited]

Definition at line 482 of file TeAbstractTheme.cpp.

References TeAbstractTheme::grouping_, TeGrouping::groupNumSlices_, and TeAbstractTheme::legend_.

00483 {
00484         if(     (n > grouping_.groupNumSlices_) ||
00485                 ((int)legend_.size() < n)               || 
00486                 (legend_.empty()) )
00487                 return false;
00488 
00489         TeGeomRepVisualMap::iterator it = vismap.begin();
00490         while (it != vismap.end())
00491         {
00492                 legend_[(n-1)].setVisual(it->second->copy(),it->first);
00493                 ++it;
00494         }
00495         return true;
00496 }

bool TeAbstractTheme::setGroupingVisual ( int  n,
TeVisual visual,
TeGeomRep  rep 
) [virtual, inherited]

Examples:
rasterSlicing.cpp, and themeGrouping.cpp.

Definition at line 471 of file TeAbstractTheme.cpp.

References TeVisual::copy(), TeAbstractTheme::grouping_, TeGrouping::groupNumSlices_, and TeAbstractTheme::legend_.

Referenced by TeAbstractTheme::afterCopyThemeTo(), main(), and TeCopyDatabase().

00472 {
00473         if(     (n > grouping_.groupNumSlices_) ||
00474                 ((int)legend_.size() < n)                               || 
00475                 (legend_.empty()) )
00476                 return false;
00477         legend_[(n-1)].setVisual (visual->copy(), rep); 
00478         return true;
00479 }

void TeTheme::setLegendsForObjects (  )  [virtual]

Implements TeAbstractTheme.

Reimplemented in TeExternalTheme.

Definition at line 1524 of file TeTheme.cpp.

References attTableVector_, TeLayer::database(), db, TeAbstractTheme::defaultLegend_, TeDatabasePortal::fetchRow(), TeLegendEntry::from(), TeDatabasePortal::getData(), TeDatabase::getPortal(), TeGrouping::groupAttribute_, TeGrouping::groupFunction_, TeAbstractTheme::grouping_, TeGrouping::groupMode_, TeGrouping::groupNullAttr_, TeGrouping::groupPrecision_, TeLegendEntry::id(), layer_, TeAbstractTheme::legend_, TeAttributeRep::name_, TeAbstractTheme::objLegendMap_, TeDatabasePortal::query(), sqlFrom_, Te2String(), TeINT, TeNoGrouping, TeREAL, TeUniqueValue, TeLegendEntry::to(), TeViewNode::type(), and TeAttributeRep::type_.

Referenced by saveGrouping().

01525 {
01526         if(grouping_.groupMode_ == TeNoGrouping || attTableVector_.empty())
01527                 return;
01528 
01529         unsigned int i, j;
01530         string func, query, oid, val;
01531 
01532         TeDatabase *db = layer_->database();
01533         TeDatabasePortal* portal = db->getPortal();
01534 
01535         TeAttrDataType type = grouping_.groupAttribute_.type_;
01536         string  groupingAttr = grouping_.groupAttribute_.name_;
01537 
01538         vector<string> oidVec;
01539         vector<string> oidWithNullValVec;
01540         vector<string> valVec;
01541         map<int, set<string> > legObjSetMap;
01542 
01543         objLegendMap_.clear();
01544 
01545         if(grouping_.groupFunction_.empty())
01546                 func = "MIN";
01547         else
01548                 func = grouping_.groupFunction_;
01549 
01550         if(grouping_.groupFunction_ == "COUNT")
01551                 type = TeINT;
01552 
01553         query = "SELECT MIN(" + attTableVector_[0].uniqueName() + ")";
01554         query += ", " + func + "(" + groupingAttr + ")" + sqlFrom_;
01555         query += " GROUP BY " + attTableVector_[0].uniqueName();
01556 
01557         if(portal->query(query) == false)
01558         {
01559                 delete portal;
01560                 return;
01561         }
01562 
01563         while(portal->fetchRow())
01564         {
01565                 oid = portal->getData(0);
01566                 val = portal->getData(1);
01567                 if (val.empty() == false)
01568                 {
01569                         oidVec.push_back(oid);
01570                         valVec.push_back(val);
01571                 }
01572                 else
01573                         oidWithNullValVec.push_back(oid);
01574         }
01575 
01576         unsigned int legSize = legend_.size();
01577         if(grouping_.groupNullAttr_ && oidWithNullValVec.size() > 0)
01578                 --legSize;
01579 
01580         if (grouping_.groupMode_ == TeUniqueValue)
01581         {
01582                 for (i = 0; i < oidVec.size(); ++i)
01583                 {
01584                         oid = oidVec[i];
01585                         val = valVec[i];
01586 
01587                         if(type == TeREAL)
01588                                 val = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
01589                         else if(type == TeINT)
01590                                 val = Te2String(atoi(val.c_str()));
01591 
01592                         for(j = 0; j < legSize; ++j)
01593                         {
01594                                 TeLegendEntry& leg = legend_[j];
01595                                 if(val == leg.from())
01596                                 {
01597                                         objLegendMap_[oid] = leg.id();
01598                                         set<string>& oidSet = legObjSetMap[leg.id()];
01599                                         oidSet.insert(oid);
01600                                         break;
01601                                 }
01602                         }
01603                 }
01604         }
01605         else
01606         {
01607                 for (i = 0; i < oidVec.size(); ++i)
01608                 {
01609                         double dVal, dFrom, dTo;
01610                         oid = oidVec[i];
01611                         val = valVec[i];
01612 
01613                         if (type == TeREAL)
01614                                 val = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
01615 
01616                         for (j = 0; j < legSize; ++j)
01617                         {
01618                                 TeLegendEntry& leg = legend_[j];
01619                                 if (leg.from().find("mean") != string::npos)
01620                                         continue;
01621 
01622                                 dVal  = atof(val.c_str());
01623                                 dFrom = atof(leg.from().c_str());
01624                                 dTo = atof(leg.to().c_str());
01625 
01626                                 if (j < (legSize - 1))
01627                                 {
01628                                         if(dVal >= dFrom && dVal < dTo)
01629                                         {
01630                                                 objLegendMap_[oid] = leg.id();
01631                                                 set<string>& oidSet = legObjSetMap[leg.id()];
01632                                                 oidSet.insert(oid);
01633                                                 break;
01634                                         }
01635                                 }
01636                                 else
01637                                 {
01638                                         if(dVal >= dFrom && dVal <= dTo)
01639                                         {
01640                                                 objLegendMap_[oid] = leg.id();
01641                                                 set<string>& oidSet = legObjSetMap[leg.id()];
01642                                                 oidSet.insert(oid);
01643                                                 break;
01644                                         }
01645                                 }
01646                         }
01647                 }
01648         }
01649         delete portal;
01650 
01651         // Set the leg id for the objects with null values
01652         int legId = defaultLegend_.id();
01653         if (grouping_.groupNullAttr_)
01654                 legId = legend_[legend_.size() - 1].id();
01655 
01656         for (i = 0; i < oidWithNullValVec.size(); ++i)
01657         {
01658                 oid = oidWithNullValVec[i];
01659                 objLegendMap_[oid] = legId;
01660                 set<string>& oidSet = legObjSetMap[legId];
01661                 oidSet.insert(oid);
01662         }
01663 
01664 /*
01665         // Insert the legends in the te_legend table
01666         map<int, set<string> >::iterator mapIt;
01667         set<string>::iterator setIt;
01668         unsigned char *data;
01669         string where = " theme_id = " + Te2String(id());
01670         for (mapIt = legObjSetMap.begin(); mapIt != legObjSetMap.end(); ++mapIt)
01671         {
01672                 legId = mapIt->first;
01673                 set<string>& oidSet = mapIt->second;
01674                 string whereClause = where;
01675                 whereClause +=  " AND legend_id = " + Te2String(legId);
01676                 string objStr;
01677                 for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
01678                         objStr += *setIt + ';';
01679                 data = (unsigned char*)objStr.c_str();
01680                 db->insertBlob("te_legend", "object_list", whereClause, data, objStr.size());
01681         }
01682 */
01683 }

void TeAbstractTheme::setObjectsToDefaultStatus (  )  [virtual, inherited]

Definition at line 1259 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

01260 {
01261         unsigned int i;
01262         string oid, uid;
01263         vector<string> defaultVec;
01264         map<string, int>::iterator mapIt;
01265 
01266         // Set the default status for objects that are pointed, queried, or pointed and queried
01267         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
01268         {
01269                 oid = mapIt->first;
01270                 if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TeQUERIED ||
01271                         objStatusMap_[oid] == TePOINTED_QUERIED)
01272                         defaultVec.push_back(oid);
01273         }
01274 
01275         for (i = 0; i < defaultVec.size(); ++i)
01276                 objStatusMap_.erase(defaultVec[i]);
01277 
01278         // Set the default status for uids that are pointed, queried, or pointed and queried
01279         defaultVec.clear();
01280         for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
01281         {
01282                 uid = mapIt->first;
01283                 if (itemStatusMap_[uid] == TePOINTED || itemStatusMap_[uid] == TeQUERIED ||
01284                         itemStatusMap_[uid] == TePOINTED_QUERIED)
01285                         defaultVec.push_back(uid);
01286         }
01287 
01288         for (i = 0; i < defaultVec.size(); ++i)
01289                 itemStatusMap_.erase(defaultVec[i]);
01290 }

void TeTheme::setOwnLegendsForObjects (  )  [virtual]

Implements TeAbstractTheme.

Definition at line 1686 of file TeTheme.cpp.

01687 {
01688 
01689 }

void TeAbstractTheme::setParent ( TeViewNode  )  [virtual, inherited]

Reimplemented from TeViewNode.

Definition at line 553 of file TeAbstractTheme.cpp.

00554 {
00555 }

void TeTheme::setSpatialRest ( TeGeometry geom,
TeGeomRep  rep = TeGEOMETRYNONE,
TeSpatialRelation  relation = TeWITHIN 
) [virtual]

Reimplemented from TeAbstractTheme.

Definition at line 161 of file TeTheme.cpp.

References TeAbstractTheme::boxRest_, TeAbstractTheme::geomRepRest_, TeAbstractTheme::geomRest_, TeAbstractTheme::hasSpatialRes_, layer(), TeAbstractTheme::spatialRelation_, TeGEOMETRYNONE, and TeLayer::vectRepres().

00162 {
00163         hasSpatialRes_ = true;
00164         geomRest_ = geom;
00165         spatialRelation_ = relation;
00166 
00167         if(rep==TeGEOMETRYNONE)
00168                 geomRepRest_ = layer()->vectRepres()[0]->geomRep_;
00169         else
00170                 geomRepRest_ = rep;
00171 
00172         boxRest_ = TeBox();
00173 }

void TeTheme::setSpatialRest ( TeBox box,
TeGeomRep  rep = TeGEOMETRYNONE,
TeSpatialRelation  relation = TeWITHIN 
) [virtual]

Reimplemented from TeAbstractTheme.

Examples:
createSTElementSetFromTheme.cpp.

Definition at line 146 of file TeTheme.cpp.

References TeAbstractTheme::boxRest_, TeAbstractTheme::geomRepRest_, TeAbstractTheme::geomRest_, TeAbstractTheme::hasSpatialRes_, layer(), TeAbstractTheme::spatialRelation_, TeGEOMETRYNONE, and TeLayer::vectRepres().

Referenced by main(), and TeFillCellAggregateOperation().

00147 {
00148         hasSpatialRes_ = true;
00149         boxRest_ = box;
00150         spatialRelation_ = relation;
00151 
00152         if(rep==TeGEOMETRYNONE)
00153                 geomRepRest_ = layer()->vectRepres()[0]->geomRep_;
00154         else
00155                 geomRepRest_ = rep;
00156 
00157         geomRest_ = 0;
00158 }

void TeAbstractTheme::setStatus ( vector< string > &  oidVec,
vector< string > &  itemVec,
int  status 
) [virtual, inherited]

Definition at line 557 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, and TeAbstractTheme::objStatusMap_.

Referenced by saveObjectStatus().

00558 {
00559         vector<string>::iterator it;
00560 
00561         if(status == 0)
00562         {
00563                 for(it=oidVec.begin(); it!=oidVec.end();++it)
00564                 {
00565                         string s = *it;
00566                         if(objStatusMap_.find(s) != objStatusMap_.end())
00567                                 objStatusMap_.erase(s);
00568                 }
00569                 for(it=itemVec.begin(); it!=itemVec.end();++it)
00570                 {
00571                         string s = *it;
00572                         if(itemStatusMap_.find(s) != itemStatusMap_.end())
00573                                 itemStatusMap_.erase(s);
00574                 }
00575         }
00576         else
00577         {
00578                 for(it=oidVec.begin(); it!=oidVec.end();++it)
00579                 {
00580                         string s = *it;
00581                         objStatusMap_[s] = status;
00582                 }
00583                 for(it=itemVec.begin(); it!=itemVec.end();++it)
00584                 {
00585                         string s = *it;
00586                         itemStatusMap_[s] = status;
00587                 }
00588         }
00589 }

void TeAbstractTheme::setStatusForItemsAddedByPointing ( vector< string > &  itemVec  )  [virtual, inherited]

Definition at line 1010 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getObjects(), TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

01011 {
01012         unsigned int i;
01013         string oid, item;
01014 
01015         //-----------------------------------------------------------------------
01016         // Set the pointing status for the input items
01017         //-----------------------------------------------------------------------
01018         for (i = 0; i < itemVec.size(); ++i)
01019         {
01020                 item = itemVec[i];
01021                 if (itemStatusMap_[item] == TeDEFAULT)
01022                         itemStatusMap_[item] = TePOINTED;
01023                 else if (objStatusMap_[item] == TeQUERIED)
01024                         itemStatusMap_[item] = TePOINTED_QUERIED;
01025 
01026         }
01027 
01028         //-----------------------------------------------------------------------
01029         // Set the pointing status for the objects associated to the input items
01030         //-----------------------------------------------------------------------
01031         set<string> oidSet = getObjects(itemVec);
01032         set<string>::iterator setIt;
01033         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
01034         {
01035                 oid = *setIt;
01036                 if (objStatusMap_[oid] == TeDEFAULT)
01037                         objStatusMap_[oid] = TePOINTED;
01038                 else if (objStatusMap_[oid] == TeQUERIED)
01039                         objStatusMap_[oid] = TePOINTED_QUERIED; 
01040         }
01041 }

void TeAbstractTheme::setStatusForItemsAddedByQuerying ( set< string > &  oidSet,
vector< string > &  uidVec 
) [virtual, inherited]

Definition at line 1044 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

01045 {
01046         unsigned int i;
01047         string oid, uid;
01048         set<string>::iterator setIt;
01049 
01050         // Set the status for the oids in oidSet as "queried"
01051         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
01052         {
01053                 oid = *setIt;
01054                 if (objStatusMap_[oid] == TeDEFAULT)
01055                         objStatusMap_[oid] = TeQUERIED;
01056                 else if (objStatusMap_[oid] == TePOINTED)
01057                         objStatusMap_[oid] = TePOINTED_QUERIED;
01058         }
01059 
01060         // Set the new status for the uidVec
01061         for (i = 0; i < uidVec.size(); ++i)
01062         {
01063                 uid = uidVec[i];
01064                 if (itemStatusMap_[uid] == TeDEFAULT)
01065                         itemStatusMap_[uid] = TeQUERIED;
01066                 else if (itemStatusMap_[uid] == TePOINTED)
01067                         itemStatusMap_[uid] = TePOINTED_QUERIED;
01068         }
01069 }

void TeAbstractTheme::setStatusForItemsFilteredByQuerying ( set< string > &  oidSet,
vector< string > &  uidVec 
) [virtual, inherited]

Definition at line 1072 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

01073 {
01074         unsigned int i;
01075         string oid, uid;
01076         vector<string> prevOidQVec;             // previous oids queried
01077         vector<string> notInOidSetVec;  // oid is not in oidSet
01078         vector<string> defaultVec;              // vector with oids or uids to be set as default
01079         map<string, int>::iterator mapIt;
01080         set<string>::iterator setIt;
01081 
01082         // Get the previous oids queried
01083         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
01084         {
01085                 oid = mapIt->first;
01086                 if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
01087                         prevOidQVec.push_back(mapIt->first);
01088         }
01089 
01090         // Check if the previous oids queried are in the oidSet; in positive case, remove
01091         // them from the oidSet; in negative case, put them in the vector notInOidSetVec
01092         for (i = 0; i < prevOidQVec.size(); ++i)
01093         {
01094                 oid = prevOidQVec[i];
01095                 if (oidSet.find(oid) != oidSet.end())                   
01096                         oidSet.erase(oid);                              // object is in the input oidSet
01097                 else
01098                         notInOidSetVec.push_back(oid);  // object is not in the input oidSet
01099         }
01100 
01101         // For the objects not in oidSet, insert it in oidSet, and remove their queried status
01102         for (i = 0; i < notInOidSetVec.size(); ++i)
01103         {
01104                 oid = notInOidSetVec[i];
01105                 if (objStatusMap_[oid] == TeQUERIED)
01106                         defaultVec.push_back(oid);
01107                 else if (objStatusMap_[oid] == TePOINTED_QUERIED)
01108                         objStatusMap_[oid] = TePOINTED;
01109                 
01110                 oidSet.insert(oid);
01111         }
01112 
01113         for (i = 0; i < defaultVec.size(); ++i)
01114                 objStatusMap_.erase(defaultVec[i]);
01115 
01116         // Remove the queried status for the uids that were previously queried
01117         defaultVec.clear();
01118         for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
01119         {
01120                 uid = mapIt->first;
01121                 if (itemStatusMap_[uid] == TeQUERIED)
01122                         defaultVec.push_back(uid);
01123                 else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
01124                         itemStatusMap_[uid] = TePOINTED;                        
01125         }
01126 
01127         for (i = 0; i < defaultVec.size(); ++i)
01128                 itemStatusMap_.erase(defaultVec[i]);
01129 
01130         // Set the queried status for the input uidVec
01131         for (i = 0; i < uidVec.size(); ++i)
01132         {
01133                 uid = uidVec[i];
01134                 if (itemStatusMap_[uid] == TeDEFAULT)
01135                         itemStatusMap_[uid] = TeQUERIED;
01136                 else if (itemStatusMap_[uid] == TePOINTED)
01137                         itemStatusMap_[uid] = TePOINTED_QUERIED;
01138         }
01139 }

void TeAbstractTheme::setStatusForItemsToggled ( set< string > &  oidSet,
vector< string > &  itemVec 
) [virtual, inherited]

Definition at line 639 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getItemVector(), TeAbstractTheme::itemStatusMap_, MAX, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

00640 {
00641         unsigned int i;
00642         int oidStatus;
00643         string oid, uid;
00644         set<string>::iterator it;
00645 
00646         // Set the new status of the uids
00647         for (i = 0; i < uidVec.size(); ++i)
00648         {
00649                 uid = uidVec[i];
00650                 if (itemStatusMap_[uid] == TeDEFAULT)
00651                         itemStatusMap_[uid] = TePOINTED;
00652                 else if (itemStatusMap_[uid] == TePOINTED)
00653                         itemStatusMap_.erase(uid);
00654                 else if (itemStatusMap_[uid] == TeQUERIED)
00655                         itemStatusMap_[uid] = TePOINTED_QUERIED;
00656                 else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
00657                         itemStatusMap_[uid] = TeQUERIED;
00658         }
00659 
00660 
00661         // Set the new status of the oids
00662         for (it = oidSet.begin(); it != oidSet.end(); ++it)
00663         {
00664                 oid = *it;
00665                 oidStatus = 0;
00666                 set<string> objSet;
00667                 objSet.insert(oid);
00668                 vector<string> uidVec = getItemVector(objSet);
00669                 for (i = 0; i < uidVec.size(); ++i)
00670                 {
00671                         uid = uidVec[i];
00672                         if (itemStatusMap_[uid] == TePOINTED_QUERIED)
00673                         {
00674                                 oidStatus = TePOINTED_QUERIED;
00675                                 break;
00676                         }
00677                         oidStatus = MAX(oidStatus, itemStatusMap_[uid]);
00678                         if (itemStatusMap_[uid] == TeDEFAULT)
00679                                 itemStatusMap_.erase(uid);
00680                 }       
00681                 
00682                 if (oidStatus == 0)
00683                         objStatusMap_.erase(oid);
00684                 else
00685                         objStatusMap_[oid] = oidStatus;
00686         }
00687 }

void TeAbstractTheme::setStatusForNewItemsPointed ( vector< string > &  itemVec  )  [virtual, inherited]

Definition at line 893 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getObjects(), TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

00894 {
00895         unsigned int i;
00896         string oid, item;
00897         map<string, int>::iterator mapIt;
00898         vector<string> defaultVec;
00899 
00900         //-----------------------------------------------------------------------
00901         // Set the pointing status for the input items
00902         //-----------------------------------------------------------------------
00903 
00904         // Remove the pointing status for all the items
00905         for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
00906         {
00907                 item = mapIt->first;
00908                 if (itemStatusMap_[item] == TePOINTED)
00909                         defaultVec.push_back(item);
00910                 else if (objStatusMap_[item] == TePOINTED_QUERIED)
00911                         itemStatusMap_[item] = TeQUERIED;
00912         }
00913 
00914         for (i = 0; i < defaultVec.size(); ++i)
00915                 itemStatusMap_.erase(defaultVec[i]);
00916 
00917         for (i = 0; i < itemVec.size(); ++i)
00918         {
00919                 item = itemVec[i];
00920                 if (itemStatusMap_[item] == TeDEFAULT)
00921                         itemStatusMap_[item] = TePOINTED;
00922                 else if (itemStatusMap_[item] == TeQUERIED)
00923                         itemStatusMap_[item] = TePOINTED_QUERIED;       
00924         }
00925 
00926         //-----------------------------------------------------------------------
00927         // Set the pointing status for the objects associated to the input items
00928         //-----------------------------------------------------------------------
00929         
00930         // Remove the pointing status for all the objects
00931         defaultVec.clear();
00932         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
00933         {
00934                 oid = mapIt->first;
00935                 if (objStatusMap_[oid] == TePOINTED)
00936                         defaultVec.push_back(oid);
00937                 else if (objStatusMap_[oid] == TePOINTED_QUERIED)
00938                         objStatusMap_[oid] = TeQUERIED;
00939         }
00940 
00941         for (i = 0; i < defaultVec.size(); ++i)
00942                 objStatusMap_.erase(defaultVec[i]);
00943 
00944         // Set the pointing status for the objects associated to the input items
00945         set<string> oidSet = getObjects(itemVec);
00946         set<string>::iterator setIt;
00947         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
00948         {
00949                 oid = *setIt;
00950                 if (objStatusMap_[oid] == TeDEFAULT)
00951                         objStatusMap_[oid] = TePOINTED;
00952                 else if (objStatusMap_[oid] == TeQUERIED)
00953                         objStatusMap_[oid] = TePOINTED_QUERIED; 
00954         }
00955 }

void TeAbstractTheme::setStatusForNewItemsQueried ( set< string > &  oidSet,
vector< string > &  uidVec 
) [virtual, inherited]

Definition at line 689 of file TeAbstractTheme.cpp.

References TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

00690 {
00691         unsigned int i;
00692         string oid, uid;
00693         vector<string> prevOidQVec;             // previous oids queried
00694         vector<string> notInOidSetVec;  // oid is not in oidSet
00695         vector<string> defaultVec;              // vector with oids or uids to be set as default
00696         map<string, int>::iterator mapIt;
00697         set<string>::iterator setIt;
00698 
00699         // Get the previous oids queried
00700         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
00701         {
00702                 oid = mapIt->first;
00703                 if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
00704                         prevOidQVec.push_back(mapIt->first);
00705         }
00706 
00707         // Check if the previous oids queried are in the oidSet; in positive case, remove
00708         // them from the oidSet; in negative case, put them in the vector notInOidSetVec
00709         for (i = 0; i < prevOidQVec.size(); ++i)
00710         {
00711                 oid = prevOidQVec[i];
00712                 if (oidSet.find(oid) != oidSet.end())                   
00713                         oidSet.erase(oid);                              // object is in the input oidSet
00714                 else
00715                         notInOidSetVec.push_back(oid);  // object is not in the input oidSet
00716         }
00717 
00718         // For the objects in oidSet, set the queried status for them
00719         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
00720         {
00721                 oid = *setIt;
00722                 if (objStatusMap_[oid] == TeDEFAULT)
00723                         objStatusMap_[oid] = TeQUERIED;
00724                 else if (objStatusMap_[oid] == TePOINTED)
00725                         objStatusMap_[oid] = TePOINTED_QUERIED;
00726         }
00727 
00728         // For the objects not in oidSet, insert it in oidSet, and remove their queried status
00729         for (i = 0; i < notInOidSetVec.size(); ++i)
00730         {
00731                 oid = notInOidSetVec[i];
00732                 if (objStatusMap_[oid] == TeQUERIED)
00733                         defaultVec.push_back(oid);
00734                 else if (objStatusMap_[oid] == TePOINTED_QUERIED)
00735                         objStatusMap_[oid] = TePOINTED;
00736                 
00737                 oidSet.insert(oid);
00738         }
00739 
00740         for (i = 0; i < defaultVec.size(); ++i)
00741                 objStatusMap_.erase(defaultVec[i]);
00742 
00743         // Remove the queried status for the uids that were previously queried
00744         defaultVec.clear();
00745         for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
00746         {
00747                 uid = mapIt->first;
00748                 if (itemStatusMap_[uid] == TeQUERIED)
00749                         defaultVec.push_back(uid);
00750                 else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
00751                         itemStatusMap_[uid] = TePOINTED;                        
00752         }
00753 
00754         for (i = 0; i < defaultVec.size(); ++i)
00755                 itemStatusMap_.erase(defaultVec[i]);
00756 
00757         // Set the queried status for the input uidVec
00758         for (i = 0; i < uidVec.size(); ++i)
00759         {
00760                 uid = uidVec[i];
00761                 if (itemStatusMap_[uid] == TeDEFAULT)
00762                         itemStatusMap_[uid] = TeQUERIED;
00763                 else if (itemStatusMap_[uid] == TePOINTED)
00764                         itemStatusMap_[uid] = TePOINTED_QUERIED;
00765         }
00766 }

void TeAbstractTheme::setStatusForNewObjectsPointed ( set< string > &  oidSet  )  [virtual, inherited]

Definition at line 768 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getItemVector(), TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

00769 {
00770         unsigned int i;
00771         string oid, uid;
00772         set<string> prevOidPointedSet;          // previous oids pointed
00773         set<string> objInInputOidSet;           // set containing objects in oidSet
00774         set<string> objNotInInputOidSet;        // set containing objects not in oidSet
00775         vector<string> defaultVec;                  // vector with oids or uids to be set as default
00776         vector<string> uidVec;                          // vector of uids
00777         map<string, int>::iterator mapIt;
00778         set<string>::iterator setIt;
00779 
00780         // Get the previous oids pointed
00781         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
00782         {
00783                 oid = mapIt->first;
00784                 if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
00785                         prevOidPointedSet.insert(mapIt->first);
00786         }
00787 
00788         // If the set of objects is empty, remove the pointed status of the previous oids and uids
00789         if (oidSet.empty())
00790         {
00791                 for (setIt = prevOidPointedSet.begin(); setIt != prevOidPointedSet.end(); ++setIt)
00792                 {
00793                         oid = *setIt;
00794                         if (objStatusMap_[oid] == TePOINTED)
00795                                 defaultVec.push_back(oid);
00796                         else if (objStatusMap_[oid] == TePOINTED_QUERIED)
00797                                 objStatusMap_[oid] = TeQUERIED;
00798 
00799                         oidSet.insert(oid);
00800                 }
00801 
00802                 for (i = 0; i < defaultVec.size(); ++i)
00803                         objStatusMap_.erase(defaultVec[i]);
00804 
00805                 defaultVec.clear();
00806 //              uidVec = getUidVec(prevOidPointedVec.begin(), prevOidPointedVec.end(), this); 
00807                 uidVec = getItemVector(prevOidPointedSet); 
00808                 for (i = 0; i < uidVec.size(); ++i)
00809                 {
00810                         uid = uidVec[i];
00811                         if (itemStatusMap_[uid] == TePOINTED)
00812                                 defaultVec.push_back(uid);
00813                         else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
00814                                 itemStatusMap_[uid] = TeQUERIED;
00815                 }
00816 
00817                 for (i = 0; i < defaultVec.size(); ++i)
00818                         itemStatusMap_.erase(defaultVec[i]);
00819 
00820                 return;
00821         }
00822 
00823         // Check if the previous oids pointed are in the oidSet; in positive case, put
00824         // them in objInOidSetVec; in negative case, put them in the objNotInOidSetVec
00825         for (setIt = prevOidPointedSet.begin(); setIt != prevOidPointedSet.end(); ++setIt)
00826         {
00827                 oid = *setIt;
00828                 if (oidSet.find(oid) != oidSet.end())
00829                         objInInputOidSet.insert(oid);           // object is in the input oidSet
00830                 else
00831                         objNotInInputOidSet.insert(oid);        // object is not in the input oidSet
00832         }
00833 
00834         // For the objects in oidSet, set the pointed status for them
00835         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
00836         {
00837                 oid = *setIt;
00838                 if (objStatusMap_[oid] == TeDEFAULT)
00839                         objStatusMap_[oid] = TePOINTED;
00840                 else if (objStatusMap_[oid] == TeQUERIED)
00841                         objStatusMap_[oid] = TePOINTED_QUERIED;
00842         }
00843 
00844         // For the objects not in oidSet, remove their pointed status
00845         defaultVec.clear();
00846         for (setIt = objNotInInputOidSet.begin(); setIt != objNotInInputOidSet.end(); ++setIt)
00847         {
00848                 oid = *setIt;
00849                 if (objStatusMap_[oid] == TePOINTED)
00850                         defaultVec.push_back(oid);
00851                 else if (objStatusMap_[oid] == TePOINTED_QUERIED)
00852                         objStatusMap_[oid] = TeQUERIED;
00853         }
00854 
00855         for (i = 0; i < defaultVec.size(); ++i)
00856                 objStatusMap_.erase(defaultVec[i]);
00857 
00858         // For the objects in oidSet, set the pointed status for their uids
00859         uidVec = getItemVector(oidSet);
00860         for (i = 0; i < uidVec.size(); ++i)
00861         {
00862                 uid = uidVec[i];
00863                 if (itemStatusMap_[uid] == TeDEFAULT)
00864                         itemStatusMap_[uid] = TePOINTED;
00865                 else if (itemStatusMap_[uid] == TeQUERIED)
00866                         itemStatusMap_[uid] = TePOINTED_QUERIED;
00867         }
00868 
00869         // For the objects not in oidSet, remove the pointed status for their uids
00870         defaultVec.clear();
00871         uidVec = getItemVector(objNotInInputOidSet);
00872         for (i = 0; i < uidVec.size(); ++i)
00873         {
00874                 uid = uidVec[i];
00875                 if (itemStatusMap_[uid] == TePOINTED)
00876                         defaultVec.push_back(uid);
00877                 else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
00878                         itemStatusMap_[uid] = TeQUERIED;
00879         }
00880 
00881         for (i = 0; i < defaultVec.size(); ++i)
00882                 itemStatusMap_.erase(defaultVec[i]);
00883 
00884         // Insert in the oidSet the objects that are not in the input oidSet
00885         for (setIt = objNotInInputOidSet.begin(); setIt != objNotInInputOidSet.end(); ++setIt)
00886                 oidSet.insert(*setIt);
00887 
00888         // Remove from the oidSet the objects that were in the input oidSet
00889         for (setIt = objInInputOidSet.begin(); setIt != objInInputOidSet.end(); ++setIt)
00890                 oidSet.erase(*setIt);
00891 }

void TeAbstractTheme::setStatusForObjectsAddedByPointing ( set< string > &  oidSet  )  [virtual, inherited]

Definition at line 959 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getItemVector(), TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

00960 {
00961         if (oidSet.empty())
00962                 return;
00963 
00964         unsigned int i;
00965         string oid, uid;
00966         vector<string> prevOidPointedVec;       // previous oids pointed
00967         vector<string> uidVec;                          // vector of uids
00968         map<string, int>::iterator mapIt;
00969         set<string>::iterator setIt;
00970 
00971         // Get the previous oids pointed
00972         for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
00973         {
00974                 oid = mapIt->first;
00975                 if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
00976                         prevOidPointedVec.push_back(mapIt->first);
00977         }
00978 
00979         // If there is any object in the oidSet that is already in the previous oids pointed,
00980         // remove it from the oidSet
00981         for (i = 0; i < prevOidPointedVec.size(); ++i)
00982         {
00983                 oid = prevOidPointedVec[i];
00984                 if (oidSet.find(prevOidPointedVec[i]) != oidSet.end())
00985                         oidSet.erase(oid);
00986         }
00987 
00988         // Set the pointed status for the objects added by pointing
00989         for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
00990         {
00991                 oid = *setIt;
00992                 if (objStatusMap_[oid] == TeDEFAULT)
00993                         objStatusMap_[oid] = TePOINTED;
00994                 if (objStatusMap_[oid] == TeQUERIED)
00995                         objStatusMap_[oid] = TePOINTED_QUERIED;
00996         }
00997 
00998         // Set the pointed status for the uids of the objects added by pointing
00999         uidVec = getItemVector(oidSet);
01000         for (i = 0; i < uidVec.size(); ++i)
01001         {
01002                 uid = uidVec[i];
01003                 if (itemStatusMap_[uid] == TeDEFAULT)
01004                         itemStatusMap_[uid] = TePOINTED;
01005                 else if (itemStatusMap_[uid] == TeQUERIED)
01006                         itemStatusMap_[uid] = TePOINTED_QUERIED;
01007         }
01008 }

void TeAbstractTheme::setStatusForObjectToggled ( string  oid  )  [virtual, inherited]

Definition at line 591 of file TeAbstractTheme.cpp.

References TeAbstractTheme::getItemVector(), TeAbstractTheme::itemStatusMap_, TeAbstractTheme::objStatusMap_, TeDEFAULT, TePOINTED, TePOINTED_QUERIED, and TeQUERIED.

00592 {
00593         string uid;
00594 
00595         int& oidStatus = objStatusMap_[oid];
00596         if (oidStatus == TeDEFAULT)
00597                 oidStatus = TePOINTED;
00598         else if (oidStatus == TePOINTED)
00599                 oidStatus = TeDEFAULT;
00600         else if (oidStatus == TeQUERIED)
00601                 oidStatus = TePOINTED_QUERIED;
00602         else if (oidStatus == TePOINTED_QUERIED)
00603                 oidStatus = TeQUERIED;
00604 
00605         set<string> oidSet;
00606         oidSet.insert(oid);
00607         vector<string> uidVec = getItemVector(oidSet);
00608         for (unsigned int i = 0; i < uidVec.size(); ++i)
00609         {
00610                 uid = uidVec[i];
00611                 int& uidStatus = itemStatusMap_[uidVec[i]];
00612                 if (uidStatus == TeDEFAULT)
00613                 {
00614                         if (oidStatus == TePOINTED || oidStatus == TePOINTED_QUERIED)
00615                                 uidStatus = TePOINTED;
00616                 }
00617                 else if (uidStatus == TePOINTED)
00618                 {
00619                         if (oidStatus == TeDEFAULT || oidStatus == TeQUERIED)
00620                                 itemStatusMap_.erase(uid);
00621                 }
00622                 else if (uidStatus == TeQUERIED)
00623                 {
00624                         if (oidStatus == TePOINTED || oidStatus == TePOINTED_QUERIED)
00625                                 uidStatus = TePOINTED_QUERIED;
00626                 }
00627                 else if (uidStatus == TePOINTED_QUERIED)
00628                 {
00629                         if (oidStatus == TeDEFAULT || oidStatus == TeQUERIED)
00630                                 uidStatus = TeQUERIED;
00631                 }
00632         }
00633         
00634         // Save the status id of the object
00635         if (oidStatus == TeDEFAULT)
00636                 objStatusMap_.erase(oid);
00637 }

virtual void TeAbstractTheme::setThemeBox ( const TeBox box  )  [inline, virtual, inherited]

Definition at line 492 of file TeAbstractTheme.h.

Referenced by TeDatabasePortal::getTheme(), TeFileTheme::retrieveDataFromFile(), TeFileTheme::setDataDriver(), TeFileTheme::setRasterFile(), and TeCreateThemeFromTheme().

00493         {       themeBox_ = box; }

void TeTheme::setUsingCollection ( const bool usingCollection  ) 

Definition at line 2563 of file TeTheme.cpp.

References useCollection_.

02564 {
02565     useCollection_ = usingCollection;
02566 }

virtual void TeAbstractTheme::setVisualDefault ( TeVisual visual,
TeGeomRep  rep 
) [inline, virtual, inherited]

Examples:
createTheme.cpp.

Definition at line 387 of file TeAbstractTheme.h.

References TeLegendEntry::setVisual().

Referenced by main().

00388         { defaultLegend_.setVisual(visual, rep); }

virtual void TeAbstractTheme::setVisualOutOfCollection ( TeVisual visual,
TeGeomRep  rep 
) [inline, virtual, inherited]

Definition at line 400 of file TeAbstractTheme.h.

References TeLegendEntry::setVisual().

00401         { outOfCollectionLegend_.setVisual(visual, rep); }

virtual void TeAbstractTheme::setVisualPointing ( TeVisual visual,
TeGeomRep  rep 
) [inline, virtual, inherited]

Definition at line 425 of file TeAbstractTheme.h.

References TeLegendEntry::setVisual().

00426         { pointingLegend_.setVisual(visual, rep); }

virtual void TeAbstractTheme::setVisualQuery ( TeVisual visual,
TeGeomRep  rep 
) [inline, virtual, inherited]

Definition at line 437 of file TeAbstractTheme.h.

References TeLegendEntry::setVisual().

00438         { queryLegend_.setVisual(visual, rep); }

virtual void TeAbstractTheme::setVisualQueryAndPointing ( TeVisual visual,
TeGeomRep  rep 
) [inline, virtual, inherited]

Definition at line 457 of file TeAbstractTheme.h.

References TeLegendEntry::setVisual().

00458         { queryAndPointingLegend_.setVisual(visual, rep); }

virtual void TeAbstractTheme::setVisualWithoutDataConnection ( TeVisual visual,
TeGeomRep  rep 
) [inline, virtual, inherited]

Definition at line 413 of file TeAbstractTheme.h.

References TeLegendEntry::setVisual().

00414         { withoutDataConnectionLegend_.setVisual(visual, rep); }

virtual void TeViewNode::sort (  )  [inline, virtual, inherited]

Reimplemented in TeViewTree.

Definition at line 237 of file TeViewNode.h.

Referenced by TeView::sort().

00237 {}

virtual void TeAbstractTheme::spatialRelation ( TeSpatialRelation  s  )  [inline, virtual, inherited]

Definition at line 242 of file TeAbstractTheme.h.

virtual TeSpatialRelation TeAbstractTheme::spatialRelation (  )  [inline, virtual, inherited]

Definition at line 239 of file TeAbstractTheme.h.

Referenced by sqlWhereRestrictions().

00239 { return spatialRelation_;}

virtual void TeAbstractTheme::spatialRest ( const string s  )  [inline, virtual, inherited]

Definition at line 236 of file TeAbstractTheme.h.

00236 { generateSpatialRest_ = s; };

virtual string TeAbstractTheme::spatialRest (  )  [inline, virtual, inherited]

Definition at line 233 of file TeAbstractTheme.h.

Referenced by TeDatabasePortal::getTheme(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeCopyDatabase(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00233 { return generateSpatialRest_; }

virtual TeAttributeList TeTheme::sqlAttList (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 249 of file TeTheme.h.

Referenced by TeAppTheme::getTableIndexFromField(), TeQtGrid::init(), TeQtGrid::initPortal(), TeExternalTheme::loadAttrLists(), TeExternalTheme::sqlAttList(), and TeGeoOpAggregation().

00249 { return sqlAttList_;}

virtual string TeTheme::sqlFrom (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 264 of file TeTheme.h.

Referenced by generateCountLegends(), getItemVector(), getNumberOfObjects(), getObjects(), locateCell(), locateLine(), locatePoint(), locatePolygon(), locatePolygonSet(), populateCollection(), populateCollectionAux(), TeExternalTheme::sqlFrom(), and TeGeoOpAggregation().

00264 { return sqlFrom_;}

string TeTheme::sqlGridFrom ( const string geomTable = ""  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 1261 of file TeTheme.cpp.

References loadTablesJoin(), and sqlGridFrom_.

Referenced by buildGrouping(), TeQtGLWidget::getValues(), TeQuerierDBStr1::initGeomPortal(), TeQuerierDBStr1::initPortal(), plotPieBars(), saveLegendInCollection(), TeExternalTheme::saveLegendInCollection(), TeQtGLWidget::selectFromHexaedro(), TeExternalTheme::sqlGridFrom(), and TeCopyThemeToLayer().

01262 {
01263         if(geomTable.empty())
01264                 return sqlGridFrom_;
01265 
01266         string result;
01267         loadTablesJoin(geomTable);
01268         result = sqlGridFrom_;
01269         loadTablesJoin();
01270         return result;
01271 }

virtual string TeTheme::sqlGridJoin (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 139 of file TeTheme.h.

Referenced by TeQtGrid::init(), and TeExternalTheme::sqlGridJoin().

00139 { return sqlGridJoin_; }

virtual string TeTheme::sqlJoin (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 261 of file TeTheme.h.

Referenced by TeExternalTheme::sqlJoin().

00261 { return sqlJoin_;}

virtual TeAttributeList TeTheme::sqlNumAttList (  )  [inline, virtual]

Reimplemented in TeExternalTheme.

Definition at line 255 of file TeTheme.h.

Referenced by TeExternalTheme::loadAttrLists(), and TeExternalTheme::sqlNumAttList().

00255 { return sqlNumAttList_;}

virtual string& TeTheme::sqlWhere (  )  [inline, virtual]

Definition at line 267 of file TeTheme.h.

Referenced by populateCollection().

00267 { return sqlWhere_;}

string TeTheme::sqlWhereRestrictions ( TeRepresentation rep = 0  )  [virtual]

Reimplemented in TeExternalTheme.

Definition at line 176 of file TeTheme.cpp.

References TeAbstractTheme::attributeRest(), TeAbstractTheme::boxRestriction(), TeLayer::database(), db, TeRepresentation::geomRep_, TeAbstractTheme::geomRepRestriction(), TeAbstractTheme::geomRestriction(), TeDatabase::getSQLBoxWhere(), TeAbstractTheme::hasAttrRest(), TeAbstractTheme::hasSpatialRest(), TeAbstractTheme::hasTemporalRest(), initParse(), TeSingleton< TePrecision >::instance(), layer(), TePrecision::setPrecision(), TeAbstractTheme::spatialRelation(), TeDatabase::spatialRelation(), TeLayer::tableName(), TeRepresentation::tableName_, TeGetPrecision(), TeAbstractTheme::temporalRest(), TeLayer::vectRepres(), and yyparse().

Referenced by TeTemporalSeries::buildFrameIntervals(), TeQuerierDBStr1::initGeomPortal(), and TeQuerierDBStr1::initPortal().

00177 {
00178         TeKeys objs;
00179         string whereClause= " 1 = 1 ";
00180         TeDatabase* db = layer()->database();
00181 
00182         // load the first representation
00183         if(!rep)
00184                 rep = (layer()->vectRepres())[0];
00185 
00186         // temporal restrictions are applied only to temporal tables
00187         if(hasTemporalRest())
00188         {
00189                 string result = "";
00190 
00191                 initParse(temporalRest(), db);
00192 
00193                 if(!yyparse(result))  //0: accept  1: reject
00194                         whereClause += " AND "+ result;
00195                 else
00196                         return "";
00197         }
00198 
00199         // we should test if the attribute restriction is valid
00200         if (hasAttrRest())
00201                 whereClause += " AND "+ attributeRest();
00202 
00203         // spatial restriction with other geometry representation
00204         if (hasSpatialRest() && rep)
00205         {
00206                 if(boxRestriction().isValid())
00207                 {
00208             TeBox b =  boxRestriction();
00209             TeGeomRep gRep = rep->geomRep_;
00210 //                      whereClause += " AND "+ db->getSQLBoxWhere(boxRestriction(), rep->geomRep_);
00211                         string geomTableRest = layer()->tableName(geomRepRestriction());
00212                         whereClause += " AND "+ db->getSQLBoxWhere(b, gRep, geomTableRest);
00213                 }
00214                 else if(geomRestriction())
00215                 {
00216                         string geomTableRest = layer()->tableName(geomRepRestriction());
00217                         TePrecision::instance().setPrecision(TeGetPrecision(layer()->projection()));
00218 
00219                         if(db->spatialRelation(geomTableRest, geomRepRestriction(), geomRestriction(),
00220                                                            objs, spatialRelation()))
00221                         {
00222                                 string obs;
00223                                 for(unsigned int i=0; i<objs.size(); i++)
00224                                 {
00225                                         if(i!=0)
00226                                                 obs += ",";
00227                                         obs += "'"+ objs[i] +"'";
00228                                 }
00229 
00230                                 whereClause += " AND "+ rep->tableName_ +".object_id IN ("+ obs +")";
00231                         }
00232                 }
00233         }
00234         return whereClause;
00235 }

virtual void TeViewNode::swap ( unsigned int  ,
unsigned int   
) [inline, virtual, inherited]

Reimplemented in TeViewTree.

Definition at line 225 of file TeViewNode.h.

00225 {}

virtual void TeAbstractTheme::temporalRest ( const string t  )  [inline, virtual, inherited]

Definition at line 227 of file TeAbstractTheme.h.

00227 { generateTemporalRest_ = t; };

virtual string TeAbstractTheme::temporalRest (  )  [inline, virtual, inherited]

Definition at line 224 of file TeAbstractTheme.h.

Referenced by TeDatabasePortal::getTheme(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), sqlWhereRestrictions(), TeCopyDatabase(), TeFirebird::updateTheme(), and TeDatabase::updateTheme().

00224 { return generateTemporalRest_; }

int TeAbstractTheme::temporaryRepresentation ( void   )  [inline, inherited]

Definition at line 158 of file TeAbstractTheme.h.

00158 { return temporaryRepresentation_;}

void TeAbstractTheme::temporaryRepresentation ( int  rep  )  [inline, inherited]

Definition at line 156 of file TeAbstractTheme.h.

void TeAbstractTheme::temporaryVisibility ( short  state  )  [inline, inherited]

Definition at line 154 of file TeAbstractTheme.h.

00154 { temporaryVisibility_=state;}

short TeAbstractTheme::temporaryVisibility ( void   )  [inline, inherited]

Definition at line 152 of file TeAbstractTheme.h.

00152 { return temporaryVisibility_;}

virtual void TeViewNode::type ( const int &  t  )  [inline, virtual, inherited]

Definition at line 208 of file TeViewNode.h.

virtual int TeViewNode::type (  )  [inline, virtual, inherited]

Definition at line 206 of file TeViewNode.h.

Referenced by addThemeTable(), TeViewTree::assertsPriorities(), TeViewTree::box(), TeViewTree::clear(), TeQtGrid::eventFilter(), fillThemeCombo(), TeViewTree::find(), findNode(), TeView::get(), TeDatabasePortal::getTheme(), TeQtGLWidget::getValues(), TeDatabasePortal::getViewTree(), TeQtGrid::init(), TeSQLite::insertTheme(), TePostgreSQL::insertTheme(), TeOCIOracle::insertTheme(), TeMySQL::insertTheme(), TeFirebird::insertTheme(), TeSqlServer::insertTheme(), TeOracle::insertTheme(), TeAdo::insertTheme(), TeSQLite::insertView(), TePostgreSQL::insertView(), TeOCIOracle::insertView(), TeMySQL::insertView(), TeFirebird::insertView(), TeOracle::insertView(), TeAdo::insertView(), TeSQLite::insertViewTree(), TePostgreSQL::insertViewTree(), TeOCIOracle::insertViewTree(), TeMySQL::insertViewTree(), TeFirebird::insertViewTree(), TeOracle::insertViewTree(), TeAdo::insertViewTree(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeViewTree::moveBottom(), TeViewTree::moveTop(), TeViewTreeRevIterator::next(), TeViewTreeIterator::nex