Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
40namespace ogdf {
41class GraphAttributes;
42class GridLayout;
43class PlanRep;
44
61
62public:
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
106protected:
119 virtual void doCall(const Graph& G, GridLayout& gridLayout, IPoint& boundingBox) = 0;
120
122
123private:
125
127 void mapGridLayout(const Graph& G, GridLayout& gridLayout, GraphAttributes& AG);
128};
129
139public:
142
144
154 void callFixEmbed(GraphAttributes& AG, adjEntry adjExternal = nullptr);
155
166 void callGridFixEmbed(const Graph& G, GridLayout& gridLayout, adjEntry adjExternal = nullptr);
167
168protected:
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
213public:
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
267protected:
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
290 using PlanarGridLayoutModule::doCall;
291};
292
293}
Includes declaration of graph class.
Declaration of interface for layout algorithms (class LayoutModule)
Declares class LayoutStandards which specifies default / standard values used in graph layouts.
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Representation of a graph's grid layout.
Definition GridLayout.h:47
Base class for grid layout algorithms.
virtual void doCall(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox)=0
Implements the algorithm call.
virtual void call(GraphAttributes &GA) override final
Calls the grid layout algorithm (general call).
double m_separation
The minimum distance between nodes.
GridLayoutModule()
Initializes a grid layout module.
void callGrid(const Graph &G, GridLayout &gridLayout)
Calls the grid layout algorithm (call for GridLayout).
IPoint m_gridBoundingBox
The computed bounding box of the grid layout.
void mapGridLayout(const Graph &G, GridLayout &gridLayout, GraphAttributes &AG)
Internal transformation of grid coordinates to real coordinates.
double separation() const
Returns the current setting of the minimum distance between nodes.
void separation(double sep)
Sets the minimum distance between nodes.
const IPoint & gridBoundingBox() const
Base class for grid layout algorithms operating on a PlanRep.
void callGrid(const Graph &G, GridLayout &gridLayout)
Calls the grid layout algorithm (call for GridLayout).
void callGrid(PlanRep &PG, GridLayout &gridLayout)
Calls the grid layout algorithm (call for GridLayout of a PlanRep).
void callGridFixEmbed(PlanRep &PG, GridLayout &gridLayout, adjEntry adjExternal=nullptr)
Calls the grid layout algorithm with a fixed planar embedding (call for GridLayout of a PlanRep).
GridLayoutPlanRepModule()
Initializes a plan-rep grid layout module.
void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal=nullptr)
Calls the grid layout algorithm with a fixed planar embedding (call for GridLayout).
void doCall(const Graph &G, adjEntry adjExternal, GridLayout &gridLayout, IPoint &boundingBox, bool fixEmbedding) override
Implements PlanarGridLayoutModule::doCall().
virtual void doCall(PlanRep &PG, adjEntry adjExternal, GridLayout &gridLayout, IPoint &boundingBox, bool fixEmbedding)=0
Implements the algorithm call.
Interface of general layout algorithms.
Standard values for graphical attributes and layouts.
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:68
Base class for planar grid layout algorithms.
void callFixEmbed(GraphAttributes &AG, adjEntry adjExternal=nullptr)
Calls the grid layout algorithm with a fixed planar embedding (general call).
virtual void doCall(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox) override
Implements the GridLayoutModule::doCall().
virtual void doCall(const Graph &G, adjEntry adjExternal, GridLayout &gridLayout, IPoint &boundingBox, bool fixEmbedding)=0
Implements the algorithm call.
PlanarGridLayoutModule()
Initializes a planar grid layout module.
bool handleTrivial(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox)
Handles the special cases of graphs with less than 3 nodes.
void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal=nullptr)
Calls the grid layout algorithm with a fixed planar embedding (call for GridLayout).
#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.