| 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/TeFileTheme.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 *************************************************************************************/
    00028 #ifndef  __TERRALIB_INTERNAL_FILETHEME_H
    00029 #define  __TERRALIB_INTERNAL_FILETHEME_H
    00030
    00031 #include "TeDefines.h"
    00032
    00033 // STL's include files
    00034 #include <map>
    00035 #include <vector>
    00036 #include <string>
    00037
    00038 // TerraLib's include files and forward declarations
    00039 #include "TeAbstractTheme.h"
    00040
    00041 class TeDatabase;
    00042 class TeSTElementSet;
    00043 class TeProjection;
    00044 class TeGeoDataDriver;
    00045 class TeRaster;
    00046
    00047 class TL_DLL TeFileTheme : public TeAbstractTheme
    00048 {
    00049 protected:
    00050            TeSTElementSet*                  data_;                           // data is kept internally in a TeSTElementSet
    00051            std::string                                 fileName_;            // location of the file
    00052            TeDatabase*                                 localDb_;             // a pointer to the database that stores the theme
    00053            unsigned int                     numObjects_;          // number of objects that the theme has access to
    00054            TeProjection*                    projection_;          // spatial reference of the objects in the file
    00055            TeGeoDataDriver*      dataDriver_;          // a pointer to decoder to get an specific data
    00056            TeRaster*                        raster_;              // a pointer to a raster file
    00057
    00058 public:
    00059
    00061            TeFileTheme(const std::string& name = "", TeViewNode* parent = 0, int view = 0, int id = 0);
    00062
    00064            TeFileTheme(const std::string& name, TeGeoDataDriver* dataDriver, TeDatabase* localDb, TeViewNode* parent = 0, int view = 0);
    00065
    00067            TeFileTheme(const TeFileTheme& other);
    00068
    00070            TeFileTheme& operator=(TeFileTheme& rhs);
    00071
    00073            ~TeFileTheme();
    00074
    00076            virtual TeViewNode* clone();
    00077
    00079            void setRasterFile(const std::string& fileName);
    00080
    00082            TeRaster* getRasterFile();
    00083
    00085            void setDataDriver(TeGeoDataDriver* dataDriver);
    00086
    00088            TeGeoDataDriver* getDataDriver();
    00089
    00091     TeSTElementSet* getData();
    00092
    00094            void setFileName(const std::string& fileName);
    00095
    00097            std::string getFileName();
    00098
    00100            void setLocalDatabase(TeDatabase* db);
    00101
    00103            TeDatabase* getLocalDatabase();
    00104
    00105 // --- Methods responsible to the persistence of this kind of theme
    00106
    00108            static bool createFileThemeTable(TeDatabase* db);
    00109
    00111            bool retrieveMetadataFromFile();
    00112
    00114            bool retrieveDataFromFile();
    00115
    00117            void clearData();
    00118
    00119 //--- Methods that reimplement the interface defined by the abstract theme
    00120
    00122            TeProjection* getThemeProjection();
    00123
    00125            void setThemeProjection(TeProjection* proj);
    00126
    00128            unsigned int getNumberOfObjects();
    00129
    00131            void setNumberOfObjects(unsigned int);
    00132
    00134            bool loadMetadata(TeDatabase*);
    00135
    00137            bool saveMetadata(TeDatabase* );
    00138
    00140            bool eraseMetadata(TeDatabase* );
    00141
    00143            bool save();
    00144
    00146            bool buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll, vector<double>* dValuesVec = 0);
    00147
    00149            bool buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec);
    00150
    00152            bool saveGrouping(TeSelectedObjects selectedObjects = TeAll);
    00153
    00155            bool deleteGrouping();
    00156
    00158            void setLegendsForObjects();
    00159
    00161            void setOwnLegendsForObjects();
    00162
    00167            bool locatePolygon(TeCoord2D &pt, TePolygon &polygon, const double& tol);
    00168
    00169            bool locatePolygonSet(TeCoord2D &pt, double tol, TePolygonSet &polygons);
    00170
    00171            bool locateLine(TeCoord2D &pt, TeLine2D &line, const double& tol);
    00172
    00173            bool locatePoint(TeCoord2D &pt, TePoint &point, const double& tol);
    00174
    00175            bool locateCell(TeCoord2D &pt, TeCell &c, const double& tol);
    00177
    00179            set<string> getObjects(TeSelectedObjects selectedObjects = TeAll);
    00180
    00182            set<string> getObjects(const vector<string>& itemVec);
    00183
    00185            vector<string> getItemVector(TeSelectedObjects selectedObjects);
    00186
    00188            vector<string> getItemVector(const set<string>& oidSet);
    00189
    00190 protected:
    00191
    00193            virtual bool beforeCopyThemeTo(TeAbstractTheme* absThemeCopy, TeDatabase* outputDatabase);
    00194 };
    00195
    00196
    00198
    00201 class TeFileThemeFactory : public TeViewNodeFactory
    00202 {
    00203 public:
    00205            TeFileThemeFactory() : TeViewNodeFactory((int)TeFILETHEME)
    00206            {}
    00207
    00209            TeViewNode* build(TeViewNodeParams* params)
    00210            {
    00211                       TeViewNodeParams auxParams = *params;
    00212                       return new TeFileTheme(auxParams.name_, auxParams.myParent_, auxParams.viewId_, auxParams.id_);
    00213            }
    00214
    00215            TeViewNode* build()
    00216            {
    00217                       return new TeFileTheme();
    00218            }
    00219 };
    00220
    00221 namespace
    00222 {
    00223   static TeFileThemeFactory fileThemeFactory;
    00224 };
    00225
    00226
    00227 #endif     // __TERRALIB_INTERNAL_FILETHEME_H
    00228

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines