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
35#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/basic.h>
38
39namespace ogdf {
40class Layout;
41class OrthoRep;
42class PlanRep;
43
51 static const int cGridScale;
52
53public:
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
89private:
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}
Includes declaration of graph class.
Declaration of class GridLayout.
Basic declarations, included by all source files.
Representation of a graph's grid layout.
Definition GridLayout.h:47
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:49
Class for the representation of nodes.
Definition Graph_d.h:241
Orthogonal representation of an embedded graph.
Definition OrthoRep.h:225
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:68
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.