Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

GridLayoutModule.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
37 #include <ogdf/basic/basic.h>
38 #include <ogdf/basic/geometry.h>
39 
40 namespace ogdf {
41 class GraphAttributes;
42 class GridLayout;
43 class PlanRep;
44 
60  friend class PlanarGridLayoutModule;
61 
62 public:
64  GridLayoutModule() : LayoutModule(), m_separation(LayoutStandards::defaultNodeSeparation()) { }
65 
66  virtual ~GridLayoutModule() { }
67 
76  virtual void call(GraphAttributes& GA) override final;
77 
86  void callGrid(const Graph& G, GridLayout& gridLayout);
87 
89 
94  double separation() const { return m_separation; }
95 
97 
102  void separation(double sep) { m_separation = sep; }
103 
104  const IPoint& gridBoundingBox() const { return m_gridBoundingBox; }
105 
106 protected:
119  virtual void doCall(const Graph& G, GridLayout& gridLayout, IPoint& boundingBox) = 0;
120 
122 
123 private:
124  double m_separation;
125 
127  void mapGridLayout(const Graph& G, GridLayout& gridLayout, GraphAttributes& AG);
128 };
129 
139 public:
142 
144 
154  void callFixEmbed(GraphAttributes& AG, adjEntry adjExternal = nullptr);
155 
166  void callGridFixEmbed(const Graph& G, GridLayout& gridLayout, adjEntry adjExternal = nullptr);
167 
168 protected:
186  virtual void doCall(const Graph& G, adjEntry adjExternal, GridLayout& gridLayout,
187  IPoint& boundingBox, bool fixEmbedding) = 0;
188 
190  virtual void doCall(const Graph& G, GridLayout& gridLayout, IPoint& boundingBox) override {
191  doCall(G, nullptr, gridLayout, boundingBox, false);
192  }
193 
199  bool handleTrivial(const Graph& G, GridLayout& gridLayout, IPoint& boundingBox);
200 };
201 
213 public:
216 
218 
229  void callGrid(const Graph& G, GridLayout& gridLayout) {
230  PlanarGridLayoutModule::callGrid(G, gridLayout);
231  }
232 
239  void callGrid(PlanRep& PG, GridLayout& gridLayout);
240 
251  void callGridFixEmbed(const Graph& G, GridLayout& gridLayout, adjEntry adjExternal = nullptr) {
252  PlanarGridLayoutModule::callGridFixEmbed(G, gridLayout, adjExternal);
253  }
254 
265  void callGridFixEmbed(PlanRep& PG, GridLayout& gridLayout, adjEntry adjExternal = nullptr);
266 
267 protected:
282  virtual void doCall(PlanRep& PG, adjEntry adjExternal, GridLayout& gridLayout,
283  IPoint& boundingBox, bool fixEmbedding) = 0;
284 
285 
287  void doCall(const Graph& G, adjEntry adjExternal, GridLayout& gridLayout, IPoint& boundingBox,
288  bool fixEmbedding) override;
289 
291 };
292 
293 }
ogdf::PlanarGridLayoutModule::callGridFixEmbed
void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal=nullptr)
Calls the grid layout algorithm with a fixed planar embedding (call for GridLayout).
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::GridLayoutPlanRepModule::GridLayoutPlanRepModule
GridLayoutPlanRepModule()
Initializes a plan-rep grid layout module.
Definition: GridLayoutModule.h:215
Graph.h
Includes declaration of graph class.
ogdf::GenericPoint< int >
ogdf::GridLayoutModule::~GridLayoutModule
virtual ~GridLayoutModule()
Definition: GridLayoutModule.h:66
ogdf::PlanarGridLayoutModule::doCall
virtual void doCall(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox) override
Implements the GridLayoutModule::doCall().
Definition: GridLayoutModule.h:190
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:69
geometry.h
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
ogdf::GridLayoutModule::m_separation
double m_separation
The minimum distance between nodes.
Definition: GridLayoutModule.h:124
ogdf::GridLayoutModule::separation
double separation() const
Returns the current setting of the minimum distance between nodes.
Definition: GridLayoutModule.h:94
ogdf::GridLayoutPlanRepModule::callGrid
void callGrid(const Graph &G, GridLayout &gridLayout)
Calls the grid layout algorithm (call for GridLayout).
Definition: GridLayoutModule.h:229
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::GridLayoutPlanRepModule
Base class for grid layout algorithms operating on a PlanRep.
Definition: GridLayoutModule.h:212
LayoutStandards.h
Declares class LayoutStandards which specifies default / standard values used in graph layouts.
ogdf::GridLayoutPlanRepModule::callGridFixEmbed
void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal=nullptr)
Calls the grid layout algorithm with a fixed planar embedding (call for GridLayout).
Definition: GridLayoutModule.h:251
ogdf::PlanarGridLayoutModule
Base class for planar grid layout algorithms.
Definition: GridLayoutModule.h:138
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::LayoutStandards
Standard values for graphical attributes and layouts.
Definition: LayoutStandards.h:44
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::GridLayoutModule::callGrid
void callGrid(const Graph &G, GridLayout &gridLayout)
Calls the grid layout algorithm (call for GridLayout).
ogdf::PlanarGridLayoutModule::~PlanarGridLayoutModule
virtual ~PlanarGridLayoutModule()
Definition: GridLayoutModule.h:143
ogdf::GridLayoutModule::gridBoundingBox
const IPoint & gridBoundingBox() const
Definition: GridLayoutModule.h:104
ogdf::GridLayoutModule::separation
void separation(double sep)
Sets the minimum distance between nodes.
Definition: GridLayoutModule.h:102
ogdf::PlanarGridLayoutModule::doCall
virtual void doCall(const Graph &G, adjEntry adjExternal, GridLayout &gridLayout, IPoint &boundingBox, bool fixEmbedding)=0
Implements the algorithm call.
ogdf::GridLayoutModule::m_gridBoundingBox
IPoint m_gridBoundingBox
The computed bounding box of the grid layout.
Definition: GridLayoutModule.h:121
ogdf::GridLayout
Representation of a graph's grid layout.
Definition: GridLayout.h:47
ogdf::GridLayoutModule
Base class for grid layout algorithms.
Definition: GridLayoutModule.h:58
ogdf::PlanarGridLayoutModule::PlanarGridLayoutModule
PlanarGridLayoutModule()
Initializes a planar grid layout module.
Definition: GridLayoutModule.h:141
ogdf::GridLayoutModule::GridLayoutModule
GridLayoutModule()
Initializes a grid layout module.
Definition: GridLayoutModule.h:64
ogdf::GridLayoutPlanRepModule::~GridLayoutPlanRepModule
virtual ~GridLayoutPlanRepModule()
Definition: GridLayoutModule.h:217
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:45