1 | /** \file |
---|---|
2 | * \brief Tests for UML layout algorithms. |
3 | * |
4 | * \author Tilo Wiedera |
5 | * |
6 | * \par License: |
7 | * This file is part of the Open Graph Drawing Framework (OGDF). |
8 | * |
9 | * \par |
10 | * Copyright (C)<br> |
11 | * See README.md in the OGDF root directory for details. |
12 | * |
13 | * \par |
14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License |
16 | * Version 2 or 3 as published by the Free Software Foundation; |
17 | * see the file LICENSE.txt included in the packaging of this file |
18 | * for details. |
19 | * |
20 | * \par |
21 | * This program is distributed in the hope that it will be useful, |
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | * GNU General Public License for more details. |
25 | * |
26 | * \par |
27 | * You should have received a copy of the GNU General Public |
28 | * License along with this program; if not, see |
29 | * http://www.gnu.org/copyleft/gpl.html |
30 | */ |
31 | |
32 | #include <ogdf/uml/PlanarizationLayoutUML.h> |
33 | |
34 | #include "layout_helpers.h" |
35 | |
36 | class PLUMock : public LayoutModule { |
37 | PlanarizationLayoutUML layout; |
38 | |
39 | public: |
40 | virtual void call(GraphAttributes &attr) override { |
41 | const Graph& G = attr.constGraph(); |
42 | GraphCopy copyG(G); |
43 | UMLGraph umlGraph(copyG, attr.attributes()); |
44 | |
45 | layout.call(umlGraph); |
46 | |
47 | for (node v : G.nodes) { |
48 | node w = copyG.copy(v); |
49 | attr.x(v) = umlGraph.x(w); |
50 | attr.y(v) = umlGraph.y(w); |
51 | } |
52 | |
53 | for (edge e : G.edges) { |
54 | attr.bends(e) = umlGraph.bends(copyG.copy(e)); |
55 | } |
56 | } |
57 | }; |
58 | |
59 | go_bandit([] { |
60 | describeLayout<PLUMock>("PlanarizationLayoutUML", GraphAttributes::edgeType | GraphAttributes::nodeType, {GraphProperty::simple, GraphProperty::sparse}, true); |
61 | }); |
62 |