Open
Graph Drawing
Framework

 v.2007.11
 

GraphCopyAttributes.h

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


© 1999-2007 by oreas GmbH, © 2005-2007 by University Dortmund and University Cologne.

Generated on Thu Nov 22 19:40:01 2007 by doxygen 1.5.4.