Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / src / energybased / multilevelmixer / MMMExampleNoTwistLayout.cpp
blobafef8dda22997258cc7579e0d26500c2415cbcec
1 /*
2 * $Revision: 2523 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief useable example of the Modular Multilevel Mixer
12 * \author Gereon Bartel
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 #include <ogdf/energybased/multilevelmixer/MMMExampleNoTwistLayout.h>
44 #include <ogdf/basic/PreprocessorLayout.h>
45 #include <ogdf/packing/ComponentSplitterLayout.h>
46 #include <ogdf/energybased/multilevelmixer/ModularMultilevelMixer.h>
47 #include <ogdf/energybased/multilevelmixer/ScalingLayout.h>
48 #include <ogdf/energybased/FastMultipoleEmbedder.h>
50 #include <ogdf/energybased/multilevelmixer/LocalBiconnectedMerger.h>
51 #include <ogdf/energybased/multilevelmixer/BarycenterPlacer.h>
53 namespace ogdf {
55 MMMExampleNoTwistLayout::MMMExampleNoTwistLayout()
60 void MMMExampleNoTwistLayout::call(GraphAttributes &GA)
62 MultilevelGraph MLG(GA);
63 call(MLG);
64 MLG.exportAttributes(GA);
68 void MMMExampleNoTwistLayout::call(MultilevelGraph &MLG)
70 // Fast Multipole Embedder
71 FastMultipoleEmbedder * FME = new FastMultipoleEmbedder();
72 FME->setNumIterations(1000);
73 FME->setRandomize(false);
75 // Local Biconnected Merger
76 LocalBiconnectedMerger * LBCM = new LocalBiconnectedMerger();
77 LBCM->setFactor(2.0);
78 LBCM->setEdgeLengthAdjustment(0); // BEFORE (but arg is int!): LBCM->setEdgeLengthAdjustment(0.1);
80 // Barycenter Placer with weighted Positions
81 BarycenterPlacer * BP = new BarycenterPlacer();
82 BP->weightedPositionPriority(true);
84 // No Scaling
85 ScalingLayout *SL = new ScalingLayout();
86 SL->setExtraScalingSteps(1);
87 SL->setScaling(5.0, 10.0);
88 SL->setScalingType(ScalingLayout::st_relativeToDesiredLength);
89 SL->setSecondaryLayout(FME);
90 SL->setLayoutRepeats(1);
92 ModularMultilevelMixer *MMM = new ModularMultilevelMixer;
93 MMM->setLayoutRepeats(1);
94 // MMM->setAllEdgeLenghts(5.0);
95 // MMM->setAllNodeSizes(1.0);
96 MMM->setLevelLayoutModule(SL);
97 MMM->setInitialPlacer(BP);
98 MMM->setMultilevelBuilder(LBCM);
100 ComponentSplitterLayout *CS = new ComponentSplitterLayout;
101 CS->setLayoutModule(MMM);
102 PreprocessorLayout PPL;
103 PPL.setLayoutModule(CS);
104 PPL.setRandomizePositions(true);
106 PPL.call(MLG);
109 } // namespace ogdf