1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
//##########################################################################
//# #
//# CLOUDCOMPARE #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 or later of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: CNRS / OSUR #
//# #
//##########################################################################
#ifndef CC_WAVEFORM_DIALOG_HEADER
#define CC_WAVEFORM_DIALOG_HEADER
//Local
#include "ccPickingListener.h"
//Qt
#include <QDialog>
#include <QFont>
//QCustomPlot
#include <qcustomplot.h>
class QCPBarsWithText;
class QCPHiddenArea;
class QCPGraph;
class QCPArrow;
class Ui_WaveDialog;
class ccPointCloud;
class ccPickingHub;
//! Waveform widget
class ccWaveWidget : public QCustomPlot
{
Q_OBJECT
public:
//! Default constructor
explicit ccWaveWidget(QWidget *parent = 0);
//! Destructor
virtual ~ccWaveWidget();
//! Sets title
void setTitle(const QString& str);
//! Sets axis labels
void setAxisLabels(const QString& xLabel, const QString& yLabel);
//! Computes the wave (curve) from a given point waveform
void init(ccPointCloud* cloud, unsigned pointIndex, bool logScale, double maxValue = 0.0);
//! Clears the display
void clear();
//! Updates the display
void refresh();
protected: //methods
//mouse events handling
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
//void wheelEvent(QWheelEvent* event);
void resizeEvent(QResizeEvent * event);
//! Clears internal structures
void clearInternal();
//! Updates overlay curve width depending on the widget display size
void updateCurveWidth(int w, int h);
protected: //attributes
//Title
QString m_titleStr;
QCPPlotTitle* m_titlePlot;
//! Wave curve
QCPGraph* m_curve;
std::vector<double> m_curveValues;
double m_dt;
double m_minA, m_maxA;
double m_echoPos;
//vertical indicator
QCPBarsWithText* m_vertBar;
bool m_drawVerticalIndicator;
double m_verticalIndicatorPositionPercent;
//Peak marker
QCPBarsWithText* m_peakBar;
//! Rendering font
QFont m_renderingFont;
//! Last mouse click
QPoint m_lastMouseClick;
};
//! Waveform dialog
class ccWaveDialog : public QDialog, public ccPickingListener
{
Q_OBJECT
public:
//! Default constructor
explicit ccWaveDialog(ccPointCloud* cloud, ccPickingHub* pickingHub, QWidget* parent = 0);
//! Destructor
virtual ~ccWaveDialog();
//! Returns the encapsulated widget
inline ccWaveWidget* waveWidget() { return m_widget; }
//inherited from ccPickingListener
virtual void onItemPicked(const PickedItem& pi);
protected slots:
void onPointIndexChanged(int);
void updateCurrentWaveform();
void onPointPickingButtonToggled(bool);
void onExportWaveAsCSV();
protected: //members
//! Associated point cloud
ccPointCloud* m_cloud;
//! Wave widget
ccWaveWidget* m_widget;
//! Picking hub
ccPickingHub* m_pickingHub;
//! GUI
Ui_WaveDialog* m_gui;
//! Maximum wave amplitude (for all points)
double m_waveMax;
};
#endif //CC_WAVEFORM_DIALOG_HEADER
|