Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ProcrustesSubLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 
36 
37 namespace ogdf {
38 
40 {
41 public:
43  explicit ProcrustesPointSet(int numPoints);
44 
47 
49  void normalize(bool flip = false);
50 
52  void rotateTo(const ProcrustesPointSet& other);
53 
55  double compare(const ProcrustesPointSet& other) const;
56 
58  void set(int i, double x, double y)
59  {
60  m_x[i] = x;
61  m_y[i] = y;
62  }
63 
65  double getX(int i) const
66  {
67  return m_x[i];
68  }
69 
71  double getY(int i) const
72  {
73  return m_y[i];
74  }
75 
77  double originX() const
78  {
79  return m_originX;
80  }
81 
83  double originY() const
84  {
85  return m_originY;
86  }
87 
89  double scale() const
90  {
91  return m_scale;
92  }
93 
95  double angle() const
96  {
97  return m_angle;
98  }
99 
101  bool isFlipped() const
102  {
103  return m_flipped;
104  }
105 
106 private:
109 
111  double* m_x;
112 
114  double* m_y;
115 
117  double m_originX;
118 
120  double m_originY;
121 
123  double m_scale;
124 
126  double m_angle;
127 
129  bool m_flipped;
130 };
131 
133 
136 {
137 public:
139  ProcrustesSubLayout(LayoutModule* pSubLayout);
140 
141  // destructor
143 
145  virtual void call(GraphAttributes &GA) override;
146 
148  void setScaleToInitialLayout(bool flag)
149  {
150  m_scaleToInitialLayout = flag;
151  }
152 
154  bool scaleToInitialLayout() const
155  {
156  return m_scaleToInitialLayout;
157  }
158 
159 private:
161  void reverseTransform(GraphAttributes& graphAttributes, const ProcrustesPointSet& pointSet);
162 
164  void translate(GraphAttributes& graphAttributes, double dx, double dy);
165 
167  void rotate(GraphAttributes& graphAttributes, double angle);
168 
170  void scale(GraphAttributes& graphAttributes, double scale);
171 
173  void flipY(GraphAttributes& graphAttributes);
174 
176  void copyFromGraphAttributes(const GraphAttributes& graphAttributes, ProcrustesPointSet& pointSet);
177 
180 
183 };
184 
185 } // end of namespace ogdf
void setScaleToInitialLayout(bool flag)
Should the new layout scale be used or the initial scale? Default: inital.
double m_originY
the original avg center's y when normalized
void normalize(bool flip=false)
translates and scales the set such that the avg center is 0, 0 and the avg size is 1...
double getX(int i) const
returns ith x-coordinate
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
double getY(int i) const
returns ith y-coordinate
void rotateTo(const ProcrustesPointSet &other)
rotates the point set so it fits somehow on other
double * m_x
x coordinates
bool m_scaleToInitialLayout
option for enabling/disabling scaling to initial layout scale
bool m_flipped
if flipped then this is true
double * m_y
y coordinates
ProcrustesPointSet(int numPoints)
Constructor for allocating mem for numPoints points.
bool scaleToInitialLayout() const
Should the new layout scale be used or the initial scale?
double m_angle
if rotated, the angle
double scale() const
returns the scale factor
double angle() const
returns the rotation angle
Stores additional attributes of a graph (like layout information).
double compare(const ProcrustesPointSet &other) const
calculates a value how good the two point sets match
LayoutModule * m_pSubLayout
The layout module to call for a new layout.
Declaration of interface for layout algorithms (class LayoutModule)
~ProcrustesPointSet()
Destructor which frees mem.
int m_numPoints
The number of points.
bool isFlipped() const
returns true if the point set is flipped by y coord
Interface of general layout algorithms.
Definition: LayoutModule.h:44
double m_originX
the original avg center's x when normalized
double originY() const
returns the origins y
A simple procrustes analysis implementation.
double originX() const
returns the origins x
The namespace for all OGDF objects.
double m_scale
the scale factor