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
|
|
|
|
the Free Software Foundation, either version 2 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 (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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-01-12 23:01:55 +08:00
|
|
|
/** \file jkqtpgraphspeakstream.h
|
2019-01-19 16:40:52 +08:00
|
|
|
* \ingroup jkqtplotter_diverse
|
2018-12-19 00:13:18 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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-01-20 17:49:29 +08:00
|
|
|
class 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-01-10 04:23:24 +08:00
|
|
|
/*! \brief sets the property baseline to the specified \a __value.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter baseline is: <BLOCKQUOTE>\copydoc baseline </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see baseline for more information */
|
|
|
|
inline virtual void set_baseline(double __value)
|
|
|
|
{
|
|
|
|
this->baseline = __value;
|
|
|
|
}
|
|
|
|
/*! \brief returns the property baseline.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter baseline is: <BLOCKQUOTE>\copydoc baseline </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see baseline for more information */
|
|
|
|
inline virtual double get_baseline() const
|
|
|
|
{
|
|
|
|
return this->baseline;
|
|
|
|
}
|
|
|
|
/*! \brief sets the property peakHeight to the specified \a __value.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter peakHeight is: <BLOCKQUOTE>\copydoc peakHeight </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see peakHeight for more information */
|
|
|
|
inline virtual void set_peakHeight(double __value)
|
|
|
|
{
|
|
|
|
this->peakHeight = __value;
|
|
|
|
}
|
|
|
|
/*! \brief returns the property peakHeight.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter peakHeight is: <BLOCKQUOTE>\copydoc peakHeight </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see peakHeight for more information */
|
|
|
|
inline virtual double get_peakHeight() const
|
|
|
|
{
|
|
|
|
return this->peakHeight;
|
|
|
|
}
|
|
|
|
/*! \brief sets the property yPeaks to the specified \a __value.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter yPeaks is: <BLOCKQUOTE>\copydoc yPeaks </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see yPeaks for more information */
|
|
|
|
inline virtual void set_yPeaks(bool __value)
|
|
|
|
{
|
|
|
|
this->yPeaks = __value;
|
|
|
|
}
|
|
|
|
/*! \brief returns the property yPeaks.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter yPeaks is: <BLOCKQUOTE>\copydoc yPeaks </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see yPeaks for more information */
|
|
|
|
inline virtual bool get_yPeaks() const
|
|
|
|
{
|
|
|
|
return this->yPeaks;
|
|
|
|
}
|
|
|
|
/*! \brief sets the property drawBaseline to the specified \a __value.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter drawBaseline is: <BLOCKQUOTE>\copydoc drawBaseline </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see drawBaseline for more information */
|
|
|
|
inline virtual void set_drawBaseline(bool __value)
|
|
|
|
{
|
|
|
|
this->drawBaseline = __value;
|
|
|
|
}
|
|
|
|
/*! \brief returns the property drawBaseline.
|
2019-01-25 05:49:10 +08:00
|
|
|
\details Description of the parameter drawBaseline is: <BLOCKQUOTE>\copydoc drawBaseline </BLOCKQUOTE>
|
2019-01-10 04:23:24 +08:00
|
|
|
\see drawBaseline for more information */
|
|
|
|
inline virtual bool get_drawBaseline() const
|
|
|
|
{
|
|
|
|
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
|