Open
Graph Drawing
Framework

 v.2012.07
 

GridLayoutModule.h
Go to the documentation of this file.
1 /*
2  * $Revision: 2583 $
3  *
4  * last checkin:
5  * $Author: gutwenger $
6  * $Date: 2012-07-12 01:02:21 +0200 (Do, 12. Jul 2012) $
7  ***************************************************************/
8 
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
47 
48 #ifndef OGDF_GRID_LAYOUT_MODULE_H
49 #define OGDF_GRID_LAYOUT_MODULE_H
50 
51 
52 
54 #include <ogdf/basic/GridLayout.h>
55 #include <ogdf/planarity/PlanRep.h>
56 
57 
58 namespace ogdf {
59 
60 
75 {
77  friend class PlanarGridLayoutModule;
78 
79 public:
81  GridLayoutModule() : LayoutModule(), m_separation(40) { }
82 
83  virtual ~GridLayoutModule() { }
84 
93  void call(GraphAttributes &AG);
94 
103  void callGrid(const Graph &G, GridLayout &gridLayout);
104 
105 
107 
112  double separation() const { return m_separation; }
113 
115 
120  void separation(double sep) { m_separation = sep; }
121 
122  const IPoint &gridBoundingBox() const { return m_gridBoundingBox; }
123 
124 protected:
137  virtual void doCall(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox) = 0;
138 
139 private:
140  double m_separation;
142 
144  void mapGridLayout(const Graph &G,
145  GridLayout &gridLayout,
146  GraphAttributes &AG);
147 };
148 
149 
159 {
160 public:
163 
165 
175  void callFixEmbed(GraphAttributes &AG, adjEntry adjExternal = 0);
176 
187  void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal = 0);
188 
189 protected:
199  virtual void doCall(
200  const Graph &G,
201  GridLayout &gridLayout,
202  IPoint &boundingBox)
203  {
204  doCall(G,0,gridLayout,boundingBox,false);
205  }
206 
223  virtual void doCall(
224  const Graph &G,
225  adjEntry adjExternal,
226  GridLayout &gridLayout,
227  IPoint &boundingBox,
228  bool fixEmbedding) = 0;
229 };
230 
231 
243 {
244 public:
247 
249 
260  void callGrid(const Graph &G, GridLayout &gridLayout) {
261  PlanarGridLayoutModule::callGrid(G,gridLayout);
262  }
263 
270  void callGrid(PlanRep &PG, GridLayout &gridLayout);
271 
282  void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal = 0) {
283  PlanarGridLayoutModule::callGridFixEmbed(G,gridLayout,adjExternal);
284  }
285 
296  void callGridFixEmbed(PlanRep &PG, GridLayout &gridLayout, adjEntry adjExternal = 0);
297 
298 protected:
313  virtual void doCall(
314  PlanRep &PG,
315  adjEntry adjExternal,
316  GridLayout &gridLayout,
317  IPoint &boundingBox,
318  bool fixEmbedding) = 0;
319 
320 private:
322  void doCall(
323  const Graph &G,
324  adjEntry adjExternal,
325  GridLayout &gridLayout,
326  IPoint &boundingBox,
327  bool fixEmbedding);
328 };
329 
330 
331 } // end namespace ogdf
332 
333 
334 #endif