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