Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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 std::ostream &operator<< (std::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) {
53  output << " is tipped_over";
54  }
55  return output;
56  }
57 
59  friend std::istream &operator>> (std::istream & input, Rectangle & A)
60  {
61  input >>A.width;
62  return input;
63  }
64 
65 public:
66 
68  {
73  width = 0;
74  height = 0;
75  component_index = -1;
76  tipped_over = false;
77  }
78 
79  void set_rectangle (double w, double h, double old_dlc_x_pos,double
80  old_dlc_y_pos,int comp_index)
81  {
82  width = w;
83  height = h;
84  old_down_left_corner_position.m_x = old_dlc_x_pos;
85  old_down_left_corner_position.m_y = old_dlc_y_pos;
86  component_index = comp_index;
87  tipped_over = false;
88  }
89 
92  void set_width(double w) {width = w;}
93  void set_height(double h) {height = h;}
94  void set_component_index (int comp_index) {component_index = comp_index;}
96 
99  double get_width() const {return width;}
100  double get_height() const {return height;}
101  int get_component_index() const {return component_index;}
102  bool is_tipped_over() const {return tipped_over;}
103 
104 private:
107  double width;
108  double height;
110  bool tipped_over;
111 
113 };
114 
115 }
116 }
117 }
DPoint get_new_dlc_position() const
Definition: Rectangle.h:98
void set_new_dlc_position(DPoint dlc_pos)
Definition: Rectangle.h:91
DPoint get_old_dlc_position() const
Definition: Rectangle.h:97
friend std::istream & operator>>(std::istream &input, Rectangle &A)
Inputstream for Rectangle.
Definition: Rectangle.h:59
friend std::ostream & operator<<(std::ostream &output, const Rectangle &A)
Outputstream for Rectangle.
Definition: Rectangle.h:47
void set_old_dlc_position(DPoint dlc_pos)
Definition: Rectangle.h:90
T m_y
The y-coordinate.
Definition: geometry.h:79
DPoint old_down_left_corner_position
down left corner of the tight surround.
Definition: Rectangle.h:105
DPoint new_down_left_corner_position
new calculated down left corner of ...
Definition: Rectangle.h:106
double height
height of the surround.
Definition: Rectangle.h:108
bool tipped_over
indicates if this rectangle has been tipped over in the packing step
Definition: Rectangle.h:110
double width
width of the surround.
Definition: Rectangle.h:107
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 GenericPoint, GenericPolyline, GenericLine, GenericSegment, DPolygon, DRect, DIntersectableRect.
int component_index
the index of the related connected component
Definition: Rectangle.h:109
void set_rectangle(double w, double h, double old_dlc_x_pos, double old_dlc_y_pos, int comp_index)
Definition: Rectangle.h:79
void set_component_index(int comp_index)
Definition: Rectangle.h:94
T m_x
The x-coordinate.
Definition: geometry.h:78