Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlBoundingBoxSceneVisitor.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 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef Tulip_GLBOUNDINGBOXSCENEVISITOR_H
22 #define Tulip_GLBOUNDINGBOXSCENEVISITOR_H
23 #ifndef DOXYGEN_NOTFOR_DEVEL
24 
25 #include <tulip/BoundingBox.h>
26 
27 #include <tulip/GlSceneVisitor.h>
28 
29 namespace tlp {
30 
31 class GlGraphInputData;
32 
33 /** \brief Visitor to collect boundingBox of all GlEntities
34  *
35  * Visitor to collect boundingBox of all GlEntities
36  * At end, boundingBox member contains the scene boundingBox (in 3D coordinates)
37  * This class can be usefull to center the scene in a widget for example
38  */
39 class TLP_GL_SCOPE GlBoundingBoxSceneVisitor : public GlSceneVisitor {
40 
41 public:
42 
43  /**
44  * Constructor
45  */
46  GlBoundingBoxSceneVisitor(GlGraphInputData* inputData):inputData(inputData) {
47  threadSafe=true;
48  }
49 
50  /**
51  * Method used for GlSimpleEntity
52  */
53  virtual void visit(GlSimpleEntity *entity);
54  /**
55  * Method used for GlNodes (and GlMetaNodes)
56  */
57  virtual void visit(GlNode *glNode);
58  /**
59  * Method used for GlEdges
60  */
61  virtual void visit(GlEdge *glEdge);
62 
63  /**
64  * Return the scene boundingBox
65  */
66  BoundingBox getBoundingBox() {
67  return boundingBox;
68  }
69 
70 private:
71 
72  BoundingBox boundingBox;
73  GlGraphInputData* inputData;
74 
75 };
76 
77 }
78 
79 #endif // DOXYGEN_NOTFOR_DEVEL
80 
81 #endif // Tulip_GLLODSCENEVISITOR_H
82 ///@endcond