/usr/include/terralib/kernel/TeView.h is in libterralib-dev 4.3.0+dfsg.2-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | /************************************************************************************
TerraLib - a library for developing GIS applications.
Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
This code is part of the TerraLib library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
You should have received a copy of the GNU Lesser General Public
License along with this library.
The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The library provided hereunder is on an "as is" basis, and the authors have no
obligation to provide maintenance, support, updates, enhancements, or modifications.
In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of the use
of this library and its documentation.
*************************************************************************************/
/*! \file TeView.h
\brief This file provides TerraLib's definition of a View
*/
#ifndef __TERRALIB_INTERNAL_VIEW_H
#define __TERRALIB_INTERNAL_VIEW_H
#include "TeLayer.h"
#include "TeTheme.h"
#include "TeProjection.h"
#include "TeViewNode.h"
#include <algorithm>
using namespace std;
//! A class to deal with views in TerraLib
/*!
A View is a structure that aggregated themes to be visualized or
processed in its own projection. Views may belong to a particular user.
\sa TeTheme TeViewNode
*/
class TL_DLL TeView
{
public:
//! Constructor
TeView( const string& name="", const string& user="", int id=0)
: id_(id), name_(name), user_(user), proj_(0), is_visible_(true), connectedId_(0), currentTheme_(-1)
{}
//! Destructor
virtual ~TeView ()
{
if(proj_)
delete proj_;
}
//! Returns view unique id
virtual int id () { return id_; }
//! Sets view unique id
virtual void id (int id)
{
id_ = id; // update view id
for (unsigned int th=0;th<viewTree_.size();th++) //update its themes
viewTree_.retrieve(th)->view (id_);
viewTree_.view(id);
}
//! Returns the view name
virtual string name () { return name_; }
//! Sets the view name
virtual void name (const string& s) { name_ = s; }
//! Returns the view user name
virtual string user () { return user_; }
//! Sets the view user name
virtual void user (const string& i) { user_ = i; }
//! Returns the view projection
virtual TeProjection* projection () { return proj_; }
//! Sets the view projection
virtual void projection (TeProjection* p) { proj_ = p; }
//! Returns TRUE if view is visible
virtual bool isVisible () { return is_visible_; }
//! Sets whether view is visible
virtual void isVisible (bool v) { is_visible_ = v; }
//! Returns the current box
virtual TeBox& getCurrentBox () { return currentBox_; }
//! Sets the current box
virtual void setCurrentBox (const TeBox& b) { currentBox_ = b; }
//! Returns the current theme id
virtual int getCurrentTheme () { return currentTheme_; }
//! Sets the current theme id
virtual void setCurrentTheme (const int& id) { currentTheme_ = id; }
//! Returns the view tree where view belongs
virtual TeViewTree* root () { return &viewTree_; }
//! Adds a view node to the view tree
virtual void add( TeViewNode* node, const bool& updatePriority = true)
{
node->view (id_);
viewTree_.add ( node, updatePriority );
}
//! Removes a view node through its name from the view tree
virtual TeViewNode* remove(string name)
{
return viewTree_.remove(name);
}
//! Removes a view node through its identifier from the view tree
virtual TeViewNode* remove (int id)
{
return viewTree_.removeID(id);
}
//! Moves a node up
virtual void moveUp (TeViewNode* node)
{
viewTree_.moveUp(node);
}
//! Moves a node down
virtual void moveDown(TeViewNode* node)
{
viewTree_.moveDown(node);
}
//! Returns a node identified by its position
virtual TeViewNode* get(int i)
{
return viewTree_.retrieve(i);
}
//! Returns a node identified by its name and version
virtual TeTheme* get(string themeName)
{
TeTheme *ret = 0;
for (unsigned int th = 0;th < viewTree_.size();th++)
{
TeViewNode *node = viewTree_.retrieve(th);
if (node->type() == TeTHEME)
{
TeTheme *tmp = (TeTheme*)node;
if (tmp->name() == themeName)
{
ret = tmp;
break;
}
}
}
return ret;
}
//! Sort the themes in the view
virtual void sort()
{ viewTree_.sort(); }
//! Swap the order of two themes
virtual void swap( unsigned int i, unsigned int j)
{
viewTree_.swap(i,j);
}
//! Sets the themes visibility
virtual void visibility( int vis )
{
viewTree_.visibility( vis );
}
//! Returns the themes visibility
virtual int visibility()
{
return viewTree_.visibility();
}
//! Returns the number of themes in the view
virtual unsigned int size()
{ return viewTree_.size() ; }
//! Returns the vector of themes of the view sorted according to their priorities
virtual vector<TeViewNode*>& themes()
{ return viewTree_.nodes();}
//! Sets the id of the connected view
virtual void connectedId(int id) {connectedId_ = id;}
//! Returns the id of the connected view
virtual int connectedId() {return connectedId_;}
/*! Returns the boundary box of the view themes
\param onlyVisible If is true, returns the boundary box of visible themes, otherwise returns the boundary box of all themes
*/
virtual TeBox box( bool onlyVisible )
{
TeBox retval;
if ( root() )
retval = root()->box(onlyVisible,proj_);
return retval;
};
private:
int id_; // view id
string name_; // view name
string user_; // user id
TeProjection* proj_;
bool is_visible_;
TeViewTree viewTree_;
int connectedId_; // connected view
TeBox currentBox_; // current box
int currentTheme_; // current theme id
};
//! A map from identifiers to pointers to views
typedef map<int,TeView*> TeViewMap;
#endif
|