16#ifndef QGSCURVEEDITORWIDGET_H 
   17#define QGSCURVEEDITORWIDGET_H 
   25#include <qwt_global.h> 
   34class QwtPlotHistogram;
 
   36class QgsCurveEditorPlotEventFilter;
 
   51class QgsHistogramValuesGatherer: 
public QThread
 
   56    QgsHistogramValuesGatherer() = 
default;
 
   61      if ( mExpression.isEmpty() || !mLayer )
 
   63        mHistogram.setValues( QList<double>() );
 
   70      mHistogram.setValues( mLayer, mExpression, mFeedback );
 
   73      mFeedbackMutex.lock();
 
   76      mFeedbackMutex.unlock();
 
   78      emit calculatedHistogram();
 
   85      mFeedbackMutex.lock();
 
   88      mFeedbackMutex.unlock();
 
   94    bool wasCanceled()
 const { 
return mWasCanceled; }
 
   96    const QgsHistogram &histogram()
 const { 
return mHistogram; }
 
  107    QString expression()
 const 
  111    void setExpression( 
const QString &expression )
 
  113      mExpression = expression;
 
  121    void calculatedHistogram();
 
  125    QPointer< const QgsVectorLayer > mLayer = 
nullptr;
 
  129    QMutex mFeedbackMutex;
 
  130    bool mWasCanceled = 
false;
 
  175    void setHistogramSource( 
const QgsVectorLayer *layer, 
const QString &expression );
 
  198    void setMinHistogramValueRange( 
double minValueRange );
 
  205    void setMaxHistogramValueRange( 
double maxValueRange );
 
  214    void keyPressEvent( QKeyEvent *event ) 
override;
 
  218    void plotMousePress( QPointF point );
 
  219    void plotMouseRelease( QPointF point );
 
  220    void plotMouseMove( QPointF point );
 
  226    QwtPlot *mPlot = 
nullptr;
 
  228    QwtPlotCurve *mPlotCurve = 
nullptr;
 
  230    QList< QwtPlotMarker * > mMarkers;
 
  231    QgsCurveEditorPlotEventFilter *mPlotFilter = 
nullptr;
 
  232    int mCurrentPlotMarkerIndex = -1;
 
  234    std::unique_ptr< QgsHistogramValuesGatherer > mGatherer;
 
  235    std::unique_ptr< QgsHistogram > mHistogram;
 
  236    double mMinValueRange = 0.0;
 
  237    double mMaxValueRange = 1.0;
 
  239    QwtPlotHistogram *mPlotHistogram = 
nullptr;
 
  242    void addPlotMarker( 
double x, 
double y, 
bool isSelected = 
false );
 
  243    void updateHistogram();
 
  245    int findNearestControlPoint( QPointF point ) 
const;
 
  247    QwtPlotHistogram *createPlotHistogram( 
const QBrush &brush, 
const QPen &pen = Qt::NoPen ) 
const;
 
  260class GUI_EXPORT QgsCurveEditorPlotEventFilter: 
public QObject
 
  266    QgsCurveEditorPlotEventFilter( QwtPlot *plot );
 
  268    bool eventFilter( QObject *
object, QEvent *event ) 
override;
 
  272    void mousePress( QPointF );
 
  273    void mouseRelease( QPointF );
 
  274    void mouseMove( QPointF );
 
  278    QwtPlot *mPlot = 
nullptr;
 
  279    QPointF mapPoint( QPointF point ) 
const;
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
Calculator for a numeric histogram from a list of values.
 
Represents a vector layer which manages a vector based data sets.