Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

GridLayoutMapped.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/GridLayout.h>
36 #include <ogdf/planarity/PlanRep.h>
38 
39 namespace ogdf {
40 
47 {
49  static const int cGridScale;
50 
51 public:
52 
53  // construction (determines mapping factor)
54  GridLayoutMapped(const PlanRep &PG,
55  const OrthoRep &OR,
56  double separation,
57  double cOverhang,
58  int fineness = 4);
59 
60 
61  // writes grid layout to layout using re-mapping
62  void remap(Layout &drawing) override;
63 
64  // transforms real coordinates to grid coordinates
65  int toGrid(double x) const {
66  return cGridScale*int(m_fMapping * x + 0.5);
67  }
68 
69  // transforms grid coordinates to real coordinates
70  double toDouble(int i) const {
71  return (i/cGridScale) / m_fMapping;
72  }
73 
74 
75  const NodeArray<int> &width() const { return m_gridWidth; }
76  // returns a reference to the array storing grid widths of nodes
77  NodeArray<int> &width() { return m_gridWidth; }
78 
79  const NodeArray<int> &height() const { return m_gridHeight; }
80  // returns a reference to the array storing grid heights of nodes
81  NodeArray<int> &height() { return m_gridHeight; }
82 
83  const int &width(node v) const { return m_gridWidth[v]; }
84  // returns grid width of node v
85  int &width(node v) { return m_gridWidth[v]; }
86 
87  const int &height(node v) const { return m_gridWidth[v]; }
88  // returns grid height of node v
89  int &height(node v) { return m_gridWidth[v]; }
90 
91 
92 private:
93  NodeArray<int> m_gridWidth; // grid width of nodes
94  NodeArray<int> m_gridHeight; // grid heights of nodes
95 
96  const PlanRep *m_pPG; // planarized representation of grid layout
97  double m_fMapping; // mapping factor
98 };
99 
100 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59
ogdf::GridLayoutMapped::width
int & width(node v)
Definition: GridLayoutMapped.h:85
ogdf::GridLayoutMapped::width
const NodeArray< int > & width() const
Definition: GridLayoutMapped.h:75
ogdf::GridLayoutMapped::m_gridWidth
NodeArray< int > m_gridWidth
Definition: GridLayoutMapped.h:93
ogdf::NodeArray< int >
PlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
ogdf::GridLayoutMapped::m_fMapping
double m_fMapping
Definition: GridLayoutMapped.h:97
ogdf::GridLayoutMapped::height
const int & height(node v) const
Definition: GridLayoutMapped.h:87
ogdf::Layout
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:46
ogdf::GridLayoutMapped::height
NodeArray< int > & height()
Definition: GridLayoutMapped.h:81
ogdf::GridLayoutMapped::width
const int & width(node v) const
Definition: GridLayoutMapped.h:83
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:236
ogdf::GridLayoutMapped::m_gridHeight
NodeArray< int > m_gridHeight
Definition: GridLayoutMapped.h:94
ogdf::GridLayoutMapped::height
const NodeArray< int > & height() const
Definition: GridLayoutMapped.h:79
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
ogdf::GridLayoutMapped::width
NodeArray< int > & width()
Definition: GridLayoutMapped.h:77
ogdf::GridLayoutMapped::toDouble
double toDouble(int i) const
Definition: GridLayoutMapped.h:70
ogdf::GridLayoutMapped::height
int & height(node v)
Definition: GridLayoutMapped.h:89
ogdf::GridLayoutMapped::cGridScale
static const int cGridScale
scaling to allow correct edge anchors
Definition: GridLayoutMapped.h:49
ogdf::GridLayout
Representation of a graph's grid layout.
Definition: GridLayout.h:46
ogdf::GridLayoutMapped
Extends GridLayout by a grid mapping mechanism.
Definition: GridLayoutMapped.h:46
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:169
GridLayout.h
Declaration of class GridLayout.
ogdf::GridLayoutMapped::toGrid
int toGrid(double x) const
Definition: GridLayoutMapped.h:65
ogdf::GridLayoutMapped::m_pPG
const PlanRep * m_pPG
Definition: GridLayoutMapped.h:96