ccGLWindowSignalEmitter.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #pragma once
  2. //##########################################################################
  3. //# #
  4. //# CLOUDCOMPARE #
  5. //# #
  6. //# This program is free software; you can redistribute it and/or modify #
  7. //# it under the terms of the GNU General Public License as published by #
  8. //# the Free Software Foundation; version 2 or later of the License. #
  9. //# #
  10. //# This program is distributed in the hope that it will be useful, #
  11. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. //# GNU General Public License for more details. #
  14. //# #
  15. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  16. //# #
  17. //##########################################################################
  18. //local
  19. #include "qCC_glWindow.h"
  20. //qCC_db
  21. #include <ccHObject.h>
  22. //Qt
  23. #include <QObject>
  24. #include <QStringList>
  25. //system
  26. #include <unordered_set>
  27. class ccGLWindowInterface;
  28. //! ccGLWindow Signal emitter
  29. class CCGLWINDOW_LIB_API ccGLWindowSignalEmitter : public QObject
  30. {
  31. Q_OBJECT
  32. public:
  33. //! Default constructor
  34. ccGLWindowSignalEmitter(ccGLWindowInterface* associatedWindow, QObject* parent);
  35. //! Returns the associated window
  36. inline ccGLWindowInterface* getAssociatedWindow() { return m_associatedWindow; }
  37. Q_SIGNALS:
  38. //! Signal emitted when an entity is selected in the 3D view
  39. void entitySelectionChanged(ccHObject* entity);
  40. //! Signal emitted when multiple entities are selected in the 3D view
  41. void entitiesSelectionChanged(std::unordered_set<int> entIDs);
  42. //! Signal emitted when a point (or a triangle) is picked
  43. /** \param entity 'picked' entity
  44. \param subEntityID point or triangle index in entity
  45. \param x mouse cursor x position
  46. \param y mouse cursor y position
  47. \param P the picked point
  48. \param uvw barycentric coordinates of the point (if picked on a mesh)
  49. **/
  50. void itemPicked(ccHObject* entity, unsigned subEntityID, int x, int y, const CCVector3& P, const CCVector3d& uvw);
  51. //! Signal emitted when an item is picked (FAST_PICKING mode only)
  52. /** \param entity entity
  53. \param subEntityID point or triangle index in entity
  54. \param x mouse cursor x position
  55. \param y mouse cursor y position
  56. **/
  57. void itemPickedFast(ccHObject* entity, int subEntityID, int x, int y);
  58. //! Signal emitted when fast picking is finished (FAST_PICKING mode only)
  59. void fastPickingFinished();
  60. /*** Camera link mode (interactive modifications of the view/camera are echoed to other windows) ***/
  61. //! Signal emitted when the window 'model view' matrix is interactively changed
  62. void viewMatRotated(const ccGLMatrixd& rotMat);
  63. //! Signal emitted when the mouse wheel is rotated
  64. void mouseWheelRotated(float wheelDelta_deg);
  65. //! Signal emitted when the perspective state changes (see setPerspectiveState)
  66. void perspectiveStateChanged();
  67. //! Signal emitted when the window 'base view' matrix is changed
  68. void baseViewMatChanged(const ccGLMatrixd& newViewMat);
  69. //! Signal emitted when the f.o.v. changes
  70. void fovChanged(float fov);
  71. //! Signal emitted when the near clipping depth has been changed
  72. void nearClippingDepthChanged(double depth);
  73. //! Signal emitted when the far clipping depth has been changed
  74. void farClippingDepthChanged(double depth);
  75. //! Signal emitted when the pivot point is changed
  76. void pivotPointChanged(const CCVector3d&);
  77. //! Signal emitted when the camera position is changed
  78. void cameraPosChanged(const CCVector3d&);
  79. //! Signal emitted when the selected object is translated by the user
  80. void translation(const CCVector3d& t);
  81. //! Signal emitted when the selected object is rotated by the user
  82. /** \param rotMat rotation applied to current viewport (4x4 OpenGL matrix)
  83. **/
  84. void rotation(const ccGLMatrixd& rotMat);
  85. //! Signal emitted when the left mouse button is clicked on the window
  86. /** See INTERACT_SIG_LB_CLICKED.
  87. Arguments correspond to the clicked point coordinates (x,y) in
  88. pixels relative to the window corner!
  89. **/
  90. void leftButtonClicked(int x, int y);
  91. //! Signal emitted when the right mouse button is clicked on the window
  92. /** See INTERACT_SIG_RB_CLICKED.
  93. Arguments correspond to the clicked point coordinates (x,y) in
  94. pixels relative to the window corner!
  95. **/
  96. void rightButtonClicked(int x, int y);
  97. //! Signal emitted when the mouse is moved
  98. /** See INTERACT_SIG_MOUSE_MOVED.
  99. The two first arguments correspond to the current cursor coordinates (x,y)
  100. relative to the window corner!
  101. **/
  102. void mouseMoved(int x, int y, Qt::MouseButtons buttons);
  103. //! Signal emitted when a mouse button is released (cursor on the window)
  104. /** See INTERACT_SIG_BUTTON_RELEASED.
  105. **/
  106. void buttonReleased();
  107. //! Signal emitted during 3D pass of OpenGL display process
  108. /** Any object connected to this slot can draw additional stuff in 3D.
  109. Depth buffering, lights and shaders are enabled by default.
  110. **/
  111. void drawing3D();
  112. //! Signal emitted when files are dropped on the window
  113. void filesDropped(const QStringList& filenames);
  114. //! Signal emitted when a new label is created
  115. void newLabel(ccHObject* obj);
  116. //! Signal emitted when the exclusive fullscreen is toggled
  117. void exclusiveFullScreenToggled(bool exclusive);
  118. //! Signal emitted when the middle mouse button is clicked on the window
  119. /** See INTERACT_SIG_MB_CLICKED.
  120. Arguments correspond to the clicked point coordinates (x,y) in
  121. pixels relative to the window corner!
  122. **/
  123. void middleButtonClicked(int x, int y);
  124. //! Signal emitted when the associated window is about to close
  125. void aboutToClose(ccGLWindowInterface*);
  126. protected:
  127. ccGLWindowInterface* m_associatedWindow;
  128. };