Tulip  5.1.0
Large graphs analysis and drawing
GlBoundingBoxSceneVisitor.h
1 /*
2  *
3  * This file is part of Tulip (http://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 ///@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 #include <tulip/GlSceneVisitor.h>
27 
28 namespace tlp {
29 
30 class GlGraphInputData;
31 
32 /** \brief Visitor to collect boundingBox of all GlEntities
33  *
34  * Visitor to collect boundingBox of all GlEntities
35  * At end, boundingBox member contains the scene boundingBox (in 3D coordinates)
36  * This class can be useful to center the scene in a widget for example
37  */
38 class TLP_GL_SCOPE GlBoundingBoxSceneVisitor : public GlSceneVisitor {
39 
40 public:
41 
42  /**
43  * Constructor
44  */
45  GlBoundingBoxSceneVisitor(GlGraphInputData* inputData):inputData(inputData) {
46  threadSafe = true;
47  }
48 
49  /**
50  * Method used for GlSimpleEntity
51  */
52  virtual void visit(GlSimpleEntity *entity);
53  /**
54  * Method used for GlNodes (and GlMetaNodes)
55  */
56  virtual void visit(GlNode *glNode);
57  /**
58  * Method used for GlEdges
59  */
60  virtual void visit(GlEdge *glEdge);
61 
62  /**
63  * Return the scene boundingBox
64  */
65  BoundingBox getBoundingBox() {
66  return boundingBox;
67  }
68 
69 private:
70 
71  BoundingBox boundingBox;
72  GlGraphInputData* inputData;
73 
74 };
75 
76 }
77 
78 #endif // DOXYGEN_NOTFOR_DEVEL
79 
80 #endif // Tulip_GLLODSCENEVISITOR_H
81 ///@endcond