1 | /** \file |
2 | * \brief Tests for several planar layouts |
3 | * |
4 | * \author Carsten Gutwenger, 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/planarlayout/FPPLayout.h> |
33 | #include <ogdf/planarlayout/MixedModelLayout.h> |
34 | #include <ogdf/planarlayout/PlanarDrawLayout.h> |
35 | #include <ogdf/planarlayout/PlanarStraightLayout.h> |
36 | #include <ogdf/planarlayout/SchnyderLayout.h> |
37 | #include <ogdf/planarity/EmbedderMaxFace.h> |
38 | #include <ogdf/planarity/EmbedderMaxFaceLayers.h> |
39 | #include <ogdf/planarity/EmbedderMinDepth.h> |
40 | #include <ogdf/planarity/EmbedderMinDepthMaxFace.h> |
41 | #include <ogdf/planarity/EmbedderMinDepthMaxFaceLayers.h> |
42 | #include <ogdf/planarity/EmbedderMinDepthPiTa.h> |
43 | #include <ogdf/planarity/EmbedderOptimalFlexDraw.h> |
44 | #include <ogdf/planarity/SimpleEmbedder.h> |
45 | #include <ogdf/planarlayout/TriconnectedShellingOrder.h> |
46 | #include <ogdf/planarlayout/BiconnectedShellingOrder.h> |
47 | |
48 | #include "layout_helpers.h" |
49 | |
50 | template<typename Layout> |
51 | static void (string name, Layout &layout, std::set<GraphProperty> requirements = {}, bool skipMe = false) { |
52 | name += " and " ; |
53 | |
54 | requirements.insert({GraphProperty::planar, GraphProperty::simple}); |
55 | |
56 | layout.setEmbedder(new SimpleEmbedder); |
57 | |
58 | describeLayout(name + "SimpleEmbedder" , layout, 0, requirements, false, GraphSizes(), skipMe); |
59 | |
60 | layout.setEmbedder(new EmbedderMaxFace); |
61 | describeLayout(name + "EmbedderMaxFace" , layout, 0, requirements, false, GraphSizes(), skipMe); |
62 | |
63 | layout.setEmbedder(new EmbedderMaxFaceLayers); |
64 | describeLayout(name + "EmbedderMaxFaceLayers" , layout, 0, requirements, false, GraphSizes(), skipMe); |
65 | |
66 | layout.setEmbedder(new EmbedderMinDepth); |
67 | describeLayout(name + "EmbedderMinDepth" , layout, 0, requirements, false, GraphSizes(), skipMe); |
68 | |
69 | layout.setEmbedder(new EmbedderMinDepthMaxFace); |
70 | describeLayout(name + "EmbedderMinDepthMaxFace" , layout, 0, requirements, false, GraphSizes(), skipMe); |
71 | |
72 | layout.setEmbedder(new EmbedderMinDepthMaxFaceLayers); |
73 | describeLayout(name + "EmbedderMinDepthMaxFaceLayers" , layout, 0, requirements, false, GraphSizes(), skipMe); |
74 | |
75 | // the two embedders below are currently disabled since they cause failures |
76 | |
77 | layout.setEmbedder(new EmbedderMinDepthPiTa); |
78 | describeLayout(name + "EmbedderMinDepthPiTa" , layout, 0, requirements, false, GraphSizes(), true); |
79 | |
80 | layout.setEmbedder(new EmbedderOptimalFlexDraw); |
81 | describeLayout(name + "EmbedderOptimalFlexDraw" , layout, 0, requirements, false, GraphSizes(), true); |
82 | } |
83 | |
84 | template<typename Layout> |
85 | static void describePlanarLayout(string name, std::set<GraphProperty> requirements = {}) { |
86 | Layout layout; |
87 | name += " with " ; |
88 | |
89 | layout.setShellingOrder(new BiconnectedShellingOrder); |
90 | describeForAllEmbedders(name + "BiconnectedShellingOrder" , layout, requirements); |
91 | |
92 | requirements.insert(GraphProperty::triconnected); |
93 | layout.setShellingOrder(new TriconnectedShellingOrder); |
94 | describeForAllEmbedders(name + "TriconnectedShellingOrder" , layout, requirements); |
95 | } |
96 | |
97 | go_bandit([] { describe("Planar layouts" , [] { |
98 | describePlanarLayout<PlanarStraightLayout>("PlanarStraightLayout" ); |
99 | describePlanarLayout<PlanarDrawLayout>("PlanarDrawLayout" ); |
100 | |
101 | describePlanarLayout<MixedModelLayout>("MixedModelLayout" , {GraphProperty::connected}); |
102 | |
103 | describeLayout<FPPLayout>("FPPLayout" , 0, {GraphProperty::planar, GraphProperty::simple, GraphProperty::connected}, false, GraphSizes()); |
104 | |
105 | describeLayout<SchnyderLayout>("SchnyderLayout" , 0, {GraphProperty::planar, GraphProperty::simple, GraphProperty::connected}, false, GraphSizes()); |
106 | }); }); |
107 | |