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/GridLayout.h>
37 #include <ogdf/planarity/PlanRep.h>
38 
39 namespace ogdf {
40 
48  static const int cGridScale;
49 
50 public:
51  // construction (determines mapping factor)
52  GridLayoutMapped(const PlanRep& PG, const OrthoRep& OR, double separation, double cOverhang,
53  int fineness = 4);
54 
55 
56  // writes grid layout to layout using re-mapping
57  void remap(Layout& drawing) override;
58 
59  // transforms real coordinates to grid coordinates
60  int toGrid(double x) const { return cGridScale * int(m_fMapping * x + 0.5); }
61 
62  // transforms grid coordinates to real coordinates
63  double toDouble(int i) const { return (i / cGridScale) / m_fMapping; }
64 
65  const NodeArray<int>& width() const { return m_gridWidth; }
66 
67  // returns a reference to the array storing grid widths of nodes
68  NodeArray<int>& width() { return m_gridWidth; }
69 
70  const NodeArray<int>& height() const { return m_gridHeight; }
71 
72  // returns a reference to the array storing grid heights of nodes
73  NodeArray<int>& height() { return m_gridHeight; }
74 
75  const int& width(node v) const { return m_gridWidth[v]; }
76 
77  // returns grid width of node v
78  int& width(node v) { return m_gridWidth[v]; }
79 
80  const int& height(node v) const { return m_gridWidth[v]; }
81 
82  // returns grid height of node v
83  int& height(node v) { return m_gridWidth[v]; }
84 
85 
86 private:
87  NodeArray<int> m_gridWidth; // grid width of nodes
88  NodeArray<int> m_gridHeight; // grid heights of nodes
89 
90  const PlanRep* m_pPG; // planarized representation of grid layout
91  double m_fMapping; // mapping factor
92 };
93 
94 }
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:57
ogdf::GridLayoutMapped::width
int & width(node v)
Definition: GridLayoutMapped.h:78
ogdf::GridLayoutMapped::width
const NodeArray< int > & width() const
Definition: GridLayoutMapped.h:65
ogdf::GridLayoutMapped::m_gridWidth
NodeArray< int > m_gridWidth
Definition: GridLayoutMapped.h:87
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:91
ogdf::GridLayoutMapped::height
const int & height(node v) const
Definition: GridLayoutMapped.h:80
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:73
ogdf::GridLayoutMapped::width
const int & width(node v) const
Definition: GridLayoutMapped.h:75
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:219
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::GridLayoutMapped::m_gridHeight
NodeArray< int > m_gridHeight
Definition: GridLayoutMapped.h:88
ogdf::GridLayoutMapped::height
const NodeArray< int > & height() const
Definition: GridLayoutMapped.h:70
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:68
ogdf::GridLayoutMapped::toDouble
double toDouble(int i) const
Definition: GridLayoutMapped.h:63
ogdf::GridLayoutMapped::height
int & height(node v)
Definition: GridLayoutMapped.h:83
ogdf::GridLayoutMapped::cGridScale
static const int cGridScale
scaling to allow correct edge anchors
Definition: GridLayoutMapped.h:48
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:233
GridLayout.h
Declaration of class GridLayout.
ogdf::GridLayoutMapped::toGrid
int toGrid(double x) const
Definition: GridLayoutMapped.h:60
ogdf::GridLayoutMapped::m_pPG
const PlanRep * m_pPG
Definition: GridLayoutMapped.h:90