Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047
00048
00049 #ifndef OGDF_CLUSTER_ORTHO_FORMER_H
00050 #define OGDF_CLUSTER_ORTHO_FORMER_H
00051
00052
00053 #include <ogdf/orthogonal/OrthoRep.h>
00054 #include <ogdf/cluster/ClusterPlanRep.h>
00055
00056
00057 namespace ogdf {
00058
00059 const bool angleMaxBound = true;
00060 const bool angleMinBound = false;
00061
00062 enum bendCost {defaultCost, topDownCost, bottomUpCost};
00063
00064 class OGDF_EXPORT ClusterOrthoShaper
00065 {
00066
00067 public:
00068
00069 enum n_type {low, high, inner, outer};
00070
00071
00072 ClusterOrthoShaper() {
00073 m_distributeEdges = true;
00074 m_fourPlanar = true;
00075 m_allowLowZero = false;
00076 m_multiAlign = true;
00077 m_traditional = true;
00078 m_deg4free = false;
00079 m_align = false;
00080 m_topToBottom = 0;
00081 };
00082
00083 ~ClusterOrthoShaper() {};
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 void call(ClusterPlanRep &PG,
00099 CombinatorialEmbedding &E,
00100 OrthoRep &OR,
00101 int startBoundBendsPerEdge = 0,
00102 bool fourPlanar = true) throw(AlgorithmFailureException);
00103
00104
00105
00106 bool distributeEdges() { return m_distributeEdges; }
00107
00108 void distributeEdges(bool b) { m_distributeEdges = b; }
00109
00110
00111 bool multiAlign() { return m_multiAlign; }
00112
00113 void multiAlign(bool b) { m_multiAlign = b; }
00114
00115
00116 bool traditional() { return m_traditional; }
00117
00118 void traditional(bool b) { m_traditional = b; }
00119
00120
00121 bool fixDegreeFourAngles() { return m_deg4free; }
00122
00123 void fixDegreeFourAngles(bool b) { m_deg4free = b; }
00124
00125
00126 void align(bool al) {m_align = al;}
00127 bool align() {return m_align;}
00128
00129 void bendCostTopDown(int i) {m_topToBottom = i;}
00130
00131
00132 int clusterProgBendCost(int clDepth, int treeDepth, int pbc)
00133 {
00134 int cost = 1;
00135 switch (m_topToBottom)
00136 {
00137 case 1:
00138 cost = pbc*(clDepth+1);
00139 break;
00140 case 2:
00141 cost = pbc*(treeDepth - clDepth + 1);
00142 break;
00143 default:
00144 cost = pbc;
00145 break;
00146 }
00147
00148
00149
00150 return cost;
00151 }
00152
00153
00154
00155
00156
00157
00158 int clusterTradBendCost(int clDepth, int treeDepth, int pbc)
00159 {
00160 int cost = 1;
00161 switch (m_topToBottom)
00162 {
00163 case 1:
00164 cost = pbc*(clDepth+1);
00165 break;
00166 case 2:
00167 cost = pbc*(treeDepth - clDepth + 1);
00168 break;
00169 default:
00170 cost = pbc;
00171 break;
00172 }
00173
00174 return cost;
00175 }
00176
00177
00178
00179 private:
00180 bool m_distributeEdges;
00181 bool m_fourPlanar;
00182
00183 bool m_allowLowZero;
00184
00185 bool m_multiAlign;
00186 bool m_deg4free;
00187 bool m_traditional;
00188
00189
00190
00191
00192 bool m_align;
00193
00194 int m_topToBottom;
00195
00196
00197 void setAngleBound(edge netArc, int angle, EdgeArray<int>& lowB,
00198 EdgeArray<int>& upB, EdgeArray<edge>& aTwin, bool maxBound = true)
00199 {
00200
00201 OGDF_ASSERT(!m_traditional);
00202 if (m_traditional)
00203 {
00204 switch (angle)
00205 {
00206 case 0:
00207 case 90:
00208 case 180:
00209 break;
00210 OGDF_NODEFAULT
00211 }
00212 }
00213 else
00214 {
00215 switch (angle)
00216 {
00217 case 0: if (maxBound)
00218 {
00219 upB[netArc] = lowB[netArc] = 2;
00220 edge e2 = aTwin[netArc];
00221 if (e2)
00222 {
00223 upB[e2] = lowB[e2] = 0;
00224 }
00225 }
00226 else
00227 {
00228 upB[netArc] = 2; lowB[netArc] = 0;
00229 edge e2 = aTwin[netArc];
00230 if (e2)
00231 {
00232 upB[e2] = 2;
00233 lowB[e2] = 0;
00234 }
00235
00236 }
00237 break;
00238 case 90:
00239 if (maxBound)
00240 {
00241 lowB[netArc] = 1;
00242 upB[netArc] = 2;
00243 edge e2 = aTwin[netArc];
00244 if (e2)
00245 {
00246 upB[e2] = lowB[e2] = 0;
00247 }
00248 }
00249 else
00250 {
00251 upB[netArc] = 1;
00252 lowB[netArc] = 0;
00253 edge e2 = aTwin[netArc];
00254 if (e2)
00255 {
00256 upB[e2] = 2;
00257 lowB[e2] = 0;
00258 }
00259
00260 }
00261 break;
00262 case 180:
00263 if (maxBound)
00264 {
00265 lowB[netArc] = 0;
00266 upB[netArc] = 2;
00267 edge e2 = aTwin[netArc];
00268 if (e2)
00269 {
00270 upB[e2] = lowB[e2] = 0;
00271 }
00272 }
00273 else
00274 {
00275 upB[netArc] = 0;
00276 lowB[netArc] = 0;
00277 edge e2 = aTwin[netArc];
00278 if (e2)
00279 {
00280 upB[e2] = 2;
00281 lowB[e2] = 0;
00282 }
00283
00284 }
00285 break;
00286 OGDF_NODEFAULT
00287 }
00288 }
00289
00290 }
00291 };
00292
00293
00294 }
00295
00296
00297 #endif