Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
GlGraphRenderingParameters.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 Tulip_GLGRAPHRENDERINGPARAMETERS_H
21#define Tulip_GLGRAPHRENDERINGPARAMETERS_H
22
23#include <tulip/Color.h>
24#include <tulip/DataSet.h>
25#include <tulip/tulipconf.h>
26
27namespace tlp {
28
29class NumericProperty;
30class BooleanProperty;
31
32/**
33 * @ingroup OpenGL
34 * @brief That class defines all the parameters used by GlGraphComposite to render a graph
35 *
36 * @see GlGraphComposite
37 */
38class TLP_GL_SCOPE GlGraphRenderingParameters {
39
40public:
41 /**
42 * @brief Constructor
43 */
45
46 /**
47 * @brief Get parameters into a DataSet structure
48 */
50
51 /**
52 * @brief Set parameters with a DataSet structure
53 */
54 void setParameters(const DataSet &);
55
56 /**
57 * @brief activate or deactivate anlialiasing
58 */
59 void setAntialiasing(const bool state);
60
61 /**
62 * @brief Return true if antialiasing is activated else false.
63 */
64 bool isAntialiased() const;
65
66 /**
67 * @brief Activate or deactivate displaying of arrows along the graph's edges.
68 */
69 void setViewArrow(const bool state);
70
71 /**
72 * @brief Return true if arrows drawing is activated else false.
73 */
74 bool isViewArrow() const;
75
76 /**
77 * @brief Activate or deactivate displaying of labels on nodes.
78 */
79 void setViewNodeLabel(const bool state);
80
81 /**
82 * @brief Return true if drawing of nodes' labels is activated.
83 */
84 bool isViewNodeLabel() const;
85 /**
86 * @brief Activate or deactivate displaying of labels on nodes.
87 */
88 void setViewEdgeLabel(const bool state);
89
90 /**
91 * @brief Return true if drawing of nodes' labels is activated.
92 */
93 bool isViewEdgeLabel() const;
94
95 /**
96 * @brief Activate or deactivate displaying of labels outside the screen.
97 */
98 void setViewOutScreenLabel(const bool state);
99
100 /**
101 * @brief Return true if drawing of outscreen labels is activated.
102 */
104
105 /**
106 * @brief Activate or deactivate interpolation of nodes colors along edge
107 */
108 void setEdgeColorInterpolate(const bool state);
109
110 /**
111 * @brief Return true if color interpolation is activated
112 */
114
115 /**
116 * @brief Activate or deactivate interpolation of nodes colors along edge
117 */
118 void setEdgeSizeInterpolate(const bool state);
119
120 /**
121 * @brief Return true if color interpolation is activated
122 */
124
125 /**
126 * @brief Activate or deactivate edge display in front of the scene
127 */
128 void setEdgeFrontDisplay(const bool state);
129
130 /**
131 * @brief Return true if edge display in front of the scene is activated
132 */
133 bool isEdgeFrontDisplay() const;
134
135 /**
136 * @brief Return the type of fonts used in the renderer(0=3D,1=bitmap,2=texture)
137 */
138 unsigned int getFontsType() const;
139
140 /**
141 * @brief Set fonts type used in the renderer (0=3D,1=bitmap,2=texture)
142 */
143 void setFontsType(unsigned int type);
144
145 /**
146 * @brief Set the path for the texture loading
147 */
148 void setTexturePath(const std::string &path);
149
150 /**
151 * @brief Return the absolute path used for texture loading
152 */
153 std::string getTexturePath() const;
154
155 /**
156 * @brief Set the absolute path used for the fonts loading
157 */
158 void setFontsPath(const std::string &path);
159
160 /**
161 * @brief Return the absolute path used for the fonts loading
162 */
163 std::string getFontsPath() const;
164
165 /**
166 * @brief If true and if labels are activated label inside meta nodes will be displayed
167 */
168 void setViewMetaLabel(const bool state);
169
170 /**
171 * @brief Return the true if viewMetaLabels is enable else false
172 */
173 bool isViewMetaLabel() const;
174
175 /**
176 * @brief If true edges are displayed.
177 */
178 void setDisplayEdges(const bool state);
179
180 /**
181 * @brief Return true if edges are displayed.
182 */
183 bool isDisplayEdges() const;
184
185 /**
186 * @brief If true nodes are displayed.
187 */
188 void setDisplayNodes(const bool state);
189
190 /**
191 * @brief Return true if nodes are displayed.
192 */
193 bool isDisplayNodes() const;
194
195 /**
196 * @brief If true meta-nodes are displayed.
197 */
198 void setDisplayMetaNodes(const bool state);
199
200 /**
201 * @brief Return true if meta-nodes are displayed.
202 */
203 bool isDisplayMetaNodes() const;
204
205 /**
206 * @brief set stencil number for selected nodes
207 *
208 * Stencil is an OpenGl system to ensure that other entity can't be displayed above this entity.
209 * It's a "guaranteed visibility" system.
210 * A small number causes a guaranteed visibility
211 * Default value in Tulip is 0xFFFF (greater integer)
212 * And when we have stencil on entity value is 0x2
213 */
214 void setSelectedNodesStencil(const int stencil);
215
216 /**
217 * @brief get stencil number for selected nodes
218 */
220
221 /**
222 * @brief set stencil number for selected meta-nodes
223 *
224 * See setSelectedNodesStencil() documentation for more details on stencil number
225 */
226 void setSelectedMetaNodesStencil(const int stencil);
227
228 /**
229 * @brief get stencil number for selected meta-nodes
230 */
232
233 /**
234 * @brief set stencil number for selected edges
235 *
236 * See setSelectedNodesStencil() documentation for more details on stencil number
237 */
238 void setSelectedEdgesStencil(const int stencil);
239
240 /**
241 * @brief get stencil number for selected edges
242 */
244
245 /**
246 * @brief set stencil number for nodes
247 *
248 * See setSelectedNodesStencil() documentation for more details on stencil number
249 */
250 void setNodesStencil(const int stencil);
251
252 /**
253 * @brief get stencil number for nodes
254 */
255 int getNodesStencil() const;
256
257 /**
258 * @brief set stencil number for meta-nodes
259 *
260 * See setSelectedNodesStencil() documentation for more details on stencil number
261 */
262 void setMetaNodesStencil(const int stencil);
263
264 /**
265 * @brief get stencil number for meta-nodes
266 */
268
269 /**
270 * @brief set stencil number for edges
271 *
272 * See setSelectedNodesStencil() documentation for more details on stencil number
273 */
274 void setEdgesStencil(const int stencil);
275
276 /**
277 * @brief get stencil number for edges
278 */
279 int getEdgesStencil() const;
280
281 /**
282 * @brief set stencil number for nodes label
283 *
284 * See setSelectedNodesStencil() documentation for more details on stencil number
285 */
286 void setNodesLabelStencil(const int stencil);
287
288 /**
289 * @brief get stencil number for nodes label
290 */
292
293 /**
294 * @brief set stencil number for meta-nodes label
295 *
296 * See setSelectedNodesStencil() documentation for more details on stencil number
297 */
298 void setMetaNodesLabelStencil(const int stencil);
299
300 /**
301 * @brief get stencil number for meta-nodes label
302 */
304
305 /**
306 * @brief set stencil number for edges label
307 *
308 * See setSelectedNodesStencil() documentation for more details on stencil number
309 */
310 void setEdgesLabelStencil(const int stencil);
311
312 /**
313 * @brief get stencil number for edges label
314 */
316
317 /**
318 * @brief If true node and edges are ordered according to the element ordering property (default
319 * to viewMetric)
320 */
321 void setElementOrdered(const bool state);
322
323 /**
324 * @brief Returns true if element ordering is activated
325 */
326 bool isElementOrdered() const;
327
328 /**
329 * @brief If true (default value) nodes and edges are sorted in descending order according to the
330 * element ordering property (default to viewMetric)
331 *
332 * @since Tulip 4.8
333 */
334 void setElementOrderedDescending(const bool state);
335
336 /**
337 * @brief Returns true if the nodes and edges are sorted in descending order when the element
338 * ordering is activated
339 *
340 * @since Tulip 4.8
341 */
343
344 /**
345 * @brief Defines which property is used for the element ordering.
346 *
347 * @param property The property to use to order the elements.
348 *
349 **/
351
352 /**
353 * @brief Gets the property used for element ordering. Setting it to nullptr will use viewMetric
354 *if
355 *the ordering is enabled.
356 *
357 * @return :NumericProperty* The Property currently used.
358 **/
360
361 /**
362 * @brief If true node and edges are ordered according to the distance with camera
363 */
364 void setElementZOrdered(const bool state);
365
366 /**
367 * @brief return true if element Z ordering is activated
368 */
369 bool isElementZOrdered() const;
370
371 /**
372 * @brief if true use 3D displaying of edges instead of 2D lines on ALL edges
373 */
374 void setEdge3D(const bool state);
375
376 /**
377 * @brief return true if 3D drawing of edges is activated
378 */
379 bool isEdge3D() const;
380
381 /**
382 * @brief set if Edge max size is block to node size
383 */
384 void setEdgesMaxSizeToNodesSize(const bool b);
385
386 /**
387 * @brief return if Edge max size is block to node size
388 */
390
391 /**
392 * @brief Change the selection color
393 */
394 void setSelectionColor(const Color &color);
395
396 /**
397 * @brief return the selection color
398 */
399 Color getSelectionColor() const;
400
401 /**
402 * @brief return if labels are scaled to node size
403 */
404 bool isLabelScaled() const;
405
406 /**
407 * Set if labels are scaled to node size
408 */
409 void setLabelScaled(bool state);
410
411 /**
412 * @brief return if labels are rendered with a fixed font size (dynamic size otherwise)
413 */
415
416 /**
417 * Set if labels must be rendered with a fixed font size (dynamic size otherwise)
418 */
419 void setLabelFixedFontSize(bool state);
420
421 /**
422 * @brief Return labels -density
423 *
424 * This density must be in interval -100 100
425 * -100 : No labels
426 * 0 : No overlap
427 * 100 : All labels
428 */
429 int getLabelsDensity() const;
430
431 /**
432 * @brief Set labels density
433 *
434 * This density must be in interval -100 100
435 * -100 : No labels
436 * 0 : No overlap
437 * 100 : All labels
438 */
439 void setLabelsDensity(int density);
440
441 /**
442 * @brief return min size of label : this min size is only used if labels are not scaled and are
443 * not rendered with a fixed font size
444 */
445 int getMinSizeOfLabel() const;
446
447 /**
448 * @brief Set min size of label : this min size is only used if labels are not scaled and are not
449 * rendered with a fixed font size
450 */
451 void setMinSizeOfLabel(int size);
452
453 /**
454 * @brief return max size of label : this max size is only used if labels are not scaled and are
455 * not rendered with a fixed font size
456 */
457 int getMaxSizeOfLabel() const;
458
459 /**
460 * @brief Set max size of label : this max size is only used if labels are not scaled and are not
461 * rendered with a fixed font size
462 */
463 void setMaxSizeOfLabel(int size);
464
465 /**
466 * @brief return if labels are billboarded
467 */
469 return _labelsAreBillboarded;
470 }
471
472 /**
473 * @brief Set if labels are billboarded
474 */
475 void setLabelsAreBillboarded(bool billboarded) {
476 _labelsAreBillboarded = billboarded;
477 }
478
479 /**
480 * @brief This property is use to filter nodes/edges rendering. If this property is
481 * false, the node/edge will be rendered and displayed.
482 *
483 * @Warning : this property will not be saved in DataSet
484 */
486 _displayFilteringProperty = filteringProperty;
487 }
488
489 /**
490 * @brief Get the Boolean property use to filter the rendering of nodes/edges
491 */
493 return _displayFilteringProperty;
494 }
495
496private:
497 bool _antialiased;
498 bool _viewArrow;
499 bool _viewNodeLabel;
500 bool _viewEdgeLabel;
501 bool _viewMetaLabel;
502 bool _viewOutScreenLabel;
503 bool _elementOrdered;
504 bool _elementOrderedDescending;
505 bool _edgeColorInterpolate;
506 bool _edge3D;
507 bool _edgeSizeInterpolate;
508 bool _edgeFrontDisplay;
509 bool _displayEdges;
510 bool _displayNodes;
511 bool _displayMetaNodes;
512 bool _elementZOrdered;
513 int _selectedNodesStencil;
514 int _selectedMetaNodesStencil;
515 int _selectedEdgesStencil;
516 int _nodesStencil;
517 int _metaNodesStencil;
518 int _edgesStencil;
519 int _nodesLabelStencil;
520 int _metaNodesLabelStencil;
521 int _edgesLabelStencil;
522 bool _labelScaled;
523 bool _labelFixedFontSize;
524 int _labelMinSize;
525 int _labelMaxSize;
526 int _labelsDensity;
527 bool _labelsAreBillboarded;
528 std::string _fontsPath;
529 std::string _texturePath;
530 bool _edgesMaxSizeToNodesSize;
531 Color _selectionColor;
532 BooleanProperty *_displayFilteringProperty;
533 NumericProperty *_elementOrderingProperty;
534};
535
536///@cond DOXYGEN_HIDDEN
537/** \brief Class to get the default selection color
538 */
539class TLP_GL_SCOPE GlDefaultSelectionColorManager {
540public:
541 static void setManager(GlDefaultSelectionColorManager *);
542 static tlp::Color getDefaultSelectionColor();
543 virtual tlp::Color defaultSelectionColor(bool tulipDefault = false) = 0;
544
545private:
546 static GlDefaultSelectionColorManager *manager;
547};
548
549///@endcond
550
551} // namespace tlp
552
553#endif // Tulip_GLGRAPH_H
A graph property that maps a Boolean value to graph elements.
A container that can store data from any type.
Definition: DataSet.h:195
That class defines all the parameters used by GlGraphComposite to render a graph.
void setEdgesLabelStencil(const int stencil)
set stencil number for edges label
void setLabelsDensity(int density)
Set labels density.
void setMetaNodesLabelStencil(const int stencil)
set stencil number for meta-nodes label
void setFontsType(unsigned int type)
Set fonts type used in the renderer (0=3D,1=bitmap,2=texture)
void setNodesLabelStencil(const int stencil)
set stencil number for nodes label
void setMaxSizeOfLabel(int size)
Set max size of label : this max size is only used if labels are not scaled and are not rendered with...
unsigned int getFontsType() const
Return the type of fonts used in the renderer(0=3D,1=bitmap,2=texture)
int getLabelsDensity() const
Return labels -density.
BooleanProperty * getDisplayFilteringProperty() const
Get the Boolean property use to filter the rendering of nodes/edges.
void setEdge3D(const bool state)
if true use 3D displaying of edges instead of 2D lines on ALL edges
void setMetaNodesStencil(const int stencil)
set stencil number for meta-nodes
void setLabelsAreBillboarded(bool billboarded)
Set if labels are billboarded.
void setElementOrderingProperty(tlp::NumericProperty *property)
Defines which property is used for the element ordering.
bool isLabelScaled() const
return if labels are scaled to node size
void setSelectedNodesStencil(const int stencil)
set stencil number for selected nodes
void setElementZOrdered(const bool state)
If true node and edges are ordered according to the distance with camera.
int getMaxSizeOfLabel() const
return max size of label : this max size is only used if labels are not scaled and are not rendered w...
void setParameters(const DataSet &)
Set parameters with a DataSet structure.
void setSelectedMetaNodesStencil(const int stencil)
set stencil number for selected meta-nodes
bool isLabelFixedFontSize() const
return if labels are rendered with a fixed font size (dynamic size otherwise)
void setTexturePath(const std::string &path)
Set the path for the texture loading.
int getMetaNodesLabelStencil() const
get stencil number for meta-nodes label
bool isEdgeColorInterpolate() const
Return true if color interpolation is activated.
void setSelectedEdgesStencil(const int stencil)
set stencil number for selected edges
void setViewMetaLabel(const bool state)
If true and if labels are activated label inside meta nodes will be displayed.
bool isViewNodeLabel() const
Return true if drawing of nodes' labels is activated.
bool isDisplayEdges() const
Return true if edges are displayed.
void setViewArrow(const bool state)
Activate or deactivate displaying of arrows along the graph's edges.
int getSelectedNodesStencil() const
get stencil number for selected nodes
bool isElementZOrdered() const
return true if element Z ordering is activated
void setDisplayNodes(const bool state)
If true nodes are displayed.
void setMinSizeOfLabel(int size)
Set min size of label : this min size is only used if labels are not scaled and are not rendered with...
void setElementOrdered(const bool state)
If true node and edges are ordered according to the element ordering property (default to viewMetric)
bool isViewMetaLabel() const
Return the true if viewMetaLabels is enable else false.
void setDisplayEdges(const bool state)
If true edges are displayed.
bool isDisplayNodes() const
Return true if nodes are displayed.
void setViewEdgeLabel(const bool state)
Activate or deactivate displaying of labels on nodes.
void setEdgesStencil(const int stencil)
set stencil number for edges
void setSelectionColor(const Color &color)
Change the selection color.
bool isElementOrderedDescending() const
Returns true if the nodes and edges are sorted in descending order when the element ordering is activ...
void setViewOutScreenLabel(const bool state)
Activate or deactivate displaying of labels outside the screen.
Color getSelectionColor() const
return the selection color
int getMetaNodesStencil() const
get stencil number for meta-nodes
void setElementOrderedDescending(const bool state)
If true (default value) nodes and edges are sorted in descending order according to the element order...
void setDisplayFilteringProperty(BooleanProperty *filteringProperty)
This property is use to filter nodes/edges rendering. If this property is false, the node/edge will b...
int getSelectedMetaNodesStencil() const
get stencil number for selected meta-nodes
bool isEdgeSizeInterpolate() const
Return true if color interpolation is activated.
void setAntialiasing(const bool state)
activate or deactivate anlialiasing
bool isViewOutScreenLabel() const
Return true if drawing of outscreen labels is activated.
bool getEdgesMaxSizeToNodesSize() const
return if Edge max size is block to node size
int getNodesStencil() const
get stencil number for nodes
bool isAntialiased() const
Return true if antialiasing is activated else false.
void setLabelFixedFontSize(bool state)
void setEdgeFrontDisplay(const bool state)
Activate or deactivate edge display in front of the scene.
int getNodesLabelStencil() const
get stencil number for nodes label
void setEdgesMaxSizeToNodesSize(const bool b)
set if Edge max size is block to node size
void setEdgeColorInterpolate(const bool state)
Activate or deactivate interpolation of nodes colors along edge.
void setNodesStencil(const int stencil)
set stencil number for nodes
int getSelectedEdgesStencil() const
get stencil number for selected edges
int getEdgesStencil() const
get stencil number for edges
bool isEdge3D() const
return true if 3D drawing of edges is activated
bool isEdgeFrontDisplay() const
Return true if edge display in front of the scene is activated.
int getMinSizeOfLabel() const
return min size of label : this min size is only used if labels are not scaled and are not rendered w...
bool isViewArrow() const
Return true if arrows drawing is activated else false.
bool isElementOrdered() const
Returns true if element ordering is activated.
int getEdgesLabelStencil() const
get stencil number for edges label
DataSet getParameters() const
Get parameters into a DataSet structure.
bool isDisplayMetaNodes() const
Return true if meta-nodes are displayed.
bool isViewEdgeLabel() const
Return true if drawing of nodes' labels is activated.
void setEdgeSizeInterpolate(const bool state)
Activate or deactivate interpolation of nodes colors along edge.
tlp::NumericProperty * getElementOrderingProperty() const
Gets the property used for element ordering. Setting it to nullptr will use viewMetric if the orderin...
void setViewNodeLabel(const bool state)
Activate or deactivate displaying of labels on nodes.
void setFontsPath(const std::string &path)
Set the absolute path used for the fonts loading.
std::string getFontsPath() const
Return the absolute path used for the fonts loading.
std::string getTexturePath() const
Return the absolute path used for texture loading.
GlGraphRenderingParameters()
Constructor.
bool getLabelsAreBillboarded() const
return if labels are billboarded
void setDisplayMetaNodes(const bool state)
If true meta-nodes are displayed.
Interface all numerical properties. Property values are always returned as double.