| 1 |
//########################################################################## |
| 2 |
//# # |
| 3 |
//# CLOUDCOMPARE PLUGIN: qFacets # |
| 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: Thomas Dewez, BRGM # |
| 15 |
//# # |
| 16 |
//########################################################################## |
| 17 |
|
| 18 |
#ifndef QFACET_STEREOGRAM_DIALOG_HEADER |
| 19 |
#define QFACET_STEREOGRAM_DIALOG_HEADER |
| 20 |
|
| 21 |
#include "ui_stereogramDlg.h" |
| 22 |
#include "ui_stereogramParamsDlg.h" |
| 23 |
|
| 24 |
//qCC_db |
| 25 |
#include <ccColorScale.h> |
| 26 |
#include <ccPlane.h> |
| 27 |
|
| 28 |
// Qt |
| 29 |
#include <QDialog> |
| 30 |
|
| 31 |
//system |
| 32 |
#include <utility> |
| 33 |
|
| 34 |
class ccHObject; |
| 35 |
class FacetDensityGrid; |
| 36 |
class ccColorScaleSelector; |
| 37 |
class ccMainAppInterface; |
| 38 |
|
| 39 |
//! Dialog for stereogram parameters (qFacets plugin) |
| 40 |
class StereogramParamsDlg : public QDialog, public Ui::StereogramParamsDlg |
| 41 |
{ |
| 42 |
public: |
| 43 |
|
| 44 |
//! Default constructor |
| 45 |
StereogramParamsDlg(QWidget* parent = nullptr) |
| 46 |
: QDialog(parent, Qt::Tool) |
| 47 |
, Ui::StereogramParamsDlg() |
| 48 |
{ |
| 49 |
setupUi(this); |
| 50 |
} |
| 51 |
}; |
| 52 |
|
| 53 |
//! Orientation-based classification widget |
| 54 |
class StereogramWidget : public QLabel |
| 55 |
{ |
| 56 |
Q_OBJECT |
| 57 |
|
| 58 |
public: |
| 59 |
|
| 60 |
//! Default constructor |
| 61 |
StereogramWidget(QWidget *parent = nullptr); |
| 62 |
|
| 63 |
//! Destructor |
| 64 |
virtual ~StereogramWidget(); |
| 65 |
|
| 66 |
//! Sets current parameters |
| 67 |
bool init( double angularStep_deg, |
| 68 |
ccHObject* facetGroup, |
| 69 |
double resolution_deg = 2.0); |
| 70 |
|
| 71 |
//! Returns the mean dip direction and dip |
| 72 |
void getMeanDir(double& meanDip_deg, double& meanDipDir_deg) { meanDip_deg = m_meanDip_deg; meanDipDir_deg = m_meanDipDir_deg; } |
| 73 |
|
| 74 |
//inherited from QWidget (to get a square widget!) |
| 75 |
int heightForWidth (int w) const override { return w; } |
| 76 |
|
| 77 |
//! Sets density color scale |
| 78 |
void setDensityColorScale(ccColorScale::Shared colorScale) { m_densityColorScale = colorScale; } |
| 79 |
//! Returns density color scale |
| 80 |
ccColorScale::Shared getDensityColorScale() const { return m_densityColorScale; } |
| 81 |
//! Sets density color scale steps |
| 82 |
void setDensityColorScaleSteps(unsigned steps) { m_densityColorScaleSteps = steps; } |
| 83 |
//! Returns density color scale steps |
| 84 |
unsigned getDensityColorScaleSteps() const { return m_densityColorScaleSteps; } |
| 85 |
|
| 86 |
//! Sets the ticks frequency (0 = no ticks) |
| 87 |
void setTicksFreq(int freq) { m_ticksFreq = freq; } |
| 88 |
|
| 89 |
//! Whether to show the 'HSV' ring or not |
| 90 |
void showHSVRing(bool state) { m_showHSVRing = state; } |
| 91 |
|
| 92 |
//! Enables or not the mouse tracking mode |
| 93 |
void enableMouseTracking(bool state, double dipSpan_deg = 30.0, double dipDirSpan_deg = 30.0); |
| 94 |
|
| 95 |
//! Sets tracked center position |
| 96 |
void setTrackedCenter(double dip_deg, double dipDir_deg); |
| 97 |
|
| 98 |
Q_SIGNALS: |
| 99 |
|
| 100 |
//! Signal emitted when the mouse (left) button is clicked |
| 101 |
/** \param dip_deg dip angle (in degrees) |
| 102 |
\param dipDir_deg dip direction angle (in degrees) |
| 103 |
**/ |
| 104 |
void pointClicked(double dip_deg, double dipDir_deg); |
| 105 |
|
| 106 |
protected: |
| 107 |
|
| 108 |
//inherited from QWidget |
| 109 |
void paintEvent(QPaintEvent* e) override; |
| 110 |
void mousePressEvent(QMouseEvent* e) override; |
| 111 |
|
| 112 |
//! Angular step (in degrees) |
| 113 |
double m_angularStep_deg; |
| 114 |
|
| 115 |
//! Density grid |
| 116 |
FacetDensityGrid* m_densityGrid; |
| 117 |
|
| 118 |
//! Mean dip direction (in degrees) |
| 119 |
double m_meanDipDir_deg; |
| 120 |
//! Mean dip (in degrees) |
| 121 |
double m_meanDip_deg; |
| 122 |
|
| 123 |
//! Density color scale |
| 124 |
ccColorScale::Shared m_densityColorScale; |
| 125 |
//! Density color scale steps |
| 126 |
unsigned m_densityColorScaleSteps; |
| 127 |
|
| 128 |
//! Ticks frequency |
| 129 |
int m_ticksFreq; |
| 130 |
|
| 131 |
//! Whether to show the 'HSV' ring or not |
| 132 |
bool m_showHSVRing; |
| 133 |
|
| 134 |
//! Mouse tracking |
| 135 |
bool m_trackMouseClick; |
| 136 |
//! Last mouse click equivalent dip (in degrees) |
| 137 |
double m_clickDip_deg; |
| 138 |
//! Last mouse click equivalent dip direction (in degrees) |
| 139 |
double m_clickDipDir_deg; |
| 140 |
//! Click area span along dip (in degrees) |
| 141 |
double m_clickDipSpan_deg; |
| 142 |
//! Click area span along dip direction (in degrees) |
| 143 |
double m_clickDipDirSpan_deg; |
| 144 |
|
| 145 |
//! Stereogram center (pixels) |
| 146 |
QPoint m_center; |
| 147 |
//! Stereogram radius (pixels) |
| 148 |
int m_radius; |
| 149 |
|
| 150 |
}; |
| 151 |
|
| 152 |
//! Dialog for displaying the angular repartition of facets (qFacets plugin) |
| 153 |
class StereogramDialog : public QDialog, public Ui::StereogramDialog |
| 154 |
{ |
| 155 |
Q_OBJECT |
| 156 |
|
| 157 |
public: |
| 158 |
|
| 159 |
//! Default constructor |
| 160 |
StereogramDialog(ccMainAppInterface* app); |
| 161 |
|
| 162 |
//! Inits dialog |
| 163 |
/** Warning: input 'facetGroup' should not be deleted before this dialog is closed! |
| 164 |
**/ |
| 165 |
bool init( double angularStep_deg, |
| 166 |
ccHObject* facetGroup, |
| 167 |
double resolution_deg = 2.0); |
| 168 |
|
| 169 |
//! Returns associated widget |
| 170 |
StereogramWidget* stereogram() { return m_classifWidget; } |
| 171 |
|
| 172 |
protected: |
| 173 |
|
| 174 |
void colorScaleChanged(int); |
| 175 |
void spawnColorScaleEditor(); |
| 176 |
void onTicksFreqChanged(int); |
| 177 |
void onHSVColorsToggled(bool); |
| 178 |
void onDensityColorStepsChanged(int); |
| 179 |
void onFilterEnabled(bool); |
| 180 |
void onPointClicked(double,double); |
| 181 |
void onFilterSizeChanged(double); |
| 182 |
void onFilterCenterChanged(double); |
| 183 |
void exportCurrentSelection(); |
| 184 |
|
| 185 |
protected: |
| 186 |
|
| 187 |
//inherited from QDialog |
| 188 |
void closeEvent(QCloseEvent* e); |
| 189 |
|
| 190 |
//! Changes the associated facets visibility based on the current filter parameters |
| 191 |
void updateFacetsFilter(bool enable); |
| 192 |
|
| 193 |
//! Associated widget |
| 194 |
StereogramWidget* m_classifWidget; |
| 195 |
|
| 196 |
//! Color scale selector/editor |
| 197 |
ccColorScaleSelector* m_colorScaleSelector; |
| 198 |
|
| 199 |
//! Main application interface |
| 200 |
ccMainAppInterface* m_app; |
| 201 |
|
| 202 |
//! Associated set of facets (unique ID) |
| 203 |
int m_facetGroupUniqueID; |
| 204 |
}; |
| 205 |
|
| 206 |
#endif //QFACET_STEREOGRAM_DIALOG_HEADER |