This file is indexed.

/usr/include/magics/Layout.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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/*
 * (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 Layout.h
    \brief Definition of the Template class Layout.
    
    Magics Team - ECMWF 2004
    
    Started: Fri 30-Jan-2004
    
    Changes:
    
*/

#ifndef Layout_H
#define Layout_H

#include "magics.h"
#include "BasicGraphicsObject.h"

#include "Colour.h"


namespace magics {


class PaperPoint;
class BasicSceneObject;
class AnimationRules;
class AnimationStep;
class LayoutVisitor;


class DriverInfo {
public:
	DriverInfo(double x, double y, double width, double height): 
		x_(x), y_(y), width_(width), height_(height) {}
	~DriverInfo() {}
	DriverInfo() {}

	void print(ostream& s) const
	{
		s << "<driver_info";
		s << " x = \'" << x_ << "\'";
		s << " y = \'" << y_ <<  "\'";
		s << " width = \'" << width_ << "\'";
		s << " height = \'" << height_ << "\'";
		s << "/>";
	}

	double x_;
	double y_;
	double width_;
	double height_;
	
	friend ostream& operator<<(ostream& s,const DriverInfo& p)
		{ p.print(s); return s; }
};

class Layout;
class LayoutVisitor;

class LayoutFrame 
{
public:
	LayoutFrame();
	~LayoutFrame();
	void blank(Layout&);
	void frame(Layout&);
protected:
	int thickness_;
	LineStyle style_;
	Colour colour_;
	bool blanking_;
	bool visible_;
	friend class Layout;
};


class StartPage : public BasicGraphicsObject
{
public:
	StartPage() {}
	virtual ~StartPage() {}
	void redisplay(const BaseDriver& driver) const;
};


class EndPage : public BasicGraphicsObject
{
public:
	EndPage() {}
	virtual ~EndPage() {}
	void redisplay(const BaseDriver& driver) const;
};


class Layout : public BasicGraphicsObjectContainer
{
public:
	Layout();
	virtual ~Layout();

	virtual Layout*  clone() const;
	virtual Layout*  newLayout() const { return new Layout(); }
	
	bool reproject(BasicGraphicsObjectContainer&) const;	
	void redisplay(const BaseDriver& driver) const;
	void redisplay(AnimationStep&, const BaseDriver& driver); 

	double x()    const { return x_ ; } // percentage of the parent
	double y()    const { return y_ ; };  // percentage of the parent
	double width()	 const { return width_ ; };  // percentage of the parent 
	double height() const { return height_ ; };  // percentage of the parent 
	
	void x(double x ) { x_ = x; }
	void y(double y ) { y_ = y; }
	
    double absoluteWidth(double);
	double absoluteHeight(double);
   
    
    
	void width(double width ) { width_ = width; }
	void height(double height ) { height_ = height; }
	
	
	void display(DisplayType display) { display_ = display; }
	DisplayType display() const { return display_; }

/* Methods needed to calculate the percentage when unit in cm!*/
	double absoluteX()      		const; //absolute position from the root
	double absoluteY()      		const; //absolute position from the root
	double absoluteWidth()  const; //absolute position from the root
	double absoluteHeight()  const; //absolute position from the root
	
	bool buildTree(const Layout&, unsigned int, const BaseDriver&) const;
	void release(); // Release the graphical objects!
	
	virtual Layout* execute(AnimationStep& step,  const Layout* visitor);

	
	double minX()  const { return xmin_; }
	double maxX()  const { return xmax_; }
	double minY()  const { return ymin_; }
	double maxY()  const { return ymax_; }
	void minX(double xmin)  { xmin_ = xmin; }
	void maxX(double xmax) {  xmax_ = xmax; }
	void minY(double ymin)  { ymin_ = ymin; }
	void maxY(double ymax) { ymax_ = ymax; }
	
	
	void setCoordinates(double xmin, double xmax, double ymin, double ymax) {
		xmin_ = xmin; xmax_ = xmax; ymin_ = ymin; ymax_ = ymax; 
	}

	static void reset()
	{
		driverInfos_.clear();
	}

	void pushDriverInfo(double x, double y, double width, double height) const 
	{
		driverInfos_.push_back(DriverInfo(x, y, width, height));
	} 
	
	void getDriverInfo(double& x, double& y, double& width, double& height)
	{
		if ( !driverInfos_.empty() ) {
			x = driverInfos_.front().x_;
			y = driverInfos_.front().y_;
			width = driverInfos_.front().width_;
			height = driverInfos_.front().height_;
		}
		else {
			if (parent_)
				parent_->getDriverInfo(x, y, width, height);
		}
	}

	void frame(const Layout& other)
	{
		frame_.blanking_ = other.frame_.blanking_;
		frame_.visible_ = other.frame_.visible_;
		frame_.colour_ = other.frame_.colour_;
		frame_.style_ = other.frame_.style_;
		frame_.thickness_ = other.frame_.thickness_;
	}
	
	void frame(bool blank, bool visible, const Colour& colour, LineStyle style, int thickness) {
		frame_.blanking_ = blank;
		frame_.visible_ = visible;
		frame_.colour_ = colour;
		frame_.style_ = style;
		frame_.thickness_ = thickness;
	}
	
	void zoomable(bool zoom = true) { zoomable_ = zoom; }
	bool isZoomable() const { return zoomable_; }
	
	void setNavigable() { navigable_ = true; }
	bool isNavigable() const { return navigable_; }

	const string& id() const { return id_; }
	void id(const string& id) { id_ = id; }
    int zoomLevels() const { return zoomLevels_; }
    void zoomLevels(int levels)  { zoomLevels_ = levels; }
    int zoomCurrentLevel() const { return zoomCurrentLevel_; }
    void zoomCurrentLevel(int level)  { zoomCurrentLevel_ = level; }
 
    void animationRules(AnimationRules* rules) { animationRules_ = rules; }
    AnimationRules* animationRules() const { return animationRules_; }
    
    const Transformation& transformation() const { 
    	ASSERT(transformation_); 
    	return *transformation_; 
    }
    virtual bool childOfRoot() const { ASSERT(parent_); return parent_->root(); }
    
    void transformation(Transformation* );
    void transformation(Layout& layout) const
    { layout.transformation(transformation_);  }
  
    void frameIt() { frame_.frame(*this); }
    void clippIt(bool clipping) { clipping_ = clipping; }
    bool clipp() const { return clipping_; }
    void blankIt() { frame_.blank(*this); }
    void resolve(bool resolve) { resolve_  = resolve; }
    bool resolve() const { return resolve_; }
    virtual void resize(double, double) {}
protected:
	//! Method to print string about this class on to a stream of type ostream (virtual).
	virtual void print(ostream&) const; 

	BasicSceneObject* owner_;
	AnimationRules*   animationRules_; // will be deleted in the destructor!
	Transformation*   transformation_; // Just a reference! 

	//Dimension of the layout in percentage of the parent! 
	double width_; 
	double height_;
	double x_;
	double y_;
	DisplayType display_;
	
	// coordiantes system used in this layout!
	double xmin_;
	double xmax_;
	double ymin_; 
	double ymax_;
	
	bool zoomable_;
	bool navigable_;
	// Zoom information : only used if mode is ZOOMABLE
	int zoomLevels_;
	int zoomCurrentLevel_;
	string id_;
	
	bool resizable_;
	bool resolve_;
	
	bool clipping_;

	LayoutFrame frame_;
		
	static vector<DriverInfo> driverInfos_;
	friend class LayoutVisitor;
	friend class TopAxisVisitor;
	friend class BottomAxisVisitor;
	friend class LeftAxisVisitor;
	friend class RightAxisVisitor;
	
private:
	//! Copy constructor - No copy allowed
	Layout(const Layout&);
	//! Overloaded << operator to copy - No copy allowed
	Layout& operator=(const Layout&);
// 
};


class PreviewLayout : public Layout 
{
public:
	PreviewLayout();
	virtual ~PreviewLayout();
	void redisplay(const BaseDriver& driver) const;
	
};
class LegendLayout : public Layout
{
public:
	LegendLayout();
	virtual ~LegendLayout();
	void redisplay(const BaseDriver& driver) const;

};
class HistoLayout : public Layout 
{
public:
	HistoLayout();
	virtual ~HistoLayout();
	void redisplay(const BaseDriver& driver) const;
};

class SceneLayout : public Layout
{
public:
	SceneLayout();
	virtual ~SceneLayout();
	void redisplay(const BaseDriver& driver) const;
	
};



class MagnifierLayout : public Layout 
{
public:
	MagnifierLayout();
	virtual ~MagnifierLayout();
	void redisplay(const BaseDriver& driver) const;
	virtual void redisplay(const BaseDriver&, vector<PaperPoint>&,float,float) const {}
};

class RootLayout : public Layout
{
public:
	RootLayout(double width, double height);
	virtual ~RootLayout();
	double absoluteWidth() const { return absoluteWidth_; }
	double absoluteHeight() const { return absoluteHeight_; }
	bool childOfRoot() const { return false; }
	void redisplay(const BaseDriver& driver) const;

	 virtual void resize(double width, double height) { absoluteWidth_ = width; absoluteHeight_ = height; }

protected:
	double absoluteWidth_;
	double absoluteHeight_; 

};
class BasicLayout : public Layout
{
public:
	BasicLayout();
	virtual ~BasicLayout();
	bool buildTree(const Layout&, unsigned int, const BaseDriver&) const;
};
class LayoutVisitor;


class LayoutHelper
{
public:
	LayoutHelper();
	~LayoutHelper();
	void add(LayoutVisitor*);
	void attachTop(LayoutVisitor*);
	void attachNoConstraintTop(LayoutVisitor*);
	void attachLeft(LayoutVisitor*);
	void attachRight(LayoutVisitor*);
	void attachBottom(LayoutVisitor*);

protected :
	virtual void print(ostream&) const; 
	double xmin_;
	double xmax_;
	double ymin_;
	double ymax_;
	friend ostream& operator<<(ostream& s,const LayoutHelper& p)
		{ p.print(s); return s; }
};

} // namespace magics
#endif