Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / upward / VisibilityLayout.h
blobbf55b99d8f216976192cfad67e46ea00554fb448
1 /*
2 * $Revision: 2524 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-03 09:54:22 +0200 (Tue, 03 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of visibility layout algorithm.
12 * \author Hoi-Ming Wong
14 * \par License:
15 * This file is part of the Open Graph Drawing Framework (OGDF).
17 * \par
18 * Copyright (C)<br>
19 * See README.txt in the root directory of the OGDF installation for details.
21 * \par
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
26 * for details.
28 * \par
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.
34 * \par
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 ***************************************************************/
43 //***
44 // Visibility Layout Method. see "Graph Drawing" by Di Battista et al.
45 //***
48 #ifdef _MSC_VER
49 #pragma once
50 #endif
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>
63 namespace ogdf {
66 class OGDF_EXPORT VisibilityLayout : public LayoutModule
68 public:
70 VisibilityLayout() {
71 m_grid_dist = 1;
72 // set default module
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;}
88 private:
90 //min grid distance
91 int m_grid_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
98 struct NodeSegment {
99 int y; //y coordinate
100 int x_l; // left x coordinate
101 int x_r; // right x coordiante
104 // edge segment of the visibility representation
105 struct EdgeSegment {
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);
133 }//namespace
135 #endif