ccCameraParamEditDlg.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. #include "CCAppCommon.h"
  19. //Local
  20. #include "ccOverlayDialog.h"
  21. #include "ccPickingListener.h"
  22. //qCC_db
  23. #include <ccGLMatrix.h>
  24. //qCC_gl
  25. #include <ccGLUtils.h>
  26. //system
  27. #include <map>
  28. class QMdiSubWindow;
  29. class ccGLWindowInterface;
  30. class ccHObject;
  31. class ccPickingHub;
  32. namespace Ui
  33. {
  34. class CameraParamDlg;
  35. }
  36. //! Dialog to interactively edit the camera pose parameters
  37. class CCAPPCOMMON_LIB_API ccCameraParamEditDlg : public ccOverlayDialog, public ccPickingListener
  38. {
  39. Q_OBJECT
  40. public:
  41. //! Default constructor
  42. explicit ccCameraParamEditDlg(QWidget* parent, ccPickingHub* pickingHub);
  43. //! Destructor
  44. ~ccCameraParamEditDlg() override;
  45. //! Makes this dialog frameless
  46. void makeFrameless();
  47. //! Returns matrix corresponding to dialog values
  48. ccGLMatrixd getMatrix();
  49. //inherited from ccOverlayDialog
  50. bool start() override;
  51. bool linkWith(ccGLWindowInterface* win) override;
  52. //inherited from ccPickingListener
  53. void onItemPicked(const PickedItem& pi) override;
  54. public:
  55. //! Links this dialog with a given sub-window
  56. void linkWith(QMdiSubWindow* qWin);
  57. //! Inits dialog values with matrix
  58. void initWithMatrix(const ccGLMatrixd& mat);
  59. //! Updates dialog values with pivot point
  60. void updatePivotPoint(const CCVector3d& P);
  61. //! Updates dialog values with camera center
  62. void updateCameraCenter(const CCVector3d& P);
  63. //! Updates current view mode
  64. void updateViewMode();
  65. //! Updates view f.o.v.
  66. void updateWinFov(float fov_deg);
  67. //! Update the near clipping depth
  68. void updateNearClippingDepth(double depth);
  69. //! Update the far clipping depth
  70. void updateFarClippingDepth(double depth);
  71. void setFrontView();
  72. void setBottomView();
  73. void setTopView();
  74. void setBackView();
  75. void setLeftView();
  76. void setRightView();
  77. void setIso1View();
  78. void setIso2View();
  79. void iThetaValueChanged(int);
  80. void iPsiValueChanged(int);
  81. void iPhiValueChanged(int);
  82. void dThetaValueChanged(double);
  83. void dPsiValueChanged(double);
  84. void dPhiValueChanged(double);
  85. void nearClippingDepthChanged(double);
  86. void nearClippingCheckBoxToggled(bool);
  87. void farClippingDepthChanged(double);
  88. void farClippingCheckBoxToggled(bool);
  89. void pivotChanged();
  90. void cameraCenterChanged();
  91. void fovChanged(double);
  92. void pickPointAsPivot(bool);
  93. void processPickedItem(ccHObject*, unsigned, int, int, const CCVector3&, const CCVector3d&);
  94. protected:
  95. //! Reflects any dialog parameter change
  96. void reflectParamChange();
  97. //! Places the camera in a given prefedined orientation
  98. void setView(CC_VIEW_ORIENTATION orientation);
  99. //! Pushes current matrix
  100. void pushCurrentMatrix();
  101. //! Reverts to pushed matrix
  102. void revertToPushedMatrix();
  103. protected:
  104. //! Inits dialog values with specified window
  105. void initWith(ccGLWindowInterface* win);
  106. //! Type of the pushed matrices map structure
  107. using PushedMatricesMapType = std::map<ccGLWindowInterface*, ccGLMatrixd>;
  108. //! Type of an element of the pushed matrices map structure
  109. using PushedMatricesMapElement = std::pair<ccGLWindowInterface*, ccGLMatrixd>;
  110. //! Pushed camera matrices (per window)
  111. PushedMatricesMapType pushedMatrices;
  112. //! Picking hub
  113. ccPickingHub* m_pickingHub;
  114. private:
  115. Ui::CameraParamDlg* m_ui;
  116. };