Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00054 #ifdef _MSC_VER
00055 #pragma once
00056 #endif
00057
00058
00059 #ifndef OGDF_GRID_LAYOUT_MAPPED_H
00060 #define OGDF_GRID_LAYOUT_MAPPED_H
00061
00062
00063 #include <ogdf/basic/GridLayout.h>
00064
00065
00066 namespace ogdf {
00067
00068 class OGDF_EXPORT PlanRep;
00069 class OGDF_EXPORT PlanRepUML;
00070 class OGDF_EXPORT OrthoRep;
00071
00072
00073
00074
00075
00076
00077 class OGDF_EXPORT GridLayoutMapped : public GridLayout
00078 {
00079
00080 enum { cGridScale = 2 };
00081
00082 public:
00083
00084
00085 GridLayoutMapped(const PlanRep &PG,
00086 const OrthoRep &OR,
00087 double separation,
00088 double cOverhang,
00089 int fineness = 4);
00090
00091
00092
00093 void remap(Layout &drawing);
00094
00095
00096 int toGrid(double x) const {
00097 return cGridScale*int(m_fMapping * x + 0.5);
00098 }
00099
00100
00101 double toDouble(int i) const {
00102 return (i/cGridScale) / m_fMapping;
00103 }
00104
00105
00106 const NodeArray<int> &width() const { return m_gridWidth; }
00107
00108 NodeArray<int> &width() { return m_gridWidth; }
00109
00110 const NodeArray<int> &height() const { return m_gridHeight; }
00111
00112 NodeArray<int> &height() { return m_gridHeight; }
00113
00114 const int &width(node v) const { return m_gridWidth[v]; }
00115
00116 int &width(node v) { return m_gridWidth[v]; }
00117
00118 const int &height(node v) const { return m_gridWidth[v]; }
00119
00120 int &height(node v) { return m_gridWidth[v]; }
00121
00122
00123 private:
00124 NodeArray<int> m_gridWidth;
00125 NodeArray<int> m_gridHeight;
00126
00127 const PlanRep *m_pPG;
00128 double m_fMapping;
00129 };
00130
00131
00132 }
00133
00134
00135 #endif