52 static ccHObject* New(
const QString& pluginId,
53 const QString& classId,
54 const char*
name =
nullptr);
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);
73 static void ResizeAndPaintUniformColor(std::vector<Eigen::Vector3d>&
colors,
75 const Eigen::Vector3d&
color);
82 std::vector<Eigen::Vector3d>&
points);
88 std::vector<Eigen::Vector3d>&
normals);
94 static void TransformCovariances(
const Eigen::Matrix4d& transformation,
95 std::vector<Eigen::Matrix3d>& covariances);
104 static void TranslatePoints(
const Eigen::Vector3d& translation,
105 std::vector<Eigen::Vector3d>&
points,
115 static void ScalePoints(
const double scale,
116 std::vector<Eigen::Vector3d>&
points,
117 const Eigen::Vector3d& center);
125 std::vector<Eigen::Vector3d>&
points,
126 const Eigen::Vector3d& center);
132 std::vector<Eigen::Vector3d>&
normals);
138 static void RotateCovariances(
const Eigen::Matrix3d& R,
139 std::vector<Eigen::Matrix3d>& covariances);
144 virtual Eigen::Vector3d
GetMinBound()
const {
return Eigen::Vector3d(); }
147 virtual Eigen::Vector3d
GetMaxBound()
const {
return Eigen::Vector3d(); }
150 virtual Eigen::Vector3d
GetCenter()
const {
return Eigen::Vector3d(); }
153 virtual ccBBox GetAxisAlignedBoundingBox()
const;
166 bool relative =
true) {
187 const Eigen::Vector3d& center) {
191 return Rotate(R, GetCenter());
195 static Eigen::Matrix3d GetRotationMatrixFromXYZ(
198 static Eigen::Matrix3d GetRotationMatrixFromYZX(
201 static Eigen::Matrix3d GetRotationMatrixFromZXY(
204 static Eigen::Matrix3d GetRotationMatrixFromXZY(
207 static Eigen::Matrix3d GetRotationMatrixFromZYX(
210 static Eigen::Matrix3d GetRotationMatrixFromYXZ(
213 static Eigen::Matrix3d GetRotationMatrixFromAxisAngle(
216 static Eigen::Matrix3d GetRotationMatrixFromQuaternion(
219 static Eigen::Matrix3d GetRotationMatrixFromEulerAngle(
253 virtual QIcon getIcon()
const;
259 DP_NOTIFY_OTHER_ON_DELETE = 1,
261 DP_NOTIFY_OTHER_ON_UPDATE =
266 DP_PARENT_OF_OTHER = 24,
276 void addDependency(
ccHObject* otherObject,
int flags,
bool additive =
true);
281 int getDependencyFlagsWith(
const ccHObject* otherObject);
286 void removeDependencyWith(
ccHObject* otherObject);
292 void removeDependencyFlag(
ccHObject* otherObject, DEPENDENCY_FLAGS flag);
306 int dependencyFlags = DP_PARENT_OF_OTHER,
307 int insertIndex = -1);
313 return static_cast<unsigned>(m_children.size());
319 unsigned int getChildCountRecursive()
const;
326 return (childPos < getChildrenNumber() ? m_children[childPos]
340 using Shared = QSharedPointer<ccHObject>;
352 unsigned filterChildren(
Container& filteredChildren,
353 bool recursive =
false,
355 bool strict =
false)
const;
368 void detachAllChildren();
370 void getTypeID_recursive(std::vector<removeInfo>& rmInfos,
bool relative);
371 void getTypeID_recursive(std::vector<hideInfo>& hdInfos,
bool relative);
379 void removeChild(
int pos);
381 void removeAllChildren();
383 int getChildIndex(
const ccHObject* aChild)
const;
385 void swapChildren(
unsigned firstChildIndex,
unsigned secondChildIndex);
387 int getIndex()
const;
392 void transferChildren(
ccHObject& newParent,
393 bool forceFatherDependent =
false);
397 return (m_children.empty() ?
nullptr : m_children.front());
401 return (m_children.empty() ?
nullptr : m_children.back());
405 bool isAncestorOf(
const ccHObject* anObject)
const;
407 void removeFromRenderScreen(
bool recursive =
true);
410 void hideObject_recursive(
bool recursive);
419 virtual ccBBox getOwnBB(
bool withGLFeatures =
false);
421 void setRedrawFlagRecursive(
bool redraw =
false);
422 void setForceRedrawRecursive(
bool redraw =
false);
424 void setPointSizeRecursive(
int pSize);
432 virtual ccBBox getBB_recursive(
bool withGLFeatures =
false,
433 bool onlyEnabledChildren =
true);
464 bool withGLFeatures =
false,
bool onlyEnabledChildren =
true);
474 virtual ccBBox getDisplayBB_recursive(
bool relative);
494 void updateNameIn3DRecursive();
501 virtual void redrawDisplay(
bool forceRedraw =
true,
bool only2D =
false);
508 bool getAbsoluteGLTransformation(
ccGLMatrix& trans)
const;
511 virtual bool isDisplayed()
const;
514 virtual bool isBranchEnabled()
const;
519 #define ccHObject_recursive_call0(baseName, recursiveName) \
520 inline virtual void recursiveName() { \
522 for (Container::iterator it = m_children.begin(); \
523 it != m_children.end(); ++it) \
524 (*it)->recursiveName(); \
528 #define ccHObject_recursive_call1(baseName, param1Type, recursiveName) \
529 inline virtual void recursiveName(param1Type p) { \
531 for (Container::iterator it = m_children.begin(); \
532 it != m_children.end(); ++it) \
533 (*it)->recursiveName(p); \
541 setSelected_recursive)
543 toggleActivation_recursive)
545 toggleVisibility_recursive)
547 toggleColors_recursive)
549 resetGLTransformationHistory,
550 resetGLTransformationHistory_recursive)
553 toggleNormals_recursive)
559 toggleShowName_recursive);
562 unsigned findMaxUniqueID_recursive()
const;
569 void applyGLTransformation_recursive(
const ccGLMatrix* trans =
nullptr);
573 virtual void notifyGeometryUpdate();
577 bool toFile(QFile& out,
short dataVersion)
const override;
593 bool fromFileNoChildren(QFile& in,
617 m_selectionBehavior = mode;
622 return m_selectionBehavior;
632 return m_glTransHistory;
636 m_glTransHistory = mat;
640 m_glTransHistory.toIdentity();
662 virtual void applyGLTransformation(
const ccGLMatrix& trans);
670 virtual bool toFile_MeOnly(QFile& out,
short dataVersion)
const;
681 virtual bool fromFile_MeOnly(QFile& in,
684 LoadedIDMap& oldToNewIDMap);
691 virtual short minimumFileVersion_MeOnly()
const;
696 virtual void drawNameIn3D();
701 virtual void onDeletionOf(
const ccHObject* obj);
746 for (
size_t i = 0; i <
count; ++i) {
748 bool isSiblingOfAnotherOne =
false;
749 for (
size_t j = 0; j <
count; ++j) {
751 isSiblingOfAnotherOne =
true;
756 if (!isSiblingOfAnotherOne) {
float PointCoordinateType
Type of the coordinates of a (N-D) point.
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Generic interface for (3D) drawable entities.
virtual bool pushDisplayState()
Pushes the current display state.
virtual void popDisplayState(bool apply=true)
Pops the last pushed display state.
virtual void draw(CC_DRAW_CONTEXT &context)=0
Draws entity and its children.
Float version of ccGLMatrixTpl.
Hierarchical CLOUDVIEWER Object.
virtual SelectionBehavior getSelectionBehavior() const
Returns selection behavior.
virtual ccHObject & Scale(const double s, const Eigen::Vector3d ¢er)
Apply scaling to the geometry coordinates. Given a scaling factor , and center , a given point is tr...
virtual const ccGLMatrix & getGLTransformationHistory() const
Returns the transformation 'history' matrix.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context)
Draws the entity only (not its children)
QSharedPointer< ccHObject > Shared
Shared pointer.
virtual void setParent(ccHObject *anObject)
Sets parent object.
bool m_isDeleting
Flag to safely handle dependencies when the object is being deleted.
SelectionBehavior
Behavior when selected.
virtual bool isShareable() const
Returns whether object is shareable or not.
ccHObject * getLastChild() const
Shortcut: returns last child.
ccGLMatrix m_glTransHistory
Cumulative GL transformation.
virtual Eigen::Vector3d GetCenter() const
Returns the center of the geometry coordinates.
virtual ccHObject & Translate(const Eigen::Vector3d &translation, bool relative=true)
Apply translation to the geometry coordinates.
virtual void onUpdateOf(ccHObject *obj)
This method is called when another object (geometry) is updated.
SelectionBehavior m_selectionBehavior
Selection behavior.
std::map< ccHObject *, int > m_dependencies
Dependencies map.
virtual ccHObject & Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d ¢er)
Apply rotation to the geometry coordinates and normals. Given a rotation matrix , and center ,...
ccHObject * getFirstChild() const
Shortcut: returns first child.
std::vector< Shared > SharedContainer
Shared instances container (for children, etc.)
virtual Eigen::Vector2d GetMax2DBound() const
QString getViewId() const
virtual ccHObject & Scale(const double s)
unsigned getChildrenNumber() const
Returns the number of children.
virtual unsigned getUniqueIDForDisplay() const
Returns object unqiue ID used for display.
virtual void setGLTransformationHistory(const ccGLMatrix &mat)
Sets the transformation 'history' matrix (handle with care!)
virtual bool IsEmpty() const
virtual void setSelectionBehavior(SelectionBehavior mode)
Sets selection behavior (when displayed)
DEPENDENCY_FLAGS
Dependency flags.
virtual Eigen::Vector3d GetMaxBound() const
Returns max bounds for geometry coordinates.
ccHObject * getParent() const
Returns parent object.
virtual Eigen::Vector3d GetMinBound() const
Returns min bounds for geometry coordinates.
ccHObject * m_parent
Parent.
virtual ccHObject & Rotate(const Eigen::Matrix3d &R)
virtual ccHObject & Transform(const Eigen::Matrix4d &transformation)
Apply transformation (4x4 matrix) to the geometry coordinates.
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
virtual void resetGLTransformationHistory()
Resets the transformation 'history' matrix.
virtual Eigen::Vector2d GetMin2DBound() const
ccHObject * getChild(unsigned childPos) const
Returns the ith child.
Container m_children
Children.
CV_CLASS_ENUM getClassID() const override
Returns class ID.
bool isGroup() const
Returns whether the instance is a group.
Generic "CLOUDVIEWER Object" template.
short minimumFileVersion() const override
Returns the minimum file version required to save this instance.
virtual unsigned getUniqueID() const
Returns object unique ID.
virtual CV_CLASS_ENUM getClassID() const =0
Returns class ID.
bool toFile(QFile &out, short dataVersion) const override
Saves data to binary stream.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Reimplemented from ccSerializableObject::fromFile.
virtual bool isSerializable() const
Returns whether object is serializable of not.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
#define ccHObject_recursive_call1(baseName, param1Type, recursiveName)
void ConvertToGroup(const ccHObject::Container &origin, ccHObject &dest, int dependencyFlags=ccHObject::DP_NONE)
Puts all entities inside a container in a group.
#define ccHObject_recursive_call0(baseName, recursiveName)
static void TransformPoints(fgr::Points &points, const Eigen::Matrix4f &Trans)