ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvHObject.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 // CV_CORE_LIB
11 #include "BoundingBox.h"
12 
13 // Local
14 #include "ecvColorTypes.h"
15 #include "ecvDrawableObject.h"
16 #include "ecvGLMatrix.h"
17 #include "ecvGenericDisplayTools.h"
18 #include "ecvObject.h"
19 
20 class QIcon;
21 class ccBBox;
22 class ecvOrientedBBox;
23 
26 public: // construction
28 
30  ccHObject(QString name = QString());
32  ccHObject(const ccHObject& object);
33 
35  virtual ~ccHObject() override;
36 
38 
45  static ccHObject* New(CV_CLASS_ENUM objectType, const char* name = nullptr);
46 
48 
52  static ccHObject* New(const QString& pluginId,
53  const QString& classId,
54  const char* name = nullptr);
55 
59  static Eigen::Vector3d ComputeMinBound(
60  const std::vector<Eigen::Vector3d>& points);
62  static Eigen::Vector3d ComputeMaxBound(
63  const std::vector<Eigen::Vector3d>& points);
65  static Eigen::Vector3d ComputeCenter(
66  const std::vector<Eigen::Vector3d>& points);
67 
73  static void ResizeAndPaintUniformColor(std::vector<Eigen::Vector3d>& colors,
74  std::size_t size,
75  const Eigen::Vector3d& color);
76 
81  static void TransformPoints(const Eigen::Matrix4d& transformation,
82  std::vector<Eigen::Vector3d>& points);
87  static void TransformNormals(const Eigen::Matrix4d& transformation,
88  std::vector<Eigen::Vector3d>& normals);
89 
94  static void TransformCovariances(const Eigen::Matrix4d& transformation,
95  std::vector<Eigen::Matrix3d>& covariances);
96 
104  static void TranslatePoints(const Eigen::Vector3d& translation,
105  std::vector<Eigen::Vector3d>& points,
106  bool relative);
115  static void ScalePoints(const double scale,
116  std::vector<Eigen::Vector3d>& points,
117  const Eigen::Vector3d& center);
124  static void RotatePoints(const Eigen::Matrix3d& R,
125  std::vector<Eigen::Vector3d>& points,
126  const Eigen::Vector3d& center);
131  static void RotateNormals(const Eigen::Matrix3d& R,
132  std::vector<Eigen::Vector3d>& normals);
133 
138  static void RotateCovariances(const Eigen::Matrix3d& R,
139  std::vector<Eigen::Matrix3d>& covariances);
140 
141  // for virtual functions with cloudViewer interface
142  virtual bool IsEmpty() const { return true; }
144  virtual Eigen::Vector3d GetMinBound() const { return Eigen::Vector3d(); }
145  virtual Eigen::Vector2d GetMin2DBound() const { return Eigen::Vector2d(); }
147  virtual Eigen::Vector3d GetMaxBound() const { return Eigen::Vector3d(); }
148  virtual Eigen::Vector2d GetMax2DBound() const { return Eigen::Vector2d(); }
150  virtual Eigen::Vector3d GetCenter() const { return Eigen::Vector3d(); }
151 
155 
157  virtual ccHObject& Transform(const Eigen::Matrix4d& transformation) {
158  return *this;
159  }
165  virtual ccHObject& Translate(const Eigen::Vector3d& translation,
166  bool relative = true) {
167  return *this;
168  }
176  virtual ccHObject& Scale(const double s, const Eigen::Vector3d& center) {
177  return *this;
178  }
179  virtual ccHObject& Scale(const double s) { return Scale(s, GetCenter()); }
186  virtual ccHObject& Rotate(const Eigen::Matrix3d& R,
187  const Eigen::Vector3d& center) {
188  return *this;
189  }
190  virtual ccHObject& Rotate(const Eigen::Matrix3d& R) {
191  return Rotate(R, GetCenter());
192  }
193 
195  static Eigen::Matrix3d GetRotationMatrixFromXYZ(
196  const Eigen::Vector3d& rotation);
198  static Eigen::Matrix3d GetRotationMatrixFromYZX(
199  const Eigen::Vector3d& rotation);
201  static Eigen::Matrix3d GetRotationMatrixFromZXY(
202  const Eigen::Vector3d& rotation);
204  static Eigen::Matrix3d GetRotationMatrixFromXZY(
205  const Eigen::Vector3d& rotation);
207  static Eigen::Matrix3d GetRotationMatrixFromZYX(
208  const Eigen::Vector3d& rotation);
210  static Eigen::Matrix3d GetRotationMatrixFromYXZ(
211  const Eigen::Vector3d& rotation);
213  static Eigen::Matrix3d GetRotationMatrixFromAxisAngle(
214  const Eigen::Vector3d& rotation);
216  static Eigen::Matrix3d GetRotationMatrixFromQuaternion(
217  const Eigen::Vector4d& rotation);
219  static Eigen::Matrix3d GetRotationMatrixFromEulerAngle(
220  const Eigen::Vector3d& rotation);
223 
224 public: // base members access
225  inline QString getViewId() const {
226  return QString::number(this->getUniqueID(), 10);
227  }
228 
230 
232  inline CV_CLASS_ENUM getClassID() const override {
234  }
235 
237  inline bool isGroup() const {
238  return getClassID() ==
240  }
241 
243 
245  inline ccHObject* getParent() const { return m_parent; }
246 
248 
253  virtual QIcon getIcon() const;
254 
255 public: // dependencies management
258  DP_NONE = 0,
259  DP_NOTIFY_OTHER_ON_DELETE = 1,
261  DP_NOTIFY_OTHER_ON_UPDATE =
262  2,
264  // DP_NOTIFY_XXX = 4,
265  DP_DELETE_OTHER = 8,
266  DP_PARENT_OF_OTHER = 24,
268  };
269 
271 
276  void addDependency(ccHObject* otherObject, int flags, bool additive = true);
277 
279 
281  int getDependencyFlagsWith(const ccHObject* otherObject);
282 
284 
286  void removeDependencyWith(ccHObject* otherObject);
287 
289 
293 
294 public: // children management
296 
305  virtual bool addChild(ccHObject* child,
306  int dependencyFlags = DP_PARENT_OF_OTHER,
307  int insertIndex = -1);
308 
310 
312  inline unsigned getChildrenNumber() const {
313  return static_cast<unsigned>(m_children.size());
314  }
315 
317 
319  unsigned int getChildCountRecursive() const;
320 
322 
325  inline ccHObject* getChild(unsigned childPos) const {
326  return (childPos < getChildrenNumber() ? m_children[childPos]
327  : nullptr);
328  }
329 
331 
334  ccHObject* find(unsigned uniqueID);
335 
337  using Container = std::vector<ccHObject*>;
338 
340  using Shared = QSharedPointer<ccHObject>;
341 
343  using SharedContainer = std::vector<Shared>;
344 
346 
352  unsigned filterChildren(Container& filteredChildren,
353  bool recursive = false,
355  bool strict = false) const;
356 
358 
361  void detachChild(ccHObject* child);
363 
369 
370  void getTypeID_recursive(std::vector<removeInfo>& rmInfos, bool relative);
371  void getTypeID_recursive(std::vector<hideInfo>& hdInfos, bool relative);
372 
373  void removeChild(ccHObject* child);
375 
379  void removeChild(int pos);
383  int getChildIndex(const ccHObject* aChild) const;
385  void swapChildren(unsigned firstChildIndex, unsigned secondChildIndex);
387  int getIndex() const;
388 
390  void transferChild(ccHObject* child, ccHObject& newParent);
392  void transferChildren(ccHObject& newParent,
393  bool forceFatherDependent = false);
394 
397  return (m_children.empty() ? nullptr : m_children.front());
398  }
401  return (m_children.empty() ? nullptr : m_children.back());
402  }
403 
405  bool isAncestorOf(const ccHObject* anObject) const;
406 
407  void removeFromRenderScreen(bool recursive = true);
408 
409 public: // bounding-box
410  void hideObject_recursive(bool recursive);
413 
415 
419  virtual ccBBox getOwnBB(bool withGLFeatures = false);
420 
421  void setRedrawFlagRecursive(bool redraw = false);
422  void setForceRedrawRecursive(bool redraw = false);
423 
424  void setPointSizeRecursive(int pSize);
426 
428 
432  virtual ccBBox getBB_recursive(bool withGLFeatures = false,
433  bool onlyEnabledChildren = true);
434 
437 
440 
445  virtual GlobalBoundingBox getOwnGlobalBB(bool withGLFeatures = false);
446 
449 
456  virtual bool getOwnGlobalBB(CCVector3d& minCorner, CCVector3d& maxCorner);
457 
459 
464  bool withGLFeatures = false, bool onlyEnabledChildren = true);
465 
467 
474  virtual ccBBox getDisplayBB_recursive(bool relative);
475 
477 
485  virtual ccBBox getOwnFitBB(ccGLMatrix& trans);
486 
488  virtual void drawBB(CC_DRAW_CONTEXT& context, const ecvColor::Rgb& col);
489 
490 public: // display
491  // Inherited from ccDrawableObject
492  void draw(CC_DRAW_CONTEXT& context) override;
493 
495 
499 
501  virtual void redrawDisplay(bool forceRedraw = true, bool only2D = false);
502 
505 
509 
511  virtual bool isDisplayed() const;
512 
514  virtual bool isBranchEnabled() const;
515 
516 /*** RECURSIVE CALL SCRIPTS ***/
517 
518 // 0 parameter
519 #define ccHObject_recursive_call0(baseName, recursiveName) \
520  inline virtual void recursiveName() { \
521  baseName(); \
522  for (Container::iterator it = m_children.begin(); \
523  it != m_children.end(); ++it) \
524  (*it)->recursiveName(); \
525  }
526 
527 // 1 parameter
528 #define ccHObject_recursive_call1(baseName, param1Type, recursiveName) \
529  inline virtual void recursiveName(param1Type p) { \
530  baseName(p); \
531  for (Container::iterator it = m_children.begin(); \
532  it != m_children.end(); ++it) \
533  (*it)->recursiveName(p); \
534  }
535 
536  ccHObject_recursive_call1(redrawDisplay, bool, redrawDisplay_recursive) ccHObject_recursive_call1(
537  redrawDisplay,
538  bool,
539  refreshDisplay_recursive) ccHObject_recursive_call1(setSelected,
540  bool,
541  setSelected_recursive)
542  ccHObject_recursive_call0(toggleActivation,
543  toggleActivation_recursive)
544  ccHObject_recursive_call0(toggleVisibility,
545  toggleVisibility_recursive)
546  ccHObject_recursive_call0(toggleColors,
547  toggleColors_recursive)
549  resetGLTransformationHistory,
550  resetGLTransformationHistory_recursive)
552  toggleNormals,
553  toggleNormals_recursive)
555  toggleSF,
556  toggleSF_recursive)
558  toggleShowName,
559  toggleShowName_recursive);
560 
562  unsigned findMaxUniqueID_recursive() const;
563 
565 
569  void applyGLTransformation_recursive(const ccGLMatrix* trans = nullptr);
570 
573  virtual void notifyGeometryUpdate();
574 
575  // inherited from ccSerializableObject
576  bool isSerializable() const override;
577  bool toFile(QFile& out, short dataVersion) const override;
578  bool fromFile(QFile& in,
579  short dataVersion,
580  int flags,
581  LoadedIDMap& oldToNewIDMap) override;
582  short minimumFileVersion() const override;
583 
585 
593  bool fromFileNoChildren(QFile& in,
594  short dataVersion,
595  int flags,
596  LoadedIDMap& oldToNewIDMap);
597 
599 
602  virtual inline bool isShareable() const { return false; }
603 
608  SELECTION_IGNORED
609  };
610 
612 
616  virtual inline void setSelectionBehavior(SelectionBehavior mode) {
617  m_selectionBehavior = mode;
618  }
619 
621  virtual inline SelectionBehavior getSelectionBehavior() const {
622  return m_selectionBehavior;
623  }
624 
626  virtual inline unsigned getUniqueIDForDisplay() const {
627  return getUniqueID();
628  }
629 
631  virtual inline const ccGLMatrix& getGLTransformationHistory() const {
632  return m_glTransHistory;
633  }
635  virtual inline void setGLTransformationHistory(const ccGLMatrix& mat) {
636  m_glTransHistory = mat;
637  }
639  virtual inline void resetGLTransformationHistory() {
640  m_glTransHistory.toIdentity();
641  }
642 
643 public:
645  bool pushDisplayState() override;
646 
648  void popDisplayState(bool apply = true) override;
649 
650 protected:
652  virtual inline void setParent(ccHObject* anObject) { m_parent = anObject; }
653 
655  virtual void drawMeOnly(
656  CC_DRAW_CONTEXT& context) { /*does nothing by default*/ }
657 
659 
662  virtual void applyGLTransformation(const ccGLMatrix& trans);
663 
665 
670  virtual bool toFile_MeOnly(QFile& out, short dataVersion) const;
671 
673 
681  virtual bool fromFile_MeOnly(QFile& in,
682  short dataVersion,
683  int flags,
684  LoadedIDMap& oldToNewIDMap);
685 
688 
691  virtual short minimumFileVersion_MeOnly() const;
692 
694 
696  virtual void drawNameIn3D();
697 
699 
701  virtual void onDeletionOf(const ccHObject* obj);
702 
704 
706  virtual void onUpdateOf(ccHObject* obj) { /*does nothing by default*/ }
707 
710 
713 
716 
718 
721  std::map<ccHObject*, int> m_dependencies;
722 
724 
728 
731 };
732 
733 /*** Helpers ***/
734 
736 
742 inline void ConvertToGroup(const ccHObject::Container& origin,
743  ccHObject& dest,
744  int dependencyFlags = ccHObject::DP_NONE) {
745  size_t count = origin.size();
746  for (size_t i = 0; i < count; ++i) {
747  // we don't take objects that are siblings of others
748  bool isSiblingOfAnotherOne = false;
749  for (size_t j = 0; j < count; ++j) {
750  if (i != j && origin[j]->isAncestorOf(origin[i])) {
751  isSiblingOfAnotherOne = true;
752  break;
753  }
754  }
755 
756  if (!isSiblingOfAnotherOne) {
757  dest.addChild(origin[i], dependencyFlags);
758  }
759  }
760 }
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
int width
int size
std::string name
int count
int points
math::float4 color
Bounding box structure.
Definition: ecvBBox.h:25
Generic interface for (3D) drawable entities.
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
virtual void notifyGeometryUpdate()
virtual bool toFile_MeOnly(QFile &out, short dataVersion) const
Save own object data.
static Eigen::Vector3d ComputeCenter(const std::vector< Eigen::Vector3d > &points)
Computer center of a list of points.
static void RotatePoints(const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &center)
Rotate all points with the rotation matrix R.
static Eigen::Matrix3d GetRotationMatrixFromYXZ(const Eigen::Vector3d &rotation)
Get Rotation Matrix from YXZ RotationType.
void setLineWidthRecursive(PointCoordinateType width)
virtual void onDeletionOf(const ccHObject *obj)
This method is called when another object is deleted.
virtual SelectionBehavior getSelectionBehavior() const
Returns selection behavior.
Definition: ecvHObject.h:621
static void ResizeAndPaintUniformColor(std::vector< Eigen::Vector3d > &colors, std::size_t size, const Eigen::Vector3d &color)
Resizes the colors vector and paints a uniform color.
virtual ccHObject & Scale(const double s, const Eigen::Vector3d &center)
Apply scaling to the geometry coordinates. Given a scaling factor , and center , a given point is tr...
Definition: ecvHObject.h:176
bool fromFileNoChildren(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
Custom version of ccSerializableObject::fromFile.
void hideBB(CC_DRAW_CONTEXT context)
virtual ccBBox getOwnBB(bool withGLFeatures=false)
Returns the entity's own bounding-box.
virtual const ccGLMatrix & getGLTransformationHistory() const
Returns the transformation 'history' matrix.
Definition: ecvHObject.h:631
static Eigen::Matrix3d GetRotationMatrixFromYZX(const Eigen::Vector3d &rotation)
Get Rotation Matrix from YZX RotationType.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context)
Draws the entity only (not its children)
Definition: ecvHObject.h:655
void draw(CC_DRAW_CONTEXT &context) override
Draws entity and its children.
QSharedPointer< ccHObject > Shared
Shared pointer.
Definition: ecvHObject.h:340
ccHObject * find(unsigned uniqueID)
Finds an entity in this object hierarchy.
void setRemoveType(CC_DRAW_CONTEXT &context)
bool toFile(QFile &out, short dataVersion) const override
Saves data to binary stream.
virtual void setParent(ccHObject *anObject)
Sets parent object.
Definition: ecvHObject.h:652
void setHideShowType(CC_DRAW_CONTEXT &context)
bool m_isDeleting
Flag to safely handle dependencies when the object is being deleted.
Definition: ecvHObject.h:730
SelectionBehavior
Behavior when selected.
Definition: ecvHObject.h:605
@ SELECTION_FIT_BBOX
Definition: ecvHObject.h:607
@ SELECTION_AA_BBOX
Definition: ecvHObject.h:606
virtual ccBBox GetAxisAlignedBoundingBox() const
Returns an axis-aligned bounding box of the geometry.
virtual bool isShareable() const
Returns whether object is shareable or not.
Definition: ecvHObject.h:602
bool getAbsoluteGLTransformation(ccGLMatrix &trans) const
virtual bool isDisplayed() const
Returns whether the object is actually displayed (visible) or not.
ccHObject * getLastChild() const
Shortcut: returns last child.
Definition: ecvHObject.h:400
ccGLMatrix m_glTransHistory
Cumulative GL transformation.
Definition: ecvHObject.h:727
static Eigen::Vector3d ComputeMaxBound(const std::vector< Eigen::Vector3d > &points)
Compute max bound of a list points.
ENTITY_TYPE getEntityType() const
void transferChildren(ccHObject &newParent, bool forceFatherDependent=false)
Transfer all children to another parent.
virtual ecvOrientedBBox GetOrientedBoundingBox() const
int getChildIndex(const ccHObject *aChild) const
Returns child index.
void removeFromRenderScreen(bool recursive=true)
static ccHObject * New(const QString &pluginId, const QString &classId, const char *name=nullptr)
Static factory (version to be used by external plugin factories)
static Eigen::Matrix3d GetRotationMatrixFromEulerAngle(const Eigen::Vector3d &rotation)
Get Rotation Matrix from Euler angle.
virtual Eigen::Vector3d GetCenter() const
Returns the center of the geometry coordinates.
Definition: ecvHObject.h:150
int getIndex() const
Returns index relatively to its parent or -1 if no parent.
bool isSerializable() const override
Returns whether object is serializable of not.
virtual ccHObject & Translate(const Eigen::Vector3d &translation, bool relative=true)
Apply translation to the geometry coordinates.
Definition: ecvHObject.h:165
int getDependencyFlagsWith(const ccHObject *otherObject)
Returns the dependency flags with a given object.
virtual void onUpdateOf(ccHObject *obj)
This method is called when another object (geometry) is updated.
Definition: ecvHObject.h:706
void removeAllChildren()
Removes all children.
SelectionBehavior m_selectionBehavior
Selection behavior.
Definition: ecvHObject.h:715
virtual short minimumFileVersion_MeOnly() const
std::map< ccHObject *, int > m_dependencies
Dependencies map.
Definition: ecvHObject.h:721
short minimumFileVersion() const override
Returns the minimum file version required to save this instance.
virtual ccBBox getDisplayBB_recursive(bool relative)
Returns the bounding-box of this entity and it's children WHEN DISPLAYED.
void removeDependencyWith(ccHObject *otherObject)
Removes any dependency flags with a given object.
virtual ccHObject & Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &center)
Apply rotation to the geometry coordinates and normals. Given a rotation matrix , and center ,...
Definition: ecvHObject.h:186
void addDependency(ccHObject *otherObject, int flags, bool additive=true)
Adds a new dependence (additive or not)
ccHObject * getFirstChild() const
Shortcut: returns first child.
Definition: ecvHObject.h:396
std::vector< Shared > SharedContainer
Shared instances container (for children, etc.)
Definition: ecvHObject.h:343
void detachChild(ccHObject *child)
Detaches a specific child.
static void TransformNormals(const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &normals)
Transforms the normals with the transformation matrix.
virtual ccBBox getOwnFitBB(ccGLMatrix &trans)
Returns best-fit bounding-box (if available)
bool isAncestorOf(const ccHObject *anObject) const
Returns true if the current object is an ancestor of the specified one.
virtual Eigen::Vector2d GetMax2DBound() const
Definition: ecvHObject.h:148
virtual ~ccHObject() override
Default destructor.
QString getViewId() const
Definition: ecvHObject.h:225
void applyGLTransformation_recursive(const ccGLMatrix *trans=nullptr)
Applies the active OpenGL transformation to the entity (recursive)
virtual ccHObject & Scale(const double s)
Definition: ecvHObject.h:179
unsigned getChildrenNumber() const
Returns the number of children.
Definition: ecvHObject.h:312
void setPointSizeRecursive(int pSize)
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
unsigned int getChildCountRecursive() const
Returns the total number of children under this object recursively.
virtual bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
Loads own object data.
virtual unsigned getUniqueIDForDisplay() const
Returns object unqiue ID used for display.
Definition: ecvHObject.h:626
virtual void setGLTransformationHistory(const ccGLMatrix &mat)
Sets the transformation 'history' matrix (handle with care!)
Definition: ecvHObject.h:635
void getTypeID_recursive(std::vector< removeInfo > &rmInfos, bool relative)
void setRedrawFlagRecursive(bool redraw=false)
void updateNameIn3DRecursive()
static void ScalePoints(const double scale, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &center)
Scale the coordinates of all points by the scaling factor scale.
static Eigen::Matrix3d GetRotationMatrixFromXYZ(const Eigen::Vector3d &rotation)
Get Rotation Matrix from XYZ RotationType.
ccHObject(const ccHObject &object)
Copy constructor.
virtual bool IsEmpty() const
Definition: ecvHObject.h:142
virtual void setSelectionBehavior(SelectionBehavior mode)
Sets selection behavior (when displayed)
Definition: ecvHObject.h:616
static Eigen::Matrix3d GetRotationMatrixFromZXY(const Eigen::Vector3d &rotation)
Get Rotation Matrix from ZXY RotationType.
static Eigen::Matrix3d GetRotationMatrixFromQuaternion(const Eigen::Vector4d &rotation)
Get Rotation Matrix from Quaternion.
static Eigen::Vector3d ComputeMinBound(const std::vector< Eigen::Vector3d > &points)
Compute min bound of a list points.
virtual void drawBB(CC_DRAW_CONTEXT &context, const ecvColor::Rgb &col)
Draws the entity (and its children) bounding-box.
DEPENDENCY_FLAGS
Dependency flags.
Definition: ecvHObject.h:257
unsigned findMaxUniqueID_recursive() const
Returns the max 'unique ID' of this entity and its siblings.
virtual ccBBox getBB_recursive(bool withGLFeatures=false, bool onlyEnabledChildren=true)
Returns the bounding-box of this entity and it's children.
virtual Eigen::Vector3d GetMaxBound() const
Returns max bounds for geometry coordinates.
Definition: ecvHObject.h:147
ccHObject * getParent() const
Returns parent object.
Definition: ecvHObject.h:245
void detachAllChildren()
Removes a specific child.
ccHObject(QString name=QString())
Default constructor.
virtual bool isBranchEnabled() const
Returns whether the object and all its ancestors are enabled.
void getTypeID_recursive(std::vector< hideInfo > &hdInfos, bool relative)
virtual Eigen::Vector3d GetMinBound() const
Returns min bounds for geometry coordinates.
Definition: ecvHObject.h:144
static Eigen::Matrix3d GetRotationMatrixFromAxisAngle(const Eigen::Vector3d &rotation)
Get Rotation Matrix from AxisAngle RotationType.
void transferChild(ccHObject *child, ccHObject &newParent)
Transfer a given child to another parent.
static void TransformPoints(const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &points)
Transforms all points with the transformation matrix.
virtual void redrawDisplay(bool forceRedraw=true, bool only2D=false)
Redraws associated display.
void removeDependencyFlag(ccHObject *otherObject, DEPENDENCY_FLAGS flag)
Removes a given dependency flag.
ccHObject * m_parent
Parent.
Definition: ecvHObject.h:709
virtual GlobalBoundingBox getGlobalBB_recursive(bool withGLFeatures=false, bool onlyEnabledChildren=true)
Returns the global bounding-box of this entity and it's children.
virtual ccHObject & Rotate(const Eigen::Matrix3d &R)
Definition: ecvHObject.h:190
static void TranslatePoints(const Eigen::Vector3d &translation, std::vector< Eigen::Vector3d > &points, bool relative)
Apply translation to the geometry coordinates.
void removeChild(ccHObject *child)
void removeChild(int pos)
Removes a specific child given its index.
virtual GlobalBoundingBox getOwnGlobalBB(bool withGLFeatures=false)
virtual QIcon getIcon() const
Returns the icon associated to this entity.
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
virtual void drawNameIn3D()
Draws the entity name in 3D.
virtual ccHObject & Transform(const Eigen::Matrix4d &transformation)
Apply transformation (4x4 matrix) to the geometry coordinates.
Definition: ecvHObject.h:157
static ccHObject * New(CV_CLASS_ENUM objectType, const char *name=nullptr)
Static factory.
bool pushDisplayState() override
Pushes the current display state (overridden)
void swapChildren(unsigned firstChildIndex, unsigned secondChildIndex)
Swaps two children.
static void RotateNormals(const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &normals)
Rotate all normals with the rotation matrix R.
static void RotateCovariances(const Eigen::Matrix3d &R, std::vector< Eigen::Matrix3d > &covariances)
Rotate all covariance matrices with the rotation matrix R.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads data from binary stream.
virtual void applyGLTransformation(const ccGLMatrix &trans)
Applies a GL transformation to the entity.
virtual bool getOwnGlobalBB(CCVector3d &minCorner, CCVector3d &maxCorner)
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
virtual void resetGLTransformationHistory()
Resets the transformation 'history' matrix.
Definition: ecvHObject.h:639
void setForceRedrawRecursive(bool redraw=false)
static Eigen::Matrix3d GetRotationMatrixFromZYX(const Eigen::Vector3d &rotation)
Get Rotation Matrix from ZYX RotationType.
void popDisplayState(bool apply=true) override
Pops the last pushed display state (overridden)
void showBB(CC_DRAW_CONTEXT context)
virtual Eigen::Vector2d GetMin2DBound() const
Definition: ecvHObject.h:145
ccHObject * getChild(unsigned childPos) const
Returns the ith child.
Definition: ecvHObject.h:325
Container m_children
Children.
Definition: ecvHObject.h:712
static void TransformCovariances(const Eigen::Matrix4d &transformation, std::vector< Eigen::Matrix3d > &covariances)
Transforms all covariance matrices with the transformation.
CV_CLASS_ENUM getClassID() const override
Returns class ID.
Definition: ecvHObject.h:232
static Eigen::Matrix3d GetRotationMatrixFromXZY(const Eigen::Vector3d &rotation)
Get Rotation Matrix from XZY RotationType.
bool isGroup() const
Returns whether the instance is a group.
Definition: ecvHObject.h:237
void hideObject_recursive(bool recursive)
Generic "CLOUDVIEWER Object" template.
Definition: ecvObject.h:49
virtual unsigned getUniqueID() const
Returns object unique ID.
Definition: ecvObject.h:86
virtual CV_CLASS_ENUM getClassID() const =0
Returns class ID.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
Bounding box structure.
Definition: BoundingBox.h:25
RGB color structure.
Definition: ecvColorTypes.h:49
double colors[3]
double normals[3]
ENTITY_TYPE
#define ccHObject_recursive_call1(baseName, param1Type, recursiveName)
Definition: ecvHObject.h:528
void ConvertToGroup(const ccHObject::Container &origin, ccHObject &dest, int dependencyFlags=ccHObject::DP_NONE)
Puts all entities inside a container in a group.
Definition: ecvHObject.h:742
#define ccHObject_recursive_call0(baseName, recursiveName)
Definition: ecvHObject.h:519
ImGuiContext * context
Definition: Window.cpp:76
@ HIERARCHY_OBJECT
Definition: CVTypes.h:103
@ OBJECT
Definition: CVTypes.h:102
Display context.