ccComparisonDlg.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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_COMPARISON_DIALOG_HEADER
  18. #define CC_COMPARISON_DIALOG_HEADER
  19. //qCC_db
  20. #include <ccOctree.h>
  21. //Qt
  22. #include <QDialog>
  23. #include <QString>
  24. #include <ui_comparisonDlg.h>
  25. class ccHObject;
  26. class ccPointCloud;
  27. class ccGenericPointCloud;
  28. class ccGenericMesh;
  29. //! Dialog for cloud/cloud or cloud/mesh comparison setting
  30. class ccComparisonDlg: public QDialog, public Ui::ComparisonDialog
  31. {
  32. Q_OBJECT
  33. public:
  34. //! Comparison type
  35. enum CC_COMPARISON_TYPE
  36. {
  37. CLOUDCLOUD_DIST = 0,
  38. CLOUDMESH_DIST = 1,
  39. };
  40. //! Default constructor
  41. ccComparisonDlg(ccHObject* compEntity,
  42. ccHObject* refEntity,
  43. CC_COMPARISON_TYPE cpType,
  44. QWidget* parent = nullptr,
  45. bool noDisplay = false);
  46. //! Default destructor
  47. ~ccComparisonDlg();
  48. //! Should be called once after the dialog is created
  49. inline bool initDialog() { return computeApproxDistances(); }
  50. //! Returns compared entity
  51. ccHObject* getComparedEntity() const { return m_compEnt; }
  52. //! Returns compared entity
  53. ccHObject* getReferenceEntity() { return m_refEnt; }
  54. public:
  55. bool computeDistances();
  56. void applyAndExit();
  57. void cancelAndExit();
  58. protected:
  59. void showHisto();
  60. void locaModelChanged(int);
  61. void maxDistUpdated();
  62. void enableCompute2D(bool);
  63. protected:
  64. bool isValid();
  65. bool prepareEntitiesForComparison();
  66. bool computeApproxDistances();
  67. int getBestOctreeLevel();
  68. int determineBestOctreeLevel(double);
  69. void updateDisplay(bool showSF, bool hideRef);
  70. void releaseOctrees();
  71. //! Compared entity
  72. ccHObject* m_compEnt;
  73. //! Compared entity equivalent cloud
  74. ccPointCloud* m_compCloud;
  75. //! Compared entity's octree
  76. ccOctree::Shared m_compOctree;
  77. //! Whether the compared entity octree is partial or not
  78. bool m_compOctreeIsPartial;
  79. //! Initial compared entity visibility
  80. bool m_compSFVisibility;
  81. //! Reference entity
  82. ccHObject* m_refEnt;
  83. //! Reference entity equivalent cloud (if any)
  84. ccGenericPointCloud* m_refCloud;
  85. //! Reference entity equivalent mesh (if any)
  86. ccGenericMesh* m_refMesh;
  87. //! Reference entity's octree
  88. ccOctree::Shared m_refOctree;
  89. //! Whether the reference entity octree is partial or not
  90. bool m_refOctreeIsPartial;
  91. //! Initial reference entity visibility
  92. bool m_refVisibility;
  93. //! Comparison type
  94. CC_COMPARISON_TYPE m_compType;
  95. //! last computed scalar field name
  96. QString m_sfName;
  97. //! Initial SF name enabled on the compared entity
  98. QString m_oldSfName;
  99. //! Whether a display is active (and should be refreshed) or not
  100. bool m_noDisplay;
  101. //! Best octree level (or 0 if none has been guessed already)
  102. int m_bestOctreeLevel;
  103. };
  104. #endif