Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlGraphRenderingParameters.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
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 
27 namespace tlp {
28 
29 class NumericProperty;
30 class 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  */
38 class TLP_GL_SCOPE GlGraphRenderingParameters {
39 
40 public:
41  /**
42  * @brief Constructor
43  */
45 
46  /**
47  * @brief Get parameters into a DataSet structure
48  */
49  DataSet getParameters() const;
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  */
103  bool isViewOutScreenLabel() const;
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  */
113  bool isEdgeColorInterpolate() const;
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  */
123  bool isEdgeSizeInterpolate() const;
124 
125  /**
126  * @brief Return the type of fonts used in the renderer(0=3D,1=bitmap,2=texture)
127  */
128  unsigned int getFontsType() const;
129 
130  /**
131  * @brief Set fonts type used in the renderer (0=3D,1=bitmap,2=texture)
132  */
133  void setFontsType(unsigned int type);
134 
135  /**
136  * @brief Set the path for the texture loading
137  */
138  void setTexturePath(const std::string& path);
139 
140  /**
141  * @brief Return the absolute path used for texture loading
142  */
143  std::string getTexturePath() const;
144 
145  /**
146  * @brief Set the absolute path used for the fonts loading
147  */
148  void setFontsPath(const std::string& path);
149 
150  /**
151  * @brief Return the absolute path used for the fonts loading
152  */
153  std::string getFontsPath() const;
154 
155  /**
156  * @brief If true and if labels are activated label inside meta nodes will be displayed
157  */
158  void setViewMetaLabel(const bool state);
159 
160  /**
161  * @brief Return the true if viewMetaLabels is enable else false
162  */
163  bool isViewMetaLabel() const;
164 
165  /**
166  * @brief If true edges are displayed.
167  */
168  void setDisplayEdges(const bool state);
169 
170  /**
171  * @brief Return true if edges are displayed.
172  */
173  bool isDisplayEdges() const;
174 
175  /**
176  * @brief If true nodes are displayed.
177  */
178  void setDisplayNodes(const bool state);
179 
180  /**
181  * @brief Return true if nodes are displayed.
182  */
183  bool isDisplayNodes() const;
184 
185  /**
186  * @brief If true meta-nodes are displayed.
187  */
188  void setDisplayMetaNodes(const bool state);
189 
190  /**
191  * @brief Return true if meta-nodes are displayed.
192  */
193  bool isDisplayMetaNodes() const;
194 
195  /**
196  * @brief set stencil number for selected nodes
197  *
198  * Stencil is an OpenGl system to ensure that other entity can't be displayed above this entity. It's a "guaranted visibility" system.
199  * A small number causes a guaranted visibility
200  * Default value in Tulip is 0xFFFF (greater integer)
201  * And when we have stencil on entity value is 0x2
202  */
203  void setSelectedNodesStencil(const int stencil);
204 
205  /**
206  * @brief get stencil number for selected nodes
207  */
208  int getSelectedNodesStencil() const;
209 
210  /**
211  * @brief set stencil number for selected meta-nodes
212  *
213  * See setSelectedNodesStencil() documentation for more details on stencil number
214  */
215  void setSelectedMetaNodesStencil(const int stencil);
216 
217  /**
218  * @brief get stencil number for selected meta-nodes
219  */
220  int getSelectedMetaNodesStencil() const;
221 
222  /**
223  * @brief set stencil number for selected edges
224  *
225  * See setSelectedNodesStencil() documentation for more details on stencil number
226  */
227  void setSelectedEdgesStencil(const int stencil);
228 
229  /**
230  * @brief get stencil number for selected edges
231  */
232  int getSelectedEdgesStencil() const;
233 
234  /**
235  * @brief set stencil number for nodes
236  *
237  * See setSelectedNodesStencil() documentation for more details on stencil number
238  */
239  void setNodesStencil(const int stencil);
240 
241  /**
242  * @brief get stencil number for nodes
243  */
244  int getNodesStencil() const;
245 
246  /**
247  * @brief set stencil number for meta-nodes
248  *
249  * See setSelectedNodesStencil() documentation for more details on stencil number
250  */
251  void setMetaNodesStencil(const int stencil);
252 
253  /**
254  * @brief get stencil number for meta-nodes
255  */
256  int getMetaNodesStencil() const;
257 
258  /**
259  * @brief set stencil number for edges
260  *
261  * See setSelectedNodesStencil() documentation for more details on stencil number
262  */
263  void setEdgesStencil(const int stencil);
264 
265  /**
266  * @brief get stencil number for edges
267  */
268  int getEdgesStencil() const;
269 
270  /**
271  * @brief set stencil number for nodes label
272  *
273  * See setSelectedNodesStencil() documentation for more details on stencil number
274  */
275  void setNodesLabelStencil(const int stencil);
276 
277  /**
278  * @brief get stencil number for nodes label
279  */
280  int getNodesLabelStencil() const;
281 
282  /**
283  * @brief set stencil number for meta-nodes label
284  *
285  * See setSelectedNodesStencil() documentation for more details on stencil number
286  */
287  void setMetaNodesLabelStencil(const int stencil);
288 
289  /**
290  * @brief get stencil number for meta-nodes label
291  */
292  int getMetaNodesLabelStencil() const;
293 
294  /**
295  * @brief set stencil number for edges label
296  *
297  * See setSelectedNodesStencil() documentation for more details on stencil number
298  */
299  void setEdgesLabelStencil(const int stencil);
300 
301  /**
302  * @brief get stencil number for edges label
303  */
304  int getEdgesLabelStencil() const;
305 
306  /**
307  * @brief If true node and edges are ordered according to the viewMetric property
308  */
309  void setElementOrdered(const bool state);
310 
311  /**
312  * @brief return true if element ordering is activated
313  */
314  bool isElementOrdered() const;
315 
316  /**
317  * @brief Defines which property is used for the element ordering.
318  *
319  * @param property The property to use to order the elements.
320  * @return void
321  **/
322  void setElementOrderingProperty(tlp::NumericProperty* property);
323 
324  /**
325  * @brief Gets the property used for element ordering. Setting it to NULL will use viewMetric if the ordering is enabled.
326  *
327  * @return :NumericProperty* The Property currently used.
328  **/
329  tlp::NumericProperty* getElementOrderingProperty() const;
330 
331  /**
332  * @brief If true node and edges are ordered according to the distance with camera
333  */
334  void setElementZOrdered(const bool state);
335 
336  /**
337  * @brief return true if element Z ordering is activated
338  */
339  bool isElementZOrdered() const;
340 
341  /**
342  * @brief if true use 3D displaying of edges instead of 2D lines on ALL edges
343  */
344  void setEdge3D(const bool state);
345 
346  /**
347  * @brief return true if 3D drawing of edges is activated
348  */
349  bool isEdge3D() const;
350 
351  /**
352  * @brief Get the size of the border that is added to any label when using bitmap fonts.
353  *
354  * @deprecated Use getLabelsDensity instead
355  */
356  unsigned int _DEPRECATED getLabelsBorder() const;
357 
358  /**
359  * @brief Get the size of label border
360  *
361  * Get the size of the border that is added to any label when
362  * using bitmap fonts. Setting this parameter to a high value
363  * enables de reduce the label density in the final drawing.
364  * Default value is set to 2 which enables readable labels.
365  * @deprecated Use setLabelsDensity instead
366  */
367  void _DEPRECATED setLabelsBorder(const unsigned int);
368 
369  /**
370  * @brief set if Edge max size is block to node size
371  */
372  void setEdgesMaxSizeToNodesSize(const bool b);
373 
374  /**
375  * @brief return if Edge max size is block to node size
376  */
377  bool getEdgesMaxSizeToNodesSize() const;
378 
379  /**
380  * @brief if true draw graph with feedback information (very low)
381  */
382  void setFeedbackRender(bool feedback);
383 
384  /**
385  * @brief return true if the graph is draw with feedback information
386  */
387  bool getFeedbackRender() const;
388 
389  /**
390  * @brief Change the selection color
391  */
392  void setSelectionColor(const Color &color);
393 
394  /**
395  * @brief return the selection color
396  */
397  Color getSelectionColor() const;
398 
399  /**
400  * @brief return if labels are scaled to node size
401  */
402  bool isLabelScaled() const;
403 
404  /**
405  * Set if labels are scaled to node size
406  */
407  void setLabelScaled(bool state);
408 
409  /**
410  * @brief return if labels are rendered with a fixed font size (dynamic size otherwise)
411  */
412  bool isLabelFixedFontSize() const;
413 
414  /**
415  * Set if labels must be rendered with a fixed font size (dynamic size otherwise)
416  */
417  void setLabelFixedFontSize(bool state);
418 
419  /**
420  * @brief Return labels -density
421  *
422  * This density must be in interval -100 100
423  * -100 : No labels
424  * 0 : No overlap
425  * 100 : All labels
426  */
427  int getLabelsDensity() const;
428 
429  /**
430  * @brief Set labels density
431  *
432  * This density must be in interval -100 100
433  * -100 : No labels
434  * 0 : No overlap
435  * 100 : All labels
436  */
437  void setLabelsDensity(int density);
438 
439  /**
440  * @brief return min size of label : this min size is only used if labels are not scaled and are not rendered with a fixed font size
441  */
442  int getMinSizeOfLabel() const;
443 
444  /**
445  * @brief Set min size of label : this min size is only used if labels are not scaled and are not rendered with a fixed font size
446  */
447  void setMinSizeOfLabel(int size);
448 
449  /**
450  * @brief return max size of label : this max size is only used if labels are not scaled and are not rendered with a fixed font size
451  */
452  int getMaxSizeOfLabel() const;
453 
454  /**
455  * @brief Set max size of label : this max size is only used if labels are not scaled and are not rendered with a fixed font size
456  */
457  void setMaxSizeOfLabel(int size);
458 
459  /**
460  * @brief return if labels are billboarded
461  */
462  bool getLabelsAreBillboarded() const {
463  return _labelsAreBillboarded;
464  }
465 
466  /**
467  * @brief Set if labels are billboarded
468  */
469  void setLabelsAreBillboarded(bool billboarded) {
470  _labelsAreBillboarded=billboarded;
471  }
472 
473  /**
474  * @brief This property is use to filter nodes/edges display, for a node/edge if this property is false : the node/edge will not be diplayed
475  *
476  * @Warning : this property will not be saved in DataSet
477  */
478  void setDisplayFilteringProperty(BooleanProperty *filteringProperty) {
479  _displayFilteringProperty=filteringProperty;
480  }
481 
482  /**
483  * @brief Get the boolean property use to filtering displaying of nodes/edges
484  */
486  return _displayFilteringProperty;
487  }
488 
489 private:
490 
491  bool _antialiased;
492  bool _viewArrow;
493  bool _viewNodeLabel;
494  bool _viewEdgeLabel;
495  bool _viewMetaLabel;
496  bool _viewOutScreenLabel;
497  bool _elementOrdered;
498  bool _edgeColorInterpolate;
499  bool _edge3D;
500  bool _edgeSizeInterpolate;
501  bool _displayEdges;
502  bool _displayNodes;
503  bool _displayMetaNodes;
504  bool _elementZOrdered;
505  int _selectedNodesStencil;
506  int _selectedMetaNodesStencil;
507  int _selectedEdgesStencil;
508  int _nodesStencil;
509  int _metaNodesStencil;
510  int _edgesStencil;
511  int _nodesLabelStencil;
512  int _metaNodesLabelStencil;
513  int _edgesLabelStencil;
514  bool _labelScaled;
515  bool _labelFixedFontSize;
516  int _labelMinSize;
517  int _labelMaxSize;
518  int _labelsDensity;
519  bool _labelsAreBillboarded;
520  std::string _fontsPath;
521  std::string _texturePath;
522  bool _edgesMaxSizeToNodesSize;
523  bool _feedbackRender;
524  Color _selectionColor;
525  BooleanProperty *_displayFilteringProperty;
526  NumericProperty* _elementOrderingProperty;
527 };
528 
529 /** \brief Class to get the default selection color
530  */
531 class TLP_GL_SCOPE GlDefaultSelectionColorManager {
532 public:
533  static void setManager(GlDefaultSelectionColorManager *);
534  static tlp::Color getDefaultSelectionColor();
535  virtual tlp::Color defaultSelectionColor()=0;
536 
537 private:
538  static GlDefaultSelectionColorManager* manager;
539 };
540 }
541 
542 #endif // Tulip_GLGRAPH_H
A graph property that maps a boolean value to graph elements.
void setLabelsAreBillboarded(bool billboarded)
Set if labels are billboarded.
A container that can store data from any type.
Definition: DataSet.h:165
BooleanProperty * getDisplayFilteringProperty() const
Get the boolean property use to filtering displaying of nodes/edges.
That class defines all the parameters used by GlGraphComposite to render a graph. ...
Class to get the default selection color.
Interface all numerical properties. Property values are always returned as double.
bool getLabelsAreBillboarded() const
return if labels are billboarded
void setDisplayFilteringProperty(BooleanProperty *filteringProperty)
This property is use to filter nodes/edges display, for a node/edge if this property is false : the n...