Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
TulipViewSettings.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
4 *
5 * Authors: David Auber and the Tulip development Team
6 * from LaBRI, University of Bordeaux
7 *
8 * Tulip is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * Tulip is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 */
19
20#ifndef TULIPVIEWSETTINGS_H
21#define TULIPVIEWSETTINGS_H
22
23#include <tulip/tulipconf.h>
24#include <tulip/Color.h>
25#include <tulip/Size.h>
26#include <tulip/Graph.h>
27#include <tulip/Observable.h>
28
29#include <string>
30#include <map>
31
32namespace tlp {
33
34class TLP_SCOPE NodeShape {
35
36public:
37 enum NodeShapes {
38 Billboard = 7,
39 BottomShadowedSphere = 21,
40 Circle = 14,
41 Cone = 3,
42 Cross = 8,
43 Cube = 0,
44 CubeOutlined = 1,
45 CubeOutlinedTransparent = 9,
46 Cylinder = 6,
47 Diamond = 5,
48 GlowSphere = 16,
49 HalfCylinder = 10,
50 Hexagon = 13,
51 LeftBottomShadowedSphere = 22,
52 Pentagon = 12,
53 RightBottomShadowedSphere = 23,
54 Ring = 15,
55 RoundedBox = 18,
56 Sphere = 2,
57 Square = 4,
58 Triangle = 11,
59 Window = 17,
60 Star = 19,
61 FontAwesomeIcon = 20,
62 Icon = 20
63 };
64};
65
66class TLP_SCOPE EdgeShape {
67
68public:
69 enum EdgeShapes { Polyline = 0, BezierCurve = 4, CatmullRomCurve = 8, CubicBSplineCurve = 16 };
70};
71
72class TLP_SCOPE EdgeExtremityShape {
73
74public:
75 enum EdgeExtremityShapes {
76 None = -1,
77 Arrow = 50,
78 Circle = 14,
79 Cone = 3,
80 Cross = 8,
81 Cube = 0,
82 CubeOutlinedTransparent = 9,
83 Cylinder = 6,
84 Diamond = 5,
85 GlowSphere = 16,
86 Hexagon = 13,
87 Pentagon = 12,
88 Ring = 15,
89 Sphere = 2,
90 Square = 4,
91 Star = 19,
92 FontAwesomeIcon = 20,
93 Icon = 20
94 };
95};
96
97class TLP_SCOPE LabelPosition {
98
99public:
100 enum LabelPositions { Center = 0, Top, Bottom, Left, Right };
101};
102
103///@cond DOXYGEN_HIDDEN
104class TLP_SCOPE TulipViewSettings : public Observable {
105
106public:
107 typedef std::map<LabelPosition::LabelPositions, std::string> labelmap;
108
109 static TulipViewSettings &instance();
110
111 static labelmap POSITION_LABEL_MAP;
112
113 static Color defaultColor(ElementType elem);
114 static void setDefaultColor(ElementType elem, const Color &color);
115
116 static Color defaultBorderColor(ElementType elem);
117 static void setDefaultBorderColor(ElementType elem, const Color &color);
118
119 static float defaultBorderWidth(ElementType elem);
120 static void setdefaultBorderWidth(ElementType elem, float borderWidth);
121
122 static Color defaultLabelColor();
123 static void setDefaultLabelColor(const Color &color);
124
125 static Color defaultLabelBorderColor();
126 static void setDefaultLabelBorderColor(const Color &color);
127
128 static float defaultLabelBorderWidth();
129 static void setDefaultLabelBorderWidth(float borderWidth);
130
131 static int defaultLabelPosition();
132 static void setDefaultLabelPosition(int position);
133
134 static Size defaultSize(ElementType elem);
135 static void setDefaultSize(ElementType elem, const Size &size);
136
137 static int defaultShape(ElementType elem);
138 static void setDefaultShape(ElementType elem, int shape);
139
140 static int defaultEdgeExtremitySrcShape();
141 static void setDefaultEdgeExtremitySrcShape(int shape);
142
143 static int defaultEdgeExtremityTgtShape();
144 static void setDefaultEdgeExtremityTgtShape(int shape);
145
146 static Size defaultEdgeExtremitySrcSize();
147 static void setDefaultEdgeExtremitySrcSize(const Size &size);
148
149 static Size defaultEdgeExtremityTgtSize();
150 static void setDefaultEdgeExtremityTgtSize(const Size &size);
151
152 static std::string defaultFontFile();
153 static void setDefaultFontFile(const std::string &fontFile);
154
155 static int defaultFontSize();
156 static void setDefaultFontSize(int fontSize);
157};
158
159class TLP_SCOPE ViewSettingsEvent : public tlp::Event {
160
161public:
162 enum ViewSettingsEventType {
163 TLP_DEFAULT_COLOR_MODIFIED,
164 TLP_DEFAULT_SHAPE_MODIFIED,
165 TLP_DEFAULT_SIZE_MODIFIED,
166 TLP_DEFAULT_LABEL_COLOR_MODIFIED
167 };
168
169 ViewSettingsEvent(ElementType elem, const Color &color)
170 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
171 _type(TLP_DEFAULT_COLOR_MODIFIED), _elem(elem), _color(color) {}
172
173 ViewSettingsEvent(ElementType elem, const Size &size)
174 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
175 _type(TLP_DEFAULT_SIZE_MODIFIED), _elem(elem), _size(size) {}
176
177 ViewSettingsEvent(ElementType elem, int shape)
178 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
179 _type(TLP_DEFAULT_SHAPE_MODIFIED), _elem(elem), _shape(shape) {}
180
181 ViewSettingsEvent(const Color &labelColor)
182 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
183 _type(TLP_DEFAULT_LABEL_COLOR_MODIFIED), _color(labelColor) {}
184
185 ViewSettingsEventType getType() const {
186 return _type;
187 }
188
189 ElementType getElementType() const {
190 return _elem;
191 }
192
193 Color getColor() const {
194 return _color;
195 }
196
197 Size getSize() const {
198 return _size;
199 }
200
201 int getShape() const {
202 return _shape;
203 }
204
205private:
206 ViewSettingsEventType _type;
207 ElementType _elem;
208 Color _color;
209 Size _size;
210 int _shape;
211};
212///@endcond
213} // namespace tlp
214
215#endif // TULIPVIEWSETTINGS_H
Event is the base class for all events used in the Observation mechanism.
Definition: Observable.h:52
ElementType
Definition: Graph.h:50