ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvClipBox.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "ecvBBox.h"
12 #include "ecvGenericPointCloud.h"
13 #include "ecvHObject.h"
14 #include "ecvInteractor.h"
15 
16 // Qt
17 #include <QObject>
18 
20 class CV_DB_LIB_API ccClipBox : public QObject,
21  public ccHObject,
22  public ccInteractor {
23  Q_OBJECT
24 
25 public:
27  ccClipBox(QString name = QString("Clipping box"));
28 
30  ~ccClipBox() override;
31 
33 
35  bool addAssociatedEntity(ccHObject* associatedEntity);
36 
38 
40  void releaseAssociatedEntities();
41 
42  // inherited from ccHObject
43  ccBBox getOwnBB(bool withGLFeatures = false) override;
44 
45  // inherited from ccInteractor
46  bool move2D(int x, int y, int dx, int dy, int screenWidth, int screenHeight)
47  override;
48  bool move3D(const CCVector3d& u) override;
49 
51  void setClickedPoint(int x,
52  int y,
53  int screenWidth,
54  int screenHeight,
55  const ccGLMatrixd& viewMatrix);
56 
58  enum Components {
59  NONE = 0,
60  X_MINUS_ARROW = 1,
61  X_PLUS_ARROW = 2,
62  Y_MINUS_ARROW = 3,
63  Y_PLUS_ARROW = 4,
64  Z_MINUS_ARROW = 5,
65  Z_PLUS_ARROW = 6,
66  CROSS = 7,
67  SPHERE = 8,
68  X_MINUS_TORUS = 9,
69  Y_MINUS_TORUS = 10,
70  Z_MINUS_TORUS = 11,
71  X_PLUS_TORUS = 12,
72  Y_PLUS_TORUS = 13,
73  Z_PLUS_TORUS = 14,
74  };
75 
77 
79  void setActiveComponent(int id);
80 
81  // inherited from ccHObject
82  inline CV_CLASS_ENUM getClassID() const override {
84  }
85 
87  inline const ccBBox& getBox() const { return m_box; }
88 
90  inline void showBox(bool state) { m_showBox = state; }
91 
93  void setBox(const ccBBox& box);
94 
96  void shift(const CCVector3& v);
97 
100 
104  void flagPointsInside(ccGenericPointCloud* cloud,
106  bool shrink = false) const;
107 
109  void reset();
110 
112  void set(const ccBBox& extents, const ccGLMatrix& transformation);
113 
115  void get(ccBBox& extents, ccGLMatrix& transformation);
116 
118  inline const ccHObject& getContainer() const { return m_entityContainer; }
119 
120 signals:
121 
123  void boxModified(const ccBBox* box);
124 
125 protected: // methods
127  void update();
128 
129  // inherited from ccHObject
130  void drawMeOnly(CC_DRAW_CONTEXT& context) override;
131 
133  PointCoordinateType computeArrowsScale();
134 
135  void releaseAllInterators();
136  void hideShowAllInterators(bool visibility);
137 
138  void getInteractorIds(QStringList& removeViewIds);
139 
140 protected: // members
143 
146 
148  bool m_showBox;
149 
152 
155 
158 };
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
#define CV_DB_LIB_API
Definition: CV_db.h:15
std::string name
#define signals
Bounding box structure.
Definition: ecvBBox.h:25
Clipping box.
Definition: ecvClipBox.h:22
Components
Components.
Definition: ecvClipBox.h:58
const ccBBox & getBox() const
Returns the box extents.
Definition: ecvClipBox.h:87
ccGLMatrixd m_viewMatrix
View matrix.
Definition: ecvClipBox.h:157
ccHObject m_entityContainer
Associated entities container.
Definition: ecvClipBox.h:142
void showBox(bool state)
Whether to show the box or not.
Definition: ecvClipBox.h:90
CCVector3d m_lastOrientation
Last "orientation" vector (corresponding to last clicked point)
Definition: ecvClipBox.h:154
void boxModified(const ccBBox *box)
Signal sent each time the box is modified.
ccBBox m_box
Clipping box.
Definition: ecvClipBox.h:145
Components m_activeComponent
Active component.
Definition: ecvClipBox.h:151
bool m_showBox
Show box.
Definition: ecvClipBox.h:148
CV_CLASS_ENUM getClassID() const override
Returns class ID.
Definition: ecvClipBox.h:82
const ccHObject & getContainer() const
Associated entity container.
Definition: ecvClipBox.h:118
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
Double version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:56
A 3D cloud interface with associated features (color, normals, octree, etc.)
std::vector< unsigned char > VisibilityTableType
Array of "visibility" information for each point.
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
virtual void drawMeOnly(CC_DRAW_CONTEXT &context)
Draws the entity only (not its children)
Definition: ecvHObject.h:655
virtual ccBBox getOwnBB(bool withGLFeatures=false)
Returns the entity's own bounding-box.
Definition: ecvHObject.cpp:757
Interactor interface (entity that can be dragged or clicked in a 3D view)
Definition: ecvInteractor.h:20
virtual bool move3D(const CCVector3d &u)
Called on mouse move (for 3D interactors)
Definition: ecvInteractor.h:40
virtual bool move2D(int x, int y, int dx, int dy, int screenWidth, int screenHeight)
Called on mouse move (for 2D interactors)
Definition: ecvInteractor.h:32
ImGuiContext * context
Definition: Window.cpp:76
normal_z y
normal_z x
@ CLIPPING_BOX
Definition: CVTypes.h:143
@ SPHERE
Definition: CVTypes.h:121
Display context.