6 * $Date: 2012-07-03 09:54:22 +0200 (Tue, 03 Jul 2012) $
7 ***************************************************************/
10 * \brief Declaration of visibility layout algorithm.
12 * \author Hoi-Ming Wong
15 * This file is part of the Open Graph Drawing Framework (OGDF).
19 * See README.txt in the root directory of the OGDF installation for details.
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
44 // Visibility Layout Method. see "Graph Drawing" by Di Battista et al.
52 #ifndef OGDF_VISIBILITY_LAYOUT_H
53 #define OGDF_VISIBILITY_LAYOUT_H
55 #include <ogdf/module/UpwardPlanarizerModule.h>
56 #include <ogdf/module/LayoutModule.h>
57 #include <ogdf/basic/ModuleOption.h>
58 #include <ogdf/basic/GraphAttributes.h>
59 #include <ogdf/basic/FaceArray.h>
60 #include <ogdf/upward/UpwardPlanRep.h>
61 #include <ogdf/upward/SubgraphUpwardPlanarizer.h>
66 class OGDF_EXPORT VisibilityLayout
: public LayoutModule
73 m_upPlanarizer
.set(new SubgraphUpwardPlanarizer());
76 virtual void call(GraphAttributes
&GA
);
78 void layout(GraphAttributes
&GA
, const UpwardPlanRep
&UPROrig
);
80 void setUpwardPlanarizer(UpwardPlanarizerModule
*upPlanarizer
) {
81 m_upPlanarizer
.set(upPlanarizer
);
84 void setMinGridDistance(int dist
) {m_grid_dist
= dist
;}
93 Graph D
; // the dual graph of the UPR
94 node s_D
; // super source of D
95 node t_D
; // super sink f D
97 //node segment of the visibility representation
100 int x_l
; // left x coordinate
101 int x_r
; // right x coordiante
104 // edge segment of the visibility representation
106 int y_b
; // bottom y coordinate
107 int y_t
; // top y coordinate
108 int x
; // x coordiante
111 //mapping node to node segment of visibility presentation
112 NodeArray
<NodeSegment
> nodeToVis
;
114 //mapping edge to edge segment of visibility presentation
115 EdgeArray
<EdgeSegment
> edgeToVis
;
117 FaceArray
<node
> faceToNode
;
118 NodeArray
<face
> leftFace_node
;
119 NodeArray
<face
> rightFace_node
;
120 EdgeArray
<face
> leftFace_edge
;
121 EdgeArray
<face
> rightFace_edge
;
123 ModuleOption
<UpwardPlanarizerModule
> m_upPlanarizer
; // upward planarizer
125 void constructDualGraph(UpwardPlanRep
&UPR
);
127 void constructVisibilityRepresentation(UpwardPlanRep
&UPR
);