| TerraLib 4.1

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

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeTheme.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00026 #ifndef  __TERRALIB_INTERNAL_THEME_H
    00027 #define  __TERRALIB_INTERNAL_THEME_H
    00028
    00029 #include "TeAbstractTheme.h"
    00030 #include "TeLayer.h"
    00031
    00032 using namespace std;
    00033
    00035
    00054 class TL_DLL TeTheme: public TeAbstractTheme
    00055 {
    00056 public:
    00058     TeTheme( const string& name="", TeLayer* layer=0, TeViewNode* parent=0, const int& view=0, const int& id=0);
    00059
    00061            TeTheme(const TeViewNodeParams& params);
    00062
    00064            TeTheme (const TeTheme& other);
    00065
    00067            ~TeTheme ();
    00068
    00070            TeTheme& operator= (const TeTheme& other);
    00071
    00073            virtual TeViewNode* clone();
    00074
    00079
    00080            virtual int layerId()
    00081            {          return layerId_; }
    00082
    00084            virtual void layerId(int i)
    00085            {          layerId_ = i; }
    00086
    00088
    00091            virtual void layer(TeLayer* layer);
    00092
    00094            virtual TeLayer* layer() { return layer_; }
    00095
    00097            virtual TeProjection* getThemeProjection();
    00099
    00101            virtual void setSpatialRest(TeBox& box, TeGeomRep rep = TeGEOMETRYNONE, TeSpatialRelation relation = TeWITHIN);
    00102
    00104            virtual void setSpatialRest(TeGeometry* geom, TeGeomRep rep = TeGEOMETRYNONE, TeSpatialRelation relation = TeWITHIN);
    00105
    00107            virtual string sqlWhereRestrictions(TeRepresentation* rep=0);
    00108
    00110     virtual void createRasterVisual(TeRaster* rst=0);
    00111
    00116
    00117            virtual string        collectionTable() { return collectionTable_; }
    00118
    00120            virtual void collectionTable(const string& s) { collectionTable_ = s; }
    00121
    00123            virtual string collectionAuxTable() { return collectionAuxTable_; }
    00124
    00126            virtual void collectionAuxTable(string name) { collectionAuxTable_ = name; }
    00127
    00129            virtual bool generateLabelPositions(const std::string& objectId = "");
    00130
    00132            virtual void loadTablesJoin(const string& geomTable="");
    00133
    00139            virtual string sqlGridJoin() { return sqlGridJoin_; }
    00140
    00144            virtual string sqlGridFrom(const string& geomTable="");
    00145
    00147            virtual bool buildCollection(std::string objectId = "", const bool& sincronize = true);
    00148
    00150            virtual bool createCollectionAuxTable();
    00151
    00153            virtual bool populateCollectionAux(std::string objectId = "");
    00155
    00157            virtual bool isUpdated();
    00158
    00163
    00164            virtual bool buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
    00165                                      vector<double>* dValuesVec = 0);
    00166
    00168            virtual bool buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec);
    00169
    00171            virtual bool saveGrouping(TeSelectedObjects selectedObjects = TeAll);
    00172
    00174            virtual bool saveLegendInCollection(TeSelectedObjects selectedObjects = TeAll, std::string objectId = "");
    00175
    00177            virtual void setLegendsForObjects();
    00178
    00180            virtual void setOwnLegendsForObjects();
    00181
    00183            virtual bool deleteGrouping();
    00185
    00191
    00193            virtual bool loadThemeTables();
    00194
    00196            virtual bool addThemeTable (TeTable& table);
    00197
    00199            virtual void addThemeTable (string tableName);
    00200
    00202            virtual bool isThemeTable(int tableId);
    00203
    00205            virtual bool isThemeTable(string tableName);
    00206
    00208            virtual TeAttrTableVector& attrTables()
    00209            {          return attTableVector_; }
    00210
    00212            virtual bool setAttTables(TeAttrTableVector& attrs);
    00213
    00215            virtual bool getAttTables(TeAttrTableVector& attrs, TeAttrTableType attType = TeAllAttrTypes);
    00216
    00218            virtual bool getTable(TeTable& table, const string tableName);
    00219
    00221            virtual void clearAttTableVector()
    00222            {          attTableVector_.clear();         }
    00223
    00225            /*
    00226                       \note A theme supports only one temporal attribute table
    00227            */
    00228            virtual bool getTemporalTable(TeTable& table);
    00229
    00231            virtual bool removeThemeTable(unsigned int index);
    00232
    00234            virtual string getTableName(const string& attrName);
    00235
    00240            virtual string getAttribute(unsigned int i);
    00241
    00246            virtual bool isIndex(unsigned int i);
    00247
    00249            virtual TeAttributeList sqlAttList() { return sqlAttList_;}
    00250
    00252            virtual void clearAttList() {sqlAttList_.clear();}
    00253
    00255            virtual TeAttributeList sqlNumAttList() { return sqlNumAttList_;}
    00256
    00258            virtual void clearNumAttList() {sqlNumAttList_.clear();}
    00259
    00261            virtual string        sqlJoin() { return sqlJoin_;}
    00262
    00264            virtual string        sqlFrom() { return sqlFrom_;}
    00265
    00267            virtual string&       sqlWhere() { return sqlWhere_;}
    00268
    00270            virtual vector<string>&          aliasVector() { return aliasVector_; }
    00271
    00273            virtual void loadAliasVector();
    00274
    00276            /*
    00277                       \note All attributes are stored into sqlAttList_ and numeric attributes are stored into sqlNumAttList_.
    00278            */
    00279            virtual void loadAttrLists();
    00281
    00283            /*
    00284                       \note This functions is being kept for compatibility reasons with derived
    00285                       classes. IT SHOULD NOT BE USED BY APPLICATION USING ONLY THE BASIC CLASS.
    00286            */
    00287            virtual void updateThemeBox() {}
    00288
    00290            /*
    00291                       \note This functions is being kept for compatibility reasons with derived
    00292                       classes. IT SHOULD NOT BE USED BY APPLICATION USING ONLY THE BASIC CLASS.
    00293            */
    00294            virtual void updateThemeBox(const TeBox& /*box*/) {}
    00296
    00301            virtual bool locatePolygon                  (TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0);
    00302            virtual bool locatePolygonSet   (TeCoord2D &pt, double tol, TePolygonSet &polygons);
    00303            virtual bool locateLine                     (TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0);
    00304            virtual bool locatePoint         (TeCoord2D &pt, TePoint &point, const double& tol = 0.0);
    00305            virtual bool locateCell                     (TeCoord2D &pt, TeCell &c, const double& tol = 0.0);
    00307
    00309            virtual set<string> getObjects(TeSelectedObjects selectedObjects = TeAll);
    00310
    00312            virtual set<string> getObjects(const vector<string>& itemVec);
    00313
    00315            virtual vector<string> getItemVector(TeSelectedObjects selectedObjects);
    00316
    00318            virtual vector<string> getItemVector(const set<string>& oidSet);
    00319
    00321            virtual bool hasObjectsWithoutGeometries(TeGeomRep geomRep);
    00322
    00324            virtual bool removeObjectsWithoutGeometries(TeGeomRep geomRep);
    00325
    00327            virtual bool save();
    00328
    00330            virtual unsigned int getNumberOfObjects();
    00331
    00333            virtual bool saveMetadata(TeDatabase*) { return true; }
    00334
    00336            void setUsingCollection(const bool& usingCollection);
    00337
    00338 protected:
    00339
    00341            virtual bool createCollectionAuxTable(TeDatabase* db);
    00342
    00344            virtual bool buildGrouping(TeDatabase* db, const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
    00345                                              vector<double>* dValuesVec = 0);
    00346
    00348            virtual bool buildGrouping(TeDatabase* db, const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec);
    00349
    00351            virtual bool saveGrouping(TeDatabase* db, TeSelectedObjects selectedObjects = TeAll);
    00352
    00354            virtual bool saveLegendInCollection(TeDatabase* db, TeSelectedObjects selectedObjects = TeAll, std::string objectId = "");
    00355
    00357            virtual void loadThemeTablesJoin();
    00358
    00360            virtual bool populateCollection(std::string objectId = "", const bool& sincronize = true);
    00361
    00363            TeAttrTableVector     attTableVector_;
    00364
    00366            TeAttributeList       sqlAttList_;
    00367
    00369            TeAttributeList       sqlNumAttList_;
    00370
    00372            TeLayer*   layer_;
    00373
    00375            int                              layerId_;
    00376
    00377            // collection table name
    00378            string                collectionTable_;
    00379            string                collectionAuxTable_;
    00380
    00381     bool useCollection_;
    00382
    00383            // ----------------- theme tables information -----------------
    00384
    00386            string     sqlFrom_;
    00387
    00389            string     sqlJoin_;
    00390
    00392            string sqlWhere_;
    00393
    00395            string     sqlGridFrom_;
    00396
    00398            string     sqlGridJoin_;
    00399
    00401            vector<string>        aliasVector_;
    00402
    00404            virtual bool loadMetadata(TeDatabase* ) { return true; }
    00405
    00407            virtual bool eraseMetadata(TeDatabase* ) { return true; }
    00408
    00410            virtual bool beforeCopyThemeTo(TeAbstractTheme* absThemeCopy, TeDatabase* outputDatabase);
    00411
    00413            virtual bool afterCopyThemeTo(TeAbstractTheme* absThemeCopy, TeDatabase* outputDatabase);
    00414 };
    00415
    00416
    00418
    00425 class TL_DLL TeThemeFactory : public TeViewNodeFactory
    00426 {
    00427 public:
    00429            TeThemeFactory() : TeViewNodeFactory((int)TeTHEME)
    00430            {}
    00431
    00433            TeViewNode* build(TeViewNodeParams* params)
    00434            {
    00435                       TeViewNodeParams auxParams = *params;
    00436                       return new TeTheme(auxParams);
    00437            }
    00438
    00439            TeViewNode* build()
    00440            {
    00441                       return new TeTheme();
    00442            }
    00443 };
    00444
    00445
    00459 #endif
    00460

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines