Debian Codegraph @

plugins/core/Standard/qMPlane/src/ccItemTree.h

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qMPlane #
4 //# #
5 //# This program is free software; you can redistribute it and/or modify #
6 //# it under the terms of the GNU General Public License as published by #
7 //# the Free Software Foundation; version 2 of the License. #
8 //# #
9 //# This program is distributed in the hope that it will be useful, #
10 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 //# GNU General Public License for more details. #
13 //# #
14 //# COPYRIGHT: AIT Austrian Institute of Technology GmbH #
15 //# #
16 //##########################################################################
17
18 #ifndef CC_MPLANE_ITEM_TREE
19 #define CC_MPLANE_ITEM_TREE
20
21 // std
22 #include <array>
23
24 // Qt
25 #include "ccHObject.h"
26 #include "ccMainAppInterface.h"
27 #include "cc2DLabel.h"
28 #include "ccPointCloud.h"
29
30 namespace CC_ITEM_TREE {
31 enum CC_TYPES_MAP {
32 HIERARCHY_OBJECT = CC_TYPES::HIERARCHY_OBJECT,
33 PLANE = CC_TYPES::PLANE,
34 LABEL2D = CC_TYPES::LABEL_2D
35 };
36
37 /**
38 * Find an item in the root's hierarchy tree by type and optionally by name.
39 * If multiple matching objects exist in the hierarchy, the first one is returned.
40 *
41 * @param[in] root The root of the item tree to be searched.
42 * @param[in] itemType The type of items to be found.
43 * @param[in] itemName (Optional) name of the searched item.
44 * @throws std::invalid_argument Exception is thrown if root is nullptr
45 * @return ccHObject* Returns an item if found, otherwise a nullptr.
46 */
47 ccHObject* findItemInHierarchy(ccHObject *root, CC_TYPES_MAP itemType, QString itemName = nullptr);
48
49 /**
50 * Find a matching container or create a new one if it is not existing in the parent's hierarchy tree.
51 * The newly created object is added to the parent object as a child.
52 *
53 * @param[in] parent The parent object of the container.
54 * @param[in] containerName The name of the new container object.
55 * @param[in] app The ccMainAppInterface object.
56 * @throws std::invalid_argument Exception is thrown if parent is nullptr
57 * @return ccHObject* Returns the newly created container if not existing, otherwise existing one.
58 */
59
60 ccHObject* findOrCreateContainer(ccHObject *parent, const QString &containerName, ccMainAppInterface *app);
61
62 /**
63 * Create a cc2DLabel associated with a QPoint within a ccPointCloud.
64 * @param[in] labelText The label text to be displayed.
65 * @param[in] parentCloud The associated parent cloud.
66 * @param[in] clickPoint The 2D clickPoint which specifies the rendered label positions.
67 * @param[in] pointIdx The point index which specifies the 3D point within the parent cloud.
68 */
69 cc2DLabel* createPointLabel2D(QString labelText, ccPointCloud *parentCloud, QPoint clickPoint, unsigned int pointIdx);
70 }
71
72 #endif