ccGuiParameters.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 "qCC_glWindow.h"
  19. //Qt
  20. #include <QString>
  21. //qCC_db
  22. #include <ccColorTypes.h>
  23. #include <ccLog.h>
  24. /***************************************************
  25. GUI parameters
  26. ***************************************************/
  27. //! This class manages some persistent parameters (mostly for display)
  28. /** Values of persistent parameters are stored by the system
  29. (either in the registry or in a separate file depending on the OS).
  30. **/
  31. class CCGLWINDOW_LIB_API ccGui
  32. {
  33. public:
  34. //! GUI parameters
  35. struct CCGLWINDOW_LIB_API ParamStruct
  36. {
  37. //! Light diffuse color (RGBA)
  38. ccColor::Rgbaf lightDiffuseColor;
  39. //! Light ambient color (RGBA)
  40. ccColor::Rgbaf lightAmbientColor;
  41. //! Light specular color (RGBA)
  42. ccColor::Rgbaf lightSpecularColor;
  43. //! Double sided light
  44. bool lightDoubleSided;
  45. //! Default mesh diffuse color (front)
  46. ccColor::Rgbaf meshFrontDiff;
  47. //! Default mesh diffuse color (back)
  48. ccColor::Rgbaf meshBackDiff;
  49. //! Default mesh specular color
  50. ccColor::Rgbaf meshSpecular;
  51. //! Default text color
  52. ccColor::Rgba textDefaultCol;
  53. //! Default 3D points color
  54. ccColor::Rgba pointsDefaultCol;
  55. //! Background color
  56. ccColor::Rgbub backgroundCol;
  57. //! Labels background color
  58. ccColor::Rgba labelBackgroundCol;
  59. //! Labels marker color
  60. ccColor::Rgba labelMarkerCol;
  61. //! Bounding-boxes color
  62. ccColor::Rgba bbDefaultCol;
  63. //! Use background gradient
  64. bool drawBackgroundGradient;
  65. //! Decimate meshes when moved
  66. bool decimateMeshOnMove;
  67. //! Min mesh size for decimation
  68. unsigned minLoDMeshSize;
  69. //! Decimate clouds when moved
  70. bool decimateCloudOnMove;
  71. //! Min cloud size for decimation
  72. unsigned minLoDCloudSize;
  73. //! Display cross in the middle of the screen
  74. bool displayCross;
  75. //! Whether to use VBOs for faster display
  76. bool useVBOs;
  77. //! Label marker size
  78. unsigned labelMarkerSize;
  79. //! Color scale option: show histogram next to color ramp
  80. bool colorScaleShowHistogram;
  81. //! Whether to use shader for color scale display (if available) or not
  82. bool colorScaleUseShader;
  83. //! Whether shader for color scale display is available or not
  84. bool colorScaleShaderSupported;
  85. //! Color scale ramp width (for display)
  86. unsigned colorScaleRampWidth;
  87. //! Default displayed font size
  88. unsigned defaultFontSize;
  89. //! Label font size
  90. unsigned labelFontSize;
  91. //! Displayed numbers precision
  92. unsigned displayedNumPrecision;
  93. //! Labels background opcaity
  94. unsigned labelOpacity;
  95. //! Zoom speed (1.0 by default)
  96. double zoomSpeed;
  97. //! Octree computation (for picking) behaviors
  98. enum ComputeOctreeForPicking { ALWAYS = 0, ASK_USER = 1, NEVER = 2 };
  99. //! Octree computation (for picking) behavior
  100. ComputeOctreeForPicking autoComputeOctree;
  101. //! Whether to draw rounded points (slower) or not
  102. bool drawRoundedPoints;
  103. //! Whether to pick objects by single clicking in the GUI
  104. //! can be slow with large point clouds/large number of objects
  105. bool singleClickPicking;
  106. //! Picking cursor
  107. Qt::CursorShape pickingCursorShape;
  108. //! Log verbosity level
  109. ccLog::MessageLevelFlags logVerbosityLevel;
  110. //! Default constructor
  111. ParamStruct();
  112. //! Resets parameters to default values
  113. void reset();
  114. //! Loads from persistent DB
  115. void fromPersistentSettings();
  116. //! Saves to persistent DB
  117. void toPersistentSettings() const;
  118. //! Returns whether a given parameter is already defined in persistent settings or not
  119. /** \param paramName the corresponding attribute name
  120. **/
  121. bool isInPersistentSettings(QString paramName) const;
  122. };
  123. //! Returns the stored values of each parameter.
  124. static const ParamStruct& Parameters();
  125. //! Sets GUI parameters
  126. static void Set(const ParamStruct& params);
  127. //! Release unique instance (if any)
  128. static void ReleaseInstance();
  129. protected:
  130. //! Parameters set
  131. ParamStruct params;
  132. };