Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
GridLayoutMapped.h
Go to the documentation of this file.
1
33#pragma once
34
38
39namespace ogdf {
40
48 static const int cGridScale;
49
50public:
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
86private:
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}
Declaration of class GridLayout.
Declaration of orthogonal representation of planar graphs.
Declaration of a base class for planar representations of graphs and cluster graphs.
Representation of a graph's grid layout.
Definition GridLayout.h:46
Extends GridLayout by a grid mapping mechanism.
const int & height(node v) const
NodeArray< int > m_gridHeight
const NodeArray< int > & width() const
static const int cGridScale
scaling to allow correct edge anchors
const int & width(node v) const
int toGrid(double x) const
NodeArray< int > & width()
GridLayoutMapped(const PlanRep &PG, const OrthoRep &OR, double separation, double cOverhang, int fineness=4)
NodeArray< int > m_gridWidth
NodeArray< int > & height()
const NodeArray< int > & height() const
void remap(Layout &drawing) override
Transforms the grid layout to a layout.
double toDouble(int i) const
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition Layout.h:46
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Orthogonal representation of an embedded graph.
Definition OrthoRep.h:219
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:57
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.