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