/usr/include/magics/BasicSceneObject.h is in libmagics++-dev 3.0.0-1.
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 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | /*
* (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation nor
* does it submit to any jurisdiction.
*/
/*! \file BasicSceneObject.h
\brief Definition of the Template class BasicSceneObject.
Magics Team - ECMWF 2007
Started: Thu 1-Mar-2007
Changes:
*/
#ifndef BasicSceneObject_H
#define BasicSceneObject_H
#include "magics.h"
#include "MagLog.h"
#include "VectorOfPointers.h"
#include "BasicGraphicsObject.h"
#include "Layout.h"
#include "DisplayManager.h"
#include "MagicsEvent.h"
//#include "SceneVisitor.h"
namespace magics {
class XmlNode;
class UserPoint;
class UserPoint;
class Transformation;
class AnimationRules;
class DrawingVisitor;
class TopAxisVisitor;
class BottomAxisVisitor;
class LeftAxisVisitor;
class RightAxisVisitor;
class BackgroundVisitor;
class FrameVisitor;
class TextVisitor;
class MetaDataVisitor;
class LegendVisitor;
class PreviewVisitor;
class HistoVisitor;
class MagnifierVisitor;
class SceneVisitor;
class LayoutManager;
class AnimationStep;
class SceneLayer;
class MetaDataCollector;
class MagnifierCollector;
class ValuesCollector;
class DataIndexCollector;
class BinningObject;
class Data;
class Visdef;
class BasicPositionalObject;
class BasicSceneNode;
enum MagicsMode { interactif, paper, basic};
class BasicSceneObject : public MetviewIcon {
public:
BasicSceneObject(BasicSceneObject* parent = 0);
virtual ~BasicSceneObject();
virtual void push_back(BasicSceneObject* item) {
item->parent(this);
items_.push_back(item);
}
bool items_empty() { return items_.empty(); }
virtual void text(TextVisitor* text) { ASSERT(parent_); parent_->text(text); }
virtual void legend(LegendVisitor* legend) { ASSERT(parent_); parent_->legend(legend); }
virtual void getReady(const LegendVisitor&);
virtual void binning(BinningObject*) { MagLog::warning() << "binning(BinningObject*) to be checked" << endl; }
virtual void data(Data*) { MagLog::warning() << "data(Data*) to be checked" << endl; }
virtual void visdef(Visdef*) { MagLog::warning() << "visdef(Data*) to be checked" << endl; }
void addVisitor(SceneVisitor* visitor) { visitors_.push_back(visitor); }
void parent(BasicSceneObject* parent) {
parent_ = parent;
}
void reparent(BasicSceneObject* parent) {
parent_ = parent;
}
void orphan() { parent_ = 0; }
BasicSceneObject& parent() const { ASSERT(parent_); return *parent_; }
virtual void set(const XmlNode&)
{ MagLog::dev() << "Warning: BasicSceneObject::set(const XmlNode&)-->Not implemented!" << endl; }
virtual void resolve();
virtual Layout* execute(AnimationStep&, Layout&)
{ MagLog::dev() << "Warning: BasicGraphicsObject* BasicSceneObject::execute(AnimsationStep&))-->Not implemented!" << endl; return 0;}
virtual void getReady() { dispatch(&BasicSceneObject::getReady); }
virtual void release() { dispatch(&BasicSceneObject::release); }
virtual void visit(MetaDataVisitor& meta) { dispatch(meta); }
virtual void visit(PreviewVisitor& preview) { dispatch(preview); }
virtual void visit(HistoVisitor& histo) { dispatch(histo); }
virtual void visit(MagnifierVisitor& magnifier) { dispatch(magnifier); }
virtual void visit(DateDescription& timestamp) { dispatch(timestamp); }
virtual void visit(LevelDescription& level) { dispatch(level); }
virtual void visit(Transformation& transformation) { dispatch(transformation); }
virtual void visit(AnimationRules& rules) { dispatch(rules); }
virtual void visit(MetaDataCollector& infos) { dispatch(infos); }
virtual void visit(MagnifierCollector& infos) { dispatch(infos); }
virtual void visit(ValuesCollector& infos) { dispatch(infos); }
virtual void visit(DataIndexCollector& infos) { dispatch(infos); }
virtual void visit(DrawingVisitor& drawing) { dispatch(drawing); }
virtual void visit(TopAxisVisitor& top) { dispatch(top); }
virtual void visit(BottomAxisVisitor& bottom) { dispatch(bottom); }
virtual void visit(LeftAxisVisitor& left) { dispatch(left); }
virtual void visit(RightAxisVisitor& right) { dispatch(right); }
virtual void visit(BackgroundVisitor& background) { dispatch(background); }
virtual void visit(FrameVisitor& frame) { dispatch(frame); }
virtual void visit(TextVisitor& text) { dispatch(text); }
virtual void visit(LegendVisitor& legend) { dispatch(legend); }
virtual void visit(SceneLayer& tree) { dispatch(tree); }
virtual void visit(BasicGraphicsObjectContainer& tree) { dispatch(tree); }
virtual void visit(AnimationStep& step) { dispatch(step); }
virtual void visit(SceneLayer& visitor, vector<LayoutVisitor*>& args) { dispatch(visitor, args); }
virtual bool needLegend();
virtual void execute()
{
ASSERT(parent_);
return parent_->execute();
}
virtual BasicGraphicsObject* visualise()
{
ASSERT(parent_);
return parent_->visualise();
}
virtual MagicsMode mode() { ASSERT(parent_); return parent_->mode(); }
virtual Transformation& transformation() const
{ ASSERT(parent_); return parent_->transformation(); }
virtual const Layout& layout() const
{ ASSERT(parent_); return parent_->layout(); }
virtual BasicGraphicsObject* toDisplay()
{ ASSERT(parent_); return parent_->toDisplay(); }
virtual double absoluteWidth() const
{ ASSERT ( parent_ ); return parent_->absoluteWidth(); }
virtual double absoluteHeight() const
{ ASSERT ( parent_ ); return parent_->absoluteHeight(); }
virtual void absoluteRootWidth(double width)
{ ASSERT ( parent_ ); return parent_->absoluteRootWidth(width); }
virtual void absoluteRootHeight(double height)
{ ASSERT ( parent_ ); return parent_->absoluteRootHeight(height); }
virtual int rootWidthResolution() const
{ ASSERT ( parent_ ); return parent_->rootWidthResolution(); }
virtual int rootHeightResolution() const
{ ASSERT ( parent_ ); return parent_->rootHeightResolution(); }
virtual int widthResolution() const
{ ASSERT ( parent_ ); return parent_->rootWidthResolution(); }
virtual int heightResolution() const
{ ASSERT ( parent_ ); return parent_->rootHeightResolution(); }
virtual string theme() const // REturn the parent theme!
{
return (parent_) ? parent_->theme() : "magics";
}
const string& name() const { return name_; }
void name(const string& name) { name_ = name; }
virtual BasicSceneNode* insert(BasicPositionalObject*) { ASSERT (false); return 0;}
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream&) const;
typedef void (BasicSceneObject::*Function)();
template <class T>
void dispatch(T& visitor) {
for ( vector<BasicSceneObject*>::iterator item = items_.begin(); item != items_.end(); ++item)
(*item)->visit(visitor);
}
template <class T1, class T2>
void dispatch(T1& visitor, T2& args) {
for ( vector<BasicSceneObject*>::iterator item = items_.begin(); item != items_.end(); ++item)
(*item)->visit(visitor, args);
}
void dispatch(Function function)
{
for ( vector<BasicSceneObject*>::iterator item = items_.begin(); item != items_.end(); ++item)
((*item)->*function)();
}
VectorOfPointers<vector<BasicSceneObject*> > items_;
vector<SceneVisitor*> visitors_;
BasicSceneObject* parent_; //Do not delete! Only a reference
string name_;
private:
BasicSceneObject(const BasicSceneObject&);
//! Overloaded << operator to copy - No copy allowed
BasicSceneObject& operator=(const BasicSceneObject&);
// -- Friends
//! Overloaded << operator to call print().
friend ostream& operator<<(ostream& s,const BasicSceneObject& p)
{ p.print(s); return s; }
};
class BasicPositionalObject : public BasicSceneObject
{
public:
BasicPositionalObject() {}
virtual ~BasicPositionalObject() {}
virtual Layout& layout() const = 0;
protected:
double adjustDimension(double, double, double);
};
class BasicSceneNode : public BasicPositionalObject
{
public:
BasicSceneNode();
BasicSceneNode(Layout*);
virtual ~BasicSceneNode();
virtual BasicSceneNode* insert(BasicPositionalObject*); // Return the node tinto which the object has been inserted!
Layout& layout() const
{
{ ASSERT(layout_); return *layout_; }
}
virtual void getReady();
virtual BasicSceneNode* clone();
virtual BasicSceneNode* newNode(BasicPositionalObject*);
virtual void visit(BasicGraphicsObjectContainer& tree)
{
tree.push_back(layout_);
layout_->blankIt();
dispatch(*layout_);
layout_->frameIt();
}
void newpage();
double absoluteWidth() const;
double absoluteHeight() const;
void manager(LayoutManager* manager) { manager_ = manager; }
protected:
Layout* layout_;
LayoutManager* manager_;
friend class LayoutManager;
};
class EmptySceneObject: public BasicSceneObject {
public:
EmptySceneObject();
virtual ~EmptySceneObject();
void visit(SceneLayer&, vector<LayoutVisitor*>&);
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream&) const;
private:
//! Copy constructor - No copy allowed
EmptySceneObject(const EmptySceneObject&);
//! Overloaded << operator to copy - No copy allowed
EmptySceneObject& operator=(const EmptySceneObject&);
// -- Friends
//! Overloaded << operator to call print().
friend ostream& operator<<(ostream& s,const EmptySceneObject& )
{ s << "EmptySceneObject"; return s; }
};
} // namespace magics
#endif
|