Debian Codegraph @

src/Gui/Inventor/SoFCBoundingBox.h

raw
1 /***************************************************************************
2 * Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23 #ifndef COIN_SOFCBOUNDINGBOX_H
24 #define COIN_SOFCBOUNDINGBOX_H
25
26 #include <Inventor/actions/SoAction.h>
27 #include <Inventor/fields/SoSFBool.h>
28 #include <Inventor/fields/SoSFVec3f.h>
29 #include <Inventor/nodes/SoCoordinate3.h>
30 #include <Inventor/nodes/SoIndexedLineSet.h>
31 #include <Inventor/nodes/SoSeparator.h>
32 #include <Inventor/nodes/SoShape.h>
33 #include <FCGlobal.h>
34
35
36 namespace Gui
37 {
38
39 /**
40 * A subclass of SoShape used to create an axis aligned wire frame box based
41 * on the minBounds and maxBounds fields. The class also has a field which
42 * can be toggled on or off for displaying text coordinate labels at the
43 * vertices of the box.
44 * @note Original source are taken from
45 * http://www.wheatchex.com/projects/openinventor/bbox/BoundingBox.h and
46 * http://www.wheatchex.com/projects/openinventor/bbox/BoundingBox.cpp
47 * @date November 12th, 2001
48 * @author Josh Grant
49 */
50 class GuiExport SoFCBoundingBox: public SoShape
51 {
52 using inherited = SoShape;
53
54 SO_NODE_HEADER(Gui::SoFCBoundingBox);
55
56 public:
57 static void initClass();
58 static void finish();
59
60 public:
61 SoFCBoundingBox();
62 SoSFVec3f minBounds; /**< minimum box coordinates */
63 SoSFVec3f maxBounds; /**< maximum box coordinates */
64 SoSFBool coordsOn; /**< If true, the coordinates are displayed at each vertex */
65 SoSFBool dimensionsOn; /**< If true, the dimensions are displayed in x,y and z direction */
66
67
68 protected:
69 ~SoFCBoundingBox() override;
70 void GLRender(SoGLRenderAction* action) override;
71 void generatePrimitives(SoAction* action) override;
72 void computeBBox(SoAction* action, SbBox3f& box, SbVec3f& center) override;
73
74 private:
75 SoSeparator *root, *textSep, *dimSep;
76 SoCoordinate3* bboxCoords;
77 SoIndexedLineSet* bboxLines;
78 };
79
80 /**
81 * This is a special group node which must be defined to ignore bounding box actions.
82 * @author Werner Mayer
83 */
84 class GuiExport SoSkipBoundingGroup: public SoGroup
85 {
86 using inherited = SoGroup;
87
88 SO_NODE_HEADER(Gui::SoSkipBoundingGroup);
89
90 public:
91 static void initClass();
92 static void finish();
93 SoSkipBoundingGroup();
94
95 enum Modes
96 {
97 INCLUDE_BBOX,
98 EXCLUDE_BBOX
99 };
100
101 SoSFEnum mode;
102
103 void getBoundingBox(SoGetBoundingBoxAction* action) override;
104
105 protected:
106 ~SoSkipBoundingGroup() override;
107 };
108
109 } // namespace Gui
110
111
112 #endif // COIN_SOFCBOUNDINGBOX_H