/* QAD - Qt ADvanced Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef graphic_analysis_h #define graphic_analysis_h #include "qad_graphic_analysis_export.h" #include #include namespace Ui { class GraphicAnalysis; } class GraphicAnalysisPlugin; class GraphicAnalysisStatistics; class QAD_GRAPHIC_ANALYSIS_EXPORT GraphicAnalysis: public GraphicRanges { Q_OBJECT friend class GraphicAnalysisPlugin; Q_PROPERTY(bool toolboxVisible READ isToolboxVisible WRITE setToolboxVisible) Q_PROPERTY(bool showSpectrum READ isShowSpectrum WRITE setShowSpectrum) public: GraphicAnalysis(QWidget * parent = 0); virtual ~GraphicAnalysis(); void setGraphicData(const QPolygonF & g, int graphic, bool update_ = true); bool isSpectrumFixedDuration() const; void setIsSpectrumFixedDuration(bool on); double spectrumFixedDuration() const; void setSpectrumFixedDuration(double val); bool isToolboxVisible() const; void setToolboxVisible(bool yes); void setLabelX(const QString & str); QWidget * toolboxWidget(); void setShowSpectrum(bool on); bool isShowSpectrum() const; void setGraphicsCount(int cnt, bool update = true); void addPoint(const QPointF & p, int graphic, bool update_ = true); void setGraphicTransformFunction(std::function f); void setSpectrumTransformFunction(std::function f); protected: void changeEvent(QEvent * e); void updateGraphic(int index); void updateAllGraphic(); void setFFTInternal(bool on); void setFFT(bool on); QPolygonF calcToFFT(const QPointF * in, int count); void checkRangeRequest(); Ui::GraphicAnalysis * ui = nullptr; GraphicAnalysisStatistics * window_stat; QWidget * widget_toolbox = nullptr; QMap src_data; GraphicRanges::Range range_fft; std::function tf_gr, tf_fft; QString data_label_x; QRectF saved_view; bool saved_autofit = true, show_fft = false; PRIVATE_DECLARATION(QAD_GRAPHIC_ANALYSIS_EXPORT) public slots: void clear(); private slots: void gaMousePressEvent(QPointF point, int buttons); void gaMouseMoveEvent(QPointF point, int buttons); void gaMouseReleaseEvent(QPointF point, int buttons); void gaRangeSelected(double start, double end); void checkSpectrum_toggled(bool on); void buttonSpectrumRange_toggled(bool on); void checkSpectrumFixDuration_toggled(bool on); void buttonStatistics_toggled(bool on); signals: void showSpectrumChanged(bool); void configChanged(); }; #endif