1/** \file
2 * \brief Declaration of ogdf::SpringEmbedderGridVariant.
3 *
4 * \author Carsten Gutwenger
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#pragma once
33
34#include <ogdf/energybased/spring_embedder/SpringEmbedderBase.h>
35#include <ogdf/basic/Array2D.h>
36#include <ogdf/energybased/SpringForceModel.h>
37#include <ogdf/basic/GraphCopyAttributes.h>
38
39namespace ogdf {
40
41//! The spring-embedder layout algorithm with force approximation using hte grid variant approach.
42/**
43 * @ingroup gd-energy
44 *
45 * The implementation used in SpringEmbedderGridVariant is based on
46 * the following publication:
47 *
48 * Thomas M. J. Fruchterman, Edward M. Reingold: <i>%Graph Drawing by Force-directed
49 * Placement</i>. Software - Practice and Experience 21(11), pp. 1129-1164, 1991.
50 *
51 * <H3>Optional parameters</H3>
52 * Fruchterman/Reingold layout provides the following optional parameters.
53 *
54 * <table>
55 * <tr>
56 * <th><i>Option</i><th><i>Type</i><th><i>Default</i><th><i>Description</i>
57 * </tr><tr>
58 * <td><i>iterations</i><td>int<td>400
59 * <td>The number of iterations performed in the optimization.
60 * </tr><tr>
61 * <td><i>noise</i><td>bool<td>true
62 * <td>If set to true, (small) random perturbations are performed.
63 * </tr><tr>
64 * <td><i>minDistCC</i><td>double<td>20.0
65 * <td>The minimum distance between connected components.
66 * </tr><tr>
67 * <td><i>pageRatio</i><td>double<td>1.0
68 * <td>The page ratio.
69 * </tr><tr>
70 * <td><i>scaling</i><td> #Scaling <td> Scaling::scaleFunction
71 * <td>The scaling method for scaling the inital layout.
72 * </tr><tr>
73 * <td><i>scaleFunctionFactor</i><td>double<td>8.0
74 * <td>The scale function factor (used if scaling = scaleFunction).
75 * </tr><tr>
76 * <td><i>userBoundingBox</i><td>rectangle<td>(0.0,100.0,0.0,100.0)
77 * <td>The user bounding box for scaling (used if scaling = scUserBoundingBox).
78 * </tr>
79 * </table>
80 */
81class OGDF_EXPORT SpringEmbedderGridVariant : public spring_embedder::SpringEmbedderBase
82{
83public:
84 SpringEmbedderGridVariant() {
85 m_forceLimitStep = .5;
86 }
87
88protected:
89 void callMaster(const GraphCopy& copy, GraphAttributes& attr, DPoint& box) override;
90
91private:
92 struct NodeInfo
93 {
94 DPoint m_pos;
95
96 int m_adjBegin;
97 int m_adjStop;
98
99 int m_gridX;
100 int m_gridY;
101
102 ListIterator<int> m_lit;
103 };
104
105 class ForceModelBase;
106 class ForceModelFR;
107 class ForceModelFRModAttr;
108 class ForceModelFRModRep;
109 class ForceModelEades;
110 class ForceModelHachul;
111 class ForceModelGronemann;
112
113 class Master;
114 class Worker;
115};
116
117}
118