qTransformsPlugin.h 3.93 KB
Newer Older
Sören Schwertfeger's avatar
Sören Schwertfeger committed
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
//##########################################################################
//#                                                                        #
//#                       CLOUDCOMPARE PLUGIN: qDummy                      #
//#                                                                        #
//#  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: XXX                             #
//#                                                                        #
//##########################################################################

#ifndef Q_TRANSFORMS_PLUGIN_HEADER
#define Q_TRANSFORMS_PLUGIN_HEADER

//qCC
#include "../ccStdPluginInterface.h"

#include "sttl.h"
#include <list>

//! Dummy qCC plugin
/** Replace the 'qDummyPlugin' string by your own plugin class name
	and then check 'qDummyPlugin.cpp' for more directions (you
	have to fill-in the blank methods. The most important one is the
	'getActions' method.  This method should return all actions
	(QAction objects). CloudCompare will automatically add them to an
	icon in the plugin toolbar and to an entry in the plugin menu
	(if your plugin returns several actions, CC will create a dedicated
	toolbar and sub-menu). 
	You are responsible to connect these actions to custom slots of your
	plugin.
	Look at the ccStdPluginInterface::m_app attribute to get access to
	most of CC components (database, 3D views, console, etc.).
**/
class qTransformsPlugin : public QObject, public ccStdPluginInterface
{
	Q_OBJECT
	Q_INTERFACES(ccStdPluginInterface)
	//replace qDummy by the plugin name (IID should be unique - let's hope your plugin name is unique ;)
Sören Schwertfeger's avatar
Sören Schwertfeger committed
46
47
48
49
50
        #ifdef CC_QT5
        Q_PLUGIN_METADATA(IID "cccorp.cloudcompare.plugin.qTransforms")
        //replace qDummy by the plugin name (IID should be unique - let's hope your plugin name is unique ;)
        #endif
        
Sören Schwertfeger's avatar
Sören Schwertfeger committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
public:

	//! Default constructor
	explicit qTransformsPlugin(QObject* parent = 0);

	//inherited from ccPluginInterface
	virtual QString getName() const override { return "qTransformsPlugin"; }
	virtual QString getDescription() const override { return "Transforms plugin (add description here)"; }
	virtual QIcon getIcon() const override;

	//inherited from ccStdPluginInterface
	void onNewSelection(const ccHObject::Container& selectedEntities) override;
	virtual void getActions(QActionGroup& group) override;

protected slots:

	/*** ADD YOUR CUSTOM ACTIONS' SLOTS HERE ***/
	void doAction();
Sören Schwertfeger's avatar
Sören Schwertfeger committed
69
70
	void loadTransforms();
	void saveTransforms();
Sören Schwertfeger's avatar
Sören Schwertfeger committed
71

Sören Schwertfeger's avatar
Sören Schwertfeger committed
72
73
74
75
76
	void changeUser();
	void changeMethod();
	void changeDetails();
	void changeFrameNameLength();

Sören Schwertfeger's avatar
Sören Schwertfeger committed
77
78
79
80
81
82
83
84
85
protected:

	//! Default action
	/** You can add as many actions as you want in a plugin.
		All actions will correspond to an icon in the dedicated
		toolbar and an entry in the plugin menu.
	**/
	void recTravTree(ccHObject * obj, QString spaces);

Sören Schwertfeger's avatar
Sören Schwertfeger committed
86
	void recTravTree(ccHObject * obj, sttl::Transform * parent);
Sören Schwertfeger's avatar
Sören Schwertfeger committed
87

88
89
90

	void applyFrames(ccHObject * obj, std::list<sttl::Frame> &frames);

Sören Schwertfeger's avatar
Sören Schwertfeger committed
91
	std::list<sttl::Transform> m_transforms;
Sören Schwertfeger's avatar
Sören Schwertfeger committed
92
93

	QAction* m_action;
Sören Schwertfeger's avatar
Sören Schwertfeger committed
94
95
	QAction* m_actionLoadTransform;
	QAction* m_actionSaveTransform;
Sören Schwertfeger's avatar
Sören Schwertfeger committed
96
97
98
99
100
101
102
103
104
105

	QAction* m_changeUserAction;
	QAction* m_changeMethodAction;
	QAction* m_changeDetailsAction;
	QAction* m_changeFrameNameLengthAction;

	QString m_user;
	QString m_method;
	QString m_detials;
	int m_frameNameLength;
Sören Schwertfeger's avatar
Sören Schwertfeger committed
106
107
108
};

#endif