ccBoundingBoxEditorDlg.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  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 or later 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: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #ifndef CC_BOUNDING_BOX_EDITOR_DLG_HEADER
  18. #define CC_BOUNDING_BOX_EDITOR_DLG_HEADER
  19. #include <ui_boundingBoxEditorDlg.h>
  20. //qCC_db
  21. #include <ccBBox.h>
  22. //! Dialog to define the extents of a 3D box
  23. class ccBoundingBoxEditorDlg : public QDialog, public Ui::BoundingBoxEditorDialog
  24. {
  25. Q_OBJECT
  26. public:
  27. //! Default constructor
  28. /** \param showBoxAxes Whether to display the box axes or not
  29. \param showRasterGridImage Whether to display the raster grid image or not
  30. \param parent Parent widget
  31. **/
  32. explicit ccBoundingBoxEditorDlg(bool showBoxAxes, bool showRasterGridImage, QWidget* parent = nullptr);
  33. //! Returns bounding box
  34. inline const ccBBox& getBox() const { return m_currentBBox; }
  35. //! Overrides the current bounding box
  36. /** \param box bounding box
  37. **/
  38. void setBox(const ccBBox& box);
  39. //! Sets the (minimal) base box
  40. /** \param box base box
  41. \param isMinimal set whether the user must define a bounding-box at least as large as this one
  42. **/
  43. void setBaseBBox(const ccBBox& box, bool isMinimal = true);
  44. //! Sets the box axes
  45. void setBoxAxes(const CCVector3& X, const CCVector3& Y, const CCVector3& Z);
  46. //! Returns the box axes
  47. void getBoxAxes(CCVector3d& X, CCVector3d& Y, CCVector3d& Z);
  48. //! Whether the warning about bounding box inclusion in the base one should be displayed or not
  49. /** True by default.
  50. **/
  51. void showInclusionWarning(bool state) { m_showInclusionWarning = state; }
  52. //! Forces the 'keep square' mode
  53. void forceKeepSquare(bool state);
  54. //! Returns whether 'keep square' mode is enabled or not
  55. bool keepSquare() const;
  56. //! Sets 2D mode (the line 'dim' will be hidden)
  57. void set2DMode(bool state, unsigned char dim);
  58. public:
  59. //overloaded from QDialog
  60. virtual int exec();
  61. protected:
  62. void squareModeActivated(bool);
  63. void resetToDefault();
  64. void resetToLast();
  65. void cancel();
  66. void saveBoxAndAccept();
  67. int computeBestDialogHeight(bool showBoxAxes, bool showRasterGridImage) const;
  68. void updateXWidth(double);
  69. void updateYWidth(double);
  70. void updateZWidth(double);
  71. //! Updates current box based on the dialog state
  72. void updateCurrentBBox(double dummy = 0.0);
  73. //! Reflects changes on bbox
  74. void reflectChanges(int dummy = 0);
  75. //! Slot called anytime a component of the box axes is modified
  76. void onAxisValueChanged(double);
  77. void fromClipboardClicked();
  78. void toClipboardClicked();
  79. protected:
  80. //! Checks if currentBox includes baseBox
  81. void checkBaseInclusion();
  82. //! Base box (invalid if none)
  83. ccBBox m_baseBBox;
  84. //! Whether base box is minimal or not
  85. bool m_baseBoxIsMinimal;
  86. //! Current box
  87. ccBBox m_currentBBox;
  88. //! Box state at dialog start
  89. ccBBox m_initBBox;
  90. //! Whether to show 'inclusion' warning or not
  91. bool m_showInclusionWarning;
  92. };
  93. #endif //CC_BOUNDING_BOX_EDITOR_DLG_HEADER