Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 } // end namespace ogdf
const NodeArray< int > & width() const
Representation of a graph&#39;s grid layout.
Definition: GridLayout.h:46
NodeArray< int > & height()
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
Declaration of orthogonal representation of planar graphs.
Extends GridLayout by a grid mapping mechanism.
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:237
Declaration of a base class for planar representations of graphs and cluster graphs.
int toGrid(double x) const
const int & width(node v) const
Declaration of class GridLayout.
static const int cGridScale
scaling to allow correct edge anchors
Class for the representation of nodes.
Definition: Graph_d.h:167
double toDouble(int i) const
NodeArray< int > m_gridWidth
const NodeArray< int > & height() const
NodeArray< int > m_gridHeight
NodeArray< int > & width()
const int & height(node v) const
The namespace for all OGDF objects.
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:60
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:46