ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvOctreeProxy.cpp
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 #include "ecvOctreeProxy.h"
9 
10 #include "ecvBBox.h"
11 #include "ecvDisplayTools.h"
12 
13 // Local
14 // #include "ccCameraSensor.h"
15 // #include "ccNormalVectors.h"
16 // #include "ccBox.h"
17 
18 // cloudViewer
19 // #include <ScalarFieldTools.h>
20 // #include <RayAndBox.h>
21 
23  QString name /*="Octree"*/)
24  : ccHObject(name), m_octree(octree) {
25  setVisible(false);
26  lockVisibility(false);
27 }
28 
30 
31 ccBBox ccOctreeProxy::getOwnBB(bool withGLFeatures /*=false*/) {
32  if (!m_octree) {
33  assert(false);
34  return ccBBox();
35  }
36 
37  return withGLFeatures ? m_octree->getSquareBB() : m_octree->getPointsBB();
38 }
39 
41  if (!m_octree) {
42  assert(false);
43  return;
44  }
45 
46  if (!MACRO_Draw3D(context)) return;
47 
48  if (ecvDisplayTools::GetMainWindow() == nullptr) return;
49 
50  bool entityPickingMode = MACRO_EntityPicking(context);
51 
52  if (entityPickingMode) {
53  // not fast at all!
54  if (MACRO_FastEntityPicking(context)) return;
55  }
56 
58  m_octree->draw(context);
59 }
std::string name
Bounding box structure.
Definition: ecvBBox.h:25
virtual void lockVisibility(bool state)
Locks/unlocks visibility.
virtual void setVisible(bool state)
Sets entity visibility.
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
virtual bool isEnabled() const
Returns whether the object is enabled or not.
Definition: ecvObject.h:97
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
virtual ~ccOctreeProxy()
Destructor.
ccOctree::Shared m_octree
Associated octree.
ccOctreeProxy(ccOctree::Shared octree=ccOctree::Shared(0), QString name="Octree")
Default constructor.
void setOctreeVisibale(bool state)
virtual void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
QSharedPointer< ccOctree > Shared
Shared pointer.
Definition: ecvOctree.h:32
static QMainWindow * GetMainWindow()
#define MACRO_Draw3D(context)
#define MACRO_FastEntityPicking(context)
#define MACRO_EntityPicking(context)
ImGuiContext * context
Definition: Window.cpp:76
cloudViewer::DgmOctree * octree
Display context.