1 | /** \file |
2 | * \brief Tests for planarization 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/planarity/PlanarizationLayout.h> |
33 | #include <ogdf/planarity/PlanarizationGridLayout.h> |
34 | #include <ogdf/planarity/SubgraphPlanarizer.h> |
35 | #include <ogdf/planarity/PlanarSubgraphFast.h> |
36 | #include <ogdf/planarity/VariableEmbeddingInserter.h> |
37 | #include <ogdf/planarity/FixedEmbeddingInserter.h> |
38 | #include <ogdf/planarlayout/MixedModelLayout.h> |
39 | #include <ogdf/planarlayout/MMCBLocalStretch.h> |
40 | |
41 | #include "layout_helpers.h" |
42 | |
43 | go_bandit([] { describe("Planarization layouts" , [] { |
44 | PlanarizationLayout pl, plFixed; |
45 | PlanarizationGridLayout pgl, pglMM; |
46 | |
47 | VariableEmbeddingInserter *pVarInserter = new VariableEmbeddingInserter; |
48 | FixedEmbeddingInserter *pFixInserter = new FixedEmbeddingInserter; |
49 | |
50 | SubgraphPlanarizer *pCrossMin = new SubgraphPlanarizer; |
51 | pCrossMin->setSubgraph(new PlanarSubgraphFast<int>); |
52 | pCrossMin->setInserter(pVarInserter); |
53 | pCrossMin->permutations(4); |
54 | |
55 | pl.setCrossMin(pCrossMin->clone()); |
56 | pgl.setCrossMin(pCrossMin->clone()); |
57 | pglMM.setCrossMin(pCrossMin->clone()); |
58 | |
59 | pCrossMin->setInserter(pFixInserter); |
60 | pCrossMin->permutations(1); |
61 | plFixed.setCrossMin(pCrossMin); |
62 | |
63 | MixedModelLayout *pMml = new MixedModelLayout; |
64 | pMml->setCrossingsBeautifier(new MMCBLocalStretch); |
65 | pglMM.setPlanarLayouter(pMml); |
66 | |
67 | GraphSizes smallSizes = GraphSizes(16, 48, 16); |
68 | |
69 | describeLayout("PlanarizationLayout" , pl, GraphAttributes::edgeType | GraphAttributes::nodeType, {GraphProperty::simple, GraphProperty::sparse}, true, smallSizes); |
70 | describeLayout("PlanarizationLayout with fixed inserter" , plFixed, GraphAttributes::edgeType | GraphAttributes::nodeType, {GraphProperty::simple, GraphProperty::sparse}, true, smallSizes); |
71 | |
72 | describeLayout("PlanarizationGridLayout" , pgl, 0, {GraphProperty::simple, GraphProperty::sparse}, true, smallSizes); |
73 | describeLayout("PlanarizationGridLayout with mixed model" , pglMM, 0, {GraphProperty::simple, GraphProperty::sparse}, true, smallSizes); |
74 | }); }); |
75 | |