2015-07-11 18:56:02 +08:00
/*
2019-02-08 00:24:46 +08:00
Copyright ( c ) 2008 - 2019 Jan W . Krieger
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/>.
*/
2018-12-19 00:13:18 +08:00
# ifndef jkqtpgraphsimage_H
# define jkqtpgraphsimage_H
2015-07-11 18:56:02 +08:00
# include <QString>
# include <QPainter>
# include <QImage>
# include <QIcon>
2019-04-22 19:27:50 +08:00
# include "jkqtplotter/jkqtpgraphsscatter.h"
2019-05-18 19:22:46 +08:00
# include "jkqtcommon/jkqtptools.h"
2018-11-26 03:25:44 +08:00
# include "jkqtplotter/jkqtpbaseelements.h"
2019-05-18 19:22:46 +08:00
# include "jkqtcommon/jkqtp_imexport.h"
2018-12-19 00:13:18 +08:00
# include "jkqtplottertools/jkqtpimagetools.h"
2015-07-11 18:56:02 +08:00
/*! \brief base class for plotting an image
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_imagelots_elements
2015-07-11 18:56:02 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPImageBase : public JKQTPGraph {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPImageBase ( JKQTBasePlotter * parent = nullptr ) ;
2015-07-11 18:56:02 +08:00
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPImageBase ( double x , double y , double width , double height , JKQTBasePlotter * parent = nullptr ) ;
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPImageBase ( JKQTPlotter * parent ) ;
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPImageBase ( double x , double y , double width , double height , JKQTPlotter * parent ) ;
2015-07-11 18:56:02 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2015-07-11 18:56:02 +08:00
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call - by - reference parameters !
*/
2018-12-28 05:52:00 +08:00
virtual bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) override ;
2015-07-11 18:56:02 +08:00
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call - by - reference parameters !
*/
2018-12-28 05:52:00 +08:00
virtual bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) override ;
2015-07-11 18:56:02 +08:00
/** \brief returns the color to be used for the key label */
2019-04-22 19:27:50 +08:00
virtual QColor getKeyLabelColor ( ) const override ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \copydoc x
\ see see x for details */
2019-04-22 19:27:50 +08:00
void setX ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc x
\ see see x for details */
2019-04-22 19:27:50 +08:00
double getX ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc y
\ see see y for details */
2019-04-22 19:27:50 +08:00
void setY ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc y
\ see see y for details */
2019-04-22 19:27:50 +08:00
double getY ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc width
\ see see width for details */
2019-04-22 19:27:50 +08:00
void setWidth ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc width
\ see see width for details */
2019-04-22 19:27:50 +08:00
double getWidth ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc height
\ see see height for details */
2019-04-22 19:27:50 +08:00
void setHeight ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc height
\ see see height for details */
2019-04-22 19:27:50 +08:00
double getHeight ( ) const ;
2015-07-11 18:56:02 +08:00
protected :
/** \brief x coordinate of lower left corner */
double x ;
/** \brief y coordinate of lower left corner */
double y ;
/** \brief width of image */
double width ;
/** \brief height of image */
double height ;
/*! \brief plot the given QImage onto the widget where the QImage fills the area defined by x, y (lower left corner) and width, height
in the simplest case your implementation of draw ( ) will call
< code > plotImage ( painter , image , this - > x , this - > y , this - > width , this - > height ) ; < / code >
*/
virtual void plotImage ( JKQTPEnhancedPainter & painter , QImage & image , double x , double y , double width , double height ) ;
} ;
/*! \brief base class to hold an image from an 2-dimensional array of values
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_imagelots_elements
\ image html jkqtplotter_simpletest_imageplot . png
2015-07-11 18:56:02 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPMathImageBase : public JKQTPImageBase {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/** \brief possible datatypes of the data array, plotted by this class. */
enum DataType {
2019-01-26 20:00:40 +08:00
FloatArray , /*!< Data is of type \c float */
DoubleArray , /*!< Data is of type \c double */
UInt8Array , /*!< Data is of type \c uint8_t */
UInt16Array , /*!< Data is of type \c uint16_t */
UInt32Array , /*!< Data is of type \c uint32_t */
UInt64Array , /*!< Data is of type \c uint8_t */
Int8Array , /*!< Data is of type \c int8_t */
Int16Array , /*!< Data is of type \c int16_t */
Int32Array , /*!< Data is of type \c int32_t */
Int64Array /*!< Data is of type \c int64_t */
2015-07-11 18:56:02 +08:00
} ;
2019-01-26 20:00:40 +08:00
/** \brief describes how to modify a rendered image with a second data array \see ModifierModeToString(), StringToModifierMode(), JKQTPImageModifierModeComboBox */
2015-07-11 18:56:02 +08:00
enum ModifierMode {
2019-01-26 20:00:40 +08:00
ModifyNone = 0 , /*!< no modification \image html JKQTPMathImageBaseModifyNone.png */
ModifyValue = 1 , /*!< modify the VALUE-channel from the HSV color space \image html JKQTPMathImageBaseModifyValue.png */
ModifySaturation = 2 , /*!< modify the SATURATION-channel from the HSV color space \image html JKQTPMathImageBaseModifySaturation.png */
ModifyAlpha = 3 , /*!< modify the ALPHA/TRANSPARENCY-channel from the RGBA color space \image html JKQTPMathImageBaseModifyAlpha.png */
ModifyTransparency = ModifyAlpha , /*!< \see ModifyAlpha */
ModifyLuminance = 4 , /*!< modify the LUMINANCE-channel from the HSL color space \image html JKQTPMathImageBaseModifyLuminance.png */
ModifyHue = 5 , /*!< modify the VALUE-channel from the HSV color space \image html JKQTPMathImageBaseModifyHue.png */
2015-07-11 18:56:02 +08:00
} ;
2019-01-26 20:00:40 +08:00
/** \brief convert a ModifierMode to a string \see ModifierModeToString(), ModifierMode */
static ModifierMode StringToModifierMode ( const QString & mode ) ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
/** \brief convert a string to a ModifierMode \see StringToModifierMode(), ModifierMode */
static QString ModifierModeToString ( const ModifierMode & mode ) ;
2015-07-11 18:56:02 +08:00
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPMathImageBase ( JKQTBasePlotter * parent = nullptr ) ;
JKQTPMathImageBase ( double x , double y , double width , double height , JKQTBasePlotter * parent = nullptr ) ;
2019-01-26 19:28:44 +08:00
JKQTPMathImageBase ( double x , double y , double width , double height , DataType datatype , void * data , int Nx , int Ny , JKQTBasePlotter * parent = nullptr ) ;
2015-07-11 18:56:02 +08:00
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPMathImageBase ( JKQTPlotter * parent ) ;
JKQTPMathImageBase ( double x , double y , double width , double height , JKQTPlotter * parent = nullptr ) ;
2019-01-26 19:28:44 +08:00
JKQTPMathImageBase ( double x , double y , double width , double height , DataType datatype , void * data , int Nx , int Ny , JKQTPlotter * parent ) ;
2015-08-02 19:36:54 +08:00
2015-07-11 18:56:02 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \copydoc Nx
\ see see Nx for details */
2019-04-22 19:27:50 +08:00
void setNx ( int __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc Nx
\ see see Nx for details */
2019-04-22 19:27:50 +08:00
int getNx ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc Ny
\ see see Ny for details */
2019-04-22 19:27:50 +08:00
void setNy ( int __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc Ny
\ see see Ny for details */
2019-04-22 19:27:50 +08:00
int getNy ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc data
\ see see data for details */
2019-04-22 19:27:50 +08:00
virtual void setData ( void * __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc data
\ see see data for details */
2019-04-22 19:27:50 +08:00
virtual void * getData ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc datatype
\ see see datatype for details */
2019-04-22 19:27:50 +08:00
virtual void setDatatype ( DataType __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc datatype
\ see see datatype for details */
2019-04-22 19:27:50 +08:00
virtual DataType getDatatype ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc dataModifier
\ see see dataModifier for details */
2019-04-22 19:27:50 +08:00
virtual void setDataModifier ( void * __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc dataModifier
\ see see dataModifier for details */
2019-04-22 19:27:50 +08:00
virtual void * getDataModifier ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc datatypeModifier
\ see see datatypeModifier for details */
2019-04-22 19:27:50 +08:00
virtual void setDatatypeModifier ( DataType __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc datatypeModifier
\ see see datatypeModifier for details */
2019-04-22 19:27:50 +08:00
virtual DataType getDatatypeModifier ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierMode
\ see see modifierMode for details */
2019-04-22 19:27:50 +08:00
void setModifierMode ( const ModifierMode & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierMode
\ see see modifierMode for details */
2019-04-22 19:27:50 +08:00
ModifierMode getModifierMode ( ) const ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
virtual void setDataModifier ( void * data , DataType datatype ) ;
virtual void setData ( void * data , int Nx , int Ny , DataType datatype ) ;
virtual void setData ( void * data , int Nx , int Ny ) ;
2015-07-11 18:56:02 +08:00
/** \brief determine min/max data value of the image */
virtual void getDataMinMax ( double & imin , double & imax ) ;
/** \brief determine min/max data value of the image */
virtual void getModifierMinMax ( double & imin , double & imax ) ;
QVector < double > getDataAsDoubleVector ( ) const ;
QVector < double > getDataModifierAsDoubleVector ( ) const ;
protected :
/** \brief points to the data array, holding the image */
void * data ;
/** \brief datatype of the data array data */
DataType datatype ;
2019-01-20 23:15:10 +08:00
/** \brief width of the data array data in pt */
2019-01-26 19:28:44 +08:00
int Nx ;
2019-01-20 23:15:10 +08:00
/** \brief height of the data array data in pt */
2019-01-26 19:28:44 +08:00
int Ny ;
2015-07-11 18:56:02 +08:00
/** \brief points to the data array, holding the modifier image */
void * dataModifier ;
/** \brief datatype of the data array data */
DataType datatypeModifier ;
ModifierMode modifierMode ;
double internalDataMin ;
double internalDataMax ;
double internalModifierMin ;
double internalModifierMax ;
/** \brief overwrite this to fill the data poiters before they are accessed (e.g. to load data from a column in the datastore */
virtual void ensureImageData ( ) ;
void modifyImage ( QImage & img ) ;
2019-01-26 19:28:44 +08:00
void modifyImage ( QImage & img , void * dataModifier , DataType datatypeModifier , int Nx , int Ny , double internalModifierMin , double internalModifierMax ) ;
2015-07-11 18:56:02 +08:00
} ;
/*! \brief class to plot an image from a QImage object
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_imagelots_elements
2015-07-11 18:56:02 +08:00
2019-01-29 05:14:27 +08:00
\ image html jkqtplotter_simpletest_rgbimageplot_qt . png
2015-07-11 18:56:02 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPImage : public JKQTPImageBase {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPImage ( JKQTBasePlotter * parent = nullptr ) ;
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPImage ( JKQTPlotter * parent ) ;
2018-12-07 01:19:02 +08:00
/** \brief class constructor, which points to an external image (not owned by this object!!!) */
2019-01-20 17:49:29 +08:00
JKQTPImage ( double x , double y , double width , double height , QImage * image , JKQTBasePlotter * parent = nullptr ) ;
2018-12-07 01:19:02 +08:00
/** \brief class constructor, which points to an external image (not owned by this object!!!) */
2019-01-20 23:15:10 +08:00
JKQTPImage ( double x , double y , double width , double height , QImage * image , JKQTPlotter * parent ) ;
2018-12-07 01:19:02 +08:00
/** \brief class constructor, which generates an internal image object, by copying \a image */
2019-01-20 17:49:29 +08:00
JKQTPImage ( double x , double y , double width , double height , const QImage & image , JKQTBasePlotter * parent = nullptr ) ;
2018-12-07 01:19:02 +08:00
/** \brief class constructor, which generates an internal image object, by copying \a image */
2019-01-20 23:15:10 +08:00
JKQTPImage ( double x , double y , double width , double height , const QImage & image , JKQTPlotter * parent ) ;
2018-12-07 01:19:02 +08:00
2018-12-28 05:52:00 +08:00
virtual ~ JKQTPImage ( ) override ;
2015-07-11 18:56:02 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2018-12-28 05:52:00 +08:00
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2015-07-11 18:56:02 +08:00
2018-12-07 01:19:02 +08:00
/** \brief copy an external image into an internally owned copy */
2019-01-26 20:00:40 +08:00
virtual void setImage ( const QImage & image ) ;
2018-12-07 01:19:02 +08:00
/** \brief set an external image to be plotted, the image will NOT BE OWNED by the graph-object */
2019-01-26 20:00:40 +08:00
virtual void setImage ( QImage * image ) ;
2015-07-11 18:56:02 +08:00
2018-12-07 01:19:02 +08:00
/** \brief deletes the internal image */
void clear_image ( ) ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
/*! \brief returns the property image ( \copybrief image ). \details Description of the parameter image is: <BLOCKQUOTE>\copydoc image </BLOCKQUOTE>. \see image for more information */
inline QImage * getImage ( ) const { return this - > image ; }
2015-07-11 18:56:02 +08:00
protected :
2018-12-07 01:19:02 +08:00
/** \brief the image to be plotted. This is freed by the destructor, iff \a image_owned is set to \c true (.e.g by QImage-copy-constructors) */
2015-07-11 18:56:02 +08:00
QImage * image ;
2018-12-07 01:19:02 +08:00
/** \brief indicates that the image \a image is owned by this object (i.e. freed, when the object is destroyed) */
bool image_owned ;
2015-07-11 18:56:02 +08:00
2015-08-02 19:36:54 +08:00
void createImageActions ( ) ;
2015-07-11 18:56:02 +08:00
protected :
QAction * actSaveImage ;
QAction * actCopyImage ;
public :
2019-01-20 17:49:29 +08:00
virtual void setParent ( JKQTBasePlotter * parent ) override ;
2019-01-26 20:00:40 +08:00
virtual void setTitle ( const QString & title ) override ;
2015-07-11 18:56:02 +08:00
public slots :
void saveImagePlotAsImage ( const QString & filename = QString ( " " ) , const QByteArray & outputFormat = QByteArray ( ) ) ;
void copyImagePlotAsImage ( ) ;
} ;
/*! \brief class to plot an image from an 2-dimensional array of values
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_imagelots_elements
2015-07-11 18:56:02 +08:00
2019-01-13 01:53:16 +08:00
\ image html jkqtplotter_simpletest_imageplot . png
\ image html jkqtplotter_simpletest_imageplot_modifier . png
\ image html jkqtplotter_simpletest_imageplot__smallscaletransparent . png
2015-07-11 18:56:02 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPMathImage : public JKQTPMathImageBase {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-26 19:28:44 +08:00
JKQTPMathImage ( double x , double y , double width , double height , DataType datatype , void * data , int Nx , int Ny , JKQTPMathImageColorPalette palette = JKQTPMathImageGRAY , JKQTBasePlotter * parent = nullptr ) ;
2019-01-20 17:49:29 +08:00
JKQTPMathImage ( JKQTBasePlotter * parent = nullptr ) ;
2019-01-26 19:28:44 +08:00
JKQTPMathImage ( double x , double y , double width , double height , DataType datatype , void * data , int Nx , int Ny , JKQTPMathImageColorPalette palette , JKQTPlotter * parent ) ;
2019-01-20 23:15:10 +08:00
JKQTPMathImage ( JKQTPlotter * parent ) ;
2015-07-11 18:56:02 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2018-12-28 05:52:00 +08:00
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
virtual void setParent ( JKQTBasePlotter * parent ) override ;
2015-07-11 18:56:02 +08:00
/*! \brief get list with all available palettes */
static QStringList getPalettes ( ) ;
/*! \brief get list with all available palettes */
static int getPalettesCount ( ) ;
/*! \brief get QIcon representing the given palette */
static QIcon getPaletteIcon ( int i ) ;
/*! \brief get QIcon representing the given palette */
static QIcon getPaletteIcon ( JKQTPMathImageColorPalette palette ) ;
2018-11-29 06:10:14 +08:00
/*! \brief get QImage representing the given palette */
2015-08-05 20:27:09 +08:00
static QImage getPaletteImage ( int i , int width , int height = 1 ) ;
2018-11-29 06:10:14 +08:00
/*! \brief get QImage representing the given palette */
2015-08-05 20:27:09 +08:00
static QImage getPaletteImage ( JKQTPMathImageColorPalette palette , int width , int height = 1 ) ;
2015-07-11 18:56:02 +08:00
/*! \brief get QIcon representing the given palette */
static QIcon getPaletteKeyIcon ( int i ) ;
/*! \brief get QIcon representing the given palette */
static QIcon getPaletteKeyIcon ( JKQTPMathImageColorPalette palette ) ;
2018-11-29 06:10:14 +08:00
/*! \brief get QImage representing the given palette */
2015-07-11 18:56:02 +08:00
static QImage getPaletteKeyImage ( int i , int width , int height ) ;
2018-11-29 06:10:14 +08:00
/*! \brief get QImage representing the given palette */
2015-07-11 18:56:02 +08:00
static QImage getPaletteKeyImage ( JKQTPMathImageColorPalette palette , int width , int height ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc palette
\ see see palette for details */
2019-04-22 19:27:50 +08:00
void setPalette ( const JKQTPMathImageColorPalette & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc palette
\ see see palette for details */
2019-04-22 19:27:50 +08:00
JKQTPMathImageColorPalette getPalette ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMinFailAction
\ see see rangeMinFailAction for details */
2019-04-22 19:27:50 +08:00
void setRangeMinFailAction ( const JKQTPMathImageColorRangeFailAction & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMinFailAction
\ see see rangeMinFailAction for details */
2019-04-22 19:27:50 +08:00
JKQTPMathImageColorRangeFailAction getActionRangeMinFail ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMaxFailAction
\ see see rangeMaxFailAction for details */
2019-04-22 19:27:50 +08:00
void setRangeMaxFailAction ( const JKQTPMathImageColorRangeFailAction & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMaxFailAction
\ see see rangeMaxFailAction for details */
2019-04-22 19:27:50 +08:00
JKQTPMathImageColorRangeFailAction getActionRangeMaxFail ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMinFailColor
\ see see rangeMinFailColor for details */
2019-04-22 19:27:50 +08:00
void setRangeMinFailColor ( const QColor & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMinFailColor
\ see see rangeMinFailColor for details */
2019-04-22 19:27:50 +08:00
QColor getRangeMinFailColor ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMaxFailColor
\ see see rangeMaxFailColor for details */
2019-04-22 19:27:50 +08:00
void setRangeMaxFailColor ( const QColor & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc rangeMaxFailColor
\ see see rangeMaxFailColor for details */
2019-04-22 19:27:50 +08:00
QColor getRangeMaxFailColor ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc nanColor
\ see see nanColor for details */
2019-04-22 19:27:50 +08:00
void setNanColor ( const QColor & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc nanColor
\ see see nanColor for details */
2019-04-22 19:27:50 +08:00
QColor getNanColor ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc infColor
\ see see infColor for details */
2019-04-22 19:27:50 +08:00
void setInfColor ( const QColor & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc infColor
\ see see infColor for details */
2019-04-22 19:27:50 +08:00
QColor getInfColor ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc showColorBar
\ see see showColorBar for details */
2019-04-22 19:27:50 +08:00
void setShowColorBar ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc showColorBar
\ see see showColorBar for details */
2019-04-22 19:27:50 +08:00
bool getShowColorBar ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarWidth
\ see see colorBarWidth for details */
2019-04-22 19:27:50 +08:00
void setColorBarWidth ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarWidth
\ see see colorBarWidth for details */
2019-04-22 19:27:50 +08:00
double getColorBarWidth ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarModifiedWidth
\ see see colorBarModifiedWidth for details */
2019-04-22 19:27:50 +08:00
void setColorBarModifiedWidth ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarModifiedWidth
\ see see colorBarModifiedWidth for details */
2019-04-22 19:27:50 +08:00
double getColorBarModifiedWidth ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarOffset
\ see see colorBarOffset for details */
2019-04-22 19:27:50 +08:00
void setColorBarOffset ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarOffset
\ see see colorBarOffset for details */
2019-04-22 19:27:50 +08:00
double getColorBarOffset ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarRelativeHeight
\ see see colorBarRelativeHeight for details */
2019-04-22 19:27:50 +08:00
void setColorBarRelativeHeight ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarRelativeHeight
\ see see colorBarRelativeHeight for details */
2019-04-22 19:27:50 +08:00
double getColorBarRelativeHeight ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageMin
\ see see imageMin for details */
2019-04-22 19:27:50 +08:00
void setImageMin ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageMin
\ see see imageMin for details */
2019-04-22 19:27:50 +08:00
double getImageMin ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageMax
\ see see imageMax for details */
2019-04-22 19:27:50 +08:00
void setImageMax ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageMax
\ see see imageMax for details */
2019-04-22 19:27:50 +08:00
double getImageMax ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc autoImageRange
\ see see autoImageRange for details */
2019-04-22 19:27:50 +08:00
void setAutoImageRange ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc autoImageRange
\ see see autoImageRange for details */
2019-04-22 19:27:50 +08:00
bool getAutoImageRange ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageName
\ see see imageName for details */
2019-04-22 19:27:50 +08:00
void setImageName ( const QString & __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageName
\ see see imageName for details */
2019-04-22 19:27:50 +08:00
QString getImageName ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageNameFontSize
\ see see imageNameFontSize for details */
2019-04-22 19:27:50 +08:00
void setImageNameFontSize ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageNameFontSize
\ see see imageNameFontSize for details */
2019-04-22 19:27:50 +08:00
double getImageNameFontSize ( ) const ;
2019-01-26 20:00:40 +08:00
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
2019-04-22 19:27:50 +08:00
JKQTPVerticalIndependentAxis * getColorBarRightAxis ( ) ;
2019-01-26 20:00:40 +08:00
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
2019-04-22 19:27:50 +08:00
JKQTPHorizontalIndependentAxis * getColorBarTopAxis ( ) ;
2019-01-26 20:00:40 +08:00
/*! \brief returns the property modifierColorBarTopAxis ( \copybrief modifierColorBarTopAxis ). \details Description of the parameter modifierColorBarTopAxis is: <BLOCKQUOTE>\copydoc modifierColorBarTopAxis </BLOCKQUOTE>. \see modifierColorBarTopAxis for more information */
2019-04-22 19:27:50 +08:00
JKQTPVerticalIndependentAxis * getModifierColorBarTopAxis ( ) ;
2019-01-26 20:00:40 +08:00
/*! \brief returns the property modifierColorBarRightAxis ( \copybrief modifierColorBarRightAxis ). \details Description of the parameter modifierColorBarRightAxis is: <BLOCKQUOTE>\copydoc modifierColorBarRightAxis </BLOCKQUOTE>. \see modifierColorBarRightAxis for more information */
2019-04-22 19:27:50 +08:00
JKQTPHorizontalIndependentAxis * getModifierColorBarRightAxis ( ) ;
2019-02-08 00:24:46 +08:00
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
2019-04-22 19:27:50 +08:00
const JKQTPVerticalIndependentAxis * getColorBarRightAxis ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
2019-04-22 19:27:50 +08:00
const JKQTPHorizontalIndependentAxis * getColorBarTopAxis ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \brief returns the property modifierColorBarTopAxis ( \copybrief modifierColorBarTopAxis ). \details Description of the parameter modifierColorBarTopAxis is: <BLOCKQUOTE>\copydoc modifierColorBarTopAxis </BLOCKQUOTE>. \see modifierColorBarTopAxis for more information */
2019-04-22 19:27:50 +08:00
const JKQTPVerticalIndependentAxis * getModifierColorBarTopAxis ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \brief returns the property modifierColorBarRightAxis ( \copybrief modifierColorBarRightAxis ). \details Description of the parameter modifierColorBarRightAxis is: <BLOCKQUOTE>\copydoc modifierColorBarRightAxis </BLOCKQUOTE>. \see modifierColorBarRightAxis for more information */
2019-04-22 19:27:50 +08:00
const JKQTPHorizontalIndependentAxis * getModifierColorBarRightAxis ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarTopVisible
\ see see colorBarTopVisible for details */
2019-04-22 19:27:50 +08:00
void setColorBarTopVisible ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarTopVisible
\ see see colorBarTopVisible for details */
2019-04-22 19:27:50 +08:00
bool getColorBarTopVisible ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarRightVisible
\ see see colorBarRightVisible for details */
2019-04-22 19:27:50 +08:00
void setColorBarRightVisible ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc colorBarRightVisible
\ see see colorBarRightVisible for details */
2019-04-22 19:27:50 +08:00
bool getColorBarRightVisible ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc autoModifierRange
\ see see autoModifierRange for details */
2019-04-22 19:27:50 +08:00
void setAutoModifierRange ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc autoModifierRange
\ see see autoModifierRange for details */
2019-04-22 19:27:50 +08:00
bool getAutoModifierRange ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierMin
\ see see modifierMin for details */
2019-04-22 19:27:50 +08:00
void setModifierMin ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierMin
\ see see modifierMin for details */
2019-04-22 19:27:50 +08:00
double getModifierMin ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierMax
\ see see modifierMax for details */
2019-04-22 19:27:50 +08:00
void setModifierMax ( double __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierMax
\ see see modifierMax for details */
2019-04-22 19:27:50 +08:00
double getModifierMax ( ) const ;
2015-07-11 18:56:02 +08:00
2019-01-26 20:00:40 +08:00
void setPalette ( int pal ) ;
2015-07-11 18:56:02 +08:00
/*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\ note If you want to draw outside , then you ' ll also have to implement drawOutside ( )
*/
2018-12-28 05:52:00 +08:00
virtual void getOutsideSize ( JKQTPEnhancedPainter & painter , int & leftSpace , int & rightSpace , int & topSpace , int & bottomSpace ) override ;
2015-07-11 18:56:02 +08:00
/*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\ note If you want to draw outside , then you ' ll also have to implement getOutsideSize ( ) , so enough space is reserved
The four value supplied tell the method where to draw ( inside one of the rectangles ) .
*/
2018-12-28 05:52:00 +08:00
virtual void drawOutside ( JKQTPEnhancedPainter & painter , QRect leftSpace , QRect rightSpace , QRect topSpace , QRect bottomSpace ) override ;
2015-07-11 18:56:02 +08:00
2015-08-05 20:27:09 +08:00
/*! \brief returns a QImage, which contains the plaette drawn outside the plot. \a steps is the number of data-setps (and the size of the output image) used for the palette image. */
2019-01-26 20:00:40 +08:00
virtual QImage drawOutsidePalette ( uint8_t steps = 200 ) ;
2015-08-05 20:27:09 +08:00
2015-07-11 18:56:02 +08:00
/*! \brief return the plotted image only as a QImage */
virtual QImage drawImage ( ) ;
/** \brief determine min/max data value of the image */
2018-12-28 05:52:00 +08:00
virtual void getDataMinMax ( double & imin , double & imax ) override ;
2015-07-11 18:56:02 +08:00
/** \brief determine min/max data value of the image */
2018-12-28 05:52:00 +08:00
virtual void getModifierMinMax ( double & imin , double & imax ) override ;
2015-07-11 18:56:02 +08:00
/** \brief return the value (raw data!) of the contained image at the given coordinate */
double getValueAt ( double x , double y ) ;
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2015-07-11 18:56:02 +08:00
protected :
2015-08-02 19:36:54 +08:00
void initJKQTPMathImage ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief top color bar visible */
bool colorBarTopVisible ;
/** \brief right color bar visible */
bool colorBarRightVisible ;
/** \brief name of the image displayed above color bar (may contain LaTeX markup!) */
QString imageName ;
/** \brief font size in points when displaying imageName */
double imageNameFontSize ;
/** \brief palette for plotting an image */
JKQTPMathImageColorPalette palette ;
/** \brief indicate whether to display a color bar */
bool showColorBar ;
2019-02-08 00:24:46 +08:00
/** \brief width of the color bar [pt] */
double colorBarWidth ;
2015-07-11 18:56:02 +08:00
/** \brief width of the color bar when modifier is on */
2019-02-08 00:24:46 +08:00
double colorBarModifiedWidth ;
2015-07-11 18:56:02 +08:00
/** \brief height of the color bar, as multiple of plotHeight */
double colorBarRelativeHeight ;
/** \brief indicates whether to estimate min/max of the image automatically */
bool autoImageRange ;
/** \brief image value range minimum */
double imageMin ;
/** \brief image value range maximum */
double imageMax ;
/** \brief indicates whether to estimate min/max of the modifier automatically */
bool autoModifierRange ;
/** \brief modifier value range minimum */
double modifierMin ;
/** \brief modifier value range maximum */
double modifierMax ;
2019-02-08 00:24:46 +08:00
/** \brief offset between outside space border and color bar [pt] */
double colorBarOffset ;
2015-07-11 18:56:02 +08:00
/** \brief which action to take if a color is below \a imageMin and \a autoImageRange \c ==false */
JKQTPMathImageColorRangeFailAction rangeMinFailAction ;
/** \brief which action to take if a color is above \a imageMax and \a autoImageRange \c ==false */
JKQTPMathImageColorRangeFailAction rangeMaxFailAction ;
/** \brief color to use for some settings of \a rangeMinFailAction */
QColor rangeMinFailColor ;
/** \brief color to use for some settings of \a rangeMaxFailAction */
QColor rangeMaxFailColor ;
/** \brief color to use for a not-a-number value */
QColor nanColor ;
/** \brief color to use for an infinity value */
QColor infColor ;
/** \brief object used for color bar axes
*
* \ note this axis has some kind of a special role . It is used to format color bar axes
*/
2019-01-20 17:49:29 +08:00
JKQTPVerticalIndependentAxis * colorBarRightAxis ;
JKQTPHorizontalIndependentAxis * colorBarTopAxis ;
JKQTPVerticalIndependentAxis * modifierColorBarTopAxis ;
JKQTPHorizontalIndependentAxis * modifierColorBarRightAxis ;
2015-07-11 18:56:02 +08:00
protected :
QAction * actSaveImage ;
QAction * actCopyImage ;
2015-08-05 20:27:09 +08:00
QAction * actSavePalette ;
QAction * actCopyPalette ;
2015-07-11 18:56:02 +08:00
public :
2019-01-26 20:00:40 +08:00
virtual void setTitle ( const QString & title ) override ;
2015-07-11 18:56:02 +08:00
public slots :
void saveImagePlotAsImage ( const QString & filename = QString ( " " ) , const QByteArray & outputFormat = QByteArray ( ) ) ;
void copyImagePlotAsImage ( ) ;
2015-08-05 20:27:09 +08:00
void saveColorbarPlotAsImage ( const QString & filename = QString ( " " ) , const QByteArray & outputFormat = QByteArray ( ) ) ;
void copyColorbarPlotAsImage ( ) ;
2015-07-11 18:56:02 +08:00
} ;
/*! \brief class to plot an image from an 2-dimensional array of values stored in a column of the datastore
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_imagelots_elements
\ image html jkqtplotter_simpletest_imageplot . png
\ image html jkqtplotter_simpletest_imageplot_modifier . png
\ image html jkqtplotter_simpletest_imageplot__smallscaletransparent . png
2015-07-11 18:56:02 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPColumnMathImage : public JKQTPMathImage {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPColumnMathImage ( JKQTBasePlotter * parent = nullptr ) ;
2019-01-26 19:28:44 +08:00
JKQTPColumnMathImage ( double x , double y , double width , double height , int Nx , int Ny , JKQTBasePlotter * parent = nullptr ) ;
JKQTPColumnMathImage ( double x , double y , double width , double height , int imageColumn , int Nx , int Ny , JKQTPMathImageColorPalette palette = JKQTPMathImageGRAY , JKQTBasePlotter * parent = nullptr ) ;
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPColumnMathImage ( JKQTPlotter * parent ) ;
2019-01-26 19:28:44 +08:00
JKQTPColumnMathImage ( double x , double y , double width , double height , int Nx , int Ny , JKQTPlotter * parent ) ;
JKQTPColumnMathImage ( double x , double y , double width , double height , int imageColumn , int Nx , int Ny , JKQTPMathImageColorPalette palette , JKQTPlotter * parent ) ;
JKQTPColumnMathImage ( double x , double y , double width , double height , int imageColumn , int Nx , int Ny , JKQTPlotter * parent ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \copydoc imageColumn
\ see see imageColumn for details */
2019-04-22 19:27:50 +08:00
virtual void setImageColumn ( int __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc imageColumn
\ see see imageColumn for details */
2019-04-22 19:27:50 +08:00
int getImageColumn ( ) const ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierColumn
\ see see modifierColumn for details */
2019-04-22 19:27:50 +08:00
virtual void setModifierColumn ( int __value ) ;
2019-02-08 00:24:46 +08:00
/*! \copydoc modifierColumn
\ see see modifierColumn for details */
2019-04-22 19:27:50 +08:00
int getModifierColumn ( ) const ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \copydoc JKQTPGraph::usesColumn() */
2018-12-28 05:52:00 +08:00
virtual bool usesColumn ( int c ) const override ;
2015-07-11 18:56:02 +08:00
protected :
/** \brief column containing the displayed image */
int imageColumn ;
/** \brief column containing the modifier image */
int modifierColumn ;
2018-12-28 05:52:00 +08:00
virtual void ensureImageData ( ) override ;
2015-07-11 18:56:02 +08:00
} ;
2018-12-19 00:13:18 +08:00
# endif // jkqtpgraphsimage_H
2015-07-11 18:56:02 +08:00