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/MMMExampleNiceLayout.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/EdgeCoverMerger.h>
51 #include <ogdf/energybased/multilevelmixer/BarycenterPlacer.h>
55 MMMExampleNiceLayout::MMMExampleNiceLayout()
60 void MMMExampleNiceLayout::call(GraphAttributes
&GA
)
62 MultilevelGraph
MLG(GA
);
64 MLG
.exportAttributes(GA
);
68 void MMMExampleNiceLayout::call(MultilevelGraph
&MLG
)
70 // Fast Multipole Embedder
71 FastMultipoleEmbedder
* FME
= new FastMultipoleEmbedder();
72 FME
->setNumIterations(1000);
73 FME
->setRandomize(false);
75 // Fast Edges Only Embedder
76 FastMultipoleEmbedder
* FEOE
= new FastMultipoleEmbedder();
77 FEOE
->setNumIterations(0);
78 FEOE
->setRandomize(false);
81 EdgeCoverMerger
* ECM
= new EdgeCoverMerger();
83 ECM
->setEdgeLengthAdjustment(0); // BEFORE (but arg is int!): ECM->setEdgeLengthAdjustment(0.1);
85 // Barycenter Placer with weighted Positions
86 BarycenterPlacer
* BP
= new BarycenterPlacer();
87 BP
->weightedPositionPriority(true);
90 ScalingLayout
* SL
= new ScalingLayout();
91 SL
->setExtraScalingSteps(0);
92 SL
->setScaling(1.0, 1.0);
93 SL
->setScalingType(ScalingLayout::st_relativeToDrawing
);
94 SL
->setSecondaryLayout(FME
);
95 SL
->setLayoutRepeats(1);
97 ModularMultilevelMixer
*MMM
= new ModularMultilevelMixer
;
98 MMM
->setLayoutRepeats(1);
99 // MMM->setAllEdgeLenghts(5.0);
100 // MMM->setAllNodeSizes(1.0);
101 MMM
->setLevelLayoutModule(SL
);
102 MMM
->setInitialPlacer(BP
);
103 MMM
->setMultilevelBuilder(ECM
);
105 ComponentSplitterLayout
*CS
= new ComponentSplitterLayout
;
106 CS
->setLayoutModule(MMM
);
107 PreprocessorLayout PPL
;
108 PPL
.setLayoutModule(CS
);
109 PPL
.setRandomizePositions(true);