Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / cluster / ClusterGraphCopyAttributes.h
blob9941ee37906d464724ead4fe45e55148265015fb
1 /*
2 * $Revision: 2523 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declares ClusterGraphCopyAttributes, which manages access
11 * on copy of an attributed clustered graph.
13 * \author Carsten Gutwenger
15 * \par License:
16 * This file is part of the Open Graph Drawing Framework (OGDF).
18 * \par
19 * Copyright (C)<br>
20 * See README.txt in the root directory of the OGDF installation for details.
22 * \par
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * Version 2 or 3 as published by the Free Software Foundation;
26 * see the file LICENSE.txt included in the packaging of this file
27 * for details.
29 * \par
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * \par
36 * You should have received a copy of the GNU General Public
37 * License along with this program; if not, write to the Free
38 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
39 * Boston, MA 02110-1301, USA.
41 * \see http://www.gnu.org/copyleft/gpl.html
42 ***************************************************************/
45 #ifdef _MSC_VER
46 #pragma once
47 #endif
49 #ifndef OGDF_A_CLUSTER_GRAPH_COPY_H
50 #define OGDF_A_CLUSTER_GRAPH_COPY_H
54 #include <ogdf/layered/ExtendedNestingGraph.h>
55 #include <ogdf/cluster/ClusterGraphAttributes.h>
58 namespace ogdf {
60 /**
61 * \brief Manages access on copy of an attributed clustered graph
63 class OGDF_EXPORT ClusterGraphCopyAttributes {
65 const ExtendedNestingGraph *m_pH;
66 ClusterGraphAttributes *m_pACG;
67 NodeArray<double> m_x, m_y;
69 public:
70 //! Initializes instance of class ClusterGraphCopyAttributes.
71 ClusterGraphCopyAttributes(
72 const ExtendedNestingGraph &H,
73 ClusterGraphAttributes &ACG) :
74 m_pH(&H), m_pACG(&ACG), m_x(H,0), m_y(H,0) { }
76 ~ClusterGraphCopyAttributes() { }
78 //! Returns corresponding ClusterGraphAttributes.
79 const ClusterGraphAttributes &getClusterGraphAttributes() const { return *m_pACG; }
81 //! Returns width of node v.
82 double getWidth(node v) const {
83 node vOrig = m_pH->origNode(v);
84 return (vOrig == 0) ? 0.0 : m_pACG->width(vOrig);
87 //! Returns height of node v.
88 double getHeight(node v) const {
89 node vOrig = m_pH->origNode(v);
90 return (vOrig == 0) ? 0.0 : m_pACG->height(vOrig);
93 //! Returns reference to x-coord. of node v.
94 const double &x(node v) const {
95 return m_x[v];
98 //! Returns reference to x-coord. of node v.
99 double &x(node v) {
100 return m_x[v];
103 //! Returns reference to y-coord. of node v.
104 const double &y(node v) const {
105 return m_y[v];
108 //! Returns reference to y-coord. of node v.
109 double &y(node v) {
110 return m_y[v];
113 //! Returns coordinate of upper cluster boundary of original cluster \a cOrig.
114 double top(cluster cOrig) const {
115 return m_pACG->clusterYPos(cOrig);
117 //! Returns coordinate of lower cluster boundary of original cluster \a cOrig.
118 double bottom(cluster cOrig) const {
119 return m_pACG->clusterYPos(cOrig) + m_pACG->clusterHeight(cOrig);
122 //! Sets the position of the cluster rectangle for original cluster \a cOrig.
123 void setClusterRect(
124 cluster cOrig,
125 double left,
126 double right,
127 double top,
128 double bottom)
130 m_pACG->clusterXPos (cOrig) = left;
131 m_pACG->clusterYPos (cOrig) = top;
132 m_pACG->clusterWidth (cOrig) = right-left;
133 m_pACG->clusterHeight(cOrig) = bottom-top;
136 void setClusterLeftRight(
137 cluster cOrig,
138 double left,
139 double right)
141 m_pACG->clusterXPos (cOrig) = left;
142 m_pACG->clusterWidth (cOrig) = right-left;
145 void setClusterTopBottom(
146 cluster cOrig,
147 double top,
148 double bottom)
150 m_pACG->clusterYPos (cOrig) = top;
151 m_pACG->clusterHeight(cOrig) = bottom-top;
154 //! Sets attributes for the original graph in attributed graph.
155 void transform();
159 } // end namespace ogdf
162 #endif