-
Notifications
You must be signed in to change notification settings - Fork 0
/
qTreeIso.h
111 lines (92 loc) · 4.47 KB
/
qTreeIso.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: qTreeIso #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: Morris Aurich #
//# #
//##########################################################################
#ifndef Q_TREEISO_PLUGIN_HEADER
#define Q_TREEISO_PLUGIN_HEADER
// qCC
#include <ccPickingListener.h>
#include "ccStdPluginInterface.h"
//! Example qCC plugin
/** Replace 'ExamplePlugin' by your own plugin class name throughout and then
check 'ExamplePlugin.cpp' for more directions.
Each plugin requires an info.json file to provide information about itself -
the name, authors, maintainers, icon, etc..
The one method you are required to implement is 'getActions'. This should
return all actions (QAction objects) for the plugin. CloudCompare will
automatically add these with their icons in the plugin toolbar and to the
plugin menu. If your plugin returns several actions, CC will create a
dedicated toolbar and a sub-menu for your plugin. You are responsible for
connecting these actions to methods in your plugin.
Use the ccStdPluginInterface::m_app variable for access to most of the CC
components (database, 3D views, console, etc.) - see the ccMainAppInterface
class in ccMainAppInterface.h.
**/
class qTreeIso : public QObject, public ccStdPluginInterface, public ccPickingListener
{
Q_OBJECT
Q_INTERFACES(ccStdPluginInterface)
// Replace "Example" by your plugin name (IID should be unique - let's hope your plugin name is unique ;)
// The info.json file provides information about the plugin to the loading system and
// it is displayed in the plugin information dialog.
Q_PLUGIN_METADATA(IID "cccorp.cloudcompare.plugin.qTreeIso" FILE "info.json")
public:
explicit qTreeIso( QObject *parent = nullptr );
~qTreeIso() override = default;
// inherited from ccStdPluginInterface
void onNewSelection( const ccHObject::Container &selectedEntities ) override;
QList<QAction *> getActions() override;
private:
/*** ADD YOUR CUSTOM ACTIONS HERE ***/
void doSplitByColor();
void doSplitByScalar();
void doRemoveLowestPoints();
void doBHDSlice();
void doExtractPointsOfSameColor();
void doExtractPointsOfSameColorIntoOther();
//inherited from ccPickingListener
void onItemPicked(const ccPickingListener::PickedItem& pi) override;
//picked point callback (called by the above function, depending on m_onPointPicked)
void pointPickedExtractPointsOfSameColor(ccHObject* entity, unsigned itemIdx, int x, int y, const CCVector3& P);
void pointPickedExtractPointsOfSameColorIntoOther(ccHObject* entity, unsigned itemIdx, int x, int y, const CCVector3& P);
void pointPickedBHDSlice(ccHObject* entity, unsigned itemIdx, int x, int y, const CCVector3& P);
//registers this plugin with the picking hub
bool startPicking();
//removes this plugin from the picking hub
void stopPicking();
//picking or not?
bool m_picking = false;
void splitCloudBy(bool splitByColor, bool selectClouds = true, bool randomColor = false);
//! Default action
/** You can add as many actions as you want in a plugin.
Each action will correspond to an icon in the dedicated
toolbar and an entry in the plugin menu.
**/
QAction* m_actionSplitByColor;
QAction* m_actionSplitByScalar;
QAction* m_actionRemoveLowestPoints;
QAction* m_actionBHDSlice;
QAction* m_actionExtractPointsOfSameColor;
QAction* m_actionExtractPointsOfSameColorIntoOther;
enum onPointPicked
{
NONE = 0,
EXTRACT_POINTS,
EXTRACT_POINTS_INTO_OHTER,
DO_BHD_SLICE
};
onPointPicked m_onPointPicked = NONE;
};
#endif