Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Rectangle.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/geometry.h>
35 
36 #include <iostream>
37 
38 namespace ogdf {
39 namespace energybased {
40 namespace fmmm {
41 
45 class Rectangle {
47  friend std::ostream& operator<<(std::ostream& output, const Rectangle& A) {
48  output << "width: " << A.width << " height: " << A.height
49  << " old dlc_position: " << A.old_down_left_corner_position
50  << " new dlc_position: " << A.new_down_left_corner_position
51  << " 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  input >> A.width;
61  return input;
62  }
63 
64 public:
66  {
71  width = 0;
72  height = 0;
73  component_index = -1;
74  tipped_over = false;
75  }
76 
77  void set_rectangle(double w, double h, double old_dlc_x_pos, double old_dlc_y_pos,
78  int comp_index) {
79  width = w;
80  height = h;
81  old_down_left_corner_position.m_x = old_dlc_x_pos;
82  old_down_left_corner_position.m_y = old_dlc_y_pos;
83  component_index = comp_index;
84  tipped_over = false;
85  }
86 
88 
90 
91  void set_width(double w) { width = w; }
92 
93  void set_height(double h) { height = h; }
94 
95  void set_component_index(int comp_index) { component_index = comp_index; }
96 
98 
100 
102 
103  double get_width() const { return width; }
104 
105  double get_height() const { return height; }
106 
107  int get_component_index() const { return component_index; }
108 
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 }
123 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::energybased::fmmm::Rectangle::operator>>
friend std::istream & operator>>(std::istream &input, Rectangle &A)
Inputstream for Rectangle.
Definition: Rectangle.h:59
ogdf::energybased::fmmm::Rectangle::old_down_left_corner_position
DPoint old_down_left_corner_position
down left corner of the tight surround.
Definition: Rectangle.h:112
ogdf::GenericPoint< double >
ogdf::energybased::fmmm::Rectangle::height
double height
height of the surround.
Definition: Rectangle.h:115
ogdf::energybased::fmmm::Rectangle::new_down_left_corner_position
DPoint new_down_left_corner_position
new calculated down left corner of ...
Definition: Rectangle.h:113
ogdf::energybased::fmmm::Rectangle::get_height
double get_height() const
Definition: Rectangle.h:105
ogdf::energybased::fmmm::Rectangle::set_height
void set_height(double h)
Definition: Rectangle.h:93
geometry.h
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
ogdf::energybased::fmmm::Rectangle::operator<<
friend std::ostream & operator<<(std::ostream &output, const Rectangle &A)
Outputstream for Rectangle.
Definition: Rectangle.h:47
ogdf::energybased::fmmm::Rectangle::set_component_index
void set_component_index(int comp_index)
Definition: Rectangle.h:95
ogdf::GenericPoint::m_y
T m_y
The y-coordinate.
Definition: geometry.h:87
ogdf::energybased::fmmm::Rectangle::is_tipped_over
bool is_tipped_over() const
Definition: Rectangle.h:109
ogdf::whaType::A
@ A
ogdf::energybased::fmmm::Rectangle::set_width
void set_width(double w)
Definition: Rectangle.h:91
ogdf::energybased::fmmm::Rectangle::get_new_dlc_position
DPoint get_new_dlc_position() const
Definition: Rectangle.h:101
ogdf::energybased::fmmm::Rectangle::set_rectangle
void set_rectangle(double w, double h, double old_dlc_x_pos, double old_dlc_y_pos, int comp_index)
Definition: Rectangle.h:77
ogdf::energybased::fmmm::Rectangle::set_old_dlc_position
void set_old_dlc_position(DPoint dlc_pos)
Definition: Rectangle.h:87
ogdf::energybased::fmmm::Rectangle::tipp_over
void tipp_over()
Definition: Rectangle.h:97
ogdf::GenericPoint::m_x
T m_x
The x-coordinate.
Definition: geometry.h:86
ogdf::energybased::fmmm::Rectangle::set_new_dlc_position
void set_new_dlc_position(DPoint dlc_pos)
Definition: Rectangle.h:89
ogdf::energybased::fmmm::Rectangle::get_width
double get_width() const
Definition: Rectangle.h:103
ogdf::energybased::fmmm::Rectangle
Helping data structure for packing rectangles; The width, height and the position of the down left co...
Definition: Rectangle.h:45
ogdf::energybased::fmmm::Rectangle::width
double width
width of the surround.
Definition: Rectangle.h:114
ogdf::energybased::fmmm::Rectangle::Rectangle
Rectangle()
Definition: Rectangle.h:65
ogdf::energybased::fmmm::Rectangle::get_component_index
int get_component_index() const
Definition: Rectangle.h:107
ogdf::energybased::fmmm::Rectangle::component_index
int component_index
the index of the related connected component
Definition: Rectangle.h:116
ogdf::energybased::fmmm::Rectangle::get_old_dlc_position
DPoint get_old_dlc_position() const
Definition: Rectangle.h:99
ogdf::energybased::fmmm::Rectangle::tipped_over
bool tipped_over
indicates if this rectangle has been tipped over in the packing step
Definition: Rectangle.h:117