2015-07-11 18:56:02 +08:00
/*
2018-11-25 21:53:26 +08:00
Copyright ( c ) 2008 - 2018 Jan W . Krieger ( < jan @ jkrieger . de > )
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
the Free Software Foundation , either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU Lesser General Public License ( LGPL ) for more details .
You should have received a copy of the GNU Lesser General Public License ( LGPL )
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef JKQTPPARSEDFUNCTIONELEMENTS_H
# define JKQTPPARSEDFUNCTIONELEMENTS_H
# include <QString>
# include <QPainter>
# include <QPair>
2018-11-26 03:25:44 +08:00
# include "jkqtplottertools/jkqtptools.h"
# include "jkqtplottertools/jkqtpmathparser.h"
# include "jkqtplottertools/jkqtp_imexport.h"
# include "jkqtplotter/jkqtpevaluatedfunctionelements.h"
2015-07-11 18:56:02 +08:00
// forward declarations
class JKQtBasePlotter ;
2015-08-02 19:36:54 +08:00
class JKQtPlotter ;
2015-07-11 18:56:02 +08:00
struct JKQTPxParsedFunctionLineGraphFunctionData {
JKQTPMathParser * parser ;
JKQTPMathParser : : jkmpNode * node ;
int varcount ;
} ;
/*! \brief This implements line plots where the data is taken from a user supplied function \f$ y=f(x) \f$ The function is defined as a string and parsed by JKMathParser
\ ingroup jkqtplotter_plots
Additional function parameters may be given in the vector parameters . They are accessible in the function as \ c p1 , \ c p2 , \ c p3 , . . .
Parameters may also be given from a data column . Then first the params from the column and the the parameters from the vector are numbered .
*/
class LIB_EXPORT JKQTPxParsedFunctionLineGraph : public JKQTPxFunctionLineGraph {
Q_OBJECT
public :
/** \brief class constructor */
2018-11-18 18:59:30 +08:00
JKQTPxParsedFunctionLineGraph ( JKQtBasePlotter * parent = nullptr ) ;
2015-08-02 19:36:54 +08:00
/** \brief class constructor */
JKQTPxParsedFunctionLineGraph ( JKQtPlotter * parent ) ;
2015-07-11 18:56:02 +08:00
/** \brief class destructor */
2015-08-02 19:36:54 +08:00
virtual ~ JKQTPxParsedFunctionLineGraph ( ) ;
2015-07-11 18:56:02 +08:00
JKQTPGET_SET_MACRO ( QList < double > , parameters )
JKQTPGET_SET_MACRO ( QString , function )
JKQTPGET_SET_MACRO ( int , parameterColumn )
JKQTPGET_SET_MACRO ( QList < double > , errorParameters )
JKQTPGET_SET_MACRO ( QString , errorFunction )
JKQTPGET_SET_MACRO ( int , errorParameterColumn )
protected :
/** \brief which plot style to use from the parent plotter (via JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::getNextStyle() ) */
QString function ;
QList < double > parameters ;
JKQTPxParsedFunctionLineGraphFunctionData fdata ;
int parameterColumn ;
QString errorFunction ;
QList < double > errorParameters ;
JKQTPxParsedFunctionLineGraphFunctionData efdata ;
int errorParameterColumn ;
JKQTPGET_SET_MACRO_I ( jkqtpPlotFunctionType , plotFunction , clearData ( ) )
JKQTPGET_SET_MACRO_I ( void * , params , clearData ( ) )
JKQTPGET_SET_MACRO ( jkqtpPlotFunctionType , errorPlotFunction )
JKQTPGET_SET_MACRO ( void * , errorParams )
/** \brief fill the data array with data from the function plotFunction */
virtual void createPlotData ( bool collectParams = true ) ;
} ;
# endif // JKQTPPARSEDFUNCTIONELEMENTS_H