| 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/TeView.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_VIEW_H
    00027 #define  __TERRALIB_INTERNAL_VIEW_H
    00028
    00029 #include "TeLayer.h"
    00030 #include "TeTheme.h"
    00031 #include "TeProjection.h"
    00032 #include "TeViewNode.h"
    00033 #include <algorithm>
    00034
    00035 using namespace std;
    00036
    00038
    00043 class TL_DLL TeView
    00044 {
    00045 public:
    00047     TeView( const string& name="", const string& user="", int id=0)
    00048                       : id_(id), name_(name), user_(user), proj_(0), is_visible_(true), connectedId_(0), currentTheme_(-1)
    00049            {}
    00050
    00052            virtual ~TeView ()
    00053            {
    00054             viewTree_.clear();
    00055             delete proj_;
    00056            }
    00057
    00059            virtual int           id () { return id_; }
    00060
    00062            virtual void id (int id)
    00063            {
    00064                       id_ = id;  // update view id
    00065                       for (unsigned int th=0;th<viewTree_.size();th++)       //update its themes
    00066                                  viewTree_.retrieve(th)->view (id_);
    00067                       viewTree_.view(id);
    00068            }
    00069
    00071            virtual string        name () const { return name_; }
    00072
    00074            virtual void name (const string& s) { name_ = s; }
    00075
    00077            virtual string        user () { return user_; }
    00078
    00080            virtual void user (const string& i) { user_ = i; }
    00081
    00083            virtual TeProjection* projection () { return proj_; }
    00084
    00086            virtual void projection (TeProjection* p) { proj_ = p; }
    00087
    00089            virtual bool isVisible () { return is_visible_; }
    00090
    00092            virtual void isVisible (bool v) { is_visible_ = v; }
    00093
    00095            virtual TeBox& getCurrentBox () { return currentBox_; }
    00096
    00098            virtual void setCurrentBox (const TeBox& b) { currentBox_ = b; }
    00099
    00101            virtual int getCurrentTheme () { return currentTheme_; }
    00102
    00104            virtual void setCurrentTheme (const int& id) { currentTheme_ = id; }
    00105
    00107            virtual TeViewTree* root () { return &viewTree_; }
    00108
    00110            virtual void add( TeViewNode* node, const bool& updatePriority = true)
    00111            {
    00112                       node->view (id_);
    00113                       viewTree_.add ( node, updatePriority );
    00114            }
    00115
    00117            virtual TeViewNode* remove(string name)
    00118            {
    00119                       return viewTree_.remove(name);
    00120            }
    00121
    00123            virtual TeViewNode* remove (int id)
    00124            {
    00125                       return viewTree_.removeID(id);
    00126            }
    00127
    00129            virtual void moveUp (TeViewNode* node)
    00130            {
    00131                       viewTree_.moveUp(node);
    00132            }
    00133
    00135            virtual void moveDown(TeViewNode* node)
    00136            {
    00137                       viewTree_.moveDown(node);
    00138            }
    00139
    00141            virtual TeViewNode* get(int i)
    00142            {
    00143                       return viewTree_.retrieve(i);
    00144            }
    00145
    00147            virtual TeTheme* get(string themeName)
    00148            {
    00149                       TeTheme *ret = 0;
    00150                       for (unsigned int th = 0;th < viewTree_.size();th++)
    00151                       {
    00152                                  TeViewNode *node = viewTree_.retrieve(th);
    00153                                  if (node->type() == TeTHEME)
    00154                                  {
    00155                                             TeTheme *tmp = (TeTheme*)node;
    00156                                             if (tmp->name() == themeName)
    00157                                             {
    00158                                                        ret = tmp;
    00159                                                        break;
    00160                                             }
    00161                                  }
    00162                       }
    00163                       return ret;
    00164            }
    00165
    00167            virtual void sort()
    00168            { viewTree_.sort(); }
    00169
    00171            virtual void swap( unsigned int i, unsigned int j)
    00172            {
    00173                       viewTree_.swap(i,j);
    00174            }
    00175
    00177            virtual void visibility( int vis )
    00178            {
    00179                       viewTree_.visibility( vis );
    00180            }
    00181
    00183            virtual int visibility()
    00184            {
    00185                       return viewTree_.visibility();
    00186            }
    00187
    00189            virtual unsigned int size()
    00190                       { return viewTree_.size() ; }
    00191
    00193            virtual vector<TeViewNode*>& themes()
    00194            { return viewTree_.nodes();}
    00195
    00197            virtual void connectedId(int id) {connectedId_ = id;}
    00198
    00200            virtual int connectedId() {return connectedId_;}
    00201
    00205            virtual TeBox box( bool onlyVisible )
    00206            {
    00207                       TeBox retval;
    00208                       if ( root() )
    00209                                  retval = root()->box(onlyVisible,proj_);
    00210                       return retval;
    00211            };
    00212
    00213 private:
    00214            int                                         id_;       // view id
    00215            string                           name_;     // view name
    00216            string                           user_;     // user id
    00217            TeProjection*   proj_;
    00218            bool                             is_visible_;
    00219
    00220            TeViewTree            viewTree_;
    00221            int                                         connectedId_; // connected view
    00222
    00223            TeBox                            currentBox_; // current box
    00224            int                                         currentTheme_; // current theme id
    00225 };
    00226
    00228 typedef map<int,TeView*> TeViewMap;
    00229
    00230 #endif
    00231
    00232
    00233

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines