20 #ifndef TULIPVIEWSETTINGS_H
21 #define TULIPVIEWSETTINGS_H
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>
34 class TLP_SCOPE TulipShape {
41 BottomShadowedSphere = 21,
47 CubeOutlinedTransparent = 9,
53 LeftBottomShadowedSphere = 22,
55 RightBottomShadowedSphere = 23,
67 class TLP_SCOPE NodeShape {
71 Billboard = TulipShape::Billboard,
72 BottomShadowedSphere = TulipShape::BottomShadowedSphere,
73 Circle = TulipShape::Circle,
74 Cone = TulipShape::Cone,
75 Cross = TulipShape::Cross,
76 Cube = TulipShape::Cube,
77 CubeOutlined = TulipShape::CubeOutlined,
78 CubeOutlinedTransparent = TulipShape::CubeOutlinedTransparent,
79 Cylinder = TulipShape::Cylinder,
80 Diamond = TulipShape::Diamond,
81 GlowSphere = TulipShape::GlowSphere,
82 HalfCylinder = TulipShape::HalfCylinder,
83 Hexagon = TulipShape::Hexagon,
84 LeftBottomShadowedSphere = TulipShape::LeftBottomShadowedSphere,
85 Pentagon = TulipShape::Pentagon,
86 RightBottomShadowedSphere = TulipShape::RightBottomShadowedSphere,
87 Ring = TulipShape::Ring,
88 RoundedBox = TulipShape::RoundedBox,
89 Sphere = TulipShape::Sphere,
90 Square = TulipShape::Square,
91 Triangle = TulipShape::Triangle,
92 Window = TulipShape::Window,
93 Star = TulipShape::Star,
94 Icon = TulipShape::Icon
97 static bool checkValue(
int v) {
98 return v > -1 && v < 24;
102 class TLP_SCOPE EdgeShape {
105 enum EdgeShapes { Polyline = 0, BezierCurve = 4, CatmullRomCurve = 8, CubicBSplineCurve = 16 };
107 inline bool static checkValue(
int v) {
111 case CatmullRomCurve:
112 case CubicBSplineCurve:
120 class TLP_SCOPE EdgeExtremityShape {
123 enum EdgeExtremityShapes {
124 None = TulipShape::None,
125 Arrow = TulipShape::Arrow,
126 Circle = TulipShape::Circle,
127 Cone = TulipShape::Cone,
128 Cross = TulipShape::Cross,
129 Cube = TulipShape::Cube,
130 CubeOutlinedTransparent = TulipShape::CubeOutlinedTransparent,
131 Cylinder = TulipShape::Cylinder,
132 Diamond = TulipShape::Diamond,
133 GlowSphere = TulipShape::GlowSphere,
134 Hexagon = TulipShape::Hexagon,
135 Pentagon = TulipShape::Pentagon,
136 Ring = TulipShape::Ring,
137 Sphere = TulipShape::Sphere,
138 Square = TulipShape::Square,
139 Star = TulipShape::Star,
140 Icon = TulipShape::Icon
143 inline bool static checkValue(
int v) {
145 case TulipShape::None:
146 case TulipShape::Arrow:
147 case TulipShape::Circle:
148 case TulipShape::Cone:
149 case TulipShape::Cross:
150 case TulipShape::Cube:
151 case TulipShape::CubeOutlinedTransparent:
152 case TulipShape::Cylinder:
153 case TulipShape::Diamond:
154 case TulipShape::GlowSphere:
155 case TulipShape::Hexagon:
156 case TulipShape::Pentagon:
157 case TulipShape::Ring:
158 case TulipShape::Sphere:
159 case TulipShape::Square:
160 case TulipShape::Star:
161 case TulipShape::Icon:
169 class TLP_SCOPE LabelPosition {
172 enum LabelPositions { Center = 0, Top = 1, Bottom = 2, Left = 3, Right = 4 };
174 inline static bool checkValue(
int v) {
175 return v > -1 && v < 4;
180 class TLP_SCOPE TulipViewSettings :
public Observable {
183 typedef std::map<LabelPosition::LabelPositions, std::string> labelmap;
185 static TulipViewSettings &instance();
187 static labelmap POSITION_LABEL_MAP;
190 static void setDefaultColor(
ElementType elem,
const Color &color);
193 static void setDefaultBorderColor(
ElementType elem,
const Color &color);
196 static void setdefaultBorderWidth(
ElementType elem,
float borderWidth);
198 static Color defaultLabelColor();
199 static void setDefaultLabelColor(
const Color &color);
201 static Color defaultLabelBorderColor();
202 static void setDefaultLabelBorderColor(
const Color &color);
204 static float defaultLabelBorderWidth();
205 static void setDefaultLabelBorderWidth(
float borderWidth);
207 static int defaultLabelPosition();
208 static void setDefaultLabelPosition(
int position);
211 static void setDefaultSize(
ElementType elem,
const Size &size);
214 static void setDefaultShape(
ElementType elem,
int shape);
216 static int defaultEdgeExtremitySrcShape();
217 static void setDefaultEdgeExtremitySrcShape(
int shape);
219 static int defaultEdgeExtremityTgtShape();
220 static void setDefaultEdgeExtremityTgtShape(
int shape);
222 static Size defaultEdgeExtremitySrcSize();
223 static void setDefaultEdgeExtremitySrcSize(
const Size &size);
225 static Size defaultEdgeExtremityTgtSize();
226 static void setDefaultEdgeExtremityTgtSize(
const Size &size);
228 static std::string defaultFontFile();
229 static void setDefaultFontFile(
const std::string &fontFile);
231 static int defaultFontSize();
232 static void setDefaultFontSize(
int fontSize);
235 class TLP_SCOPE ViewSettingsEvent :
public tlp::Event {
238 enum ViewSettingsEventType {
239 TLP_DEFAULT_COLOR_MODIFIED,
240 TLP_DEFAULT_SHAPE_MODIFIED,
241 TLP_DEFAULT_SIZE_MODIFIED,
242 TLP_DEFAULT_LABEL_COLOR_MODIFIED
245 ViewSettingsEvent(
ElementType elem,
const Color &color)
246 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
247 _type(TLP_DEFAULT_COLOR_MODIFIED), _elem(elem), _color(color) {}
249 ViewSettingsEvent(
ElementType elem,
const Size &size)
250 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
251 _type(TLP_DEFAULT_SIZE_MODIFIED), _elem(elem), _size(size) {}
254 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
255 _type(TLP_DEFAULT_SHAPE_MODIFIED), _elem(elem), _shape(shape) {}
257 ViewSettingsEvent(
const Color &labelColor)
258 : Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
259 _type(TLP_DEFAULT_LABEL_COLOR_MODIFIED), _color(labelColor) {}
261 ViewSettingsEventType getType()
const {
269 Color getColor()
const {
273 Size getSize()
const {
277 int getShape()
const {
282 ViewSettingsEventType _type;
Event is the base class for all events used in the Observation mechanism.