| 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/TeAbstractTheme.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_ABSTRACT_THEME_H
    00027 #define  __TERRALIB_INTERNAL_ABSTRACT_THEME_H
    00028
    00029 #include "TeDefines.h"
    00030 #include "TeLegendEntry.h"
    00031 #include "TeGeometry.h"
    00032 #include "TeViewNode.h"
    00033 #include "TeAttribute.h"
    00034
    00035 class TeRasterTransform;
    00036 class TeRaster;
    00037 class TeDatabase;
    00038 class TeView;
    00039 struct TeRepresentation;
    00040
    00041 #include <string>
    00042 #include <set>
    00043
    00045
    00049 struct TL_DLL TeGrouping
    00050 {
    00052            TeAttributeRep        groupAttribute_;
    00053
    00055            string     groupNormAttribute_;
    00056
    00058            TeGroupingMode        groupMode_;
    00059
    00061            int        groupNumSlices_;
    00062
    00064            int        groupPrecision_;
    00065
    00067            double     groupStdDev_;
    00068
    00070            string     groupFunction_;
    00071
    00073            bool       groupNullAttr_;
    00074
    00076            double groupMinVal_;
    00077
    00079            double groupMaxVal_;
    00080
    00082            TeChronon groupChronon_;
    00083
    00085            TeGrouping(TeAttributeRep att=TeAttributeRep(), const string& normAttr="",
    00086                                             TeGroupingMode gMode=TeNoGrouping, int numSlice=0, int gPrecision=6,
    00087                                             double     gStDev=1.0, const string& func="", TeChronon gChronon = TeNOCHRONON):
    00088                                  groupAttribute_(att),
    00089                                  groupNormAttribute_(normAttr),
    00090                                  groupMode_(gMode),
    00091                                  groupNumSlices_(numSlice),
    00092                                  groupPrecision_(gPrecision),
    00093                                  groupStdDev_(gStDev),
    00094                                  groupFunction_(func),
    00095                                  groupNullAttr_(false),
    00096                                  groupMinVal_(TeMAXFLOAT),
    00097                                  groupMaxVal_(TeMINFLOAT),
    00098                                  groupChronon_(gChronon)
    00099                                  {}
    00100
    00102            TeGrouping(const TeGrouping& other)
    00103            {
    00104                       groupAttribute_                  = other.groupAttribute_;
    00105                       groupNormAttribute_   = other.groupNormAttribute_;
    00106                       groupMode_                       = other.groupMode_;
    00107                       groupNumSlices_                  = other.groupNumSlices_;
    00108                       groupPrecision_                  = other.groupPrecision_;
    00109                       groupStdDev_                     = other.groupStdDev_;
    00110                       groupFunction_                   = other.groupFunction_;
    00111                       groupNullAttr_                   = other.groupNullAttr_;
    00112                       groupMinVal_                     = other.groupMinVal_;
    00113                       groupMaxVal_                     = other.groupMaxVal_;
    00114                       groupChronon_                               = other.groupChronon_;
    00115            }
    00116
    00118            ~TeGrouping() {}
    00119
    00121            TeGrouping& operator= (const TeGrouping& other)
    00122            {
    00123                       if ( this != &other )
    00124                       {
    00125                                  groupAttribute_                  = other.groupAttribute_;
    00126                                  groupNormAttribute_   = other.groupNormAttribute_;
    00127                                  groupMode_                       = other.groupMode_;
    00128                                  groupNumSlices_                  = other.groupNumSlices_;
    00129                                  groupPrecision_                  = other.groupPrecision_;
    00130                                  groupStdDev_                     = other.groupStdDev_;
    00131                                  groupFunction_                   = other.groupFunction_;
    00132                                  groupNullAttr_                   = other.groupNullAttr_;
    00133                                  groupNullAttr_                   = other.groupNullAttr_;
    00134                                  groupMinVal_                     = other.groupMinVal_;
    00135                                  groupMaxVal_                     = other.groupMaxVal_;
    00136                                  groupChronon_                    = other.groupChronon_;
    00137                       }
    00138                       return *this;
    00139            }
    00140 };
    00141
    00142 using namespace std;
    00143
    00144
    00146 class TL_DLL TeAbstractTheme: public TeViewNode
    00147 {
    00148
    00149            friend class TeDatabase;
    00150 public :
    00152            short temporaryVisibility(void) { return temporaryVisibility_;}
    00154            void temporaryVisibility(short state) { temporaryVisibility_=state;}
    00156            void temporaryRepresentation(int rep) { temporaryRepresentation_=rep;}
    00158            int temporaryRepresentation(void) { return temporaryRepresentation_;}
    00159
    00160 protected :
    00161
    00162            // if theme is visible or not only memory (TeCanvas)
    00163            short                 temporaryVisibility_;
    00164
    00165            // set the active representation on memory (TeCanvas);
    00166            int                              temporaryRepresentation_;
    00167
    00168 public:
    00170     TeAbstractTheme(const string& name, TeViewNode* parent, const int& view, const int& id, const TeViewNodeType& nodeType);
    00171
    00173            TeAbstractTheme(const TeViewNodeParams& params);
    00174
    00176            TeAbstractTheme(const TeAbstractTheme& other);
    00177
    00179            virtual ~TeAbstractTheme();
    00180
    00182            TeAbstractTheme& operator= (const TeAbstractTheme& other);
    00183
    00188
    00190
    00191            virtual TeProjection* getThemeProjection() = 0;
    00192
    00194            virtual double minScale() { return minScale_; }
    00195
    00197            virtual void minScale(double s) { minScale_ = s; }
    00198
    00200            virtual double maxScale() { return maxScale_; }
    00201
    00203            virtual void maxScale(double s) { maxScale_ = s; }
    00205
    00210
    00211            virtual bool hasRestriction() { return (!(generateAttributeRest_.empty() ||
    00212                                                                                                      generateTemporalRest_.empty()) && hasSpatialRes_); }
    00213
    00215            virtual string attributeRest() { return generateAttributeRest_; }
    00216
    00218            virtual void attributeRest(const string& s) { generateAttributeRest_ = s; }
    00219
    00221            virtual bool hasAttrRest () { return (!generateAttributeRest_.empty());}
    00222
    00224            virtual string temporalRest() { return generateTemporalRest_; }
    00225
    00227            virtual void temporalRest(const string& t) { generateTemporalRest_ = t; };
    00228
    00230            virtual bool hasTemporalRest() { return (!generateTemporalRest_.empty());}
    00231
    00233            virtual string spatialRest() { return generateSpatialRest_; }
    00234
    00236            virtual void spatialRest(const string& s) { generateSpatialRest_ = s; };
    00237
    00239            virtual TeSpatialRelation        spatialRelation() { return spatialRelation_;}
    00240
    00242            virtual void spatialRelation(TeSpatialRelation s) {spatialRelation_=s;}
    00243
    00245            virtual bool hasSpatialRest() { return hasSpatialRes_;}
    00246
    00248            virtual void hasSpatialRest(bool a) {hasSpatialRes_ = a;}
    00249
    00251            virtual TeBox boxRestriction() { return boxRest_;}
    00252
    00254            virtual void boxRestriction(TeBox& b) {boxRest_ = b;}
    00255
    00257            virtual TeGeometry* geomRestriction() { return geomRest_;}
    00258
    00260            virtual void geomRestriction(TeGeometry* g) {geomRest_ = g;}
    00261
    00263            virtual TeGeomRep geomRepRestriction() { return geomRepRest_; }
    00264
    00266            virtual void geomRepRestriction (TeGeomRep& rep) { geomRepRest_ = rep; }
    00267
    00269            virtual void setSpatialRest(TeBox& box, TeGeomRep rep, TeSpatialRelation relation = TeWITHIN);
    00270
    00272            virtual void setSpatialRest(TeGeometry* geom, TeGeomRep rep, TeSpatialRelation relation = TeWITHIN);
    00274
    00275
    00281
    00282
    00288            virtual void visibleRep(int rep) { visibleRep_ = rep; }
    00289
    00291
    00297            virtual int visibleRep() { return visibleRep_; }
    00298
    00300            virtual int visibleGeoRep();
    00301
    00302            virtual void setAvailability(const bool& avaiability);
    00303
    00304            const bool& isAvailable() const;
    00305
    00309            bool isEditable() const;
    00310
    00314            void setEditable(const bool& editable);
    00315
    00317
    00323            virtual int visibility()
    00324            {          return enableVisibility_; }
    00325
    00327
    00333            virtual void visibility(int v)
    00334            {          enableVisibility_ = v; }
    00336
    00343
    00344            virtual TeGrouping& grouping() { return grouping_; }
    00345
    00347            virtual void grouping(const TeGrouping& g)
    00348            { grouping_ = g; }
    00349
    00351            virtual TeLegendEntryVector& legend() { return legend_; }
    00352
    00354            virtual bool setGroupingVisual(int n, TeVisual* visual, TeGeomRep rep);
    00355
    00357            virtual bool setGroupingVisual(int n, TeGeomRepVisualMap& vismap);
    00358
    00360            virtual void resetGrouping ();
    00361
    00363            virtual void cleanLegend();
    00364
    00366            virtual bool buildGrouping(const TeGrouping& g, vector<TeSlice>& slices);
    00367
    00369            virtual TeSliceVector getSlices();
    00371
    00378
    00379            virtual void defaultLegend (TeLegendEntry& leg)
    00380            { defaultLegend_ = leg; }
    00381
    00383            virtual TeLegendEntry& defaultLegend ()
    00384            { return defaultLegend_; }
    00385
    00387            virtual void setVisualDefault (TeVisual* visual, TeGeomRep rep)
    00388            { defaultLegend_.setVisual(visual, rep); }
    00389
    00391
    00392            virtual void outOfCollectionLegend (TeLegendEntry &leg)
    00393            { outOfCollectionLegend_ = leg;}
    00394
    00396            virtual TeLegendEntry& outOfCollectionLegend ()
    00397            { return outOfCollectionLegend_; }
    00398
    00400            virtual void setVisualOutOfCollection (TeVisual* visual, TeGeomRep rep)
    00401            { outOfCollectionLegend_.setVisual(visual, rep); }
    00402
    00404
    00405            virtual void withoutDataConnectionLegend (TeLegendEntry &leg)
    00406            { withoutDataConnectionLegend_ = leg; }
    00407
    00409            virtual TeLegendEntry& withoutDataConnectionLegend ()
    00410            { return withoutDataConnectionLegend_; }
    00411
    00413            virtual void setVisualWithoutDataConnection (TeVisual* visual, TeGeomRep rep)
    00414            { withoutDataConnectionLegend_.setVisual(visual, rep); }
    00415
    00417            virtual void pointingLegend (TeLegendEntry &leg)
    00418            { pointingLegend_ = leg; }
    00419
    00421            virtual TeLegendEntry& pointingLegend ()
    00422            { return pointingLegend_; }
    00423
    00425            virtual void setVisualPointing (TeVisual* visual, TeGeomRep rep)
    00426            { pointingLegend_.setVisual(visual, rep); }
    00427
    00429            virtual void queryLegend (TeLegendEntry &leg)
    00430            { queryLegend_ = leg; }
    00431
    00433            virtual TeLegendEntry& queryLegend ()
    00434            { return queryLegend_; }
    00435
    00437            virtual void setVisualQuery (TeVisual* visual, TeGeomRep rep)
    00438            { queryLegend_.setVisual(visual, rep); }
    00439
    00441            virtual void queryAndPointingLegend (TeLegendEntry &leg)
    00442            { queryAndPointingLegend_ = leg; }
    00443
    00445            virtual TeLegendEntry& queryAndPointingLegend ()
    00446            { return queryAndPointingLegend_; }
    00447
    00449            virtual map<string, int>& getObjLegendMap()
    00450            { return objLegendMap_; }
    00451
    00453            virtual map<string, int>& getObjOwnLegendMap()
    00454            { return objOwnLegendMap_; }
    00455
    00457            virtual void setVisualQueryAndPointing (TeVisual* visual, TeGeomRep rep)
    00458            { queryAndPointingLegend_.setVisual(visual, rep); }
    00459
    00461            virtual void legend(TeLegendEntry& leg);
    00462
    00467
    00468            virtual TeRasterTransform* rasterVisual()
    00469            { return rasterVisual_; }
    00470
    00472            virtual void rasterVisual(TeRasterTransform* r)
    00473            { rasterVisual_ = r; }
    00474
    00476            virtual void removeRasterVisual();
    00477
    00479            virtual void createRasterVisual(TeRaster* rst=0);
    00481
    00482
    00487
    00488            virtual TeBox& getThemeBox()
    00489            {          return themeBox_; }
    00490
    00492            virtual void setThemeBox(const TeBox& box)
    00493            {          themeBox_ = box; }
    00494
    00496            virtual TeBox& box()
    00497            {          return themeBox_; }
    00499
    00501            virtual void setParent (TeViewNode* );
    00502
    00504            virtual bool operator< (const TeAbstractTheme& r) const
    00505            {          return viewNodeParams_.priority_ < r.viewNodeParams_.priority_; }
    00506
    00508            virtual void clearObjectSet()
    00509            { objectSet_.clear(); }
    00510
    00512            virtual int getNumLayerObjects()
    00513            { return numLayerObjects_; }
    00514
    00516            virtual map<string, int>& getObjStatusMap()
    00517            { return objStatusMap_; }
    00518
    00520            virtual void clearObjStatus()
    00521            { objStatusMap_.clear(); }
    00522
    00524            virtual void clearItemStatus()
    00525            { itemStatusMap_.clear(); }
    00526
    00528            virtual map<string, int>& getItemStatusMap()
    00529            { return itemStatusMap_; }
    00530
    00532            virtual void setStatus(vector<string>& oidVec, vector<string>& itemVec, int status);
    00533
    00535            virtual void setStatusForItemsToggled(set<string>& oidSet, vector<string>& itemVec);
    00536
    00538            virtual void setStatusForObjectToggled(string oid);
    00539
    00541            virtual void setStatusForNewObjectsPointed(set<string>& oidSet);
    00542
    00544            virtual void setStatusForObjectsAddedByPointing(set<string>& oidSet);
    00545
    00547            virtual void setStatusForNewItemsPointed(vector<string>& itemVec);
    00548
    00550            virtual void setStatusForItemsAddedByPointing(vector<string>& itemVec);
    00551
    00553            virtual void setStatusForNewItemsQueried(set<string>& oidSet, vector<string>& uidVec);
    00554
    00556            virtual void setStatusForItemsAddedByQuerying(set<string>& oidSet, vector<string>& uidVec);
    00557
    00559            virtual void setStatusForItemsFilteredByQuerying(set<string>& oidSet, vector<string>& uidVec);
    00560
    00562            virtual void removePointingColor();
    00563
    00565            virtual void removeQueryColor();
    00566
    00568            virtual void invertObjectStatus();
    00569
    00571            virtual void setObjectsToDefaultStatus();
    00572
    00574            virtual TeTime getCreationTime() const;
    00575
    00577            virtual void setCreationTime(const TeTime& creationTime);
    00578
    00580            virtual bool updateThemeCreationTime(TeDatabase* database);
    00581
    00583            virtual bool isUpdated();
    00584
    00586            virtual bool save() = 0;
    00587
    00589            virtual bool buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
    00590                                      vector<double>* dValuesVec = 0) = 0;
    00591
    00593            virtual bool buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec) = 0;
    00594
    00595
    00597            virtual bool saveGrouping(TeSelectedObjects selectedObjects = TeAll) = 0;
    00598
    00600            virtual bool deleteGrouping() = 0;
    00601
    00603            virtual void setLegendsForObjects() = 0;
    00604
    00606            virtual void setOwnLegendsForObjects() = 0;
    00607
    00612            virtual bool locatePolygon                  (TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0) = 0;
    00613            virtual bool locatePolygonSet   (TeCoord2D &pt, double tol, TePolygonSet &polygons) = 0;
    00614            virtual bool locateLine                     (TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0) = 0;
    00615            virtual bool locatePoint         (TeCoord2D &pt, TePoint &point, const double& tol = 0.0) = 0;
    00616            virtual bool locateCell                     (TeCoord2D &pt, TeCell &c, const double& tol = 0.0) = 0;
    00618
    00620            virtual set<string> getObjects(TeSelectedObjects selectedObjects = TeAll) = 0;
    00621
    00623            virtual set<string> getObjects(const vector<string>& itemVec) = 0;
    00624
    00626            virtual vector<string> getItemVector(TeSelectedObjects selectedObjects) = 0;
    00627
    00629            virtual vector<string> getItemVector(const set<string>& oidSet) = 0;
    00630
    00632            virtual unsigned int getNumberOfObjects()=0;
    00633
    00635            virtual bool saveMetadata(TeDatabase* ) = 0;
    00636
    00638            TeAbstractTheme* copyTo(TeDatabase* outputDatabase, TeView* view, const std::string& renameTo = "", const int& orderIndex = -1);
    00639
    00640 protected:
    00641            string                generateAttributeRest_;
    00642            string                generateTemporalRest_;
    00643            string                generateSpatialRest_; //future use
    00644
    00645            TeSpatialRelation     spatialRelation_;
    00646            bool                                        hasSpatialRes_;
    00647            TeBox                                       boxRest_;             //box which defines the spatial restriction
    00648            TeGeometry*                                 geomRest_;            //geometry which defines the spatial restriction
    00649            TeGeomRep                        geomRepRest_;         //geometry representation of the theme which will be
    00650                                                                                                               //considered in the spatial restriction
    00651            // Display scale
    00652            double     minScale_;
    00653            double     maxScale_;
    00654
    00655            //representation visible in the theme
    00656            int visibleRep_;
    00657
    00658            //Theme status
    00659            int        enableVisibility_;
    00660
    00661            // ----------------- grouping information -----------------
    00662            TeGrouping            grouping_;
    00663
    00664            // ----------------- legend information -----------------
    00665            TeLegendEntryVector   legend_;
    00666
    00667            // Background Legend
    00668            TeLegendEntry                    outOfCollectionLegend_;                                //group(-1)
    00669            TeLegendEntry                    withoutDataConnectionLegend_;    //group(-2)
    00670            TeLegendEntry                    defaultLegend_;                                                   //group(-3)
    00671            TeLegendEntry                    pointingLegend_;                                       //group(-4)
    00672            TeLegendEntry                    queryLegend_;                                                     //group(-5)
    00673            TeLegendEntry                    queryAndPointingLegend_;                    //group(-6)
    00674
    00675            map<string, int>      objLegendMap_;                                                    // object legend
    00676            map<string, int>      objOwnLegendMap_;                                      // object own legend
    00677
    00679            TeRasterTransform*    rasterVisual_;
    00680
    00681            bool isAvailable_,
    00682                       isEditable_;
    00683
    00684            TeBox      themeBox_;
    00685
    00687            set<string> objectSet_;
    00688
    00690            int numLayerObjects_;
    00691
    00693            map<string, int> itemStatusMap_;
    00694
    00696            map<string, int> objStatusMap_;
    00697
    00699            TeTime creationTime_;
    00700
    00701 public:
    00703            virtual bool loadMetadata(TeDatabase* ) = 0;
    00704
    00705 protected:
    00706
    00708            virtual bool eraseMetadata(TeDatabase* ) = 0;
    00709
    00711            virtual bool beforeCopyThemeTo(TeAbstractTheme* absThemeCopy, TeDatabase* outputDatabase);
    00712
    00714            virtual bool afterCopyThemeTo(TeAbstractTheme* absThemeCopy, TeDatabase* outputDatabase);
    00715 };
    00716
    00718 typedef vector<TeAbstractTheme*> TeThemeVector;
    00719
    00721 typedef map<int, TeAbstractTheme*>          TeThemeMap;
    00722
    00734 #endif
    00735

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines