Open
Graph Drawing
Framework

 v.2012.05
 

GraphCopyAttributes.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  
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047 
00048 #ifndef OGDF_A_GRAPH_COPY_H
00049 #define OGDF_A_GRAPH_COPY_H
00050 
00051 
00052 
00053 #include <ogdf/basic/GraphCopy.h>
00054 #include <ogdf/basic/GraphAttributes.h>
00055 
00056 
00057 namespace ogdf {
00058 
00059 //---------------------------------------------------------
00060 // GraphCopyAttributes 
00061 // manages access on copy of an attributed graph
00062 //---------------------------------------------------------
00063 class OGDF_EXPORT GraphCopyAttributes {
00064 
00065     const GraphCopy *m_pGC;
00066     GraphAttributes *m_pAG;
00067     NodeArray<double> m_x, m_y;
00068 
00069 public:
00070     // construction
00071     GraphCopyAttributes(const GraphCopy &GC, GraphAttributes &AG) :
00072         m_pGC(&GC), m_pAG(&AG), m_x(GC,0), m_y(GC,0) { }
00073 
00074     // destruction
00075     ~GraphCopyAttributes() { }
00076 
00077     // returns width of node v
00078     double getWidth(node v) const {
00079         return (m_pGC->isDummy(v) ? 0.0 : m_pAG->width(m_pGC->original(v)));
00080     }
00081 
00082     // returns height of node v
00083     double getHeight(node v) const {
00084         return (m_pGC->isDummy(v) ? 0.0 : m_pAG->height(m_pGC->original(v)));
00085     }
00086 
00087     // returns reference to x-coord. of node v
00088     const double &x(node v) const {
00089         return m_x[v];
00090     }
00091 
00092     // returns reference to x-coord. of node v
00093     double &x(node v) {
00094         return m_x[v];
00095     }
00096 
00097     // returns reference to y-coord. of node v
00098     const double &y(node v) const {
00099         return m_y[v];
00100     }
00101 
00102     // returns reference to y-coord. of node v
00103     double &y(node v) {
00104         return m_y[v];
00105     }
00106 
00107     // sets attributes for the original graph in AG
00108     void transform();
00109 };
00110 
00111 
00112 } // end namespace ogdf
00113 
00114 
00115 #endif