1 /** \file
2  * \brief Declaration of class PackingRowInfo.
3  *
4  * \author Stefan Hachul
5  *
6  * \par License:
7  * This file is part of the Open Graph Drawing Framework (OGDF).
8  *
9  * \par
10  * Copyright (C)<br>
11  * See README.md in the OGDF root directory for details.
12  *
13  * \par
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * Version 2 or 3 as published by the Free Software Foundation;
17  * see the file LICENSE.txt included in the packaging of this file
18  * for details.
19  *
20  * \par
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * \par
27  * You should have received a copy of the GNU General Public
28  * License along with this program; if not, see
29  * http://www.gnu.org/copyleft/gpl.html
30  */
31 
32 #pragma once
33 
34 #include <ogdf/basic/basic.h>
35 
36 namespace ogdf {
37 namespace energybased {
38 namespace fmmm {
39 
40 //! Helping data structure for MAARPacking.
41 class PackingRowInfo
42 {
43 	//! Outputstream for PackingRowInfo
44 	friend std::ostream &operator<< (std::ostream & output, const PackingRowInfo & A)
45 	{
46 		output <<" max_height "<<A.max_height<<" total_width "<<A.total_width<<" row_index "
47 			<< A.row_index;
48 		return output;
49 	}
50 
51 	//! Inputstream for PackingRowInfo
52 	friend std::istream &operator>> (std::istream & input,  PackingRowInfo & A)
53 	{
54 		input >>A.max_height>>A.total_width>>A.row_index;
55 		return input;
56 	}
57 
58 public:
59 
PackingRowInfo()60 	PackingRowInfo()      //!< constructor
61 	{
62 		total_width = 0;
63 		max_height = 0;
64 		row_index = 0;
65 	}
66 
set_max_height(double h)67 	void set_max_height(double h) { max_height = h; }
set_total_width(double w)68 	void set_total_width(double w) { total_width = w; }
set_row_index(int i)69 	void set_row_index(int i) { row_index = i; }
70 
get_max_height()71 	double get_max_height() { return max_height; }
get_total_width()72 	double get_total_width() { return total_width; }
get_row_index()73 	int get_row_index() { return row_index; }
74 
75 private:
76 	double max_height;  //!< the maximum height of a rectangle placed in this row
77 	double total_width; //!< the sum of the width of all rectsngles in this row
78 	int row_index;      //!< the index of the row (first row in packing has index 0)
79 };
80 
81 }
82 }
83 }
84