/usr/include/magics/LayoutManager.h is in libmagics++-dev 2.18.15-5.
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 | /*! \file LayoutManager.h
\brief Definition of the Template class LayoutManager.
Magics Team - ECMWF 2009
Started: Mon 19-Jan-2009
Changes:
*/
#ifndef LayoutManager_H
#define LayoutManager_H
#include "magics.h"
#include "MagTranslator.h"
#include "Factory.h"
namespace magics {
class BasicSceneNode;
class BasicPositionalObject;
class LayoutManager {
public:
LayoutManager();
virtual ~LayoutManager();
virtual LayoutManager* clone() { return new LayoutManager(); }
virtual void set(const XmlNode&) {
MagLog::dev() << "(const XmlNode&)---> to be checked!...\n";
}
virtual void set(const map<string, string>&) {
MagLog::dev() << "(const map<string, string&)---> to be checked!...\n";
}
virtual LayoutManager* clone() const {
MagLog::dev() << "(const map<string, string&)---> to be checked!...\n";
return new LayoutManager();
}
void newpage() { newpage_ = true; }
virtual BasicSceneNode* operator()(BasicSceneNode* parent, BasicPositionalObject* node);
static LayoutManager* manager(const string& type, const string& start, const string& direction);
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream&) const;
bool newpage_;
private:
//! Copy constructor - No copy allowed
LayoutManager(const LayoutManager&);
//! Overloaded << operator to copy - No copy allowed
LayoutManager& operator=(const LayoutManager&);
// -- Friends
//! Overloaded << operator to call print().
friend ostream& operator<<(ostream& s,const LayoutManager& p)
{ p.print(s); return s; }
};
class AutomaticLayout : public LayoutManager
{
public:
AutomaticLayout(): x_(0), y_(0), gapx_(0), gapy_(0) {}
~ AutomaticLayout() {}
void gapx(double gapx) { gapx_ = gapx; }
void gapy(double gapy) { gapx_ = gapy; }
protected:
double x_;
double y_;
double gapx_;
double gapy_;
};
class MagMLLayoutManager : public AutomaticLayout
{
public:
MagMLLayoutManager() ;
~ MagMLLayoutManager() {}
BasicSceneNode* operator()(BasicSceneNode* parent, BasicPositionalObject* node);
virtual LayoutManager* clone() {
MagMLLayoutManager* layout = new MagMLLayoutManager();
return layout;
}
protected:
BasicSceneNode* block(BasicSceneNode* parent, BasicPositionalObject* node);
BasicSceneNode* inline_display(BasicSceneNode* parent, BasicPositionalObject* node);
BasicSceneNode* absolute(BasicSceneNode* parent, BasicPositionalObject* node);
typedef BasicSceneNode* (MagMLLayoutManager::*Action)(BasicSceneNode* parent, BasicPositionalObject* node);
static std::map<DisplayType, Action> actions_;
double maxy_;
double maxx_;
};
class BottomVerticalLayoutManager : public AutomaticLayout
{
public:
BottomVerticalLayoutManager();
~ BottomVerticalLayoutManager();
BasicSceneNode* operator()(BasicSceneNode* parent, BasicPositionalObject* node);
virtual LayoutManager* clone() {
BottomVerticalLayoutManager* layout = new BottomVerticalLayoutManager();
layout->gapx_ = gapx_;
layout->gapy_ = gapy_;
return layout;
}
};
class BottomHorizontalLayoutManager : public AutomaticLayout
{
public:
BottomHorizontalLayoutManager();
~ BottomHorizontalLayoutManager();
BasicSceneNode* operator()(BasicSceneNode* parent, BasicPositionalObject* node);
virtual LayoutManager* clone() {
BottomHorizontalLayoutManager* layout = new BottomHorizontalLayoutManager();
layout->gapx_ = gapx_;
layout->gapy_ = gapy_;
return layout;
}
};
class TopHorizontalLayoutManager : public AutomaticLayout
{
public:
TopHorizontalLayoutManager();
~ TopHorizontalLayoutManager();
BasicSceneNode* operator()(BasicSceneNode* parent, BasicPositionalObject* node);
virtual LayoutManager* clone() {
TopHorizontalLayoutManager* layout = new TopHorizontalLayoutManager();
layout->gapx_ = gapx_;
layout->gapy_ = gapy_;
return layout;
}
};
class TopVerticalLayoutManager : public AutomaticLayout
{
public:
TopVerticalLayoutManager();
~ TopVerticalLayoutManager();
BasicSceneNode* operator()(BasicSceneNode* parent, BasicPositionalObject* node);
virtual LayoutManager* clone() {
TopVerticalLayoutManager* layout = new TopVerticalLayoutManager();
layout->gapx_ = gapx_;
layout->gapy_ = gapy_;
return layout;
}
};
template <>
class MagTranslator<string, LayoutManager> {
public:
LayoutManager* operator()(const string& val )
{
return SimpleObjectMaker<LayoutManager>::create(val);
}
LayoutManager* magics(const string& param)
{
LayoutManager* object;
ParameterManager::update(param, object);
return object;
}
};
} // namespace magics
#endif
|