2018-12-19 00:13:18 +08:00
|
|
|
/*
|
2019-01-12 23:01:55 +08:00
|
|
|
Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>)
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This software is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License (LGPL) as published by
|
2019-02-08 00:24:46 +08:00
|
|
|
the Free Software Foundation, either version 2.1 of the License, or
|
2018-12-19 00:13:18 +08:00
|
|
|
(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 (LGPL) for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License (LGPL)
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPair>
|
|
|
|
#include "jkqtplotter/jkqtpgraphsbase.h"
|
|
|
|
|
|
|
|
#ifndef jkqtpgraphspeakstream_H_INCLUDED
|
|
|
|
#define jkqtpgraphspeakstream_H_INCLUDED
|
|
|
|
|
|
|
|
// forward declarations
|
2019-01-20 17:49:29 +08:00
|
|
|
class JKQTBasePlotter;
|
2019-01-20 23:15:10 +08:00
|
|
|
class JKQTPlotter;
|
2019-01-20 17:49:29 +08:00
|
|
|
class JKQTPCoordinateAxis;
|
|
|
|
class JKQTPDatastore;
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*! \brief interprets data as a stream of x- or y-positions \f$ p_i \f$ (depending in \a yPeaks ) ans plots a line on the height
|
|
|
|
\a baseline and upright lines from baseline to baseline+peakHeight at each position \f$ p_i \f$. This can be used to
|
|
|
|
display a stream of photons with given arrivaltimes \f$ p_i \f$.
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtplotter_diverse
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
\image html JKQTPPeakStreamGraphY.png "yPeaks=true"
|
|
|
|
\image html JKQTPPeakStreamGraphX.png "yPeaks=false"
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPSingleColumnGraph {
|
2018-12-19 00:13:18 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPPeakStreamGraph(JKQTBasePlotter* parent=nullptr);
|
|
|
|
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQTBasePlotter* parent=nullptr);
|
|
|
|
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQTBasePlotter* parent=nullptr);
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPPeakStreamGraph(JKQTPlotter* parent);
|
|
|
|
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQTPlotter* parent);
|
|
|
|
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQTPlotter* parent);
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
/** \brief get the maximum and minimum x-value of the graph
|
|
|
|
*
|
|
|
|
* The result is given in the two parameters which are call-by-reference parameters!
|
|
|
|
*/
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
/** \brief get the maximum and minimum y-value of the graph
|
|
|
|
*
|
|
|
|
* The result is given in the two parameters which are call-by-reference parameters!
|
|
|
|
*/
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/** \brief plots the graph to the plotter object specified as parent */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc baseline
|
|
|
|
\see see baseline for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual void setBaseline(double __value)
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
this->baseline = __value;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc baseline
|
|
|
|
\see see baseline for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual double getBaseline() const
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
return this->baseline;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc peakHeight
|
|
|
|
\see see peakHeight for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual void setPeakHeight(double __value)
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
this->peakHeight = __value;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc peakHeight
|
|
|
|
\see see peakHeight for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual double getPeakHeight() const
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
return this->peakHeight;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc yPeaks
|
|
|
|
\see see yPeaks for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual void setYPeaks(bool __value)
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
this->yPeaks = __value;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc yPeaks
|
|
|
|
\see see yPeaks for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual bool getYPeaks() const
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
return this->yPeaks;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc drawBaseline
|
|
|
|
\see see drawBaseline for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual void setDrawBaseline(bool __value)
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
this->drawBaseline = __value;
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
/*! \copydoc drawBaseline
|
|
|
|
\see see drawBaseline for details */
|
2019-01-26 20:00:40 +08:00
|
|
|
inline virtual bool getDrawBaseline() const
|
2019-01-10 04:23:24 +08:00
|
|
|
{
|
|
|
|
return this->drawBaseline;
|
|
|
|
}
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/** \brief position of the baseline */
|
|
|
|
double baseline;
|
|
|
|
/** \brief height of each peak */
|
|
|
|
double peakHeight;
|
|
|
|
/** \brief if set \c true the peaks are in Y direction (default: true)*/
|
|
|
|
bool yPeaks;
|
|
|
|
/** \brief indicates whether to draw the basleine (default: \c true ) */
|
|
|
|
bool drawBaseline;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // jkqtpgraphspeakstream_H_INCLUDED
|