6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
10 * \brief useable example of the Modular Multilevel Mixer
12 * \author Gereon Bartel
15 * This file is part of the Open Graph Drawing Framework (OGDF).
19 * See README.txt in the root directory of the OGDF installation for details.
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
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.
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>
55 MMMExampleNoTwistLayout::MMMExampleNoTwistLayout()
60 void MMMExampleNoTwistLayout::call(GraphAttributes
&GA
)
62 MultilevelGraph
MLG(GA
);
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();
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);
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);