ExamplePlugin.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE PLUGIN: ExamplePlugin #
  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: XXX #
  15. //# #
  16. //##########################################################################
  17. #pragma once
  18. #include "ccStdPluginInterface.h"
  19. //! Example qCC plugin
  20. /** Replace 'ExamplePlugin' by your own plugin class name throughout and then
  21. check 'ExamplePlugin.cpp' for more directions.
  22. Each plugin requires an info.json file to provide information about itself -
  23. the name, authors, maintainers, icon, etc..
  24. The one method you are required to implement is 'getActions'. This should
  25. return all actions (QAction objects) for the plugin. CloudCompare will
  26. automatically add these with their icons in the plugin toolbar and to the
  27. plugin menu. If your plugin returns several actions, CC will create a
  28. dedicated toolbar and a sub-menu for your plugin. You are responsible for
  29. connecting these actions to methods in your plugin.
  30. Use the ccStdPluginInterface::m_app variable for access to most of the CC
  31. components (database, 3D views, console, etc.) - see the ccMainAppInterface
  32. class in ccMainAppInterface.h.
  33. **/
  34. class ExamplePlugin : public QObject, public ccStdPluginInterface
  35. {
  36. Q_OBJECT
  37. Q_INTERFACES( ccPluginInterface ccStdPluginInterface )
  38. // Replace "Example" by your plugin name (IID should be unique - let's hope your plugin name is unique ;)
  39. // The info.json file provides information about the plugin to the loading system and
  40. // it is displayed in the plugin information dialog.
  41. Q_PLUGIN_METADATA( IID "cccorp.cloudcompare.plugin.Example" FILE "../info.json" )
  42. public:
  43. explicit ExamplePlugin( QObject *parent = nullptr );
  44. ~ExamplePlugin() override = default;
  45. // Inherited from ccStdPluginInterface
  46. void onNewSelection( const ccHObject::Container &selectedEntities ) override;
  47. QList<QAction *> getActions() override;
  48. private:
  49. //! Default action
  50. /** You can add as many actions as you want in a plugin.
  51. Each action will correspond to an icon in the dedicated
  52. toolbar and an entry in the plugin menu.
  53. **/
  54. QAction* m_action;
  55. };