Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / energybased / multilevelmixer / ScalingLayout.h
blob3aecd95a484a90f28d13d341f0552529e7b345a2
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 ScalingLayout scales and calls a secondary layout
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 #ifdef _MSC_VER
44 #pragma once
45 #endif
47 #ifndef OGDF_SCALING_LAYOUT_H
48 #define OGDF_SCALING_LAYOUT_H
50 #include <ogdf/basic/ModuleOption.h>
51 #include <ogdf/module/MultilevelLayoutModule.h>
52 #include <ogdf/energybased/multilevelmixer/ModularMultilevelMixer.h>
53 #include <ogdf/internal/energybased/MultilevelGraph.h>
56 namespace ogdf {
58 /*!\class ScalingLayout ScalingLayout.h "ogdf/energybased/multilevelmixer/ScalingLayout.h"
59 * \brief Scales a Graph relative to the ScalingType.
61 * For use with ModularMultilevelMixer.
63 class OGDF_EXPORT ScalingLayout : public MultilevelLayoutModule
65 public:
66 /*!
67 * \brief To define the relative scale used for a Graph, the ScalingType is applied.
69 enum ScalingType {
70 //! Scales by a factor relative to the drawing.
71 st_relativeToDrawing,
72 /*!
73 * Scales by a factor relative to the avg edge weights
74 * to be used in combination with the fixed edge length
75 * setting in ModularMultilevelMixer.
77 st_relativeToAvgLength,
78 //! Scales by a factor relative to the desired Edgelength m_desEdgeLength.
79 st_relativeToDesiredLength,
80 //! Absolute factor, can be used to scale relative to level size change.
81 st_absolute
84 ScalingLayout();
86 /**
87 * \brief Computes a layout of graph \a GA.
89 * @param GA is the input graph and will also be assigned the layout information.
91 void call(GraphAttributes &GA);
93 /**
94 * \brief Computes a layout of graph \a MLG.
96 * @param MLG is the input graph and will also be assigned the layout information.
98 void call(MultilevelGraph &MLG);
101 * \brief Sets the minimum and the maximum scaling factor.
103 * @param min sets the minimum
104 * @param max sets the maximum
106 void setScaling(double min, double max);
109 * \brief Sets how often the scaling should be repeated.
111 * @param steps is the number of repeats
113 void setExtraScalingSteps(unsigned int steps);
116 * \brief Sets a LayoutModule that should be applied after scaling.
118 * @param layout is the secondary LayoutModule
120 void setSecondaryLayout(LayoutModule* layout);
123 * \brief Is used to compute the scaling relatively to the level size change when ScalingType st_absolute is used.
125 * @param mmm is the ModularMultilevelMixer
127 void setMMM(ModularMultilevelMixer* mmm);
130 * \brief Sets a ScalingType wich sets the relative scale for the Graph
132 * @param type is the ScalingType
134 void setScalingType(ScalingType type);
137 * \brief Sets how often the LayoutModule should be applied.
139 * @param repeats is the number of repeats
141 void setLayoutRepeats(unsigned int repeats);
142 //TODO: only a workaround, this should be retrieved from the layout module
143 //when we have a interface class on top of Layoutmodule that allows this
144 void setDesiredEdgeLength(double eLength);
146 private:
148 // Usually a simple force-directed / energy-based Layout should be chosen.
149 ModuleOption<LayoutModule> m_secondaryLayoutModule;
151 double m_minScaling;
152 double m_maxScaling;
153 ModularMultilevelMixer* m_mmm;//!< Used to derive level size ratio if st_absolute
154 double m_desEdgeLength;
156 // 0 = scale to maxScaling only
157 unsigned int m_extraScalingSteps;
159 unsigned int m_layoutRepeats;
161 ScalingType m_scalingType;
164 } // namespace ogdf
166 #endif