Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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