Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 00020 #ifndef Tulip_GLGRAPHRENDERINGPARAMETERS_H 00021 #define Tulip_GLGRAPHRENDERINGPARAMETERS_H 00022 00023 #include <tulip/Color.h> 00024 #include <tulip/DataSet.h> 00025 #include <tulip/tulipconf.h> 00026 00027 namespace tlp { 00028 00029 class NumericProperty; 00030 class BooleanProperty; 00031 00032 /** 00033 * @ingroup OpenGL 00034 * @brief That class defines all the parameters used by GlGraphComposite to render a graph 00035 * 00036 * @see GlGraphComposite 00037 */ 00038 class TLP_GL_SCOPE GlGraphRenderingParameters { 00039 00040 public: 00041 /** 00042 * @brief Constructor 00043 */ 00044 GlGraphRenderingParameters(); 00045 00046 /** 00047 * @brief Get parameters into a DataSet structure 00048 */ 00049 DataSet getParameters() const; 00050 00051 /** 00052 * @brief Set parameters with a DataSet structure 00053 */ 00054 void setParameters(const DataSet &); 00055 00056 /** 00057 * @brief activate or deactivate anlialiasing 00058 */ 00059 void setAntialiasing(const bool state); 00060 00061 /** 00062 * @brief Return true if antialiasing is activated else false. 00063 */ 00064 bool isAntialiased()const; 00065 00066 /** 00067 * @brief Activate or deactivate displaying of arrows along the graph's edges. 00068 */ 00069 void setViewArrow(const bool state); 00070 00071 /** 00072 * @brief Return true if arrows drawing is activated else false. 00073 */ 00074 bool isViewArrow()const; 00075 00076 /** 00077 * @brief Activate or deactivate displaying of labels on nodes. 00078 */ 00079 void setViewNodeLabel(const bool state); 00080 00081 /** 00082 * @brief Return true if drawing of nodes' labels is activated. 00083 */ 00084 bool isViewNodeLabel() const; 00085 /** 00086 * @brief Activate or deactivate displaying of labels on nodes. 00087 */ 00088 void setViewEdgeLabel(const bool state); 00089 00090 /** 00091 * @brief Return true if drawing of nodes' labels is activated. 00092 */ 00093 bool isViewEdgeLabel() const; 00094 00095 /** 00096 * @brief Activate or deactivate displaying of labels outside the screen. 00097 */ 00098 void setViewOutScreenLabel(const bool state); 00099 00100 /** 00101 * @brief Return true if drawing of outscreen labels is activated. 00102 */ 00103 bool isViewOutScreenLabel() const; 00104 00105 /** 00106 * @brief Activate or deactivate interpolation of nodes colors along edge 00107 */ 00108 void setEdgeColorInterpolate(const bool state); 00109 00110 /** 00111 * @brief Return true if color interpolation is activated 00112 */ 00113 bool isEdgeColorInterpolate() const; 00114 00115 /** 00116 * @brief Activate or deactivate interpolation of nodes colors along edge 00117 */ 00118 void setEdgeSizeInterpolate(const bool state); 00119 00120 /** 00121 * @brief Return true if color interpolation is activated 00122 */ 00123 bool isEdgeSizeInterpolate() const; 00124 00125 /** 00126 * @brief Return the type of fonts used in the renderer(0=3D,1=bitmap,2=texture) 00127 */ 00128 unsigned int getFontsType() const; 00129 00130 /** 00131 * @brief Set fonts type used in the renderer (0=3D,1=bitmap,2=texture) 00132 */ 00133 void setFontsType(unsigned int type); 00134 00135 /** 00136 * @brief Set the path for the texture loading 00137 */ 00138 void setTexturePath(const std::string& path); 00139 00140 /** 00141 * @brief Return the absolute path used for texture loading 00142 */ 00143 std::string getTexturePath() const; 00144 00145 /** 00146 * @brief Set the absolute path used for the fonts loading 00147 */ 00148 void setFontsPath(const std::string& path); 00149 00150 /** 00151 * @brief Return the absolute path used for the fonts loading 00152 */ 00153 std::string getFontsPath() const; 00154 00155 /** 00156 * @brief If true and if labels are activated label inside meta nodes will be displayed 00157 */ 00158 void setViewMetaLabel(const bool state); 00159 00160 /** 00161 * @brief Return the true if viewMetaLabels is enable else false 00162 */ 00163 bool isViewMetaLabel() const; 00164 00165 /** 00166 * @brief If true edges are displayed. 00167 */ 00168 void setDisplayEdges(const bool state); 00169 00170 /** 00171 * @brief Return true if edges are displayed. 00172 */ 00173 bool isDisplayEdges() const; 00174 00175 /** 00176 * @brief If true nodes are displayed. 00177 */ 00178 void setDisplayNodes(const bool state); 00179 00180 /** 00181 * @brief Return true if nodes are displayed. 00182 */ 00183 bool isDisplayNodes() const; 00184 00185 /** 00186 * @brief If true meta-nodes are displayed. 00187 */ 00188 void setDisplayMetaNodes(const bool state); 00189 00190 /** 00191 * @brief Return true if meta-nodes are displayed. 00192 */ 00193 bool isDisplayMetaNodes() const; 00194 00195 /** 00196 * @brief set stencil number for selected nodes 00197 * 00198 * Stencil is an OpenGl system to ensure that other entity can't be displayed above this entity. It's a "guaranted visibility" system. 00199 * A small number causes a guaranted visibility 00200 * Default value in Tulip is 0xFFFF (greater integer) 00201 * And when we have stencil on entity value is 0x2 00202 */ 00203 void setSelectedNodesStencil(const int stencil); 00204 00205 /** 00206 * @brief get stencil number for selected nodes 00207 */ 00208 int getSelectedNodesStencil() const; 00209 00210 /** 00211 * @brief set stencil number for selected meta-nodes 00212 * 00213 * See setSelectedNodesStencil() documentation for more details on stencil number 00214 */ 00215 void setSelectedMetaNodesStencil(const int stencil); 00216 00217 /** 00218 * @brief get stencil number for selected meta-nodes 00219 */ 00220 int getSelectedMetaNodesStencil() const; 00221 00222 /** 00223 * @brief set stencil number for selected edges 00224 * 00225 * See setSelectedNodesStencil() documentation for more details on stencil number 00226 */ 00227 void setSelectedEdgesStencil(const int stencil); 00228 00229 /** 00230 * @brief get stencil number for selected edges 00231 */ 00232 int getSelectedEdgesStencil() const; 00233 00234 /** 00235 * @brief set stencil number for nodes 00236 * 00237 * See setSelectedNodesStencil() documentation for more details on stencil number 00238 */ 00239 void setNodesStencil(const int stencil); 00240 00241 /** 00242 * @brief get stencil number for nodes 00243 */ 00244 int getNodesStencil() const; 00245 00246 /** 00247 * @brief set stencil number for meta-nodes 00248 * 00249 * See setSelectedNodesStencil() documentation for more details on stencil number 00250 */ 00251 void setMetaNodesStencil(const int stencil); 00252 00253 /** 00254 * @brief get stencil number for meta-nodes 00255 */ 00256 int getMetaNodesStencil() const; 00257 00258 /** 00259 * @brief set stencil number for edges 00260 * 00261 * See setSelectedNodesStencil() documentation for more details on stencil number 00262 */ 00263 void setEdgesStencil(const int stencil); 00264 00265 /** 00266 * @brief get stencil number for edges 00267 */ 00268 int getEdgesStencil() const; 00269 00270 /** 00271 * @brief set stencil number for nodes label 00272 * 00273 * See setSelectedNodesStencil() documentation for more details on stencil number 00274 */ 00275 void setNodesLabelStencil(const int stencil); 00276 00277 /** 00278 * @brief get stencil number for nodes label 00279 */ 00280 int getNodesLabelStencil() const; 00281 00282 /** 00283 * @brief set stencil number for meta-nodes label 00284 * 00285 * See setSelectedNodesStencil() documentation for more details on stencil number 00286 */ 00287 void setMetaNodesLabelStencil(const int stencil); 00288 00289 /** 00290 * @brief get stencil number for meta-nodes label 00291 */ 00292 int getMetaNodesLabelStencil() const; 00293 00294 /** 00295 * @brief set stencil number for edges label 00296 * 00297 * See setSelectedNodesStencil() documentation for more details on stencil number 00298 */ 00299 void setEdgesLabelStencil(const int stencil); 00300 00301 /** 00302 * @brief get stencil number for edges label 00303 */ 00304 int getEdgesLabelStencil() const; 00305 00306 /** 00307 * @brief If true node and edges are ordered according to the viewMetric property 00308 */ 00309 void setElementOrdered(const bool state); 00310 00311 /** 00312 * @brief return true if element ordering is activated 00313 */ 00314 bool isElementOrdered() const; 00315 00316 /** 00317 * @brief Defines which property is used for the element ordering. 00318 * 00319 * @param property The property to use to order the elements. 00320 * @return void 00321 **/ 00322 void setElementOrderingProperty(tlp::NumericProperty* property); 00323 00324 /** 00325 * @brief Gets the property used for element ordering. Setting it to NULL will use viewMetric if the ordering is enabled. 00326 * 00327 * @return :NumericProperty* The Property currently used. 00328 **/ 00329 tlp::NumericProperty* getElementOrderingProperty() const; 00330 00331 /** 00332 * @brief If true node and edges are ordered according to the distance with camera 00333 */ 00334 void setElementZOrdered(const bool state); 00335 00336 /** 00337 * @brief return true if element Z ordering is activated 00338 */ 00339 bool isElementZOrdered() const; 00340 00341 /** 00342 * @brief if true use 3D displaying of edges instead of 2D lines on ALL edges 00343 */ 00344 void setEdge3D(const bool state); 00345 00346 /** 00347 * @brief return true if 3D drawing of edges is activated 00348 */ 00349 bool isEdge3D() const; 00350 00351 /** 00352 * @brief Get the size of the border that is added to any label when using bitmap fonts. 00353 * 00354 * @deprecated Use getLabelsDensity instead 00355 */ 00356 unsigned int _DEPRECATED getLabelsBorder() const; 00357 00358 /** 00359 * @brief Get the size of label border 00360 * 00361 * Get the size of the border that is added to any label when 00362 * using bitmap fonts. Setting this parameter to a high value 00363 * enables de reduce the label density in the final drawing. 00364 * Default value is set to 2 which enables readable labels. 00365 * @deprecated Use setLabelsDensity instead 00366 */ 00367 void _DEPRECATED setLabelsBorder(const unsigned int); 00368 00369 /** 00370 * @brief set if Edge max size is block to node size 00371 */ 00372 void setEdgesMaxSizeToNodesSize(const bool b); 00373 00374 /** 00375 * @brief return if Edge max size is block to node size 00376 */ 00377 bool getEdgesMaxSizeToNodesSize() const; 00378 00379 /** 00380 * @brief if true draw graph with feedback information (very low) 00381 */ 00382 void setFeedbackRender(bool feedback); 00383 00384 /** 00385 * @brief return true if the graph is draw with feedback information 00386 */ 00387 bool getFeedbackRender() const; 00388 00389 /** 00390 * @brief Change the selection color 00391 */ 00392 void setSelectionColor(const Color &color); 00393 00394 /** 00395 * @brief return the selection color 00396 */ 00397 Color getSelectionColor() const; 00398 00399 /** 00400 * @brief return if labels are scaled to node size 00401 */ 00402 bool isLabelScaled() const; 00403 00404 /** 00405 * Set if labels are scaled to node size 00406 */ 00407 void setLabelScaled(bool state); 00408 00409 /** 00410 * @brief return if labels are rendered with a fixed font size (dynamic size otherwise) 00411 */ 00412 bool isLabelFixedFontSize() const; 00413 00414 /** 00415 * Set if labels must be rendered with a fixed font size (dynamic size otherwise) 00416 */ 00417 void setLabelFixedFontSize(bool state); 00418 00419 /** 00420 * @brief Return labels -density 00421 * 00422 * This density must be in interval -100 100 00423 * -100 : No labels 00424 * 0 : No overlap 00425 * 100 : All labels 00426 */ 00427 int getLabelsDensity() const; 00428 00429 /** 00430 * @brief Set labels density 00431 * 00432 * This density must be in interval -100 100 00433 * -100 : No labels 00434 * 0 : No overlap 00435 * 100 : All labels 00436 */ 00437 void setLabelsDensity(int density); 00438 00439 /** 00440 * @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 00441 */ 00442 int getMinSizeOfLabel() const; 00443 00444 /** 00445 * @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 00446 */ 00447 void setMinSizeOfLabel(int size); 00448 00449 /** 00450 * @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 00451 */ 00452 int getMaxSizeOfLabel() const; 00453 00454 /** 00455 * @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 00456 */ 00457 void setMaxSizeOfLabel(int size); 00458 00459 /** 00460 * @brief return if labels are billboarded 00461 */ 00462 bool getLabelsAreBillboarded() const { 00463 return _labelsAreBillboarded; 00464 } 00465 00466 /** 00467 * @brief Set if labels are billboarded 00468 */ 00469 void setLabelsAreBillboarded(bool billboarded) { 00470 _labelsAreBillboarded=billboarded; 00471 } 00472 00473 /** 00474 * @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 00475 * 00476 * @Warning : this property will not be saved in DataSet 00477 */ 00478 void setDisplayFilteringProperty(BooleanProperty *filteringProperty) { 00479 _displayFilteringProperty=filteringProperty; 00480 } 00481 00482 /** 00483 * @brief Get the boolean property use to filtering displaying of nodes/edges 00484 */ 00485 BooleanProperty * getDisplayFilteringProperty() const { 00486 return _displayFilteringProperty; 00487 } 00488 00489 private: 00490 00491 bool _antialiased; 00492 bool _viewArrow; 00493 bool _viewNodeLabel; 00494 bool _viewEdgeLabel; 00495 bool _viewMetaLabel; 00496 bool _viewOutScreenLabel; 00497 bool _elementOrdered; 00498 bool _edgeColorInterpolate; 00499 bool _edge3D; 00500 bool _edgeSizeInterpolate; 00501 bool _displayEdges; 00502 bool _displayNodes; 00503 bool _displayMetaNodes; 00504 bool _elementZOrdered; 00505 int _selectedNodesStencil; 00506 int _selectedMetaNodesStencil; 00507 int _selectedEdgesStencil; 00508 int _nodesStencil; 00509 int _metaNodesStencil; 00510 int _edgesStencil; 00511 int _nodesLabelStencil; 00512 int _metaNodesLabelStencil; 00513 int _edgesLabelStencil; 00514 bool _labelScaled; 00515 bool _labelFixedFontSize; 00516 int _labelMinSize; 00517 int _labelMaxSize; 00518 int _labelsDensity; 00519 bool _labelsAreBillboarded; 00520 std::string _fontsPath; 00521 std::string _texturePath; 00522 bool _edgesMaxSizeToNodesSize; 00523 bool _feedbackRender; 00524 Color _selectionColor; 00525 BooleanProperty *_displayFilteringProperty; 00526 NumericProperty* _elementOrderingProperty; 00527 }; 00528 00529 /** \brief Class to get the default selection color 00530 */ 00531 class TLP_GL_SCOPE GlDefaultSelectionColorManager { 00532 public: 00533 static void setManager(GlDefaultSelectionColorManager *); 00534 static tlp::Color getDefaultSelectionColor(); 00535 virtual tlp::Color defaultSelectionColor()=0; 00536 00537 private: 00538 static GlDefaultSelectionColorManager* manager; 00539 }; 00540 } 00541 00542 #endif // Tulip_GLGRAPH_H