Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

Rectangle.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/geometry.h>
35 #include <iostream>
36 
37 namespace ogdf {
38 namespace energybased {
39 namespace fmmm {
40 
44 class Rectangle
45 {
47  friend ostream &operator<< (ostream & output, const Rectangle & A)
48  {
49  output <<"width: "<< A.width<<" height: "<<A.height<<" old dlc_position: "
50  <<A.old_down_left_corner_position<<" new dlc_position: "
51  <<A.new_down_left_corner_position<<" coponenet_index: "<<A.component_index;
52  if(A.tipped_over == true)
53  output<<" is tipped_over";
54  return output;
55  }
56 
58  friend istream &operator>> (istream & input, Rectangle & A)
59  {
60  input >>A.width;
61  return input;
62  }
63 
64 public:
65 
67  {
72  width = 0;
73  height = 0;
74  component_index = -1;
75  tipped_over = false;
76  }
77 
78  ~Rectangle() { }
79 
80  void set_rectangle (double w, double h, double old_dlc_x_pos,double
81  old_dlc_y_pos,int comp_index)
82  {
83  width = w;
84  height = h;
85  old_down_left_corner_position.m_x = old_dlc_x_pos;
86  old_down_left_corner_position.m_y = old_dlc_y_pos;
87  component_index = comp_index;
88  tipped_over = false;
89  }
90 
93  void set_width(double w) {width = w;}
94  void set_height(double h) {height = h;}
95  void set_component_index (int comp_index) {component_index = comp_index;}
96  void tipp_over()
97  {
98  if(tipped_over == false)
99  tipped_over = true;
100  else
101  tipped_over = false;
102  }
103 
106  double get_width() const {return width;}
107  double get_height() const {return height;}
108  int get_component_index() const {return component_index;}
109  bool is_tipped_over() const {return tipped_over;}
110 
111 private:
114  double width;
115  double height;
117  bool tipped_over;
118 
120 };
121 
122 
125 {
126 public:
129 
130  bool less(const Rectangle& A,const Rectangle & B) const
131  {
132  if(A.get_height() > B.get_height() )
133  return true;
134  else
135  return false;
136  }
137 
138  bool leq(const Rectangle& A,const Rectangle & B) const
139  {
140  if(A.get_height() >= B.get_height() )
141  return true;
142  else
143  return false;
144  }
145 
146  bool equal(const Rectangle& A,const Rectangle & B) const
147  {
148  if(A.get_height() == B.get_height() )
149  return true;
150  else
151  return false;
152  }
153 };
154 
155 
157 {
158 public:
161 
162  bool less(const Rectangle& A,const Rectangle & B) const
163  {
164  if(A.get_width() > B.get_width() )
165  return true;
166  else
167  return false;
168  }
169 
170  bool leq(const Rectangle& A,const Rectangle & B) const
171  {
172  if(A.get_width() >= B.get_width() )
173  return true;
174  else
175  return false;
176  }
177 
178  bool equal(const Rectangle& A,const Rectangle & B) const
179  {
180  if(A.get_width() == B.get_width() )
181  return true;
182  else
183  return false;
184  }
185 };
186 
187 }
188 }
189 }
bool leq(const Rectangle &A, const Rectangle &B) const
Definition: Rectangle.h:170
NUMBER m_y
The y-coordinate.
Definition: geometry.h:78
void set_new_dlc_position(DPoint dlc_pos)
Definition: Rectangle.h:92
bool less(const Rectangle &A, const Rectangle &B) const
Definition: Rectangle.h:162
NUMBER m_x
The x-coordinate.
Definition: geometry.h:77
Needed for sorting algorithms in ogdf/List and ogdf/Array.
Definition: Rectangle.h:124
bool leq(const Rectangle &A, const Rectangle &B) const
Definition: Rectangle.h:138
Real points.
Definition: geometry.h:219
friend istream & operator>>(istream &input, Rectangle &A)
Inputstream for Rectangle.
Definition: Rectangle.h:58
bool equal(const Rectangle &A, const Rectangle &B) const
Definition: Rectangle.h:178
bool equal(const Rectangle &A, const Rectangle &B) const
Definition: Rectangle.h:146
bool less(const Rectangle &A, const Rectangle &B) const
Definition: Rectangle.h:130
void set_old_dlc_position(DPoint dlc_pos)
Definition: Rectangle.h:91
DPoint old_down_left_corner_position
down left corner of the tight surround.
Definition: Rectangle.h:112
DPoint new_down_left_corner_position
new calculated down left corner of ...
Definition: Rectangle.h:113
double height
height of the surround.
Definition: Rectangle.h:115
bool tipped_over
indicates if this rectangle has been tipped over in the packing step
Definition: Rectangle.h:117
double width
width of the surround.
Definition: Rectangle.h:114
The namespace for all OGDF objects.
Helping data structure for packing rectangles; The width, height and the position of the down left co...
Definition: Rectangle.h:44
Declaration of classes DPoint, DPolyline, DLine, DRect, DIntersectableRect, DScaler.
int component_index
the index of the related connected component
Definition: Rectangle.h:116
friend ostream & operator<<(ostream &output, const Rectangle &A)
Outputstream for Rectangle.
Definition: Rectangle.h:47
void set_rectangle(double w, double h, double old_dlc_x_pos, double old_dlc_y_pos, int comp_index)
Definition: Rectangle.h:80
void set_component_index(int comp_index)
Definition: Rectangle.h:95