00001
00002
00003
00004
00005
00006
00007
00008
00052 #ifdef _MSC_VER
00053 #pragma once
00054 #endif
00055
00056 #ifndef OGDF_A_CLUSTER_GRAPH_COPY_H
00057 #define OGDF_A_CLUSTER_GRAPH_COPY_H
00058
00059
00060
00061 #include <ogdf/layered/ExtendedNestingGraph.h>
00062 #include <ogdf/cluster/ClusterGraphAttributes.h>
00063
00064
00065 namespace ogdf {
00066
00070 class ClusterGraphCopyAttributes {
00071
00072 const ExtendedNestingGraph *m_pH;
00073 ClusterGraphAttributes *m_pACG;
00074 NodeArray<double> m_x, m_y;
00075
00076 public:
00078 ClusterGraphCopyAttributes(
00079 const ExtendedNestingGraph &H,
00080 ClusterGraphAttributes &ACG) :
00081 m_pH(&H), m_pACG(&ACG), m_x(H,0), m_y(H,0) { }
00082
00083 ~ClusterGraphCopyAttributes() { }
00084
00086 const ClusterGraphAttributes &getClusterGraphAttributes() const { return *m_pACG; }
00087
00089 double getWidth(node v) const {
00090 node vOrig = m_pH->origNode(v);
00091 return (vOrig == 0) ? 0.0 : m_pACG->width(vOrig);
00092 }
00093
00095 double getHeight(node v) const {
00096 node vOrig = m_pH->origNode(v);
00097 return (vOrig == 0) ? 0.0 : m_pACG->height(vOrig);
00098 }
00099
00101 const double &x(node v) const {
00102 return m_x[v];
00103 }
00104
00106 double &x(node v) {
00107 return m_x[v];
00108 }
00109
00111 const double &y(node v) const {
00112 return m_y[v];
00113 }
00114
00116 double &y(node v) {
00117 return m_y[v];
00118 }
00119
00121 double top(cluster cOrig) const {
00122 return m_pACG->clusterYPos(cOrig);
00123 }
00125 double bottom(cluster cOrig) const {
00126 return m_pACG->clusterYPos(cOrig) + m_pACG->clusterHeight(cOrig);
00127 }
00128
00130 void setClusterRect(
00131 cluster cOrig,
00132 double left,
00133 double right,
00134 double top,
00135 double bottom)
00136 {
00137 m_pACG->clusterXPos (cOrig) = left;
00138 m_pACG->clusterYPos (cOrig) = top;
00139 m_pACG->clusterWidth (cOrig) = right-left;
00140 m_pACG->clusterHeight(cOrig) = bottom-top;
00141 }
00142
00143 void setClusterLeftRight(
00144 cluster cOrig,
00145 double left,
00146 double right)
00147 {
00148 m_pACG->clusterXPos (cOrig) = left;
00149 m_pACG->clusterWidth (cOrig) = right-left;
00150 }
00151
00152 void setClusterTopBottom(
00153 cluster cOrig,
00154 double top,
00155 double bottom)
00156 {
00157 m_pACG->clusterYPos (cOrig) = top;
00158 m_pACG->clusterHeight(cOrig) = bottom-top;
00159 }
00160
00162 void transform();
00163 };
00164
00165
00166 }
00167
00168
00169 #endif