| 1 |
//########################################################################## |
| 2 |
//# # |
| 3 |
//# CLOUDCOMPARE PLUGIN: qSRA # |
| 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 # |
| 15 |
//# # |
| 16 |
//########################################################################## |
| 17 |
|
| 18 |
#ifndef QSRA_DISTANCE_MAP_GENERATION_DIALOG |
| 19 |
#define QSRA_DISTANCE_MAP_GENERATION_DIALOG |
| 20 |
|
| 21 |
//Local |
| 22 |
#include "distanceMapGenerationTool.h" |
| 23 |
|
| 24 |
//qCC_db |
| 25 |
#include <ccBBox.h> |
| 26 |
|
| 27 |
//Qt |
| 28 |
#include <QSharedPointer> |
| 29 |
#include <QColor> |
| 30 |
|
| 31 |
//CCCoreLib |
| 32 |
#include <CCTypes.h> |
| 33 |
|
| 34 |
//GUIs generated by Qt Designer |
| 35 |
#include <ui_distanceMapGenerationDlg.h> |
| 36 |
|
| 37 |
class ccMainAppInterface; |
| 38 |
class ccPointCloud; |
| 39 |
class ccPolyline; |
| 40 |
class ccScalarField; |
| 41 |
class ccColorScaleSelector; |
| 42 |
class ccSymbolCloud; |
| 43 |
class ccMapWindow; |
| 44 |
|
| 45 |
//! Dialog for generating a distance map (surface of revolution) |
| 46 |
class DistanceMapGenerationDlg : public QDialog, public Ui::DistanceMapGenerationDlg |
| 47 |
{ |
| 48 |
Q_OBJECT |
| 49 |
|
| 50 |
public: |
| 51 |
|
| 52 |
//! Default constructor |
| 53 |
DistanceMapGenerationDlg(ccPointCloud* cloud, ccScalarField* sf, ccPolyline* polyline, ccMainAppInterface* app = nullptr); |
| 54 |
|
| 55 |
//! Default destructor |
| 56 |
virtual ~DistanceMapGenerationDlg() = default; |
| 57 |
|
| 58 |
//! Angular units |
| 59 |
enum ANGULAR_UNIT { ANG_DEG, ANG_RAD, ANG_GRAD }; |
| 60 |
|
| 61 |
//! Returns selected angular unit |
| 62 |
ANGULAR_UNIT getAngularUnit() const; |
| 63 |
//! Returns selected angular unit as a string |
| 64 |
QString getAngularUnitString() const; |
| 65 |
//! Returns selected angular unit as a condensed string |
| 66 |
QString getCondensedAngularUnitString() const; |
| 67 |
|
| 68 |
//! Returns height unit |
| 69 |
QString getHeightUnitString() const; |
| 70 |
|
| 71 |
//! Returns the grid filling strategy |
| 72 |
DistanceMapGenerationTool::FillStrategyType getFillingStrategy() const; |
| 73 |
|
| 74 |
//! Returns the empty cells filling option |
| 75 |
DistanceMapGenerationTool::EmptyCellFillOption getEmptyCellFillingOption() const; |
| 76 |
|
| 77 |
//! Projection mode |
| 78 |
enum ProjectionMode { PROJ_CYLINDRICAL, |
| 79 |
PROJ_CONICAL, |
| 80 |
}; |
| 81 |
|
| 82 |
//! Returns current projection mode |
| 83 |
ProjectionMode getProjectionMode() const; |
| 84 |
|
| 85 |
//! Returns the current 'X' parameters |
| 86 |
/** Always correspond to angular values |
| 87 |
**/ |
| 88 |
void getGridXValues(double& minX, double& maxX, double& step, ANGULAR_UNIT unit = ANG_RAD) const; |
| 89 |
|
| 90 |
//! Returns the current 'Y' parameters |
| 91 |
/** Depends on the current projection mode (i.e. height or latitude). |
| 92 |
The 'unit' parameter is only required for Conical mode. |
| 93 |
**/ |
| 94 |
void getGridYValues(double& minY, double& maxY, double& step, ANGULAR_UNIT unit = ANG_RAD) const; |
| 95 |
|
| 96 |
//! Returns scale 'Y' step (current unit) |
| 97 |
/** The 'unit' parameter is only required for Conical mode. |
| 98 |
**/ |
| 99 |
double getScaleYStep(ANGULAR_UNIT unit = ANG_RAD) const; |
| 100 |
|
| 101 |
protected: |
| 102 |
|
| 103 |
void projectionModeChanged(int); |
| 104 |
void angularUnitChanged(int); |
| 105 |
void updateGridSteps(); |
| 106 |
void updateProfileRevolDim(int); |
| 107 |
void updateProfileOrigin(); |
| 108 |
void colorScaleChanged(int); |
| 109 |
void spawnColorScaleEditor(); |
| 110 |
void updateHeightUnits(); |
| 111 |
void exportMapAsCloud(); |
| 112 |
void exportMapAsMesh(); |
| 113 |
void exportMapAsGrid(); |
| 114 |
void exportMapAsImage(); |
| 115 |
void exportProfilesAsDXF(); |
| 116 |
void loadOverlaySymbols(); |
| 117 |
void clearOverlaySymbols(); |
| 118 |
void overlaySymbolsSizeChanged(int); |
| 119 |
void overlaySymbolsColorChanged(); |
| 120 |
void overlayGridColorChanged(); |
| 121 |
void labelFontSizeChanged(int); |
| 122 |
void labelPrecisionChanged(int); |
| 123 |
void baseRadiusChanged(double); |
| 124 |
void colorRampStepsChanged(int); |
| 125 |
void toggleOverlayGrid(bool); |
| 126 |
void changeGridColor(); |
| 127 |
void changeSymbolColor(); |
| 128 |
void toggleColorScaleDisplay(bool); |
| 129 |
void updateVolumes(); |
| 130 |
|
| 131 |
//! Updates overlat grid (if any) |
| 132 |
void updateOverlayGrid(); |
| 133 |
|
| 134 |
//! Updates map (and display) |
| 135 |
void update(); |
| 136 |
|
| 137 |
void closeEvent(QCloseEvent* e) override; |
| 138 |
|
| 139 |
protected: |
| 140 |
|
| 141 |
//! Updates internal map |
| 142 |
QSharedPointer<DistanceMapGenerationTool::Map> updateMap(); |
| 143 |
|
| 144 |
//! Updates internal map texture (if any) |
| 145 |
void updateMapTexture(); |
| 146 |
|
| 147 |
//! Updates 2D view zoom |
| 148 |
void updateZoom(ccBBox& box); |
| 149 |
|
| 150 |
//! Clears the 3D view |
| 151 |
void clearView(); |
| 152 |
|
| 153 |
//! Returns currently applicable base radius |
| 154 |
/** Warning: return always 1 for concial projection mode! |
| 155 |
**/ |
| 156 |
double getBaseRadius() const; |
| 157 |
|
| 158 |
//! Returns the angle in a particular spinbox in the specified units |
| 159 |
double getSpinboxAngularValue(QDoubleSpinBox* spinBox, DistanceMapGenerationDlg::ANGULAR_UNIT unit) const; |
| 160 |
|
| 161 |
//! Loads parameters from persistent settings |
| 162 |
void initFromPersistentSettings(); |
| 163 |
|
| 164 |
//! Saves parameters to persistent settings |
| 165 |
void saveToPersistentSettings(); |
| 166 |
|
| 167 |
//! Updates the min and max limits (fields) |
| 168 |
void updateMinAndMaxLimits(); |
| 169 |
|
| 170 |
//! Application interface |
| 171 |
ccMainAppInterface* m_app; |
| 172 |
|
| 173 |
//! Associated cloud |
| 174 |
ccPointCloud* m_cloud; |
| 175 |
|
| 176 |
//! Associated profile |
| 177 |
ccPolyline* m_profile; |
| 178 |
|
| 179 |
//! Associated scalar field |
| 180 |
ccScalarField* m_sf; |
| 181 |
|
| 182 |
//! Internal map structure |
| 183 |
QSharedPointer<DistanceMapGenerationTool::Map> m_map; |
| 184 |
|
| 185 |
//! Current angular units |
| 186 |
ANGULAR_UNIT m_angularUnits; |
| 187 |
|
| 188 |
//! 2D display |
| 189 |
ccMapWindow* m_window; |
| 190 |
|
| 191 |
//! Color scale selector |
| 192 |
ccColorScaleSelector* m_colorScaleSelector; |
| 193 |
|
| 194 |
//! X labels |
| 195 |
ccSymbolCloud* m_xLabels; |
| 196 |
//! Y labels |
| 197 |
ccSymbolCloud* m_yLabels; |
| 198 |
|
| 199 |
//! Grid color |
| 200 |
QColor m_gridColor; |
| 201 |
|
| 202 |
//! Symbols color |
| 203 |
QColor m_symbolColor; |
| 204 |
}; |
| 205 |
|
| 206 |
#endif //QSRA_DISTANCE_MAP_GENERATION_DIALOG |