Open
Graph Drawing
Framework

 v.2010.10
 

GraphCopyAttributes.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 2027 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2010-09-01 11:55:17 +0200 (Wed, 01 Sep 2010) $ 
00007  ***************************************************************/
00008  
00054 #ifdef _MSC_VER
00055 #pragma once
00056 #endif
00057 
00058 #ifndef OGDF_A_GRAPH_COPY_H
00059 #define OGDF_A_GRAPH_COPY_H
00060 
00061 
00062 
00063 #include <ogdf/basic/GraphCopy.h>
00064 #include <ogdf/basic/GraphAttributes.h>
00065 
00066 
00067 namespace ogdf {
00068 
00069 //---------------------------------------------------------
00070 // GraphCopyAttributes 
00071 // manages access on copy of an attributed graph
00072 //---------------------------------------------------------
00073 class OGDF_EXPORT GraphCopyAttributes {
00074 
00075     const GraphCopy *m_pGC;
00076     GraphAttributes *m_pAG;
00077     NodeArray<double> m_x, m_y;
00078 
00079 public:
00080     // construction
00081     GraphCopyAttributes(const GraphCopy &GC, GraphAttributes &AG) :
00082         m_pGC(&GC), m_pAG(&AG), m_x(GC,0), m_y(GC,0) { }
00083 
00084     // destruction
00085     ~GraphCopyAttributes() { }
00086 
00087     // returns width of node v
00088     double getWidth(node v) const {
00089         return (m_pGC->isDummy(v) ? 0.0 : m_pAG->width(m_pGC->original(v)));
00090     }
00091 
00092     // returns height of node v
00093     double getHeight(node v) const {
00094         return (m_pGC->isDummy(v) ? 0.0 : m_pAG->height(m_pGC->original(v)));
00095     }
00096 
00097     // returns reference to x-coord. of node v
00098     const double &x(node v) const {
00099         return m_x[v];
00100     }
00101 
00102     // returns reference to x-coord. of node v
00103     double &x(node v) {
00104         return m_x[v];
00105     }
00106 
00107     // returns reference to y-coord. of node v
00108     const double &y(node v) const {
00109         return m_y[v];
00110     }
00111 
00112     // returns reference to y-coord. of node v
00113     double &y(node v) {
00114         return m_y[v];
00115     }
00116 
00117     // sets attributes for the original graph in AG
00118     void transform();
00119 };
00120 
00121 
00122 } // end namespace ogdf
00123 
00124 
00125 #endif