2015-07-11 18:56:02 +08:00
/*
2020-08-26 18:58:23 +08:00
Copyright ( c ) 2008 - 2020 Jan W . Krieger ( < jan @ jkrieger . de > ) ( DKFZ ) & IWR , University of Heidelberg
2015-07-11 18:56:02 +08:00
2015-07-12 22:34:27 +08:00
2015-07-11 18:56:02 +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
2015-07-11 18:56:02 +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/>.
*/
# ifndef JKQTFASTPLOTTER_H
# define JKQTFASTPLOTTER_H
2019-06-22 20:21:32 +08:00
# include "jkqtfastplotter_imexport.h"
2015-07-11 18:56:02 +08:00
# include <QWidget>
# include <QVector>
# include <QSettings>
# include <QColor>
# include <QVector>
# include <QPair>
# include <QStringList>
# include <QIcon>
# include <cmath>
# include <iostream>
# include <QMutex>
2022-04-21 16:57:24 +08:00
# if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
# include <QtOpenGLWidgets/QOpenGLWidget>
# define JKQTFASTPLOTTER_BASE QOpenGLWidget
# else
2015-07-11 18:56:02 +08:00
# include <QGLWidget>
2022-04-21 16:57:24 +08:00
# define JKQTFASTPLOTTER_BASE QGLWidget
# endif
2019-11-24 17:42:44 +08:00
# include "jkqtcommon/jkqtpmathtools.h"
2015-07-11 18:56:02 +08:00
# ifdef DEBUG_TIMING
2019-05-30 04:40:02 +08:00
# include "jkqtcommon / jkqtphighrestimer.h"
2015-07-11 18:56:02 +08:00
# endif
2019-02-08 00:24:46 +08:00
2015-07-11 18:56:02 +08:00
// forward declaration
class JKQTFPPlot ;
/*! \brief a speed optimized plotter class
\ ingroup jkqtfastplotter
2019-01-20 23:15:10 +08:00
This plotter class is ( in contrast to JKQTPlotter ) optimized for speed . It allows to plot function graphs / data in
2015-07-11 18:56:02 +08:00
a simple manner . The focus of design was not on a nice output ( athough this is not unimportant ) , but on the speed
of the output . So the class may be used to di quick plotting of data , i . e . in fast image sequence applications .
These measures were taken to increase speed :
- The coordinate system is drawn onto an internal image which is only updated , when the size of the widget
or a property of the coordinate system changes . When only the data changes , just the data plot has to be
updated .
- The class uses an internal buffer with the complete image , so a repaint does not always trigger a complete
repaint of all elements , but just measns painting the internal image to the screen . This also allows to
plot selections . . . over the plot , without having to replot the plots .
- The definition of the coordinate system as well as the definition the system ticks . . . is reduced to the absolute
minimum .
2019-01-26 03:16:04 +08:00
- The method setPlotUpdateEnabled ( ) allows to prevent replotting of the class contents , e . g . when you want to set
2015-07-11 18:56:02 +08:00
a multitude of parameters without triggering a replot every time .
.
The class supports these features :
- coordinate axes may be linear or logarithmic .
- ticks and tick labels are drawn by a simple algorithm : The user has to supply two values :
\ c zeroTick is a tick value that exists in any case ( i . e . 0 ) and \ c tickDistance which contains the distance
between two ticks ( only applicable to linear axes ) . Then the class starts to draw at zeroTick and move on to
\ c zeroTick + tickDistance and \ c zeroTick - tickDistance until \ c min / \ c max of the axis is reached . For logarithmic axes
the class uses \ c zeroTick * 10 and \ c zeroTick / 10
- plot may contain a grid ( x and y grid may be switched on / off separately ) .
- plots are represented by descendents of JKQTFPPlot and the plotting code is completely
contained therein ( and should be speed optimized ) .
2019-02-08 00:24:46 +08:00
- it is possible to keep a specified aspect ratio
2015-07-11 18:56:02 +08:00
- it is possible to couple different plots in a way , that they are plottetd with the same width / height
both in pixel and world coordinates by using plotterSizesChanged ( ) and synchronizeX ( ) / synchronizeY ( ) .
.
*/
2022-04-21 16:57:24 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFastPlotter :
# if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
public QOpenGLWidget
# else
public QGLWidget
# endif
{
2015-07-11 18:56:02 +08:00
Q_OBJECT
2019-02-08 00:24:46 +08:00
public :
/*! \brief smallest allowed line width for JKQTFastPlotter
*/
static const double ABS_MIN_LINEWIDTH ;
/*! \brief size of the lookup tables used by JKQTFPimagePlot_array2image()
*/
2019-05-30 04:40:02 +08:00
static const size_t LUTSIZE ;
2019-02-08 00:24:46 +08:00
2015-07-11 18:56:02 +08:00
protected :
/** \brief indicates whether to do full repaint (system and data) at the next repaint (any of the repaint meothods) */
bool doFullRepaint ;
/** \brief this stores the currently displayed coordinate system */
QImage systemImage ;
/** \brief this stores the currently displayed plot */
QImage image ;
/** \brief this can be used when drawing a zoom rectangle to store an unchanged
* copy of the currently displayed image .
*/
QImage oldImage ;
/** \brief if \c false the plotting won't be performed (may be used to set more than one parameter without replot */
bool doDrawing ;
/** \brief list of plots in this graph */
QVector < JKQTFPPlot * > plots ;
/** \brief free space between widget left border and plot left border */
2019-01-10 04:23:24 +08:00
int plotBorderLeft ;
/*! \brief default value for property plotBorderLeft.
\ see plotBorderLeft for more information */
2019-01-26 20:00:40 +08:00
int default_plotBorderLeft ;
2015-07-11 18:56:02 +08:00
/** \brief free space between widget bottom border and plot bottom border */
2019-01-10 04:23:24 +08:00
int plotBorderBottom ;
/*! \brief default value for property plotBorderBottom.
\ see plotBorderBottom for more information */
2019-01-26 20:00:40 +08:00
int default_plotBorderBottom ;
2015-07-11 18:56:02 +08:00
/** \brief free space between widget right border and plot left border */
2019-01-10 04:23:24 +08:00
int plotBorderRight ;
/*! \brief default value for property plotBorderRight.
\ see plotBorderRight for more information */
2019-01-26 20:00:40 +08:00
int default_plotBorderRight ;
2015-07-11 18:56:02 +08:00
/** \brief free space between widget top border and plot bottom border */
2019-01-10 04:23:24 +08:00
int plotBorderTop ;
/*! \brief default value for property plotBorderTop.
\ see plotBorderTop for more information */
2019-01-26 20:00:40 +08:00
int default_plotBorderTop ;
2015-07-11 18:56:02 +08:00
/** \brief internally calculated: free space between widget left border and plot left border
*
* \ note This is the actual border used for plotting , as it may be different from what the user supplied .
* Note also that this is at least as huge as the suer supplied border value !
*/
int internalPlotBorderLeft ;
/** \brief internally calculated: free space between widget bottom border and plot bottom border
*
* \ note This is the actual border used for plotting , as it may be different from what the user supplied .
* Note also that this is at least as huge as the suer supplied border value !
*/
int internalPlotBorderBottom ;
/** \brief internally calculated: free space between widget right border and plot left border
*
* \ note This is the actual border used for plotting , as it may be different from what the user supplied .
* Note also that this is at least as huge as the suer supplied border value !
*/
int internalPlotBorderRight ;
/** \brief internally calculated: free space between widget top border and plot bottom border
*
* \ note This is the actual border used for plotting , as it may be different from what the user supplied .
* Note also that this is at least as huge as the suer supplied border value !
*/
int internalPlotBorderTop ;
2019-01-20 23:15:10 +08:00
/** \brief plot width in pt inside the widget (calculated by calcPlotScaling() from plotBorderLeft, plotBorderRight and widgetWidth) */
2015-07-11 18:56:02 +08:00
int plotWidth ;
2019-01-20 23:15:10 +08:00
/** \brief plot height in pt inside the widget (calculated by calcPlotScaling() from plotBorderTop, plotBorderBottom and widgetHeight) */
2015-07-11 18:56:02 +08:00
int plotHeight ;
/** \brief color of the coordinate system */
2019-01-10 04:23:24 +08:00
QColor systemColor ;
/*! \brief default value for property systemColor.
\ see systemColor for more information */
2019-01-26 20:00:40 +08:00
QColor default_systemColor ;
2015-07-11 18:56:02 +08:00
/** \brief width of the coordinate (in pixel) */
2019-01-10 04:23:24 +08:00
double systemWidth ;
/*! \brief default value for property systemWidth.
\ see systemWidth for more information */
2019-01-26 20:00:40 +08:00
double default_systemWidth ;
2015-07-11 18:56:02 +08:00
/** \brief color of the background*/
2019-01-10 04:23:24 +08:00
QColor backgroundColor ;
/*! \brief default value for property backgroundColor.
\ see backgroundColor for more information */
2019-01-26 20:00:40 +08:00
QColor default_backgroundColor ;
2015-07-11 18:56:02 +08:00
/** \brief color of the plot's background
*
* \ note the background is not drawn if this color is set to \ c QColor ( Qt : : transparent ) !
*/
2019-01-10 04:23:24 +08:00
QColor plotBackgroundColor ;
/*! \brief default value for property plotBackgroundColor.
\ see plotBackgroundColor for more information */
2019-01-26 20:00:40 +08:00
QColor default_plotBackgroundColor ;
2015-07-11 18:56:02 +08:00
/** \brief indicates whether to draw a system box */
2019-01-10 04:23:24 +08:00
bool drawSystemBox ;
/*! \brief default value for property drawSystemBox.
\ see drawSystemBox for more information */
2019-01-26 20:00:40 +08:00
bool default_drawSystemBox ;
2015-07-11 18:56:02 +08:00
/** \brief indicates whether to draw axes at x=0/y=0 */
2019-01-10 04:23:24 +08:00
bool drawZeroAxes ;
/*! \brief default value for property drawZeroAxes.
\ see drawZeroAxes for more information */
2019-01-26 20:00:40 +08:00
bool default_drawZeroAxes ;
2015-07-11 18:56:02 +08:00
/** \brief indicates whether to draw a grid */
2019-01-10 04:23:24 +08:00
bool drawGrid ;
/*! \brief default value for property drawGrid.
\ see drawGrid for more information */
2019-01-26 20:00:40 +08:00
bool default_drawGrid ;
2015-07-11 18:56:02 +08:00
/** \brief color of the coordinate grid */
2019-01-10 04:23:24 +08:00
QColor gridColor ;
/*! \brief default value for property gridColor.
\ see gridColor for more information */
2019-01-26 20:00:40 +08:00
QColor default_gridColor ;
2015-07-11 18:56:02 +08:00
/** \brief style of the coordinate grid */
2019-01-10 04:23:24 +08:00
Qt : : PenStyle gridStyle ;
/*! \brief default value for property gridStyle.
\ see gridStyle for more information */
2019-01-26 20:00:40 +08:00
Qt : : PenStyle default_gridStyle ;
2015-07-11 18:56:02 +08:00
/** \brief width of the coordinate grid (in pixel) */
2019-01-10 04:23:24 +08:00
double gridWidth ;
/*! \brief default value for property gridWidth.
\ see gridWidth for more information */
2019-01-26 20:00:40 +08:00
double default_gridWidth ;
2015-07-11 18:56:02 +08:00
/** \brief font size (in points) of the axis labels */
2019-01-10 04:23:24 +08:00
double labelFontSize ;
/*! \brief default value for property labelFontSize.
\ see labelFontSize for more information */
2019-01-26 20:00:40 +08:00
double default_labelFontSize ;
2015-07-11 18:56:02 +08:00
/** \brief font name of the axis labels */
2019-01-10 04:23:24 +08:00
QString labelFontName ;
/*! \brief default value for property labelFontName.
\ see labelFontName for more information */
2019-01-26 20:00:40 +08:00
QString default_labelFontName ;
2015-07-11 18:56:02 +08:00
/** \brief font size (in points) of the tick labels */
2019-01-10 04:23:24 +08:00
double tickFontSize ;
/*! \brief default value for property tickFontSize.
\ see tickFontSize for more information */
2019-01-26 20:00:40 +08:00
double default_tickFontSize ;
2015-07-11 18:56:02 +08:00
/** \brief font name of the tick labels */
2019-01-10 04:23:24 +08:00
QString tickFontName ;
/*! \brief default value for property tickFontName.
\ see tickFontName for more information */
2019-01-26 20:00:40 +08:00
QString default_tickFontName ;
2015-07-11 18:56:02 +08:00
/** \brief length of an axis tick (pixels) */
2019-01-10 04:23:24 +08:00
double tickLength ;
/*! \brief default value for property tickLength.
\ see tickLength for more information */
2019-01-26 20:00:40 +08:00
double default_tickLength ;
2015-07-11 18:56:02 +08:00
/** \brief minimum value of x axis */
double xMin ;
/** \brief maximum value of x axis */
double xMax ;
/** \brief minimum value of y axis */
double yMin ;
/** \brief maximum value of y axis */
double yMax ;
/** \brief is x axis logarithmic? */
bool xAxisLog ;
/** \brief is x axis logarithmic? */
bool yAxisLog ;
/** \brief width of plot on x axis (calculated internally) */
double xWidth ;
/** \brief x axis scaling factor (calculated internally) */
double xScale ;
/** \brief x axis offset (calculated internally) */
double xOffset ;
/** \brief width of plot on y axis (calculated internally) */
double yWidth ;
/** \brief y axis scaling factor (calculated internally) */
double yScale ;
/** \brief y axis offset (calculated internally) */
double yOffset ;
/** \brief a label position from which axis label plotting is started for the x axis */
double xZeroTick ;
/** \brief a label position from which axis label plotting is started for the y axis */
double yZeroTick ;
/** \brief distance between two labels on x axis */
double xTickDistance ;
/** \brief distance between two labels on y axis */
double yTickDistance ;
/** \brief label of x axis */
QString xAxisLabel ;
/** \brief label of y axis */
QString yAxisLabel ;
/** \brief plot y axis label */
bool yAxisLabelVisible ;
/** \brief plot x axis label */
bool xAxisLabelVisible ;
/** \brief synchronize x-axis settings to this plotter */
JKQTFastPlotter * synchronizeX ;
/** \brief synchronize y-axis settings to this plotter */
JKQTFastPlotter * synchronizeY ;
2019-02-08 00:24:46 +08:00
/** \brief aspect ratio of the plot, only used when maintainAspectRation is \c true
2015-07-11 18:56:02 +08:00
*
2019-01-20 23:15:10 +08:00
* The aspect ratio is defined as \ c width / height of the plot in pt .
2015-07-11 18:56:02 +08:00
* So if you want to have a plot spanning \ c x = 0. .20 and \ c y = 0. .10 where each 1 x1 square should be
* as wide as high you will have to set aspectRatio to \ c 2 .
*
* \ note Note that aspect ratios only make sense for linear - linear plots . This will be ignored
* if any one axis is logarithmic .
*/
double aspectRatio ;
/** \brief indicates whether to maintain a specific aspect ratio */
bool maintainAspectRatio ;
QPoint mouseDragStart ;
QPoint mouseDragEnd ;
bool dragging ;
QPen dragShapePen ;
bool dragLine ;
QAction * actCopyImage ;
/** \brief this simply paints the stored image to the widget's surface */
2019-01-10 04:23:24 +08:00
virtual void paintEvent ( QPaintEvent * event ) override ;
2015-07-11 18:56:02 +08:00
/** \brief resizes the internal representation (image) of the graphs */
2019-01-10 04:23:24 +08:00
virtual void resizeEvent ( QResizeEvent * event ) override ;
2015-07-11 18:56:02 +08:00
/** \brief event handler for a double click */
2019-01-10 04:23:24 +08:00
virtual void mouseDoubleClickEvent ( QMouseEvent * event ) override ;
2015-07-11 18:56:02 +08:00
/** \brief event handler for a mouse move */
2019-01-10 04:23:24 +08:00
virtual void mouseMoveEvent ( QMouseEvent * event ) override ;
2015-07-11 18:56:02 +08:00
/** \brief event handler for a mouse button press */
2019-01-10 04:23:24 +08:00
virtual void mousePressEvent ( QMouseEvent * event ) override ;
2015-07-11 18:56:02 +08:00
/** \brief event handler for a mouse button is released */
2019-01-10 04:23:24 +08:00
virtual void mouseReleaseEvent ( QMouseEvent * event ) override ;
2015-07-11 18:56:02 +08:00
/** \brief paint the coordinate system */
void plotSystem ( QPainter & painter ) ;
/** \brief paint the graphs */
void plotGraphs ( QPainter & painter ) ;
/** \brief recalculate the scaling of the plot */
void calcPlotScaling ( ) ;
2019-01-26 20:00:40 +08:00
QSize minimumSizeHint ( ) const override ;
2015-07-11 18:56:02 +08:00
/** \brief mutex to lock global widget repaint */
QMutex mutexRepaint ;
/** \brief mutex to lock data repaint */
QMutex mutexRepaintData ;
/** \brief mutex to lock system repaint */
QMutex mutexRepaintSystem ;
public :
/** \brief class constructor */
2019-01-10 04:23:24 +08:00
JKQTFastPlotter ( QWidget * parent = nullptr ) ;
2015-07-11 18:56:02 +08:00
/** \brief set the properties of the x axis */
void setXRange ( double min , double max , bool logarithmic = false ) ;
/** \brief set the properties of the y axis */
void setYRange ( double min , double max , bool logarithmic = false ) ;
/** \brief set the properties of both axes */
void setXYRange ( double xmin , double xmax , double ymin , double ymax , bool xlogarithmic = false , bool ylogarithmic = false ) ;
/** \brief clear all plots in the graph
*
* \ param remove if \ c true the object will also be deleted from memory , not just from the list
*/
void clearPlots ( bool remove = false ) ;
/** \brief add a new graph */
void addPlot ( JKQTFPPlot * g ) ;
/** \brief return the internal number (0..N-1) of the given plot, or -1*/
int getPlotNum ( JKQTFPPlot * g ) ;
/** \brief remove given graph
*
* \ param id specifies the graph to delete
* \ param remove if \ c true the object will also be deleted from memory , not just from the list
*/
void deletePlot ( int id , bool remove = false ) ;
/** \brief remove given graph
*
* \ param g specifies the graph to delete
* \ param remove if \ c true the object will also be deleted from memory , not just from the list
*/
void deletePlot ( JKQTFPPlot * g , bool remove = false ) ;
/** \brief return x-pixel coordinate from x coordinate */
inline double x2p ( double x ) {
if ( xAxisLog ) {
2020-09-09 02:15:33 +08:00
if ( x < = 0 ) return xOffset + log ( xMin / 10.0 ) / JKQTPSTATISTICS_LN10 * xScale ;
2020-08-26 17:43:44 +08:00
return xOffset + log ( x ) / JKQTPSTATISTICS_LN10 * xScale ;
2015-07-11 18:56:02 +08:00
} else {
return xOffset + x * xScale ;
}
2019-01-10 04:23:24 +08:00
}
2015-07-11 18:56:02 +08:00
/** \brief return x coordinate coordinate from x-pixel */
inline double p2x ( long x ) {
if ( xAxisLog ) {
2020-08-26 17:43:44 +08:00
return exp ( JKQTPSTATISTICS_LN10 * ( static_cast < double > ( x ) - xOffset ) / ( xScale ) ) ;
2015-07-11 18:56:02 +08:00
} else {
2019-01-26 20:00:40 +08:00
return ( static_cast < double > ( x ) - xOffset ) / ( xScale ) ;
2015-07-11 18:56:02 +08:00
}
2019-01-10 04:23:24 +08:00
}
2015-07-11 18:56:02 +08:00
/** \brief return y-pixel coordinate from y coordinate */
inline double y2p ( double y ) {
if ( yAxisLog ) {
2020-09-09 02:15:33 +08:00
if ( y < = 0 ) return yOffset - log ( yMin / 10.0 ) / JKQTPSTATISTICS_LN10 * yScale ;
2020-08-26 17:43:44 +08:00
return yOffset - log ( y ) / JKQTPSTATISTICS_LN10 * yScale ;
2015-07-11 18:56:02 +08:00
} else {
return yOffset - y * yScale ;
}
2019-01-10 04:23:24 +08:00
}
2015-07-11 18:56:02 +08:00
/** \brief return y coordinate coordinate from y-pixel */
inline double p2y ( long y ) {
if ( yAxisLog ) {
2020-08-26 17:43:44 +08:00
return exp ( JKQTPSTATISTICS_LN10 * ( static_cast < double > ( y ) - yOffset ) / ( - 1.0 * yScale ) ) ;
2015-07-11 18:56:02 +08:00
} else {
2019-01-26 20:00:40 +08:00
return ( static_cast < double > ( y ) - yOffset ) / ( - 1.0 * yScale ) ;
2015-07-11 18:56:02 +08:00
}
2019-01-10 04:23:24 +08:00
}
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc dragShapePen */
2019-01-26 20:00:40 +08:00
inline void setDragShapePen ( const QPen & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > dragShapePen ! = __value ) {
this - > dragShapePen = __value ;
update ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc dragShapePen */
2019-01-26 20:00:40 +08:00
inline QPen getDragShapePen ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > dragShapePen ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc dragLine */
2019-01-26 20:00:40 +08:00
inline void setDragLine ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > dragLine ! = __value ) {
this - > dragLine = __value ;
update ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc dragLine */
2019-01-26 20:00:40 +08:00
inline bool getDragLine ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > dragLine ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderLeft */
2019-01-26 20:00:40 +08:00
inline void setPlotBorderLeft ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > plotBorderLeft ! = __value ) {
this - > plotBorderLeft = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderLeft */
2019-01-26 20:00:40 +08:00
inline int getPlotBorderLeft ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > plotBorderLeft ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderBottom */
2019-01-26 20:00:40 +08:00
inline void setPlotBorderBottom ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > plotBorderBottom ! = __value ) {
this - > plotBorderBottom = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderBottom */
2019-01-26 20:00:40 +08:00
inline int getPlotBorderBottom ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > plotBorderBottom ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderRight */
2019-01-26 20:00:40 +08:00
inline void setPlotBorderRight ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > plotBorderRight ! = __value ) {
this - > plotBorderRight = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderRight */
2019-01-26 20:00:40 +08:00
inline int getPlotBorderRight ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > plotBorderRight ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderTop */
2019-01-26 20:00:40 +08:00
inline void setPlotBorderTop ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > plotBorderTop ! = __value ) {
this - > plotBorderTop = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBorderTop */
2019-01-26 20:00:40 +08:00
inline int getPlotBorderTop ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > plotBorderTop ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotWidth */
2019-01-26 03:16:04 +08:00
inline int getPlotWidth ( ) const {
2019-01-10 04:23:24 +08:00
return this - > plotWidth ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotHeight */
2019-01-26 03:16:04 +08:00
inline int getPlotHeight ( ) const {
2019-01-10 04:23:24 +08:00
return this - > plotHeight ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc doDrawing */
2019-01-26 20:00:40 +08:00
inline void setPlotUpdateEnabled ( bool __value )
2019-01-10 04:23:24 +08:00
{
this - > doDrawing = __value ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc doDrawing */
2019-01-26 20:00:40 +08:00
inline bool isPlotUpdateEnabled ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > doDrawing ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderLeft */
2019-01-26 20:00:40 +08:00
inline int getInternalPlotBorderLeft ( ) const {
2019-01-10 04:23:24 +08:00
return this - > internalPlotBorderLeft ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderBottom */
2019-01-26 20:00:40 +08:00
inline int getInternalPlotBorderBottom ( ) const {
2019-01-10 04:23:24 +08:00
return this - > internalPlotBorderBottom ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderRight */
2019-01-26 20:00:40 +08:00
inline int getInternalPlotBorderRight ( ) const {
2019-01-10 04:23:24 +08:00
return this - > internalPlotBorderRight ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderTop */
2019-01-26 20:00:40 +08:00
inline int getInternalPlotBorderTop ( ) const {
2019-01-10 04:23:24 +08:00
return this - > internalPlotBorderTop ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xMin */
2019-01-26 20:00:40 +08:00
inline double getXMin ( ) const {
2019-01-10 04:23:24 +08:00
return this - > xMin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xMax */
2019-01-26 20:00:40 +08:00
inline double getXMax ( ) const {
2019-01-10 04:23:24 +08:00
return this - > xMax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yMin */
2019-01-26 20:00:40 +08:00
inline double getYMin ( ) const {
2019-01-10 04:23:24 +08:00
return this - > yMin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yMax */
2019-01-26 20:00:40 +08:00
inline double getYMax ( ) const {
2019-01-10 04:23:24 +08:00
return this - > yMax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xAxisLog */
2019-01-26 03:16:04 +08:00
inline bool getXAxisLog ( ) const {
2019-01-10 04:23:24 +08:00
return this - > xAxisLog ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yAxisLog */
2019-01-26 03:16:04 +08:00
inline bool getYAxisLog ( ) const {
2019-01-10 04:23:24 +08:00
return this - > yAxisLog ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc backgroundColor */
2019-01-26 20:00:40 +08:00
inline void setBackgroundColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > backgroundColor ! = __value ) {
this - > backgroundColor = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc backgroundColor */
2019-01-26 20:00:40 +08:00
inline QColor getBackgroundColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > backgroundColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBackgroundColor */
2019-01-26 20:00:40 +08:00
inline void setPlotBackgroundColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > plotBackgroundColor ! = __value ) {
this - > plotBackgroundColor = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc plotBackgroundColor */
2019-01-26 20:00:40 +08:00
inline QColor getPlotBackgroundColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > plotBackgroundColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawGrid */
2019-01-26 20:00:40 +08:00
inline void setDrawGrid ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > drawGrid ! = __value ) {
this - > drawGrid = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawGrid */
2019-01-26 20:00:40 +08:00
inline bool getDrawGrid ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > drawGrid ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc gridColor */
2019-01-26 20:00:40 +08:00
inline void setGridColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > gridColor ! = __value ) {
this - > gridColor = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc gridColor */
2019-01-26 20:00:40 +08:00
inline QColor getGridColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > gridColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc gridStyle */
2019-05-06 01:31:20 +08:00
inline void setGridStyle ( Qt : : PenStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > gridStyle ! = __value ) {
this - > gridStyle = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc gridStyle */
2019-01-26 20:00:40 +08:00
inline Qt : : PenStyle getGridStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > gridStyle ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc gridWidth */
2019-01-26 20:00:40 +08:00
inline void setGridWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > gridWidth ! = __value ) {
this - > gridWidth = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc gridWidth */
2019-01-26 20:00:40 +08:00
inline double getGridWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > gridWidth ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc labelFontSize */
2019-01-26 20:00:40 +08:00
inline void setLabelFontSize ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > labelFontSize ! = __value ) {
this - > labelFontSize = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc labelFontSize */
2019-01-26 20:00:40 +08:00
inline double getLabelFontSize ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > labelFontSize ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc labelFontName */
2019-01-26 20:00:40 +08:00
inline void setLabelFontName ( const QString & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > labelFontName ! = __value ) {
this - > labelFontName = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc labelFontName */
2019-01-26 20:00:40 +08:00
inline QString getLabelFontName ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > labelFontName ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc tickFontSize */
2019-01-26 20:00:40 +08:00
inline void setTickFontSize ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > tickFontSize ! = __value ) {
this - > tickFontSize = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc tickFontSize */
2019-01-26 20:00:40 +08:00
inline double getTickFontSize ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > tickFontSize ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc tickFontName */
2019-01-26 20:00:40 +08:00
inline void setTickFontName ( const QString & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > tickFontName ! = __value ) {
this - > tickFontName = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc tickFontName */
2019-01-26 20:00:40 +08:00
inline QString getTickFontName ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > tickFontName ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc tickLength */
2019-01-26 20:00:40 +08:00
inline void setTickLength ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > tickLength ! = __value ) {
this - > tickLength = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc tickLength */
2019-01-26 20:00:40 +08:00
inline double getTickLength ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > tickLength ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawSystemBox */
2019-01-26 20:00:40 +08:00
inline void setDrawSystemBox ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > drawSystemBox ! = __value ) {
this - > drawSystemBox = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawSystemBox */
2019-01-26 20:00:40 +08:00
inline bool getDrawSystemBox ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > drawSystemBox ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawZeroAxes */
2019-01-26 20:00:40 +08:00
inline void setDrawZeroAxes ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > drawZeroAxes ! = __value ) {
this - > drawZeroAxes = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawZeroAxes */
2019-01-26 20:00:40 +08:00
inline bool getDrawZeroAxes ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > drawZeroAxes ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc systemColor */
2019-01-26 20:00:40 +08:00
inline void setSystemColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > systemColor ! = __value ) {
this - > systemColor = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc systemColor */
2019-01-26 20:00:40 +08:00
inline QColor getSystemColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > systemColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc systemWidth */
2019-01-26 20:00:40 +08:00
inline void setSystemWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > systemWidth ! = __value ) {
this - > systemWidth = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc systemWidth */
2019-01-26 20:00:40 +08:00
inline double getSystemWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > systemWidth ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xZeroTick */
2019-01-26 20:00:40 +08:00
inline void setXZeroTick ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xZeroTick ! = __value ) {
this - > xZeroTick = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xZeroTick */
2019-01-26 20:00:40 +08:00
inline double getXZeroTick ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xZeroTick ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yZeroTick */
2019-01-26 20:00:40 +08:00
inline void setYZeroTick ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > yZeroTick ! = __value ) {
this - > yZeroTick = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc yZeroTick */
2019-01-26 20:00:40 +08:00
inline double getYZeroTick ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yZeroTick ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xTickDistance */
2019-01-26 20:00:40 +08:00
inline void setXTickDistance ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xTickDistance ! = __value ) {
this - > xTickDistance = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xTickDistance */
2019-01-26 20:00:40 +08:00
inline double getXTickDistance ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xTickDistance ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yTickDistance */
2019-01-26 20:00:40 +08:00
inline void setYTickDistance ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > yTickDistance ! = __value ) {
this - > yTickDistance = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc yTickDistance */
2019-01-26 20:00:40 +08:00
inline double getYTickDistance ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yTickDistance ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xAxisLabel */
2019-01-26 20:00:40 +08:00
inline void setXAxisLabel ( const QString & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xAxisLabel ! = __value ) {
this - > xAxisLabel = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xAxisLabel */
2019-01-26 20:00:40 +08:00
inline QString getXAxisLabel ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xAxisLabel ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yAxisLabel */
2019-01-26 20:00:40 +08:00
inline void setYAxisLabel ( const QString & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > yAxisLabel ! = __value ) {
this - > yAxisLabel = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc yAxisLabel */
2019-01-26 20:00:40 +08:00
inline QString getYAxisLabel ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yAxisLabel ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc aspectRatio */
2019-01-26 20:00:40 +08:00
inline void setAspectRatio ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > aspectRatio ! = __value ) {
this - > aspectRatio = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc aspectRatio */
2019-01-26 20:00:40 +08:00
inline double getAspectRatio ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > aspectRatio ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc maintainAspectRatio */
2019-01-26 20:00:40 +08:00
inline void setMaintainAspectRatio ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > maintainAspectRatio ! = __value ) {
this - > maintainAspectRatio = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc maintainAspectRatio */
2019-01-26 20:00:40 +08:00
inline bool doesMaintainAspectRatio ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > maintainAspectRatio ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xAxisLabelVisible */
2019-01-26 20:00:40 +08:00
inline void setXAxisLabelVisible ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xAxisLabelVisible ! = __value ) {
this - > xAxisLabelVisible = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xAxisLabelVisible */
2019-01-26 20:00:40 +08:00
inline bool getXAxisLabelVisible ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xAxisLabelVisible ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yAxisLabelVisible */
2019-01-26 20:00:40 +08:00
inline void setYAxisLabelVisible ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > yAxisLabelVisible ! = __value ) {
this - > yAxisLabelVisible = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc yAxisLabelVisible */
2019-01-26 20:00:40 +08:00
inline bool getYAxisLabelVisible ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yAxisLabelVisible ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc synchronizeX */
2020-08-26 18:58:23 +08:00
inline void setSynchronizeX ( JKQTFastPlotter * __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > synchronizeX ! = __value ) {
this - > synchronizeX = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc synchronizeX */
2019-01-26 20:00:40 +08:00
inline JKQTFastPlotter * getSynchronizeX ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > synchronizeX ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc synchronizeY */
2020-08-26 18:58:23 +08:00
inline void setSynchronizeY ( JKQTFastPlotter * __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > synchronizeY ! = __value ) {
this - > synchronizeY = __value ;
2019-01-26 19:28:44 +08:00
redrawPlot ( ) ;
2019-01-10 04:23:24 +08:00
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc synchronizeY */
2019-01-26 20:00:40 +08:00
inline JKQTFastPlotter * getSynchronizeY ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > synchronizeY ;
}
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
/** \brief draw the contents onto any <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a>, starting at (0,0), returns the size of the whole plot in \a size, if supplied with the default background color */
2019-01-10 04:23:24 +08:00
void draw ( QPainter * painter , QSize * size = nullptr ) ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
/** \brief draw the contents onto any <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a>, starting at (0,0), returns the size of the whole plot in \a size, if supplied with the supplied\a background color */
2015-07-11 18:56:02 +08:00
void draw ( QPainter * painter , QColor background , QSize * size ) ;
signals :
/** \brief emitted whenever the graph sizes (borders, plotWidth, plotHeight) change*/
void plotterSizesChanged ( ) ;
/** \brief emitted whenever the graph is replotted */
void replotting ( ) ;
/** \brief emitted whenever the mouse is clicked inside the plot */
void clicked ( double x , double y ) ;
/** \brief emitted whenever the mouse is clicked inside the plot */
void clicked ( double x , double y , Qt : : KeyboardModifiers modifiers ) ;
/** \brief emitted whenever the mouse is double-clicked inside the plot */
void doubleClicked ( double x , double y ) ;
/** \brief emitted whenever the mouse is double-clicked inside the plot */
void doubleClicked ( double x , double y , Qt : : KeyboardModifiers modifiers ) ;
/** \brief emitted whenever the mouse is clicked inside the plot */
void mouseMoved ( double x , double y ) ;
/** \brief emitted when the mouse has been dragged with the left button clicked */
void mouseDragged ( double x_start , double y_start , double x_end , double y_end , Qt : : KeyboardModifiers modifiers ) ;
/** \brief emitted after the mouse has been dragged with the left button clicked */
void mouseDragFinished ( double x_start , double y_start , double x_end , double y_end , Qt : : KeyboardModifiers modifiers ) ;
public slots :
/** \brief copy the current plot image to the clipboard */
void copyImage ( ) ;
/** \brief replot everything (slowest possible plotting) */
2019-01-26 19:28:44 +08:00
void redrawPlot ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief replot everything (slowest possible plotting) and forces a repaint calling QWidget::repaint() */
2019-01-26 20:00:40 +08:00
void redrawPlotImmediate ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief replot only the data
*
* This internally calls QWidget : : update ( ) , so no immediate repaint ( ) is forced ! If you want an immediate update ,
2019-01-26 20:00:40 +08:00
* call updateDataImmediate ( ) instead !
2015-07-11 18:56:02 +08:00
*/
2019-01-26 20:00:40 +08:00
void updateData ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief replot only the data, forces a redraw by calling QWidget::repaint() */
2019-01-26 20:00:40 +08:00
void updateDataImmediate ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief set xMin*/
2019-01-26 20:00:40 +08:00
void setXMin ( double value ) {
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( false ) ;
2015-07-11 18:56:02 +08:00
setXRange ( value , xMax , xAxisLog ) ;
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( true ) ;
2015-07-11 18:56:02 +08:00
}
/** \brief set xMax*/
2019-01-26 20:00:40 +08:00
void setXMax ( double value ) {
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( false ) ;
2015-07-11 18:56:02 +08:00
setXRange ( xMin , value , xAxisLog ) ;
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( true ) ;
2015-07-11 18:56:02 +08:00
}
/** \brief set yMin*/
2019-01-26 20:00:40 +08:00
void setYMin ( double value ) {
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( false ) ;
2015-07-11 18:56:02 +08:00
setYRange ( value , yMax , yAxisLog ) ;
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( true ) ;
2015-07-11 18:56:02 +08:00
}
/** \brief set yMax*/
2019-01-26 20:00:40 +08:00
void setYMax ( double value ) {
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( false ) ;
2015-07-11 18:56:02 +08:00
setYRange ( yMin , value , yAxisLog ) ;
2019-01-26 03:16:04 +08:00
setPlotUpdateEnabled ( true ) ;
2015-07-11 18:56:02 +08:00
}
} ;
/*! \brief base class for all plots that may be plotted by JKQTFastPlotter
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPPlot : public QObject {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief parent class, i.e. the plotter to plot on */
JKQTFastPlotter * parent ;
/** \brief indicates whether the plot is visible or not */
bool visible ;
public :
/** \brief class constructor */
JKQTFPPlot ( JKQTFastPlotter * parent ) ;
/** \brief virtual class destructor */
2019-01-10 04:23:24 +08:00
virtual ~ JKQTFPPlot ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief set the parent of the plot */
2019-01-10 04:23:24 +08:00
void setParent ( JKQTFastPlotter * parent ) { this - > parent = parent ; QObject : : setParent ( parent ) ; }
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
/** \brief returns whether this graph is visible inside the plot */
2015-07-11 18:56:02 +08:00
bool isVisible ( ) const { return this - > visible ; }
/** \brief draw the graph */
virtual void drawGraph ( QPainter & painter ) = 0 ;
/** \brief draw the graph */
void paint ( QPainter & painter ) ;
/** \brief start a replot of the parent widget */
void replot ( ) ;
public slots :
void setVisible ( bool visible ) { this - > visible = visible ; replot ( ) ; }
} ;
/*! \brief a simple line plot for JKQTFastPlotter
\ ingroup jkqtfastplotter
This class plots data as ( x , y ) points connected by straight lines . If errors for the y values are
provided , also y + / - yerr errorlines are drawn .
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPLinePlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
public :
/** \brief used to store which datatype is used for the plot data */
enum DataType {
JKQTFPLPPointer ,
JKQTFPLPVector
} ;
protected :
/** \brief number of datapoints in the plot */
2019-01-26 19:28:44 +08:00
int N ;
2015-07-11 18:56:02 +08:00
/** \brief pointer to x-coordinate data to display */
double * x ;
/** \brief pointer to y-coordinate data to display */
double * y ;
/** \brief pointer to yerr-coordinate data to display */
double * yerr ;
/** \brief pointer to x-coordinate data to display */
QVector < double > * xv ;
/** \brief pointer to y-coordinate data to display */
QVector < double > * yv ;
/** \brief pointer to yerr-coordinate data to display */
QVector < double > * yerrv ;
/** \brief which type of data is used for plotting ? */
DataType datatype ;
/** \brief color of the graph */
QColor color ;
/** \brief style of the graph */
Qt : : PenStyle style ;
2019-01-20 23:15:10 +08:00
/** \brief width of the graph (in pt) */
2015-07-11 18:56:02 +08:00
double width ;
/** \brief color of the graph */
QColor errorColor ;
/** \brief style of the graph */
Qt : : PenStyle errorStyle ;
2019-01-20 23:15:10 +08:00
/** \brief width of the graph (in pt) */
2015-07-11 18:56:02 +08:00
double errorWidth ;
public :
/*! \brief class constructor
\ param parent parent widget
\ param N number of datapoints in the plot
\ param x points to the x values in the plot
\ param y points to the y values in the plot
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2015-07-11 18:56:02 +08:00
*/
2019-01-26 19:28:44 +08:00
JKQTFPLinePlot ( JKQTFastPlotter * parent , int N , double * x , double * y , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 ) ;
2015-07-11 18:56:02 +08:00
/*! \brief class constructor
\ param parent parent widget
\ param x points to the x values in the plot
\ param y points to the y values in the plot
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2015-07-11 18:56:02 +08:00
*/
JKQTFPLinePlot ( JKQTFastPlotter * parent , QVector < double > * x , QVector < double > * y , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
inline void setData ( double * x , double * y , int N ) {
2015-07-11 18:56:02 +08:00
this - > x = x ;
this - > y = y ;
2019-01-10 04:23:24 +08:00
this - > yerr = nullptr ;
2015-07-11 18:56:02 +08:00
this - > N = N ;
datatype = JKQTFPLPPointer ;
replot ( ) ;
2019-01-26 20:00:40 +08:00
}
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
inline void setData ( double * x , double * y , double * yerr , int N ) {
2015-07-11 18:56:02 +08:00
this - > x = x ;
this - > y = y ;
this - > yerr = yerr ;
this - > N = N ;
datatype = JKQTFPLPPointer ;
replot ( ) ;
2019-01-26 20:00:40 +08:00
}
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
inline void setData ( QVector < double > * x , QVector < double > * y ) {
2019-01-10 04:23:24 +08:00
this - > x = nullptr ;
this - > y = nullptr ;
this - > yerr = nullptr ;
2015-07-11 18:56:02 +08:00
this - > xv = x ;
this - > yv = y ;
2019-01-10 04:23:24 +08:00
this - > yerrv = nullptr ;
2015-07-11 18:56:02 +08:00
this - > N = x - > size ( ) ;
datatype = JKQTFPLPVector ;
replot ( ) ;
2019-01-26 20:00:40 +08:00
}
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
inline void setData ( QVector < double > * x , QVector < double > * y , QVector < double > * yerr ) {
2019-01-10 04:23:24 +08:00
this - > x = nullptr ;
this - > y = nullptr ;
this - > yerr = nullptr ;
2015-07-11 18:56:02 +08:00
this - > xv = x ;
this - > yv = y ;
this - > yerrv = yerr ;
this - > N = x - > size ( ) ;
datatype = JKQTFPLPVector ;
replot ( ) ;
2019-01-26 20:00:40 +08:00
}
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
inline int getN ( ) {
2015-07-11 18:56:02 +08:00
if ( datatype = = JKQTFPLPPointer )
return N ;
if ( datatype = = JKQTFPLPVector )
return xv - > size ( ) ;
return N ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc x */
2019-01-26 20:00:40 +08:00
inline double * getX ( ) const {
2019-01-10 04:23:24 +08:00
return this - > x ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc y */
2019-01-26 20:00:40 +08:00
inline double * getY ( ) const {
2019-01-10 04:23:24 +08:00
return this - > y ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yerr */
2019-01-26 20:00:40 +08:00
inline double * getYerr ( ) const {
2019-01-10 04:23:24 +08:00
return this - > yerr ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xv */
2019-01-26 20:00:40 +08:00
inline QVector < double > * getXv ( ) const {
2019-01-10 04:23:24 +08:00
return this - > xv ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yv */
2019-01-26 20:00:40 +08:00
inline QVector < double > * getYv ( ) const {
2019-01-10 04:23:24 +08:00
return this - > yv ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc yerrv */
2019-01-26 20:00:40 +08:00
inline QVector < double > * getYerrv ( ) const {
2019-01-10 04:23:24 +08:00
return this - > yerrv ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc datatype */
2019-01-26 20:00:40 +08:00
inline DataType getDatatype ( ) const {
2019-01-10 04:23:24 +08:00
return this - > datatype ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline void setColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > color ! = __value ) {
this - > color = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline QColor getColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > color ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-05-06 01:31:20 +08:00
inline void setStyle ( Qt : : PenStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > style ! = __value ) {
this - > style = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-01-26 20:00:40 +08:00
inline Qt : : PenStyle getStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > style ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline double getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc errorColor */
2019-05-06 01:31:20 +08:00
inline void setErrorLineColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > errorColor ! = __value ) {
this - > errorColor = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc errorColor */
2019-05-06 01:31:20 +08:00
inline QColor getErrorLineColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc errorStyle */
2019-05-06 01:31:20 +08:00
inline void setErrorLineStyle ( Qt : : PenStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > errorStyle ! = __value ) {
this - > errorStyle = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc errorStyle */
2019-05-06 01:31:20 +08:00
inline Qt : : PenStyle getErrorLineStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorStyle ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc errorWidth */
2019-05-06 01:31:20 +08:00
inline void setErrorLineWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > errorWidth ! = __value ) {
this - > errorWidth = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc errorWidth */
2019-05-06 01:31:20 +08:00
inline double getErrorLineWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorWidth ;
}
2015-07-11 18:56:02 +08:00
} ;
/*! \brief a simple plot that draws a cross for every datapoint
\ ingroup jkqtfastplotter
This class does not support y errors !
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPVCrossPlot : public JKQTFPLinePlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/*! \brief class constructor
\ param parent parent widget
\ param N number of datapoints in the plot
\ param x points to the x values in the plot
\ param y points to the y values in the plot
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2015-07-11 18:56:02 +08:00
*/
2019-01-26 19:28:44 +08:00
JKQTFPVCrossPlot ( JKQTFastPlotter * parent , int N , double * x , double * y , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 ) ;
2015-07-11 18:56:02 +08:00
/*! \brief class constructor
\ param parent parent widget
\ param x points to the x values in the plot
\ param y points to the y values in the plot
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2015-07-11 18:56:02 +08:00
*/
JKQTFPVCrossPlot ( JKQTFastPlotter * parent , QVector < double > * x , QVector < double > * y , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc crossWidth */
2019-01-26 20:00:40 +08:00
inline void setCrossWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > crossWidth ! = __value ) {
this - > crossWidth = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc crossWidth */
2019-01-26 20:00:40 +08:00
inline double getCrossWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > crossWidth ;
}
2015-07-11 18:56:02 +08:00
protected :
/** \brief width of the crosses */
double crossWidth ;
} ;
/*! \brief a simple vertical bar plot for JKQTFastPlotter
\ ingroup jkqtfastplotter
This class does not support y errors !
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPVBarPlot : public JKQTFPLinePlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/*! \brief class constructor
\ param parent parent widget
\ param N number of datapoints in the plot
\ param x points to the x values in the plot
\ param y points to the y values in the plot
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2015-07-11 18:56:02 +08:00
*/
2019-01-26 19:28:44 +08:00
JKQTFPVBarPlot ( JKQTFastPlotter * parent , int N , double * x , double * y , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 ) ;
2015-07-11 18:56:02 +08:00
/*! \brief class constructor
\ param parent parent widget
\ param x points to the x values in the plot
\ param y points to the y values in the plot
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2015-07-11 18:56:02 +08:00
*/
JKQTFPVBarPlot ( JKQTFastPlotter * parent , QVector < double > * x , QVector < double > * y , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
} ;
/*! \brief plot a range of x values
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPXRangePlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief start of x range */
double xmin ;
/** \brief end of x range */
double xmax ;
double centerline ;
bool showCenterline ;
/** \brief color of the graph */
QColor color ;
/** \brief style of the graph */
Qt : : PenStyle style ;
2019-01-20 23:15:10 +08:00
/** \brief width of the graph (in pt) */
2015-07-11 18:56:02 +08:00
double width ;
/** \brief fill color of the graph */
QColor fillColor ;
/** \brief fill style of the graph */
Qt : : BrushStyle fillStyle ;
public :
/*! \brief class constructor
\ param parent parent widget
2019-05-30 17:19:56 +08:00
\ param xmin range start
\ param xmax range end
2015-07-11 18:56:02 +08:00
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2019-05-30 17:19:56 +08:00
\ param fillStyle fill style of the range
2015-07-11 18:56:02 +08:00
*/
JKQTFPXRangePlot ( JKQTFastPlotter * parent , double xmin , double xmax , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 , Qt : : BrushStyle fillStyle = Qt : : NoBrush ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline void setColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > color ! = __value ) {
this - > color = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline QColor getColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > color ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillColor */
2019-01-26 20:00:40 +08:00
inline void setFillColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > fillColor ! = __value ) {
this - > fillColor = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillColor */
2019-01-26 20:00:40 +08:00
inline QColor getFillColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > fillColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillStyle */
2019-05-06 01:31:20 +08:00
inline void setFillStyle ( Qt : : BrushStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > fillStyle ! = __value ) {
this - > fillStyle = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillStyle */
2019-01-26 20:00:40 +08:00
inline Qt : : BrushStyle getFillStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > fillStyle ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-05-06 01:31:20 +08:00
inline void setStyle ( Qt : : PenStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > style ! = __value ) {
this - > style = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-01-26 20:00:40 +08:00
inline Qt : : PenStyle getStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > style ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline double getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline double getXmin ( ) const {
2019-01-10 04:23:24 +08:00
return this - > xmin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline double getXmax ( ) const {
2019-01-10 04:23:24 +08:00
return this - > xmax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc centerline */
2019-01-26 20:00:40 +08:00
inline double getCenterline ( ) const {
2019-01-10 04:23:24 +08:00
return this - > centerline ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc showCenterline */
2019-01-26 20:00:40 +08:00
inline void setShowCenterline ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > showCenterline ! = __value ) {
this - > showCenterline = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc showCenterline */
2019-01-26 20:00:40 +08:00
inline bool getShowCenterline ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > showCenterline ;
}
2015-07-11 18:56:02 +08:00
public slots :
2019-01-26 20:00:40 +08:00
void setCenterline ( int centerline ) {
2015-07-11 18:56:02 +08:00
if ( this - > centerline ! = centerline ) {
this - > centerline = centerline ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setXmin ( double xmin ) {
2015-07-11 18:56:02 +08:00
if ( this - > xmin ! = xmin ) {
this - > xmin = xmin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setXmax ( double xmax ) {
2015-07-11 18:56:02 +08:00
if ( this - > xmax ! = xmax ) {
this - > xmax = xmax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setXmin ( int xmin ) {
2015-07-11 18:56:02 +08:00
if ( this - > xmin ! = xmin ) {
this - > xmin = xmin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setXmax ( int xmax ) {
2015-07-11 18:56:02 +08:00
if ( this - > xmax ! = xmax ) {
this - > xmax = xmax ;
replot ( ) ;
}
}
} ;
/*! \brief plot a range of x values
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPYRangePlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief start of x range */
double ymin ;
/** \brief end of x range */
double ymax ;
double centerline ;
bool showCenterline ;
/** \brief color of the graph */
QColor color ;
/** \brief style of the graph */
Qt : : PenStyle style ;
2019-01-20 23:15:10 +08:00
/** \brief width of the graph (in pt) */
2015-07-11 18:56:02 +08:00
double width ;
/** \brief fill color of the graph */
QColor fillColor ;
/** \brief fill style of the graph */
Qt : : BrushStyle fillStyle ;
public :
/*! \brief class constructor
\ param parent parent widget
2019-05-30 17:19:56 +08:00
\ param ymin range start
\ param ymax range end
2015-07-11 18:56:02 +08:00
\ param color color of the plot
\ param style style of the graph
2019-01-20 23:15:10 +08:00
\ param width width of the plot ( in pt )
2019-05-30 17:19:56 +08:00
\ param fillStyle fill style of the range
2015-07-11 18:56:02 +08:00
*/
JKQTFPYRangePlot ( JKQTFastPlotter * parent , double ymin , double ymax , QColor color = QColor ( " red " ) , Qt : : PenStyle style = Qt : : SolidLine , double width = 1 , Qt : : BrushStyle fillStyle = Qt : : NoBrush ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline void setColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > color ! = __value ) {
this - > color = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline QColor getColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > color ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillColor */
2019-01-26 20:00:40 +08:00
inline void setFillColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > fillColor ! = __value ) {
this - > fillColor = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillColor */
2019-01-26 20:00:40 +08:00
inline QColor getFillColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > fillColor ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillStyle */
2019-05-06 01:31:20 +08:00
inline void setFillStyle ( Qt : : BrushStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > fillStyle ! = __value ) {
this - > fillStyle = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc fillStyle */
2019-01-26 20:00:40 +08:00
inline Qt : : BrushStyle getFillStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > fillStyle ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-05-06 01:31:20 +08:00
inline void setStyle ( Qt : : PenStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > style ! = __value ) {
this - > style = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-01-26 20:00:40 +08:00
inline Qt : : PenStyle getStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > style ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline double getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline double getYmin ( ) const {
2019-01-10 04:23:24 +08:00
return this - > ymin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline double getYmax ( ) const {
2019-01-10 04:23:24 +08:00
return this - > ymax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc centerline */
2019-01-26 20:00:40 +08:00
inline double getCenterline ( ) const {
2019-01-10 04:23:24 +08:00
return this - > centerline ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc showCenterline */
2019-01-26 20:00:40 +08:00
inline void setShowCenterline ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > showCenterline ! = __value ) {
this - > showCenterline = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc showCenterline */
2019-01-26 20:00:40 +08:00
inline bool getShowCenterline ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > showCenterline ;
}
2015-07-11 18:56:02 +08:00
public slots :
2019-01-26 20:00:40 +08:00
void setCenterline ( int centerline ) {
2015-07-11 18:56:02 +08:00
if ( this - > centerline ! = centerline ) {
this - > centerline = centerline ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setYmin ( double xmin ) {
2015-07-11 18:56:02 +08:00
if ( this - > ymin ! = xmin ) {
this - > ymin = xmin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setYmax ( double xmax ) {
2015-07-11 18:56:02 +08:00
if ( this - > ymax ! = xmax ) {
this - > ymax = xmax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setYmin ( int xmin ) {
2015-07-11 18:56:02 +08:00
if ( this - > ymin ! = xmin ) {
this - > ymin = xmin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setYmax ( int xmax ) {
2015-07-11 18:56:02 +08:00
if ( this - > ymax ! = xmax ) {
this - > ymax = xmax ;
replot ( ) ;
}
}
} ;
/*! \brief a plot of a QImage
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPQImagePlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief image to plot */
QImage * image ;
/** \brief minimum x value of the image */
double xmin ;
/** \brief maximum x value of the image */
double xmax ;
/** \brief minimum x value of the image */
double ymin ;
/** \brief maximum x value of the image */
double ymax ;
public :
/*! \brief class constructor
*/
JKQTFPQImagePlot ( JKQTFastPlotter * parent , QImage * image , double xmin , double xmax , double ymin , double ymax ) ;
JKQTFPQImagePlot ( JKQTFastPlotter * parent , QImage * image ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc image */
2019-01-26 20:00:40 +08:00
inline void setImage ( QImage * __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > image ! = __value ) {
this - > image = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc image */
2019-01-26 20:00:40 +08:00
inline QImage * getImage ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > image ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline void setXmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmin ! = __value ) {
this - > xmin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline double getXmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline void setXmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmax ! = __value ) {
this - > xmax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline double getXmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline void setYmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymin ! = __value ) {
this - > ymin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline double getYmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline void setYmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymax ! = __value ) {
this - > ymax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline double getYmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymax ;
}
2015-07-11 18:56:02 +08:00
} ;
/*!
\ brief An enum for selecting the palette for coloring
\ ingroup jkqtfastplotter
2019-05-30 17:19:56 +08:00
Here , the color palettes are illustrated ( left is the color for the minimum and right for the maximum ) .
2015-07-11 18:56:02 +08:00
*/
enum JKQTFPColorPalette {
2019-01-12 23:01:55 +08:00
JKQTFP_RED = 0 , /*!< \image html palettes/palette_red.png */
JKQTFP_INVERTEDRED = 1 , /*!< \image html palettes/palette_invred.png */
JKQTFP_GREEN = 2 , /*!< \image html palettes/palette_green.png */
JKQTFP_INVERTEDGREEN = 3 , /*!< \image html palettes/palette_invgreen.png */
JKQTFP_BLUE = 4 , /*!< \image html palettes/palette_blue.png */
JKQTFP_INVERTEDBLUE = 5 , /*!< \image html palettes/palette_invblue.png */
JKQTFP_GRAY = 6 , /*!< \image html palettes/palette_gray.png */
JKQTFP_INVERTEDGRAY = 7 , /*!< \image html palettes/palette_invgray.png */
JKQTFP_MATLAB = 8 , /*!< \image html palettes/palette_Matlab.png */
JKQTFP_RYGB = 9 , /*!< \image html palettes/palette_RYGB.png */
JKQTFP_HSV = 10 , /*!< \image html palettes/palette_HSV.png */
JKQTFP_INVERTED_HSV = 11 , /*!< \image html palettes/palette_invHSV.png */
JKQTFP_RAINBOW = 12 , /*!< \image html palettes/palette_rainbow.png */
JKQTFP_HOT = 13 , /*!< \image html palettes/palette_AFMhot.png */
JKQTFP_OCEAN = 14 , /*!< \image html palettes/palette_ocean.png */
JKQTFP_TRAFFICLIGHT = 15 , /*!< \image html palettes/palette_trafficlight.png */
JKQTFP_BLUEMAGENTAYELLOW = 16 , /*!< \image html palettes/palette_BlMaYe.png */
JKQTFP_BLUEYELLOW = 17 , /*!< \image html palettes/palette_BlYe.png */
JKQTFP_CYAN = 18 /*!< \image html palettes/palette_cyan.png */
2015-07-11 18:56:02 +08:00
} ;
2019-05-30 17:19:56 +08:00
/*! \brief datatype for an image plotpalette for coloring
2015-07-11 18:56:02 +08:00
\ ingroup jkqtfastplotter
2019-05-30 17:19:56 +08:00
Here , the color palettes are illustrated ( left is the color for the minimum and right for the maximum ) .
2015-07-11 18:56:02 +08:00
*/
enum JKQTFPImageFormat {
2019-05-30 17:19:56 +08:00
JKQTFP_uint8 = 0 , /*!< \brief 8 bit int */
JKQTFP_uint16 = 1 , /*!< \brief 16 bit int */
JKQTFP_uint32 = 2 , /*!< \brief 32 bit int */
JKQTFP_float = 3 , /*!< \brief float */
JKQTFP_double = 4 , /*!< \brief double */
JKQTFP_int64 = 5 /*!< \brief 64 bit signed int */
2015-07-11 18:56:02 +08:00
} ;
/*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
\ ingroup jkqtfastplotter
This method uses lookup tables which are saved as static variables to convert the 2 D array into
an image . The luts are only created once , and stored then , so mor CPU time is saved . The precompiler define
2019-02-08 00:24:46 +08:00
JKQTFastPlotter : : LUTSIZE sets the size of the LUTs . Note that if you don ' t use a specific color palette ,
2015-07-11 18:56:02 +08:00
the according LUT won ' t be calculated and stored !
*/
template < class T >
2019-01-26 19:28:44 +08:00
inline void JKQTFPimagePlot_array2image ( T * dbl , int width , int height , QImage & img , JKQTFPColorPalette palette , double minColor , double maxColor )
2015-07-11 18:56:02 +08:00
{
2019-02-08 00:24:46 +08:00
if ( ! dbl )
return ;
2015-07-11 18:56:02 +08:00
# ifdef DEBUG_TIMING
JKQTPHighResTimer timer ;
double time_sum = 0 ;
double time_gt = 0 ;
std : : cout < < " timing JKQTFPimagePlot_array2image: \n " ;
timer . start ( ) ;
# endif
//std::cout<<"color range: "<<minColor<<"..."<<maxColor<<std::endl;
2019-02-08 00:24:46 +08:00
double min = * dbl ;
double max = * dbl ;
2015-07-11 18:56:02 +08:00
if ( minColor = = maxColor ) {
2019-02-08 00:24:46 +08:00
for ( int i = 1 ; i < width * height ; + + i )
{
2019-01-26 19:28:44 +08:00
T v = dbl [ i ] ;
2019-02-08 00:24:46 +08:00
if ( v < min )
min = v ;
else if ( v > max )
max = v ;
}
} else {
min = minColor ;
max = maxColor ;
}
2015-07-11 18:56:02 +08:00
# ifdef DEBUG_TIMING
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " finding min&max: " < < time_gt / 1000.0 < < " ms \n " ;
timer . start ( ) ;
# endif
//std::cout<<"minColor="<<minColor<<" maxColor="<<maxColor<<" min="<<min<<" max="<<max<<"\n";
2019-02-08 00:24:46 +08:00
double delta = max - min ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
QRgb * lut_used = nullptr ;
static QRgb * lut_red = nullptr ;
static QRgb * lut_green = nullptr ;
static QRgb * lut_blue = nullptr ;
static QRgb * lut_gray = nullptr ;
static QRgb * lut_invred = nullptr ;
static QRgb * lut_invgreen = nullptr ;
static QRgb * lut_invblue = nullptr ;
static QRgb * lut_invgray = nullptr ;
static QRgb * lut_matlab = nullptr ;
static QRgb * lut_rygb = nullptr ;
static QRgb * lut_hsv = nullptr ;
static QRgb * lut_invhsv = nullptr ;
static QRgb * lut_rainbow = nullptr ;
static QRgb * lut_hot = nullptr ;
static QRgb * lut_ocean = nullptr ;
static QRgb * lut_trafficlight = nullptr ;
static QRgb * lut_bluemagentayellow = nullptr ;
static QRgb * lut_blueyellow = nullptr ;
static QRgb * lut_cyan = nullptr ;
2015-07-11 18:56:02 +08:00
img = QImage ( width , height , QImage : : Format_ARGB32_Premultiplied ) ;
2019-02-08 00:24:46 +08:00
if ( min = = max )
img . fill ( 0 ) ;
else
{
2015-07-11 18:56:02 +08:00
if ( palette = = JKQTFP_RED )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_red ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * v ) , 0 , 0 ) ;
}
}
}
lut_used = ( * plut ) ;
}
else if ( palette = = JKQTFP_GREEN )
2019-02-08 00:24:46 +08:00
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_green ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( 0 , static_cast < int > ( 255.0 * v ) , 0 ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_BLUE )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_blue ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( 0 , 0 , static_cast < int > ( 255.0 * v ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
2015-07-11 18:56:02 +08:00
else if ( palette = = JKQTFP_GRAY )
2019-02-08 00:24:46 +08:00
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_gray ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * v ) ,
2019-02-08 00:24:46 +08:00
static_cast < int > ( 255.0 * v ) ,
static_cast < int > ( 255.0 * v ) ) ;
2015-07-11 18:56:02 +08:00
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
else if ( palette = = JKQTFP_INVERTEDRED )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_invred ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * ( 1.0 - v ) ) , 0 , 0 ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_INVERTEDGREEN )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_invgreen ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( 0 , static_cast < int > ( 255.0 * ( 1.0 - v ) ) , 0 ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_INVERTEDBLUE )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_invblue ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( 0 , 0 , static_cast < int > ( 255.0 * ( 1.0 - v ) ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_INVERTEDGRAY )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_invgray ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = 1.0 - ( l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ) ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * v ) ,
2019-02-08 00:24:46 +08:00
static_cast < int > ( 255.0 * v ) ,
static_cast < int > ( 255.0 * v ) ) ;
2015-07-11 18:56:02 +08:00
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
else if ( palette = = JKQTFP_MATLAB )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_matlab ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = 382.5 - 1020.0 * std : : abs ( v - 0.75 ) ;
if ( r > 255.0 )
r = 255.0 ;
else if ( r < 0.0 )
r = 0.0 ;
double g = 382.5 - 1020.0 * std : : abs ( v - 0.5 ) ;
if ( g > 255.0 )
g = 255.0 ;
else if ( g < 0.0 )
g = 0.0 ;
double b = 382.5 - 1020.0 * std : : abs ( v - 0.25 ) ;
if ( b > 255.0 )
b = 255.0 ;
else if ( b < 0.0 )
b = 0.0 ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( r ) , static_cast < int > ( g ) , static_cast < int > ( b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_RYGB ) //gnuplot: 30,-13,-23
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_rygb ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = 796.875 * v - 199.21875 ;
if ( r > 255.0 )
r = 255.0 ;
else if ( r < 0.0 )
r = 0.0 ;
2019-11-24 17:42:44 +08:00
double g = 255.0 * std : : sin ( JKQTPSTATISTICS_PI * v ) ;
2015-07-11 18:56:02 +08:00
double b = 255.0 - 765.0 * v ;
if ( b < 0.0 )
b = 0.0 ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( r ) , static_cast < int > ( g ) , static_cast < int > ( b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_HSV )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_hsv ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
int h = static_cast < int > ( floor ( 6 * v ) ) ;
double f = 6 * v - double ( h ) ;
switch ( h )
{
case 0 : ( * plut ) [ l ] = qRgb ( 255 , static_cast < int > ( 255.0 * f ) , 0 ) ; break ;
case 1 : ( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * ( 1 - f ) ) , 255 , 0 ) ; break ;
case 2 : ( * plut ) [ l ] = qRgb ( 0 , 255 , static_cast < int > ( 255.0 * f ) ) ; break ;
case 3 : ( * plut ) [ l ] = qRgb ( 0 , static_cast < int > ( 255.0 * ( 1 - f ) ) , 255 ) ; break ;
case 4 : ( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * f ) , 0 , 255 ) ; break ;
case 5 : ( * plut ) [ l ] = qRgb ( 255 , 0 , static_cast < int > ( 255.0 * ( 1 - f ) ) ) ; break ;
case 6 : ( * plut ) [ l ] = qRgb ( 255 , static_cast < int > ( 255.0 * f ) , 0 ) ; break ;
}
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_INVERTED_HSV )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_invhsv ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
int h = static_cast < int > ( floor ( 6.0 - 6.0 * v ) ) ;
double f = 6.0 - 6.0 * v - double ( h ) ;
switch ( h )
{
case 0 : ( * plut ) [ l ] = qRgb ( 255 , static_cast < int > ( 255.0 * f ) , 0 ) ; break ;
case 1 : ( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * ( 1 - f ) ) , 255 , 0 ) ; break ;
case 2 : ( * plut ) [ l ] = qRgb ( 0 , 255 , static_cast < int > ( 255.0 * f ) ) ; break ;
case 3 : ( * plut ) [ l ] = qRgb ( 0 , static_cast < int > ( 255.0 * ( 1 - f ) ) , 255 ) ; break ;
case 4 : ( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * f ) , 0 , 255 ) ; break ;
case 5 : ( * plut ) [ l ] = qRgb ( 255 , 0 , static_cast < int > ( 255.0 * ( 1 - f ) ) ) ; break ;
case 6 : ( * plut ) [ l ] = qRgb ( 255 , static_cast < int > ( 255.0 * f ) , 0 ) ; break ;
}
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_RAINBOW ) //gnuplot: 33,13,10
{
2019-01-10 04:23:24 +08:00
if ( lut_rainbow = = nullptr ) {
2019-02-08 00:24:46 +08:00
lut_rainbow = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2015-07-11 18:56:02 +08:00
//std::cout<<"!!! creating rainbow lut\n";
2019-01-10 04:23:24 +08:00
if ( lut_rainbow ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = 255.0 * std : : abs ( 2.0 * v - 0.5 ) ;
if ( r > 255.0 )
r = 255.0 ;
2019-11-24 17:42:44 +08:00
double g = 255.0 * sin ( JKQTPSTATISTICS_PI * v ) ;
2015-07-11 18:56:02 +08:00
2019-11-24 17:42:44 +08:00
double b = 255.0 * cos ( 0.5 * JKQTPSTATISTICS_PI * v ) ;
2015-07-11 18:56:02 +08:00
lut_rainbow [ l ] = qRgb ( static_cast < int > ( r ) , static_cast < int > ( g ) , static_cast < int > ( b ) ) ;
}
}
}
2019-02-08 00:24:46 +08:00
lut_used = lut_rainbow ;
}
else if ( palette = = JKQTFP_HOT ) //gnuplot: 21,22,23
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_hot ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
double r = 765.0 * v ;
if ( r > 255.0 )
r = 255.0 ;
double g = 765.0 * v - 255.0 ;
if ( g > 255.0 )
g = 255.0 ;
else if ( g < 0.0 )
g = 0.0 ;
double b = 765.0 * v - 510.0 ;
if ( b < 0.0 )
b = 0.0 ;
2015-07-11 18:56:02 +08:00
( * plut ) [ l ] = qRgb ( static_cast < int > ( r ) , static_cast < int > ( g ) , static_cast < int > ( b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_OCEAN ) //gnuplot: 23,28,3
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_ocean ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = 765.0 * v - 510.0 ;
if ( r < 0.0 )
r = 0.0 ;
double g = std : : abs ( 382.5 * v - 127.5 ) ;
double b = 255.0 * v ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( r ) , static_cast < int > ( g ) , static_cast < int > ( b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_BLUEMAGENTAYELLOW ) //gnuplot: 30,31,32
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_bluemagentayellow ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = ( v / 0.32 - 0.78125 ) ;
if ( r < 0.0 ) r = 0.0 ;
if ( r > 1.0 ) r = 1.0 ;
double g = 2.0 * v - 0.84 ;
if ( g < 0.0 ) g = 0.0 ;
if ( g > 1.0 ) g = 1.0 ;
double b = 4.0 * v ;
if ( b > 1 | | b < 0 ) b = - 2.0 * v + 1.84 ;
if ( b > 1 | | b < 0 ) b = v / 0.08 - 11.5 ;
if ( b > 1 | | b < 0 ) b = 1 ;
if ( b < 0.0 ) b = 0.0 ;
if ( b > 1.0 ) b = 1.0 ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * r ) , static_cast < int > ( 255.0 * g ) , static_cast < int > ( 255.0 * b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_BLUEYELLOW ) //gnuplot: 8,9,10
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_blueyellow ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = sqrt ( sqrt ( v ) ) ;
if ( r < 0.0 ) r = 0.0 ;
if ( r > 1.0 ) r = 1.0 ;
2019-11-24 17:42:44 +08:00
double g = sin ( JKQTPSTATISTICS_PI / 2.0 * v ) ;
2015-07-11 18:56:02 +08:00
if ( g < 0.0 ) g = 0.0 ;
if ( g > 1.0 ) g = 1.0 ;
2019-11-24 17:42:44 +08:00
double b = cos ( JKQTPSTATISTICS_PI / 2.0 * v ) ;
2015-07-11 18:56:02 +08:00
if ( b < 0.0 ) b = 0.0 ;
if ( b > 1.0 ) b = 1.0 ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * r ) , static_cast < int > ( 255.0 * g ) , static_cast < int > ( 255.0 * b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_CYAN )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_cyan ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2015-07-11 18:56:02 +08:00
double r = v * 0.5 ;
if ( r < 0.0 ) r = 0.0 ;
if ( r > 1.0 ) r = 1.0 ;
double g = v ;
if ( g < 0.0 ) g = 0.0 ;
if ( g > 1.0 ) g = 1.0 ;
double b = v ;
if ( b < 0.0 ) b = 0.0 ;
if ( b > 1.0 ) b = 1.0 ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( 255.0 * r ) , static_cast < int > ( 255.0 * g ) , static_cast < int > ( 255.0 * b ) ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
else if ( palette = = JKQTFP_TRAFFICLIGHT )
{
2019-01-26 20:00:40 +08:00
QRgb * * plut = & lut_trafficlight ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) = = nullptr ) {
2019-02-08 00:24:46 +08:00
( * plut ) = static_cast < QRgb * > ( malloc ( ( JKQTFastPlotter : : LUTSIZE + 2 ) * sizeof ( QRgb ) ) ) ;
2019-01-10 04:23:24 +08:00
if ( ( * plut ) ! = nullptr ) {
2019-05-30 04:40:02 +08:00
for ( size_t l = 0 ; l < = JKQTFastPlotter : : LUTSIZE ; l + + ) {
2019-02-08 00:24:46 +08:00
double v = l / static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ;
2019-11-24 17:42:44 +08:00
double r = ( v < 0.5 ) ? 128.0 * sin ( JKQTPSTATISTICS_PI * ( 2.0 * v - 0.5 ) ) + 128.0 : 255.0 ;
2015-07-11 18:56:02 +08:00
if ( r > 255.0 )
r = 255.0 ;
double g = ( v < 0.5 ) ? 512.0 * v + 128.0 : 512.0 - 512.0 * v ;
if ( g > 255.0 )
g = 255.0 ;
( * plut ) [ l ] = qRgb ( static_cast < int > ( r ) , static_cast < int > ( g ) , 0 ) ;
}
}
}
lut_used = ( * plut ) ;
2019-02-08 00:24:46 +08:00
}
2015-07-11 18:56:02 +08:00
# ifdef DEBUG_TIMING
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " calculated/found LUT: " < < time_gt / 1000.0 < < " ms \n " ;
timer . start ( ) ;
# endif
2019-01-10 04:23:24 +08:00
if ( lut_used ! = nullptr ) {
2019-02-08 00:24:46 +08:00
// LUT found: collor the image accordingly
2019-01-26 19:28:44 +08:00
for ( int j = 0 ; j < height ; + + j ) {
2019-01-26 20:00:40 +08:00
QRgb * line = reinterpret_cast < QRgb * > ( img . scanLine ( height - 1 - j ) ) ;
2019-01-26 19:28:44 +08:00
for ( int i = 0 ; i < width ; + + i ) {
2019-05-30 04:40:02 +08:00
int v = static_cast < int > ( ( dbl [ j * width + i ] - min ) / delta * static_cast < double > ( JKQTFastPlotter : : LUTSIZE ) ) ;
v = ( v < 0 ) ? 0 : ( ( v > static_cast < int > ( JKQTFastPlotter : : LUTSIZE ) ) ? static_cast < int > ( JKQTFastPlotter : : LUTSIZE ) : v ) ;
2019-02-08 00:24:46 +08:00
line [ i ] = lut_used [ v ] ;
}
}
2015-07-11 18:56:02 +08:00
} else {
// no LUT found: paint a black image!
2019-02-08 00:24:46 +08:00
img . fill ( 0 ) ;
}
}
2015-07-11 18:56:02 +08:00
# ifdef DEBUG_TIMING
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " creating colored image: " < < time_gt / 1000.0 < < " ms \n " ;
timer . start ( ) ;
# endif
# ifdef DEBUG_TIMING
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " sum: " < < time_sum / 1000.0 < < " ms \n " ;
timer . start ( ) ;
# endif
} ;
/*! \brief get list with all available palettes
\ ingroup jkqtfastplotter
\ see JKQTFPimagePlot_array2image ( )
*/
2019-06-22 20:21:32 +08:00
JKQTFASTPLOTTER_LIB_EXPORT QStringList JKQTFPimagePlot_getPalettes ( ) ;
2015-07-11 18:56:02 +08:00
/*! \brief get QIcon representing the given palette
\ ingroup jkqtfastplotter
\ see JKQTFPimagePlot_array2image ( )
*/
2019-06-22 20:21:32 +08:00
JKQTFASTPLOTTER_LIB_EXPORT QIcon JKQTFPimagePlot_getPaletteIcon ( int i ) ;
2015-07-11 18:56:02 +08:00
/*! \brief get QIcon representing the given palette
\ ingroup jkqtfastplotter
\ see JKQTFPimagePlot_array2image ( )
*/
2019-06-22 20:21:32 +08:00
JKQTFASTPLOTTER_LIB_EXPORT QIcon JKQTFPimagePlot_getPaletteIcon ( JKQTFPColorPalette palette ) ;
2015-07-11 18:56:02 +08:00
/*! \brief plots a given grayscale image with a given color palette
\ ingroup jkqtfastplotter
- This plot may plot any 2 D array of data ( 8 - , 16 - , 32 - bit integer images , float and double ) .
- This class also draws a color bar in the right border of the plot
.
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPimagePlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief image to plot */
void * image ;
/** \brief format of the image */
JKQTFPImageFormat imageFormat ;
2019-01-20 23:15:10 +08:00
/** \brief width of image in pt */
2019-01-26 19:28:44 +08:00
int width ;
2019-01-20 23:15:10 +08:00
/** \brief height of image in pt */
2019-01-26 19:28:44 +08:00
int height ;
2015-07-11 18:56:02 +08:00
/** \brief minimum x value of the image */
double xmin ;
/** \brief maximum x value of the image */
double xmax ;
/** \brief minimum x value of the image */
double ymin ;
/** \brief maximum x value of the image */
double ymax ;
/** \brief defines the palette to use */
JKQTFPColorPalette palette ;
/** \brief defines minimum color value */
double colorMin ;
/** \brief defines maximum color value */
double colorMax ;
/** \brief draw color bar */
bool drawColorBar ;
2019-01-20 23:15:10 +08:00
/** \brief color bar width in pt */
2015-07-11 18:56:02 +08:00
int colorBarWidth ;
/** \brief rotation of the image when plotting in units of 90 degrees (counter clock wise) */
int rotation ;
public :
2019-02-08 00:24:46 +08:00
2015-07-11 18:56:02 +08:00
/*! \brief class constructor
*/
2019-01-26 19:28:44 +08:00
JKQTFPimagePlot ( JKQTFastPlotter * parent , void * image , JKQTFPImageFormat imageFormat , int width , int height , double xmin , double xmax , double ymin , double ymax , JKQTFPColorPalette palette = JKQTFP_MATLAB ) ;
2015-07-11 18:56:02 +08:00
2019-01-26 19:28:44 +08:00
JKQTFPimagePlot ( JKQTFastPlotter * parent , void * image , JKQTFPImageFormat imageFormat , int width , int height , JKQTFPColorPalette palette = JKQTFP_MATLAB ) ;
2015-07-11 18:56:02 +08:00
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2020-09-21 19:47:54 +08:00
/** \copydoc image */
2019-01-26 20:00:40 +08:00
inline void setImage ( void * __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > image ! = __value ) {
this - > image = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc image */
2019-01-26 20:00:40 +08:00
inline void * getImage ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > image ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc imageFormat */
2019-01-26 20:00:40 +08:00
inline void setImageFormat ( const JKQTFPImageFormat & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > imageFormat ! = __value ) {
this - > imageFormat = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc imageFormat */
2019-01-26 20:00:40 +08:00
inline JKQTFPImageFormat getImageFormat ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > imageFormat ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline int getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc height */
2019-01-26 20:00:40 +08:00
inline void setHeight ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > height ! = __value ) {
this - > height = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc height */
2019-01-26 20:00:40 +08:00
inline int getHeight ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > height ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline void setXmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmin ! = __value ) {
this - > xmin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline double getXmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline void setXmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmax ! = __value ) {
this - > xmax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline double getXmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline void setYmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymin ! = __value ) {
this - > ymin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline double getYmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline void setYmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymax ! = __value ) {
this - > ymax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline double getYmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawColorBar */
2019-01-26 20:00:40 +08:00
inline void setDrawColorBar ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > drawColorBar ! = __value ) {
this - > drawColorBar = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc drawColorBar */
2019-01-26 20:00:40 +08:00
inline bool getDrawColorBar ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > drawColorBar ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarWidth */
2019-01-26 20:00:40 +08:00
inline void setColorBarWidth ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > colorBarWidth ! = __value ) {
this - > colorBarWidth = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorBarWidth */
2019-01-26 20:00:40 +08:00
inline int getColorBarWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > colorBarWidth ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc rotation */
2019-01-26 20:00:40 +08:00
inline int getRotation ( ) const {
2019-01-10 04:23:24 +08:00
return this - > rotation ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc palette */
2019-01-26 20:00:40 +08:00
inline JKQTFPColorPalette getPalette ( ) const {
2019-01-10 04:23:24 +08:00
return this - > palette ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMin */
2019-01-26 20:00:40 +08:00
inline double getColorMin ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMax */
2019-01-26 20:00:40 +08:00
inline double getColorMax ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMax ;
}
2019-01-26 20:00:40 +08:00
void setImage ( void * image , JKQTFPImageFormat imageFormat , int width , int height ) {
2015-07-11 18:56:02 +08:00
this - > image = image ;
this - > imageFormat = imageFormat ;
this - > width = width ;
this - > height = height ;
replot ( ) ;
}
public slots :
2019-01-26 20:00:40 +08:00
void setRotation ( int rotation ) {
2015-07-11 18:56:02 +08:00
if ( this - > rotation ! = rotation ) {
2019-05-30 04:40:02 +08:00
this - > rotation = rotation ;
2015-07-11 18:56:02 +08:00
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setPalette ( int palette ) {
2015-07-11 18:56:02 +08:00
if ( this - > palette ! = palette ) {
2019-05-30 04:40:02 +08:00
this - > palette = static_cast < JKQTFPColorPalette > ( palette ) ;
2015-07-11 18:56:02 +08:00
replot ( ) ;
}
2019-05-30 04:40:02 +08:00
}
2019-01-26 20:00:40 +08:00
void setPalette ( JKQTFPColorPalette palette ) {
2015-07-11 18:56:02 +08:00
if ( this - > palette ! = palette ) {
this - > palette = palette ;
replot ( ) ;
}
2019-05-30 04:40:02 +08:00
}
2019-01-26 20:00:40 +08:00
void setColorMin ( uint32_t colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMin ! = colorMin ) {
this - > colorMin = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setColorMax ( uint32_t colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMax ! = colorMax ) {
this - > colorMax = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setColorMin ( int colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMin ! = colorMin ) {
this - > colorMin = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setColorMax ( int colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMax ! = colorMax ) {
this - > colorMax = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setColorMin ( double colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMin ! = colorMin ) {
this - > colorMin = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
void setColorMax ( double colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMax ! = colorMax ) {
this - > colorMax = colorMax ;
replot ( ) ;
}
}
} ;
/*! \brief convert a 2D image (as 1D array) into a QImage and puts the image values into one color channel (set by \a channel).
\ ingroup jkqtfastplotter
*/
template < class T >
2019-05-30 04:40:02 +08:00
inline void JKQTFPRGBImageOverlayPlot_array2image ( T * dbl , int width , int height , QImage & img , int channel , double minColor_ , double maxColor_ )
2015-07-11 18:56:02 +08:00
{
if ( ! dbl )
return ;
2019-05-30 04:40:02 +08:00
T minColor = static_cast < T > ( minColor_ ) ;
T maxColor = static_cast < T > ( maxColor_ ) ;
2015-07-11 18:56:02 +08:00
# ifdef DEBUG_TIMING
JKQTPHighResTimer timer ;
double time_sum = 0 ;
double time_gt = 0 ;
std : : cout < < " timing JKQTFPimagePlot_array2image: \n " ;
timer . start ( ) ;
# endif
//qDebug()<<"channel = "<<channel;
//qDebug()<<"color range: "<<minColor<<"..."<<maxColor;
double min = * dbl ;
double max = * dbl ;
if ( minColor = = maxColor ) {
for ( int i = 1 ; i < width * height ; + + i )
{
2019-01-26 19:28:44 +08:00
T v = dbl [ i ] ;
2015-07-11 18:56:02 +08:00
if ( v < min )
min = v ;
else if ( v > max )
max = v ;
}
} else {
min = minColor ;
max = maxColor ;
}
# ifdef DEBUG_TIMING
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " finding min&max: " < < time_gt / 1000.0 < < " ms \n " ;
timer . start ( ) ;
# endif
//qDebug()<<"minColor="<<minColor<<" maxColor="<<maxColor<<" min="<<min<<" max="<<max<<"\n";
double delta = max - min ;
if ( min ! = max ) {
// LUT found: collor the image accordingly
if ( channel = = 0 ) {
2019-01-26 19:28:44 +08:00
for ( int j = 0 ; j < height ; + + j ) {
2019-01-26 20:00:40 +08:00
QRgb * line = reinterpret_cast < QRgb * > ( img . scanLine ( height - 1 - j ) ) ;
2019-01-26 19:28:44 +08:00
for ( int i = 0 ; i < width ; + + i ) {
2015-07-11 18:56:02 +08:00
int v = trunc ( double ( dbl [ j * width + i ] - min ) * 255.0 / delta ) ;
v = ( v < 0 ) ? 0 : ( ( v > 255 ) ? 255 : v ) ;
2019-01-26 19:28:44 +08:00
const QRgb l = line [ i ] ;
2015-07-11 18:56:02 +08:00
line [ i ] = qRgb ( v , qGreen ( l ) , qBlue ( l ) ) ;
//if (i==j) qDebug()<<dbl[j*width+i]<<v<<hex<<l<<line[i]<<dec;
}
}
} else if ( channel = = 1 ) {
2019-01-26 19:28:44 +08:00
for ( int j = 0 ; j < height ; + + j ) {
2019-01-26 20:00:40 +08:00
QRgb * line = reinterpret_cast < QRgb * > ( img . scanLine ( height - 1 - j ) ) ;
2019-01-26 19:28:44 +08:00
for ( int i = 0 ; i < width ; + + i ) {
2015-07-11 18:56:02 +08:00
int v = ( dbl [ j * width + i ] - min ) * 255 / delta ;
v = ( v < 0 ) ? 0 : ( ( v > 255 ) ? 255 : v ) ;
2019-01-26 19:28:44 +08:00
const QRgb l = line [ i ] ;
2015-07-11 18:56:02 +08:00
line [ i ] = qRgb ( qRed ( l ) , v , qBlue ( l ) ) ;
//if (i==j) qDebug()<<dbl[j*width+i]<<v<<hex<<l<<line[i]<<dec;
}
}
} else if ( channel = = 2 ) {
2019-01-26 19:28:44 +08:00
for ( int j = 0 ; j < height ; + + j ) {
2019-01-26 20:00:40 +08:00
QRgb * line = reinterpret_cast < QRgb * > ( img . scanLine ( height - 1 - j ) ) ;
2019-01-26 19:28:44 +08:00
for ( int i = 0 ; i < width ; + + i ) {
2015-07-11 18:56:02 +08:00
int v = ( dbl [ j * width + i ] - min ) * 255 / delta ;
v = ( v < 0 ) ? 0 : ( ( v > 255 ) ? 255 : v ) ;
2019-01-26 19:28:44 +08:00
const QRgb l = line [ i ] ;
2015-07-11 18:56:02 +08:00
line [ i ] = qRgb ( qRed ( l ) , qGreen ( l ) , v ) ;
//if (i==j) qDebug()<<dbl[j*width+i]<<v<<hex<<l<<line[i]<<dec;
}
}
}
}
# ifdef DEBUG_TIMING
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " creating colored image: " < < time_gt / 1000.0 < < " ms \n " ;
timer . start ( ) ;
2019-01-26 20:00:40 +08:00
time_gt = timer . getTime ( ) ;
2015-07-11 18:56:02 +08:00
time_sum + = time_gt ;
std : : cout < < " sum: " < < time_sum / 1000.0 < < " ms \n " ;
timer . start ( ) ;
# endif
} ;
/*! \brief plots 1,2 or 3 given grayscale images as an overlay plot, where each channel is drawn as one color channel (e.g. red, green or blue).
\ ingroup jkqtfastplotter
- This plot may plot any 2 D array of data ( 8 - , 16 - , 32 - bit integer images , float and double ) .
- The images all have to have the same size
.
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPRGBImageOverlayPlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief image to plot */
void * imageRed ;
/** \brief format of the image */
JKQTFPImageFormat imageFormatRed ;
/** \brief image to plot */
void * imageGreen ;
/** \brief format of the image */
JKQTFPImageFormat imageFormatGreen ;
/** \brief image to plot */
void * imageBlue ;
/** \brief format of the image */
JKQTFPImageFormat imageFormatBlue ;
2019-01-20 23:15:10 +08:00
/** \brief width of image in pt */
2019-01-26 19:28:44 +08:00
int width ;
2019-01-20 23:15:10 +08:00
/** \brief height of image in pt */
2019-01-26 19:28:44 +08:00
int height ;
2015-07-11 18:56:02 +08:00
/** \brief minimum x value of the image */
double xmin ;
/** \brief maximum x value of the image */
double xmax ;
/** \brief minimum x value of the image */
double ymin ;
/** \brief maximum x value of the image */
double ymax ;
/** \brief defines minimum color value */
double colorMinRed ;
/** \brief defines maximum color value */
double colorMaxRed ;
/** \brief defines minimum color value */
double colorMinGreen ;
/** \brief defines maximum color value */
double colorMaxGreen ;
/** \brief defines minimum color value */
double colorMinBlue ;
/** \brief defines maximum color value */
double colorMaxBlue ;
/** \brief rotation of the image when plotting in units of 90 degrees (counter clock wise) */
int rotation ;
public :
/*! \brief class constructor
*/
2019-01-26 19:28:44 +08:00
JKQTFPRGBImageOverlayPlot ( JKQTFastPlotter * parent , void * imageRed , JKQTFPImageFormat imageFormat , int width , int height , double xmin , double xmax , double ymin , double ymax ) ;
JKQTFPRGBImageOverlayPlot ( JKQTFastPlotter * parent , void * imageRed , JKQTFPImageFormat imageFormat , int width , int height ) ;
2015-07-11 18:56:02 +08:00
JKQTFPRGBImageOverlayPlot ( JKQTFastPlotter * parent ) ;
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
/*! \brief sets the properties imageRed and imageFormatRed to the specified \a __value and \a __value2.
2019-05-30 17:19:56 +08:00
\ see imageRed , imageFormatRed
*/
2019-01-26 20:00:40 +08:00
inline void setImageRed ( void * __value , JKQTFPImageFormat __value2 )
2019-01-10 04:23:24 +08:00
{
2019-02-08 00:24:46 +08:00
bool set = false ;
if ( this - > imageRed ! = __value ) {
this - > imageRed = __value ;
set = true ;
}
if ( this - > imageFormatRed ! = __value2 ) {
this - > imageFormatRed = __value2 ;
set = true ;
}
if ( set ) {
replot ( ) ;
}
2019-01-10 04:23:24 +08:00
}
2020-09-21 19:47:54 +08:00
/** \copydoc imageRed */
2019-01-26 20:00:40 +08:00
inline void * getImageRed ( ) const { return this - > imageRed ; }
2020-09-21 19:47:54 +08:00
/** \copydoc imageFormatRed */
2019-01-26 20:00:40 +08:00
inline JKQTFPImageFormat getImageFormatRed ( ) const { return this - > imageFormatRed ; }
2019-05-30 17:19:56 +08:00
/*! \brief sets the properties imageGreen and imageFormatGreen to the specified \a __value and \a __value2.
\ see imageGreen , imageFormatGreen
*/
2019-01-26 20:00:40 +08:00
inline void setImageGreen ( void * __value , JKQTFPImageFormat __value2 )
2019-01-10 04:23:24 +08:00
{
2019-02-08 00:24:46 +08:00
bool set = false ;
if ( this - > imageGreen ! = __value ) {
this - > imageGreen = __value ;
set = true ;
}
if ( this - > imageFormatGreen ! = __value2 ) {
this - > imageFormatGreen = __value2 ;
set = true ;
}
if ( set ) {
replot ( ) ;
}
2019-01-10 04:23:24 +08:00
}
2020-09-21 19:47:54 +08:00
/** \copydoc imageGreen */
2019-01-26 20:00:40 +08:00
inline void * getImageGreen ( ) const { return this - > imageGreen ; }
2020-09-21 19:47:54 +08:00
/** \copydoc imageFormatGreen */
2019-01-26 20:00:40 +08:00
inline JKQTFPImageFormat getImageFormatGreen ( ) const { return this - > imageFormatGreen ; }
2019-05-30 17:19:56 +08:00
/*! \brief sets the properties imageBlue and imageFormatBlue to the specified \a __value and \a __value2.
\ see imageBlue , imageFormatBlue
*/
inline void setImageBlue ( void * __value , JKQTFPImageFormat __value2 )
2019-01-10 04:23:24 +08:00
{
2019-02-08 00:24:46 +08:00
bool set = false ;
if ( this - > imageBlue ! = __value ) {
this - > imageBlue = __value ;
set = true ;
}
if ( this - > imageFormatBlue ! = __value2 ) {
this - > imageFormatBlue = __value2 ;
set = true ;
}
if ( set ) {
replot ( ) ;
}
2019-01-10 04:23:24 +08:00
}
2020-09-21 19:47:54 +08:00
/** \copydoc imageBlue */
2019-01-26 20:00:40 +08:00
inline void * getImageBlue ( ) const { return this - > imageBlue ; }
2020-09-21 19:47:54 +08:00
/** \copydoc imageFormatBlue */
2019-01-26 20:00:40 +08:00
inline JKQTFPImageFormat getImageFormatBlue ( ) const { return this - > imageFormatBlue ; }
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline int getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc height */
2019-01-26 20:00:40 +08:00
inline void setHeight ( int __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > height ! = __value ) {
this - > height = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc height */
2019-01-26 20:00:40 +08:00
inline int getHeight ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > height ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline void setXmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmin ! = __value ) {
this - > xmin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline double getXmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline void setXmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmax ! = __value ) {
this - > xmax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline double getXmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline void setYmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymin ! = __value ) {
this - > ymin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline double getYmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline void setYmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymax ! = __value ) {
this - > ymax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline double getYmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc rotation */
2019-01-26 20:00:40 +08:00
inline int getRotation ( ) const {
2019-01-10 04:23:24 +08:00
return this - > rotation ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMinRed */
2019-01-26 20:00:40 +08:00
inline double getColorMinRed ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMinRed ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMaxRed */
2019-01-26 20:00:40 +08:00
inline double getColorMaxRed ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMaxRed ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMinGreen */
2019-01-26 20:00:40 +08:00
inline double getColorMinGreen ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMinGreen ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMaxGreen */
2019-01-26 20:00:40 +08:00
inline double getColorMaxGreen ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMaxGreen ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMinBlue */
2019-01-26 20:00:40 +08:00
inline double getColorMinBlue ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMinBlue ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc colorMaxBlue */
2019-01-26 20:00:40 +08:00
inline double getColorMaxBlue ( ) const {
2019-01-10 04:23:24 +08:00
return this - > colorMaxBlue ;
}
2019-01-26 20:00:40 +08:00
void setImage ( void * imageRed , JKQTFPImageFormat imageFormatRed , int width , int height ) ;
void setImage ( void * imageRed , JKQTFPImageFormat imageFormatRed , void * imageGreen , JKQTFPImageFormat imageFormatGreen , int width , int height ) ;
void setImage ( void * imageRed , JKQTFPImageFormat imageFormatRed , void * imageGreen , JKQTFPImageFormat imageFormatGreen , void * imageBlue , JKQTFPImageFormat imageFormatBlue , int width , int height ) ;
void setImage ( void * imageRed , JKQTFPImageFormat imageFormatRed , int width , int height , double xmin , double xmax , double ymin , double ymax ) ;
void setImage ( void * imageRed , JKQTFPImageFormat imageFormatRed , void * imageGreen , JKQTFPImageFormat imageFormatGreen , int width , int height , double xmin , double xmax , double ymin , double ymax ) ;
void setImage ( void * imageRed , JKQTFPImageFormat imageFormatRed , void * imageGreen , JKQTFPImageFormat imageFormatGreen , void * imageBlue , JKQTFPImageFormat imageFormatBlue , int width , int height , double xmin , double xmax , double ymin , double ymax ) ;
2015-07-11 18:56:02 +08:00
public slots :
2019-01-26 20:00:40 +08:00
inline void setRotation ( int rotation ) {
2015-07-11 18:56:02 +08:00
if ( this - > rotation ! = rotation ) {
2019-05-30 04:40:02 +08:00
this - > rotation = rotation ;
2015-07-11 18:56:02 +08:00
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinRed ( uint32_t colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinRed ! = colorMin ) {
this - > colorMinRed = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxRed ( uint32_t colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxRed ! = colorMax ) {
this - > colorMaxRed = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinRed ( int colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinRed ! = colorMin ) {
this - > colorMinRed = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxRed ( int colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxRed ! = colorMax ) {
this - > colorMaxRed = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinRed ( double colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinRed ! = colorMin ) {
this - > colorMinRed = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxRed ( double colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxRed ! = colorMax ) {
this - > colorMaxRed = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinGreen ( uint32_t colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinGreen ! = colorMin ) {
this - > colorMinGreen = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxGreen ( uint32_t colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxGreen ! = colorMax ) {
this - > colorMaxGreen = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinGreen ( int colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinGreen ! = colorMin ) {
this - > colorMinGreen = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxGreen ( int colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxGreen ! = colorMax ) {
this - > colorMaxGreen = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinGreen ( double colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinGreen ! = colorMin ) {
this - > colorMinGreen = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxGreen ( double colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxGreen ! = colorMax ) {
this - > colorMaxGreen = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinBlue ( uint32_t colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinBlue ! = colorMin ) {
this - > colorMinBlue = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxBlue ( uint32_t colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxBlue ! = colorMax ) {
this - > colorMaxBlue = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinBlue ( int colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinBlue ! = colorMin ) {
this - > colorMinBlue = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxBlue ( int colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxBlue ! = colorMax ) {
this - > colorMaxBlue = colorMax ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMinBlue ( double colorMin ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMinBlue ! = colorMin ) {
this - > colorMinBlue = colorMin ;
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColorMaxBlue ( double colorMax ) {
2015-07-11 18:56:02 +08:00
if ( this - > colorMaxBlue ! = colorMax ) {
this - > colorMaxBlue = colorMax ;
replot ( ) ;
}
}
} ;
/*! \brief plots an image overlay, i.e. a boolean image where each \c true pixel is drawn with a given color
and the \ c false pixels are transparent
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPimageOverlayPlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
enum SymbolType {
stCircle ,
stRectangle
} ;
protected :
/** \brief image to plot */
bool * image ;
2019-01-20 23:15:10 +08:00
/** \brief width of image in pt */
2019-01-26 19:28:44 +08:00
int width ;
2019-01-20 23:15:10 +08:00
/** \brief height of image in pt */
2019-01-26 19:28:44 +08:00
int height ;
2015-07-11 18:56:02 +08:00
/** \brief minimum x value of the image */
double xmin ;
/** \brief maximum x value of the image */
double xmax ;
/** \brief minimum x value of the image */
double ymin ;
/** \brief maximum x value of the image */
double ymax ;
/** \brief color of the overlay pixels */
QColor color ;
/** \brief linewidth of symbols */
double linewidth ;
/** \brief rotation of the image when plotting in units of 90 degrees */
int rotation ;
SymbolType symboltype ;
bool showAsSymbols ;
public :
/*! \brief class constructor
*/
2019-01-26 19:28:44 +08:00
JKQTFPimageOverlayPlot ( JKQTFastPlotter * parent , bool * image , int width , int height , double xmin , double xmax , double ymin , double ymax , QColor color = QColor ( " red " ) ) ;
2015-07-11 18:56:02 +08:00
2019-01-26 19:28:44 +08:00
JKQTFPimageOverlayPlot ( JKQTFastPlotter * parent , bool * image , int width , int height , QColor color = QColor ( " red " ) ) ;
2015-07-11 18:56:02 +08:00
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
void setData ( bool * image , int width , int height ) {
2015-07-11 18:56:02 +08:00
this - > image = image ;
this - > width = width ;
this - > height = height ;
replot ( ) ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc image */
2019-01-26 20:00:40 +08:00
inline bool * getImage ( ) const {
2019-01-10 04:23:24 +08:00
return this - > image ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc rotation */
2019-01-26 20:00:40 +08:00
inline int getRotation ( ) const {
2019-01-10 04:23:24 +08:00
return this - > rotation ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline int getWidth ( ) const {
2019-01-10 04:23:24 +08:00
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc height */
2019-01-26 20:00:40 +08:00
inline int getHeight ( ) const {
2019-01-10 04:23:24 +08:00
return this - > height ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline void setXmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmin ! = __value ) {
this - > xmin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmin */
2019-01-26 20:00:40 +08:00
inline double getXmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline void setXmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > xmax ! = __value ) {
this - > xmax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc xmax */
2019-01-26 20:00:40 +08:00
inline double getXmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xmax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline void setYmin ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymin ! = __value ) {
this - > ymin = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymin */
2019-01-26 20:00:40 +08:00
inline double getYmin ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymin ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline void setYmax ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > ymax ! = __value ) {
this - > ymax = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc ymax */
2019-01-26 20:00:40 +08:00
inline double getYmax ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > ymax ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc showAsSymbols */
2019-01-26 20:00:40 +08:00
inline void setShowAsSymbols ( bool __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > showAsSymbols ! = __value ) {
this - > showAsSymbols = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc showAsSymbols */
2019-01-26 20:00:40 +08:00
inline bool getShowAsSymbols ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > showAsSymbols ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline QColor getColor ( ) const {
2019-01-10 04:23:24 +08:00
return this - > color ;
}
2015-07-11 18:56:02 +08:00
public slots :
2019-01-26 20:00:40 +08:00
inline void setRotation ( int rotation ) {
2015-07-11 18:56:02 +08:00
if ( this - > rotation ! = rotation ) {
2019-05-30 04:40:02 +08:00
this - > rotation = rotation ;
2015-07-11 18:56:02 +08:00
replot ( ) ;
}
}
2019-01-26 20:00:40 +08:00
inline void setColor ( QColor color ) {
2015-07-11 18:56:02 +08:00
if ( this - > color ! = color ) {
this - > color = color ;
replot ( ) ;
}
2019-05-30 04:40:02 +08:00
}
2015-07-11 18:56:02 +08:00
} ;
/*! \brief plot a horizontal scale bar
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPQScaleBarXPlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
enum Position {
TopLeft = 0 ,
TopRight = 1 ,
BottomLeft = 2 ,
BottomRight = 3
} ;
protected :
/** \brief width of scale bar */
double width ;
2019-01-20 23:15:10 +08:00
/** \brief line width of scale bar, given in pt */
2015-07-11 18:56:02 +08:00
double lineWidth ;
/** \brief color of scale bar */
QColor color ;
/** \brief scale bar label (use %1 to include value of width) */
QString label ;
/** \brief font of scale bar */
QFont font ;
/** \brief scale bar position */
Position position ;
public :
/*! \brief class constructor
*/
2020-08-26 18:58:23 +08:00
explicit JKQTFPQScaleBarXPlot ( JKQTFastPlotter * parent , double width = 1 , const QString & label = QString ( " %1 " ) , QColor color = QColor ( " grey " ) , double lineWidth = 2 ) ;
2015-07-11 18:56:02 +08:00
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline double getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidth */
2019-01-26 20:00:40 +08:00
inline void setLineWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > lineWidth ! = __value ) {
this - > lineWidth = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidth */
2019-01-26 20:00:40 +08:00
inline double getLineWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > lineWidth ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline void setColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > color ! = __value ) {
this - > color = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline QColor getColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > color ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc label */
2019-01-26 20:00:40 +08:00
inline void setLabel ( const QString & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > label ! = __value ) {
this - > label = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc label */
2019-01-26 20:00:40 +08:00
inline QString getLabel ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > label ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc font */
2019-01-26 20:00:40 +08:00
inline void setFont ( const QFont & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > font ! = __value ) {
this - > font = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc font */
2019-01-26 20:00:40 +08:00
inline QFont getFont ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > font ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc position */
2019-01-26 20:00:40 +08:00
inline void setPosition ( const Position & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > position ! = __value ) {
this - > position = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc position */
2019-01-26 20:00:40 +08:00
inline Position getPosition ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > position ;
}
2015-07-11 18:56:02 +08:00
public slots :
2019-01-26 20:00:40 +08:00
void setPosition ( int pos ) {
2019-05-30 04:40:02 +08:00
setPosition ( static_cast < Position > ( pos ) ) ;
2015-07-11 18:56:02 +08:00
}
} ;
/*! \brief plot a horizontal scale bar
\ ingroup jkqtfastplotter
*/
2019-06-22 20:21:32 +08:00
class JKQTFASTPLOTTER_LIB_EXPORT JKQTFPQOverlayLinearGridPlot : public JKQTFPPlot {
2015-07-11 18:56:02 +08:00
Q_OBJECT
protected :
/** \brief distance between grid lines */
double width ;
2019-01-20 23:15:10 +08:00
/** \brief line width of grid lines, given in pt */
2015-07-11 18:56:02 +08:00
double lineWidth ;
/** \brief color of the grid */
QColor color ;
/** \brief grid line style */
Qt : : PenStyle style ;
public :
/*! \brief class constructor
*/
2020-08-26 18:58:23 +08:00
explicit JKQTFPQOverlayLinearGridPlot ( JKQTFastPlotter * parent , double width = 1 , QColor color = QColor ( " grey " ) , double lineWidth = 1 , Qt : : PenStyle style = Qt : : DashLine ) ;
2015-07-11 18:56:02 +08:00
/** \brief draw the graph */
2019-01-10 04:23:24 +08:00
virtual void drawGraph ( QPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline void setWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > width ! = __value ) {
this - > width = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc width */
2019-01-26 20:00:40 +08:00
inline double getWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > width ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidth */
2019-01-26 20:00:40 +08:00
inline void setLineWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > lineWidth ! = __value ) {
this - > lineWidth = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidth */
2019-01-26 20:00:40 +08:00
inline double getLineWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > lineWidth ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline void setColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > color ! = __value ) {
this - > color = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc color */
2019-01-26 20:00:40 +08:00
inline QColor getColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > color ;
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-05-06 01:31:20 +08:00
inline void setStyle ( Qt : : PenStyle __value )
2019-01-10 04:23:24 +08:00
{
if ( this - > style ! = __value ) {
this - > style = __value ;
replot ( ) ;
}
}
2020-09-21 19:47:54 +08:00
/** \copydoc style */
2019-01-26 20:00:40 +08:00
inline Qt : : PenStyle getStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > style ;
}
2015-07-11 18:56:02 +08:00
} ;
# endif // JKQTFASTPLOTTER_H