qM3C2Dialog.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE PLUGIN: qM3C2 #
  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: UNIVERSITE EUROPEENNE DE BRETAGNE #
  15. //# #
  16. //##########################################################################
  17. #ifndef Q_M3C2_DIALOG_HEADER
  18. #define Q_M3C2_DIALOG_HEADER
  19. #include <ui_qM3C2Dialog.h>
  20. //Local
  21. #include <qM3C2Tools.h>
  22. //Qt
  23. #include <QSettings>
  24. class ccMainAppInterface;
  25. class ccPointCloud;
  26. //! M3C2 plugin's main dialog
  27. class qM3C2Dialog : public QDialog, public Ui::M3C2Dialog
  28. {
  29. Q_OBJECT
  30. public:
  31. //! Default constructor
  32. qM3C2Dialog(ccPointCloud* cloud1, ccPointCloud* cloud2, ccMainAppInterface* app);
  33. //! Returns cloud #1
  34. ccPointCloud* getCloud1() const { return m_cloud1; }
  35. //! Returns cloud #2
  36. ccPointCloud* getCloud2() const { return m_cloud2; }
  37. //! Get core points cloud (if any)
  38. /** Returns either cloud #1 or the cloud specified in the combo box.
  39. It can also return a null pointer if the user has requested
  40. sub-sampling.
  41. **/
  42. ccPointCloud* getCorePointsCloud() const;
  43. //! Sets the core points cloud
  44. void setCorePointsCloud(ccPointCloud* cloud) { m_corePointsCloud = cloud; }
  45. //! Returns the cloud to be used for normals orientation (if any)
  46. ccPointCloud* getNormalsOrientationCloud() const;
  47. //! Returns selected normals computation mode
  48. qM3C2Normals::ComputationMode getNormalsComputationMode() const;
  49. //! Returns the minimum number of points to compute stats (confidence mainly)
  50. unsigned getMinPointsForStats(unsigned defaultValue = 5) const;
  51. //! Exportation options
  52. enum ExportOptions { PROJECT_ON_CLOUD1,
  53. PROJECT_ON_CLOUD2,
  54. PROJECT_ON_CORE_POINTS,
  55. };
  56. //! Returns selected export option
  57. ExportOptions getExportOption() const;
  58. //! Returns the computation mode read in the parameter file (usefull in command line calls)
  59. qM3C2Normals::ComputationMode getRequestedComputationMode() const {return m_requestedComputationMode;}
  60. //! Returns whether the original cloud should be kept instead of creating a new output one
  61. /** Only valid if the export option is PROJECT_ON_CORE_POINTS.
  62. **/
  63. bool keepOriginalCloud() const;
  64. //! Returns the max number of threads to use
  65. int getMaxThreadCount() const;
  66. //! Loads parameters from persistent settings
  67. bool loadParamsFromFile(QString filename);
  68. //! Loads parameters from persistent settings
  69. void loadParamsFromPersistentSettings();
  70. //! Saves parameters to persistent settings
  71. void saveParamsToPersistentSettings();
  72. protected:
  73. void swapClouds();
  74. void setCloud1Visibility(bool);
  75. void setCloud2Visibility(bool);
  76. void saveParamsToFile();
  77. void getParamsFromFile();
  78. inline void guessParamsSlow() { guessParams(false); }
  79. void projDestIndexChanged(int);
  80. void onUpdateNormalComboBoxChanged(int);
  81. //! Updates the normalSourceComboBox
  82. void updateNormalComboBox();
  83. protected: //methods
  84. //! Guess parameters from the cloud #1
  85. void guessParams(bool fastMode);
  86. //! Sets clouds
  87. void setClouds(ccPointCloud* cloud1, ccPointCloud* cloud2);
  88. //! Load parameters from QSettings
  89. void loadParamsFrom(const QSettings& settings);
  90. //! Saves parameters to QSettings
  91. void saveParamsTo(QSettings& settings);
  92. //! Setups the precision maps tab
  93. /** \warning 'setClouds' must have been already called
  94. **/
  95. void setupPrecisionMapsTab();
  96. protected: //members
  97. ccMainAppInterface* m_app;
  98. ccPointCloud* m_cloud1;
  99. ccPointCloud* m_cloud2;
  100. ccPointCloud* m_corePointsCloud;
  101. //! Computation mode requested in a parameter file during a command line call
  102. qM3C2Normals::ComputationMode m_requestedComputationMode = qM3C2Normals::DEFAULT_MODE;
  103. };
  104. #endif //Q_M3C2_DIALOG_HEADER