Open
Graph Drawing
Framework

 v.2012.05
 

MinimumEdgeDistances.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00045 #ifdef _MSC_VER
00046 #pragma once
00047 #endif
00048 
00049 
00050 #ifndef OGDF_MINIMUM_EDGE_DISTANCE_H
00051 #define OGDF_MINIMUM_EDGE_DISTANCE_H
00052 
00053 
00054 #include <ogdf/orthogonal/OrthoRep.h>
00055 
00056 
00057 namespace ogdf {
00058 
00059 
00060 //---------------------------------------------------------
00061 // MinimumEdgeDistances
00062 // maintains input sizes for improvement compaction (delta's
00063 // and epsilon's)
00064 //---------------------------------------------------------
00065 template <class ATYPE>
00066 class MinimumEdgeDistances {
00067 public:
00068     // constructor
00069     MinimumEdgeDistances(const Graph &G, ATYPE sep) : m_delta(G), m_epsilon(G)
00070     {
00071         m_sep = sep;
00072     }
00073 
00074     // returns delta_s(v)^i (with i = 0 => l, i = 1 => r)
00075     const ATYPE &delta(node v, OrthoDir s, int i) const {
00076         OGDF_ASSERT(0 <= int(s) && int(s) <= 3 && 0 <= i && i <= 1);
00077         return m_delta[v].info[s][i];
00078     }
00079 
00080     ATYPE &delta(node v, OrthoDir s, int i) {
00081         OGDF_ASSERT(0 <= int(s) && int(s) <= 3 && 0 <= i && i <= 1);
00082         return m_delta[v].info[s][i];
00083     }
00084 
00085     // returns epsilon_s(v)^i (with i = 0 => l, i = 1 => r)
00086     const ATYPE &epsilon(node v, OrthoDir s, int i) const {
00087         OGDF_ASSERT(0 <= int(s) && int(s) <= 3 && 0 <= i && i <= 1);
00088         return m_epsilon[v].info[s][i];
00089     }
00090 
00091     ATYPE &epsilon(node v, OrthoDir s, int i) {
00092         OGDF_ASSERT(0 <= int(s) && int(s) <= 3 && 0 <= i && i <= 1);
00093         return m_epsilon[v].info[s][i];
00094     }
00095 
00096     ATYPE separation() const {
00097         return m_sep;
00098     }
00099 
00100     void separation(ATYPE sep) {m_sep = sep;}
00101 
00102 
00103 private:
00104     struct InfoType {
00105         ATYPE info[4][2];
00106     };
00107 
00108     NodeArray<InfoType> m_delta;
00109     NodeArray<InfoType> m_epsilon;
00110     ATYPE m_sep;
00111 };
00112 
00113 
00114 } // end namespace ogdf
00115 
00116 
00117 #endif