Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046
00047 #ifndef OGDF_GRID_LAYOUT_MODULE_H
00048 #define OGDF_GRID_LAYOUT_MODULE_H
00049
00050
00051
00052 #include <ogdf/module/LayoutModule.h>
00053 #include <ogdf/basic/GridLayout.h>
00054 #include <ogdf/planarity/PlanRep.h>
00055
00056
00057 namespace ogdf {
00058
00059
00073 class OGDF_EXPORT GridLayoutModule : public LayoutModule
00074 {
00075 friend class GridLayoutPlanRepModule;
00076 friend class PlanarGridLayoutModule;
00077
00078 public:
00080 GridLayoutModule() : LayoutModule(), m_separation(40) { }
00081
00082 virtual ~GridLayoutModule() { }
00083
00092 void call(GraphAttributes &AG);
00093
00102 void callGrid(const Graph &G, GridLayout &gridLayout);
00103
00104
00106 double separation() const { return m_separation; }
00107
00109 void separation(double sep) { m_separation = sep; }
00110
00111 const IPoint &gridBoundingBox() const { return m_gridBoundingBox; }
00112
00113 protected:
00126 virtual void doCall(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox) = 0;
00127
00128 private:
00129 double m_separation;
00130 IPoint m_gridBoundingBox;
00131
00133 void mapGridLayout(const Graph &G,
00134 GridLayout &gridLayout,
00135 GraphAttributes &AG);
00136 };
00137
00138
00147 class OGDF_EXPORT PlanarGridLayoutModule : public GridLayoutModule
00148 {
00149 public:
00151 PlanarGridLayoutModule() : GridLayoutModule() { }
00152
00153 virtual ~PlanarGridLayoutModule() { }
00154
00164 void callFixEmbed(GraphAttributes &AG, adjEntry adjExternal = 0);
00165
00176 void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal = 0);
00177
00178 protected:
00188 virtual void doCall(
00189 const Graph &G,
00190 GridLayout &gridLayout,
00191 IPoint &boundingBox)
00192 {
00193 doCall(G,0,gridLayout,boundingBox,false);
00194 }
00195
00212 virtual void doCall(
00213 const Graph &G,
00214 adjEntry adjExternal,
00215 GridLayout &gridLayout,
00216 IPoint &boundingBox,
00217 bool fixEmbedding) = 0;
00218 };
00219
00220
00231 class OGDF_EXPORT GridLayoutPlanRepModule : public PlanarGridLayoutModule
00232 {
00233 public:
00235 GridLayoutPlanRepModule() : PlanarGridLayoutModule() { }
00236
00237 virtual ~GridLayoutPlanRepModule() { }
00238
00249 void callGrid(const Graph &G, GridLayout &gridLayout) {
00250 PlanarGridLayoutModule::callGrid(G,gridLayout);
00251 }
00252
00259 void callGrid(PlanRep &PG, GridLayout &gridLayout);
00260
00271 void callGridFixEmbed(const Graph &G, GridLayout &gridLayout, adjEntry adjExternal = 0) {
00272 PlanarGridLayoutModule::callGridFixEmbed(G,gridLayout,adjExternal);
00273 }
00274
00285 void callGridFixEmbed(PlanRep &PG, GridLayout &gridLayout, adjEntry adjExternal = 0);
00286
00287 protected:
00301 virtual void doCall(
00302 PlanRep &PG,
00303 adjEntry adjExternal,
00304 GridLayout &gridLayout,
00305 IPoint &boundingBox,
00306 bool fixEmbedding) = 0;
00307
00308 private:
00310 void doCall(
00311 const Graph &G,
00312 adjEntry adjExternal,
00313 GridLayout &gridLayout,
00314 IPoint &boundingBox,
00315 bool fixEmbedding);
00316 };
00317
00318
00319 }
00320
00321
00322 #endif