mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
corrected documentation
This commit is contained in:
parent
bf30964f0f
commit
306436f770
1
.gitignore
vendored
1
.gitignore
vendored
@ -89,3 +89,4 @@ Thumbs.db
|
|||||||
moc_predefs.h
|
moc_predefs.h
|
||||||
/lib/jkqtplotter/*.TMP
|
/lib/jkqtplotter/*.TMP
|
||||||
/doc/doxygen_log.txt
|
/doc/doxygen_log.txt
|
||||||
|
/doc/*.tmp
|
||||||
|
@ -122,7 +122,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
<tr><th> Screenshot <th> Description <th> Notes
|
<tr><th> Screenshot <th> Description <th> Notes
|
||||||
<tr><td> \image html jkqtmathtext_simpletest_small.png
|
<tr><td> \image html jkqtmathtext_simpletest_small.png
|
||||||
<td> \subpage JKQTmathTextSimpleExample
|
<td> \subpage JKQTmathTextSimpleExample
|
||||||
<td> JKQTMathText<br>render LaTeX markup (Schrödinger's equation)
|
<td> JKQTmathText<br>render LaTeX markup (Schrödinger's equation)
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
\defgroup jkqtmathtext JKQtMathText LaTeX-Renderer for Qt
|
\defgroup jkqtmathtext JKQTmathText LaTeX-Renderer for Qt
|
||||||
|
|
||||||
This group contains JKQtMathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
|
This group contains JKQTmathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||||
labels in JKQtPlotter, but can be used independently. The class does not depend on any library,
|
labels in JKQtPlotter, but can be used independently. The class does not depend on any library,
|
||||||
except Qt. In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
except Qt. In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
||||||
on an installed LaTeX for the rendering!
|
on an installed LaTeX for the rendering!
|
||||||
|
@ -13,7 +13,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
|
|||||||
- high-quality plotting
|
- high-quality plotting
|
||||||
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
||||||
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
||||||
- integrated LaTeX parser/renderer JKQtMathText for axis labels, ticks, notes ...
|
- integrated LaTeX parser/renderer JKQTmathText for axis labels, ticks, notes ...
|
||||||
- extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)
|
- extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)
|
||||||
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
|
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
|
||||||
- highly customizable look and feel
|
- highly customizable look and feel
|
||||||
@ -39,7 +39,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
|
|||||||
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
|
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
|
||||||
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
|
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
|
||||||
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
|
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
|
||||||
- integrated LaTeX parser/renderer JKQtMathText:
|
- integrated LaTeX parser/renderer JKQTmathText:
|
||||||
- pure C++
|
- pure C++
|
||||||
- no dependencies in particular no installed LaTeX required
|
- no dependencies in particular no installed LaTeX required
|
||||||
- can be used independently of JKQtPlotter
|
- can be used independently of JKQtPlotter
|
||||||
|
@ -54,6 +54,6 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
|
|
||||||
| Screenshot | Description | Notes |
|
| Screenshot | Description | Notes |
|
||||||
|:-------------:| ------------- | ------------- |
|
|:-------------:| ------------- | ------------- |
|
||||||
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTMathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
|
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTmathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="0" colspan="2">
|
<item row="15" column="0" colspan="2">
|
||||||
<widget class="JKQTMathTextLabel" name="labMath">
|
<widget class="JKQTmathTextLabel" name="labMath">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>left(left[sqrt{2picdotint_{-infty}^infty f(x);mathrm{d}x}right]right) </string>
|
<string>left(left[sqrt{2picdotint_{-infty}^infty f(x);mathrm{d}x}right]right) </string>
|
||||||
</property>
|
</property>
|
||||||
@ -418,7 +418,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>JKQTMathTextLabel</class>
|
<class>JKQTmathTextLabel</class>
|
||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>jkqtmathtext/jkqtmathtext.h</header>
|
<header>jkqtmathtext/jkqtmathtext.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
@ -4,9 +4,9 @@ This directory contains all files that belong to the JKQtPlotter library (includ
|
|||||||
|
|
||||||
### simply include all necessary files
|
### simply include all necessary files
|
||||||
If you use QMake and simply want to include all necessary files into your project, include one of these `PRI`-files into your QMake Project:
|
If you use QMake and simply want to include all necessary files into your project, include one of these `PRI`-files into your QMake Project:
|
||||||
- `jkqtplotter.pri` contains all files in this library, including `JKQtFastPlotter` and `JKQtMathText`
|
- `jkqtplotter.pri` contains all files in this library, including `JKQtFastPlotter` and `JKQTmathText`
|
||||||
- `jkqtfastplotter.pri` contains only those files from this directory which are necessary to build `JKQtFastPlotter`
|
- `jkqtfastplotter.pri` contains only those files from this directory which are necessary to build `JKQtFastPlotter`
|
||||||
- `jkqtmathtext.pri` contains only those files from this directory which are necessary to build `JKQtMathText`
|
- `jkqtmathtext.pri` contains only those files from this directory which are necessary to build `JKQTmathText`
|
||||||
|
|
||||||
### Build static libraries
|
### Build static libraries
|
||||||
In the directory [`../staticlib`](../staticlib) you will find several Project files that build a static library of the full JKQtPlotter (including JKQtFastPlotter and JKMathText), or of subsets of this library. You can then link against these libs in your project.
|
In the directory [`../staticlib`](../staticlib) you will find several Project files that build a static library of the full JKQtPlotter (including JKQtFastPlotter and JKMathText), or of subsets of this library. You can then link against these libs in your project.
|
||||||
|
@ -4208,7 +4208,7 @@ QString JKQTmathText::decorationToString(JKQTmathText::MTdecoration mode)
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextLabel::JKQTMathTextLabel(QWidget *parent):
|
JKQTmathTextLabel::JKQTmathTextLabel(QWidget *parent):
|
||||||
QLabel(parent)
|
QLabel(parent)
|
||||||
{
|
{
|
||||||
m_mathText=new JKQTmathText(this);
|
m_mathText=new JKQTmathText(this);
|
||||||
@ -4219,16 +4219,16 @@ JKQTMathTextLabel::JKQTMathTextLabel(QWidget *parent):
|
|||||||
buffer=QPixmap();
|
buffer=QPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextLabel::~JKQTMathTextLabel()
|
JKQTmathTextLabel::~JKQTmathTextLabel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTmathText *JKQTMathTextLabel::getMathText() const
|
JKQTmathText *JKQTmathTextLabel::getMathText() const
|
||||||
{
|
{
|
||||||
return m_mathText;
|
return m_mathText;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint)
|
void JKQTmathTextLabel::setMath(const QString &text, bool doRepaint)
|
||||||
{
|
{
|
||||||
if (text!=lastText || doRepaint){
|
if (text!=lastText || doRepaint){
|
||||||
lastText=text;
|
lastText=text;
|
||||||
@ -4239,7 +4239,7 @@ void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JKQTMathTextLabel::internalPaint()
|
void JKQTmathTextLabel::internalPaint()
|
||||||
{
|
{
|
||||||
//return;
|
//return;
|
||||||
//qDebug()<<"internalPaint "<<lastText<<repaintDo;
|
//qDebug()<<"internalPaint "<<lastText<<repaintDo;
|
||||||
@ -4249,7 +4249,7 @@ void JKQTMathTextLabel::internalPaint()
|
|||||||
repaintDo=false;
|
repaintDo=false;
|
||||||
//qDebug()<<"internalPaint(): parse "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
//qDebug()<<"internalPaint(): parse "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
||||||
if (!m_mathText->parse(lastText)) {
|
if (!m_mathText->parse(lastText)) {
|
||||||
qDebug()<<"JKQTMathTextLabel::internalPaint(): parse '"<<lastText<<"': "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
qDebug()<<"JKQTmathTextLabel::internalPaint(): parse '"<<lastText<<"': "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(1000,100);
|
if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(1000,100);
|
||||||
@ -4283,7 +4283,7 @@ void JKQTMathTextLabel::internalPaint()
|
|||||||
//qDebug()<<"internalPaint(): DONE";
|
//qDebug()<<"internalPaint(): DONE";
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTMathTextLabel::paintEvent(QPaintEvent *event)
|
void JKQTmathTextLabel::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
//QLabel::paintEvent(event);
|
//QLabel::paintEvent(event);
|
||||||
//return;
|
//return;
|
||||||
@ -4364,7 +4364,7 @@ QString JKQTmathText::MTplainTextNode::textTransform(const QString &text, JKQTma
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initJKQtMathTextResources()
|
void initJKQTmathTextResources()
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(xits);
|
Q_INIT_RESOURCE(xits);
|
||||||
}
|
}
|
||||||
|
@ -50,24 +50,24 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** \brief initialized Qt-ressources necessary for JKQtMathText
|
/** \brief initialized Qt-ressources necessary for JKQTmathText
|
||||||
* \ingroup jkqtmathtext
|
* \ingroup jkqtmathtext
|
||||||
*/
|
*/
|
||||||
LIB_EXPORT void initJKQtMathTextResources();
|
LIB_EXPORT void initJKQTmathTextResources();
|
||||||
|
|
||||||
/*! \brief this class parses a LaTeX string and can then draw the contained text/equation onto a QPainter
|
/*! \brief this class parses a LaTeX string and can then draw the contained text/equation onto a QPainter
|
||||||
\ingroup jkqtmathtext
|
\ingroup jkqtmathtext
|
||||||
|
|
||||||
|
|
||||||
JKQtMathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
|
JKQTmathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||||
labels in JKQtPlotter/JKQtBasePlotter, but can be used independently.
|
labels in JKQtPlotter/JKQtBasePlotter, but can be used independently.
|
||||||
The class does not depend on any library, except Qt.
|
The class does not depend on any library, except Qt.
|
||||||
In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
||||||
on an installed LaTeX for the rendering!
|
on an installed LaTeX for the rendering!
|
||||||
|
|
||||||
\section JKQtMathTextUsage Usage
|
\section JKQTmathTextUsage Usage
|
||||||
\subsection JKQtMathTextUsageDirect Direct Usage
|
\subsection JKQTmathTextUsageDirect Direct Usage
|
||||||
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
|
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
|
||||||
\code
|
\code
|
||||||
// create a JKQTmathText object.
|
// create a JKQTmathText object.
|
||||||
JKQTmathText mathText;
|
JKQTmathText mathText;
|
||||||
@ -86,38 +86,38 @@ LIB_EXPORT void initJKQtMathTextResources();
|
|||||||
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
|
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
|
||||||
painter.end();
|
painter.end();
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\subsection JKQtMathTextSizing Determining the size of an equation
|
\subsection JKQTmathTextSizing Determining the size of an equation
|
||||||
|
|
||||||
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in <a href="http://doc.qt.io/qt-5/qfontmetrics.html">QFontMetrics</a> and <a href="http://doc.qt.io/qt-5/qfontmetricsf.html">QFontMetricsF</a>):
|
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in <a href="http://doc.qt.io/qt-5/qfontmetrics.html">QFontMetrics</a> and <a href="http://doc.qt.io/qt-5/qfontmetricsf.html">QFontMetricsF</a>):
|
||||||
- getSizeDetail()
|
- getSizeDetail()
|
||||||
- getSize()
|
- getSize()
|
||||||
- getAscent(), getDescent()
|
- getAscent(), getDescent()
|
||||||
.
|
.
|
||||||
|
|
||||||
\subsection JKQtMathTextErrorHandling Error Handling
|
\subsection JKQTmathTextErrorHandling Error Handling
|
||||||
|
|
||||||
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors.
|
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors.
|
||||||
Nevertheless, several errors are detected while parsing. You can get a list of error messages using get_error_list() after calling parse().
|
Nevertheless, several errors are detected while parsing. You can get a list of error messages using get_error_list() after calling parse().
|
||||||
Also parse() will return \c false if an error occured while parsing.
|
Also parse() will return \c false if an error occured while parsing.
|
||||||
|
|
||||||
|
|
||||||
\subsection JKQtMathTextUsageQLabel Usage within a QLabel class JKQTMathTextLabel
|
\subsection JKQTmathTextUsageQLabel Usage within a QLabel class JKQTmathTextLabel
|
||||||
|
|
||||||
Finally, there is also a QLabel-derived class JKQTMathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
|
Finally, there is also a QLabel-derived class JKQTmathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
|
||||||
|
|
||||||
\see JKQTMathTextLabel
|
\see JKQTmathTextLabel
|
||||||
|
|
||||||
|
|
||||||
\section JKQtMathTextExamples Examples
|
\section JKQTmathTextExamples Examples
|
||||||
|
|
||||||
Examples for the usage of this class can be found here:
|
Examples for the usage of this class can be found here:
|
||||||
- \ref JKQTmathTextSimpleExample
|
- \ref JKQTmathTextSimpleExample
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
\section JKQtMathTextSuppoertedLaTeX Supported LaTeX Subset
|
\section JKQTmathTextSuppoertedLaTeX Supported LaTeX Subset
|
||||||
|
|
||||||
The supported LaTeX subset is listes below. Please note that some commands are used differently than in actual LaTeX.
|
The supported LaTeX subset is listes below. Please note that some commands are used differently than in actual LaTeX.
|
||||||
For example \c \\bf is just a renamed form of \c \\textbf and used as \c \\bf{...} and NOT as \c {\\bf...} .
|
For example \c \\bf is just a renamed form of \c \\textbf and used as \c \\bf{...} and NOT as \c {\\bf...} .
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ LIB_EXPORT void initJKQtMathTextResources();
|
|||||||
- \c \\left~ \c \\right~ : ceil braces |~ ~|
|
- \c \\left~ \c \\right~ : ceil braces |~ ~|
|
||||||
.
|
.
|
||||||
|
|
||||||
\section JKQtMathTextSuppoertedFonts Font Handling
|
\section JKQTmathTextSuppoertedFonts Font Handling
|
||||||
|
|
||||||
Several fonts are defined as properties to the class:
|
Several fonts are defined as properties to the class:
|
||||||
- A "roman" font used as the standard font ( set_fontRoman() in math-mode set_fontMathRoman() )
|
- A "roman" font used as the standard font ( set_fontRoman() in math-mode set_fontMathRoman() )
|
||||||
- A "sans-serif" font which may be activated with \c \\sf ... ( set_fontSans() in math-mode set_fontMathSans() )
|
- A "sans-serif" font which may be activated with \c \\sf ... ( set_fontSans() in math-mode set_fontMathSans() )
|
||||||
@ -166,26 +166,26 @@ LIB_EXPORT void initJKQtMathTextResources();
|
|||||||
- A "blackboard" font used to display double stroked characters (set_fontBlackboard() )
|
- A "blackboard" font used to display double stroked characters (set_fontBlackboard() )
|
||||||
- A "caligraphic" font used to display caligraphic characters ( set_fontCaligraphic() )
|
- A "caligraphic" font used to display caligraphic characters ( set_fontCaligraphic() )
|
||||||
.
|
.
|
||||||
|
|
||||||
These fonts are generic font classes, which font is actually used can be configured in JKQtMathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
|
These fonts are generic font classes, which font is actually used can be configured in JKQTmathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
|
||||||
- useSTIX() use the STIX fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode<br>\image html jkqtmathparser_stix.png
|
- useSTIX() use the STIX fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode<br>\image html jkqtmathparser_stix.png
|
||||||
- useXITS() use the XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode. These are included by default in this library and also activated by default.<br>\image html jkqtmathparser_xits.png
|
- useXITS() use the XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode. These are included by default in this library and also activated by default.<br>\image html jkqtmathparser_xits.png
|
||||||
- useASANA() use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode<br>\image html jkqtmathparser_asana.png
|
- useASANA() use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode<br>\image html jkqtmathparser_asana.png
|
||||||
- useAnyUnicode() use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results.<br>using "Times New Roman": \image html jkqtmathparser_timesnewroman.png
|
- useAnyUnicode() use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results.<br>using "Times New Roman": \image html jkqtmathparser_timesnewroman.png
|
||||||
<br>using "Arial": \image html jkqtmathparser_arial.png
|
<br>using "Arial": \image html jkqtmathparser_arial.png
|
||||||
<br>using "Courier New": \image html \image html jkqtmathparser_couriernew.png
|
<br>using "Courier New": \image html jkqtmathparser_couriernew.png
|
||||||
<br>using "Comic Sans MS": \image html \image html jkqtmathparser_comicsans.png
|
<br>using "Comic Sans MS": \image html jkqtmathparser_comicsans.png
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
Math-mode is activated by enclosing your equation in \c $...$ or \c \\[...\\] . This mode is optimized for mathematical equations. Here is an example of the difference:
|
Math-mode is activated by enclosing your equation in \c $...$ or \c \\[...\\] . This mode is optimized for mathematical equations. Here is an example of the difference:
|
||||||
- <b>math-mode (XITS is used)</b> \c $...$: <br>\image html jkqtmathparser_schreq_mathmode.png
|
- <b>math-mode (XITS fonts are used, whitespaces are mostly not drawn directly, symbol spacing is different)</b> \c $...$: <br>\image html jkqtmathparser_schreq_mathmode.png
|
||||||
- <b>normal mode (Times new Roman is used)</b>: <br>\image html jkqtmathparser_schreq_normalmode.png
|
- <b>normal mode (Times new Roman is used, whitespaces are evaluated directly)</b>: <br>\image html jkqtmathparser_schreq_normalmode.png
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
\section JKQtMathTextToHTML Convert to HTML
|
\section JKQTmathTextToHTML Convert to HTML
|
||||||
|
|
||||||
The method toHtml() may be used to get a HTML representation of the LaTeX string, if possible (only for simple LaTeX equations!). Whether
|
The method toHtml() may be used to get a HTML representation of the LaTeX string, if possible (only for simple LaTeX equations!). Whether
|
||||||
the transformation was possible is returned as a call by value argument!
|
the transformation was possible is returned as a call by value argument!
|
||||||
|
|
||||||
@ -1467,18 +1467,18 @@ inline uint qHash(const JKQTmathText::tbrDataH& data) {
|
|||||||
|
|
||||||
\see JKQTmathText
|
\see JKQTmathText
|
||||||
*/
|
*/
|
||||||
class LIB_EXPORT JKQTMathTextLabel: public QLabel {
|
class LIB_EXPORT JKQTmathTextLabel: public QLabel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit JKQTMathTextLabel(QWidget* parent=nullptr);
|
explicit JKQTmathTextLabel(QWidget* parent=nullptr);
|
||||||
virtual ~JKQTMathTextLabel();
|
virtual ~JKQTmathTextLabel();
|
||||||
|
|
||||||
/** \brief returns the internal JKQTmathText instance used for drawing
|
/** \brief returns the internal JKQTmathText instance used for drawing
|
||||||
*
|
*
|
||||||
* Use this function to set the font, font size and other properties of the used renderer.
|
* Use this function to set the font, font size and other properties of the used renderer.
|
||||||
*/
|
*/
|
||||||
JKQTmathText* getMathText() const;
|
JKQTmathText* getMathText() const;
|
||||||
/** \brief set the equation to draw */
|
/** \brief set the equation to draw */
|
||||||
void setMath(const QString& text, bool doRepaint=true);
|
void setMath(const QString& text, bool doRepaint=true);
|
||||||
protected:
|
protected:
|
||||||
JKQTmathText* m_mathText;
|
JKQTmathText* m_mathText;
|
||||||
|
@ -67,7 +67,7 @@ static QList<JKQtBasePlotter::JKQTPSaveDataAdapter*> jkqtpSaveDataAdapters;
|
|||||||
void initJKQtBasePlotterResources()
|
void initJKQtBasePlotterResources()
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(jkqtpbaseplotter);
|
Q_INIT_RESOURCE(jkqtpbaseplotter);
|
||||||
initJKQtMathTextResources();
|
initJKQTmathTextResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQtBasePlotter::JKQtBasePlotter()
|
JKQtBasePlotter::JKQtBasePlotter()
|
||||||
|
@ -379,7 +379,7 @@ class LIB_EXPORT JKQTPgeoSymbol: public JKQTPplotObject {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTMathText
|
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTmathText
|
||||||
class in order to display LaTeX formulas.
|
class in order to display LaTeX formulas.
|
||||||
\ingroup jkqtplotter_geoplots
|
\ingroup jkqtplotter_geoplots
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
* \ingroup jkmp
|
* \ingroup jkmp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup jkmpErrorhandling error handling
|
* \defgroup jkmpErrorhandling error handling
|
||||||
* \ingroup jkmp
|
* \ingroup jkmp
|
||||||
*/
|
*/
|
||||||
@ -70,6 +70,8 @@
|
|||||||
/*! \brief A simple function parser to parse (build memory tree representation) and
|
/*! \brief A simple function parser to parse (build memory tree representation) and
|
||||||
evaluate simple mathematical expressions
|
evaluate simple mathematical expressions
|
||||||
\ingroup jkmp
|
\ingroup jkmp
|
||||||
|
|
||||||
|
|
||||||
This class implements a simple function parser which can parse
|
This class implements a simple function parser which can parse
|
||||||
mathematical expressions like <code> z=a*3+2.34^2*sin(pi*sqrt(x))</code> .
|
mathematical expressions like <code> z=a*3+2.34^2*sin(pi*sqrt(x))</code> .
|
||||||
More than one expression can be separated by semicolon ';'. The result of
|
More than one expression can be separated by semicolon ';'. The result of
|
||||||
@ -184,62 +186,62 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
\section jkmp_example Simple Example of Usage
|
\section jkmp_example Simple Example of Usage
|
||||||
\code
|
\code
|
||||||
try {
|
try {
|
||||||
jkMathParser mp; // instanciate
|
jkMathParser mp; // instanciate
|
||||||
jkmpNode* n;
|
jkmpNode* n;
|
||||||
jkmpResult r;
|
jkmpResult r;
|
||||||
// parse some numeric expression
|
// parse some numeric expression
|
||||||
n=mp.parse("pi^2+4*sin(65*pi/exp(3.45))");
|
n=mp.parse("pi^2+4*sin(65*pi/exp(3.45))");
|
||||||
r=n->evaluate();
|
r=n->evaluate();
|
||||||
cout<<r.num<<endl;
|
cout<<r.num<<endl;
|
||||||
//delete n;
|
//delete n;
|
||||||
|
|
||||||
// parse some boolean expression
|
// parse some boolean expression
|
||||||
n=mp.parse("true==false");
|
n=mp.parse("true==false");
|
||||||
r=n->evaluate();
|
r=n->evaluate();
|
||||||
if (r.type==jkmpBool) {
|
if (r.type==jkmpBool) {
|
||||||
if (r.boolean) cout<<"true";
|
if (r.boolean) cout<<"true";
|
||||||
else cout<<"false";
|
else cout<<"false";
|
||||||
}
|
}
|
||||||
if (r.type==jkmpDouble) cout<<r.num<<endl;
|
if (r.type==jkmpDouble) cout<<r.num<<endl;
|
||||||
if (r.type==jkmpString) cout<<r.str<<endl;
|
if (r.type==jkmpString) cout<<r.str<<endl;
|
||||||
delete n;
|
delete n;
|
||||||
|
|
||||||
// parse some string expression
|
// parse some string expression
|
||||||
n=mp.parse("var1='false'; var1+'true'");
|
n=mp.parse("var1='false'; var1+'true'");
|
||||||
r=n->evaluate();
|
r=n->evaluate();
|
||||||
if (r.type==jkmpString) cout<<r.str<<endl;
|
if (r.type==jkmpString) cout<<r.str<<endl;
|
||||||
delete n;
|
delete n;
|
||||||
} catch(std::exception& E) {
|
} catch(std::exception& E) {
|
||||||
cout<<"ERROR!!!\n "<<E.what()<<endl<<endl;
|
cout<<"ERROR!!!\n "<<E.what()<<endl<<endl;
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\section jkmp_errorhandling Error Handling
|
\section jkmp_errorhandling Error Handling
|
||||||
|
|
||||||
In the above example we use error handling by use of exception (default behauviour).
|
In the above example we use error handling by use of exception (default behauviour).
|
||||||
|
|
||||||
|
|
||||||
It is also possible to change the error handling from using exceptions to calling a specific
|
It is also possible to change the error handling from using exceptions to calling a specific
|
||||||
error handling function. This can be usefull in programs that don't support exceptions.
|
error handling function. This can be usefull in programs that don't support exceptions.
|
||||||
To do so, use this cod:
|
To do so, use this cod:
|
||||||
\code
|
\code
|
||||||
void error(std::string message) {
|
void error(std::string message) {
|
||||||
cout<<"error: "+message;
|
cout<<"error: "+message;
|
||||||
system("PAUSE");
|
system("PAUSE");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
jkMathParser mp;
|
jkMathParser mp;
|
||||||
mp.set_exception_function(error); // make error ahndler known
|
mp.set_exception_function(error); // make error ahndler known
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
*/
|
*/
|
||||||
class JKQTPMathParser
|
class JKQTPMathParser
|
||||||
{
|
{
|
||||||
@ -247,8 +249,8 @@ class JKQTPMathParser
|
|||||||
void* data;
|
void* data;
|
||||||
|
|
||||||
/** \brief the possible tokens that can be recognized by the tokenizer in jkMathParser::getToken()
|
/** \brief the possible tokens that can be recognized by the tokenizer in jkMathParser::getToken()
|
||||||
* \ingroup jkmpultil
|
* \ingroup jkmpultil
|
||||||
*/
|
*/
|
||||||
enum jkmpTokenType {
|
enum jkmpTokenType {
|
||||||
END, /*!< \brief end token */
|
END, /*!< \brief end token */
|
||||||
PRINT, /*!< \brief a semicolon ';' */
|
PRINT, /*!< \brief a semicolon ';' */
|
||||||
@ -285,7 +287,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
|
|
||||||
/** \brief internal names for logic operations
|
/** \brief internal names for logic operations
|
||||||
* \ingroup jkmpultil */
|
* \ingroup jkmpultil */
|
||||||
enum {
|
enum {
|
||||||
jkmpLOPand='a',
|
jkmpLOPand='a',
|
||||||
jkmpLOPor='o',
|
jkmpLOPor='o',
|
||||||
@ -297,7 +299,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
|
|
||||||
/** \brief jkmpCOMPdefs internal names for compare operations
|
/** \brief jkmpCOMPdefs internal names for compare operations
|
||||||
* \ingroup jkmpultil*/
|
* \ingroup jkmpultil*/
|
||||||
enum {
|
enum {
|
||||||
jkmpCOMPequal='=',
|
jkmpCOMPequal='=',
|
||||||
jkmpCOMPnequal='!',
|
jkmpCOMPnequal='!',
|
||||||
@ -311,7 +313,7 @@ class JKQTPMathParser
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/** \brief possible result types
|
/** \brief possible result types
|
||||||
* \ingroup jkmpultil
|
* \ingroup jkmpultil
|
||||||
*/
|
*/
|
||||||
enum jkmpResultType {jkmpDouble, /*!< \brief a floating-point number with double precision. This is also used to deal with integers */
|
enum jkmpResultType {jkmpDouble, /*!< \brief a floating-point number with double precision. This is also used to deal with integers */
|
||||||
jkmpString, /*!< \brief a string of characters */
|
jkmpString, /*!< \brief a string of characters */
|
||||||
@ -320,7 +322,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
|
|
||||||
/** \brief result of any expression
|
/** \brief result of any expression
|
||||||
* \ingroup jkmpultil*/
|
* \ingroup jkmpultil*/
|
||||||
struct jkmpResult {
|
struct jkmpResult {
|
||||||
jkmpResult();
|
jkmpResult();
|
||||||
|
|
||||||
@ -354,7 +356,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/** \brief This struct is for managing variables. Unlike jkmpResult this struct
|
/** \brief This struct is for managing variables. Unlike jkmpResult this struct
|
||||||
* only contains pointers to the data
|
* only contains pointers to the data
|
||||||
* \ingroup jkmpultil
|
* \ingroup jkmpultil
|
||||||
*/
|
*/
|
||||||
struct jkmpVariable {
|
struct jkmpVariable {
|
||||||
jkmpVariable();
|
jkmpVariable();
|
||||||
@ -366,7 +368,7 @@ class JKQTPMathParser
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** \brief This struct is for managing temporary variables. It is generally like jkmpVariable.
|
/** \brief This struct is for managing temporary variables. It is generally like jkmpVariable.
|
||||||
* \ingroup jkmpultil
|
* \ingroup jkmpultil
|
||||||
*/
|
*/
|
||||||
struct jkmpTempVariable {
|
struct jkmpTempVariable {
|
||||||
std::string name; /*!< \brief name of the variable */
|
std::string name; /*!< \brief name of the variable */
|
||||||
@ -418,7 +420,7 @@ class JKQTPMathParser
|
|||||||
/**
|
/**
|
||||||
* \brief This class is the abstract base class for nodes.
|
* \brief This class is the abstract base class for nodes.
|
||||||
* All allowed node types must inherit from jkmpNode
|
* All allowed node types must inherit from jkmpNode
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpNode {
|
class jkmpNode {
|
||||||
protected:
|
protected:
|
||||||
@ -448,7 +450,7 @@ class JKQTPMathParser
|
|||||||
/**
|
/**
|
||||||
* \brief This class represents a binary arithmetic operation:
|
* \brief This class represents a binary arithmetic operation:
|
||||||
* add (+), subtract (-), multiply (*), divide (/), a to the power of b (a^b)
|
* add (+), subtract (-), multiply (*), divide (/), a to the power of b (a^b)
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpBinaryArithmeticNode: public jkmpNode {
|
class jkmpBinaryArithmeticNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -473,7 +475,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a binary boolean operation: and, or, xor, nor, nand
|
* \brief This class represents a binary boolean operation: and, or, xor, nor, nand
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpBinaryBoolNode: public jkmpNode {
|
class jkmpBinaryBoolNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -498,7 +500,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a binary compare operation: !=, ==, >=, <=, >, <
|
* \brief This class represents a binary compare operation: !=, ==, >=, <=, >, <
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpCompareNode: public jkmpNode {
|
class jkmpCompareNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -523,7 +525,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a unary operations: ! (bool negation), - (arithmetic negation)
|
* \brief This class represents a unary operations: ! (bool negation), - (arithmetic negation)
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpUnaryNode: public jkmpNode {
|
class jkmpUnaryNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -547,7 +549,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a variable assignment (a = expression)
|
* \brief This class represents a variable assignment (a = expression)
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpVariableAssignNode: public jkmpNode {
|
class jkmpVariableAssignNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -572,7 +574,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a number, a string contant or a boolean contant (true/false)
|
* \brief This class represents a number, a string contant or a boolean contant (true/false)
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpConstantNode: public jkmpNode {
|
class jkmpConstantNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -591,7 +593,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a variable.
|
* \brief This class represents a variable.
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*/
|
*/
|
||||||
class jkmpVariableNode: public jkmpNode {
|
class jkmpVariableNode: public jkmpNode {
|
||||||
private:
|
private:
|
||||||
@ -610,7 +612,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents an arbitrary function.
|
* \brief This class represents an arbitrary function.
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*
|
*
|
||||||
* When initialized this class will get the function description that is
|
* When initialized this class will get the function description that is
|
||||||
* linked to the supplied function name from jkMathParser object. This
|
* linked to the supplied function name from jkMathParser object. This
|
||||||
@ -643,7 +645,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class represents a list of jkmpNode.
|
* \brief This class represents a list of jkmpNode.
|
||||||
* \ingroup jkmpNodes
|
* \ingroup jkmpNodes
|
||||||
*
|
*
|
||||||
* when evaluating the result will be the result of the last node in the list.
|
* when evaluating the result will be the result of the last node in the list.
|
||||||
*/
|
*/
|
||||||
@ -679,7 +681,7 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
|
|
||||||
/** \brief error handling: exceptions of the type of this class will be thrown if an error occurs
|
/** \brief error handling: exceptions of the type of this class will be thrown if an error occurs
|
||||||
* \ingroup jkmpErrorhandling
|
* \ingroup jkmpErrorhandling
|
||||||
*
|
*
|
||||||
* \attention If you do not want to use the exception handling which throws
|
* \attention If you do not want to use the exception handling which throws
|
||||||
* jkmpException exceptions, but want to write your own error handling, you should write your own
|
* jkmpException exceptions, but want to write your own error handling, you should write your own
|
||||||
@ -714,12 +716,12 @@ class JKQTPMathParser
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** \brief type for a custom error handler. This an alternative error handling
|
/** \brief type for a custom error handler. This an alternative error handling
|
||||||
* \ingroup jkmpErrorhandling */
|
* \ingroup jkmpErrorhandling */
|
||||||
typedef void (*jkmpexceptionf)(std::string);
|
typedef void (*jkmpexceptionf)(std::string);
|
||||||
|
|
||||||
|
|
||||||
/** \brief function that throws an exception or calls an error handler
|
/** \brief function that throws an exception or calls an error handler
|
||||||
* \ingroup jkmpErrorhandling */
|
* \ingroup jkmpErrorhandling */
|
||||||
inline void jkmpError(std::string st) {
|
inline void jkmpError(std::string st) {
|
||||||
if (jkmathparser_exception_function!=nullptr) {
|
if (jkmathparser_exception_function!=nullptr) {
|
||||||
jkmathparser_exception_function(st);
|
jkmathparser_exception_function(st);
|
||||||
@ -730,18 +732,18 @@ class JKQTPMathParser
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/** \brief if this is nullptr then an exception may be thrown otherwise this should point to an error handler that will be called.
|
/** \brief if this is nullptr then an exception may be thrown otherwise this should point to an error handler that will be called.
|
||||||
* \ingroup jkmpErrorhandling */
|
* \ingroup jkmpErrorhandling */
|
||||||
jkmpexceptionf jkmathparser_exception_function;
|
jkmpexceptionf jkmathparser_exception_function;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** \brief activate error handling by use of an exception function
|
/** \brief activate error handling by use of an exception function
|
||||||
* \ingroup jkmpErrorhandling */
|
* \ingroup jkmpErrorhandling */
|
||||||
inline void set_exception_function(jkmpexceptionf exception_function) {
|
inline void set_exception_function(jkmpexceptionf exception_function) {
|
||||||
jkmathparser_exception_function=exception_function;
|
jkmathparser_exception_function=exception_function;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief deactivate error handling by use of an exception function
|
/** \brief deactivate error handling by use of an exception function
|
||||||
* \ingroup jkmpErrorhandling */
|
* \ingroup jkmpErrorhandling */
|
||||||
inline void reset_exception_function() {
|
inline void reset_exception_function() {
|
||||||
jkmathparser_exception_function=nullptr;
|
jkmathparser_exception_function=nullptr;
|
||||||
}
|
}
|
||||||
@ -754,38 +756,38 @@ class JKQTPMathParser
|
|||||||
/** \brief return the current token as human-readable string */
|
/** \brief return the current token as human-readable string */
|
||||||
std::string currenttokentostring();
|
std::string currenttokentostring();
|
||||||
|
|
||||||
/** \brief Tokenizer: extract the next token from the input */
|
/** \brief Tokenizer: extract the next token from the input */
|
||||||
jkmpTokenType getToken();
|
jkmpTokenType getToken();
|
||||||
|
|
||||||
/** \brief return a delimited text, i.e. extract the texte between the delimiters <code>"</code> in: of <code>"Hallo!"</code>, i.e. returns <code> Hallo!</code>
|
/** \brief return a delimited text, i.e. extract the texte between the delimiters <code>"</code> in: of <code>"Hallo!"</code>, i.e. returns <code> Hallo!</code>
|
||||||
* This is used to parse string constants.
|
* This is used to parse string constants.
|
||||||
*
|
*
|
||||||
* This functions actually reads pascal style delimited string constants. So if you want to use the delimiter as part of the string you will have to
|
* This functions actually reads pascal style delimited string constants. So if you want to use the delimiter as part of the string you will have to
|
||||||
* write it as doubled character. So <code>'Jan''s Test'</code> stands for <code>Jan's Test</code>.
|
* write it as doubled character. So <code>'Jan''s Test'</code> stands for <code>Jan's Test</code>.
|
||||||
*/
|
*/
|
||||||
std::string readDelim(char delimiter);
|
std::string readDelim(char delimiter);
|
||||||
|
|
||||||
/** \brief recognizes an compExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
/** \brief recognizes an compExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
||||||
jkmpNode* compExpression(bool get);
|
jkmpNode* compExpression(bool get);
|
||||||
|
|
||||||
/** \brief recognizes a logicalExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
/** \brief recognizes a logicalExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
||||||
jkmpNode* logicalExpression(bool get);
|
jkmpNode* logicalExpression(bool get);
|
||||||
|
|
||||||
/** \brief recognizes a logicalTerm while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
/** \brief recognizes a logicalTerm while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
||||||
jkmpNode* logicalTerm(bool get);
|
jkmpNode* logicalTerm(bool get);
|
||||||
|
|
||||||
/** \brief recognizes a mathExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
/** \brief recognizes a mathExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
||||||
jkmpNode* mathExpression(bool get);
|
jkmpNode* mathExpression(bool get);
|
||||||
|
|
||||||
/** \brief recognizes a term while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
/** \brief recognizes a term while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
||||||
jkmpNode* mathTerm(bool get);
|
jkmpNode* mathTerm(bool get);
|
||||||
|
|
||||||
/** \brief recognizes a primary while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
/** \brief recognizes a primary while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
|
||||||
jkmpNode* primary(bool get);
|
jkmpNode* primary(bool get);
|
||||||
|
|
||||||
/** \brief this stream is used to read in the program. An object is created and assigned
|
/** \brief this stream is used to read in the program. An object is created and assigned
|
||||||
* (and destroyed) by the parse()-function */
|
* (and destroyed) by the parse()-function */
|
||||||
std::istringstream* program;
|
std::istringstream* program;
|
||||||
|
|
||||||
/** \brief vector containing all temporary variables */
|
/** \brief vector containing all temporary variables */
|
||||||
std::vector<jkmpTempVariable> tempvariables;
|
std::vector<jkmpTempVariable> tempvariables;
|
||||||
@ -814,15 +816,15 @@ class JKQTPMathParser
|
|||||||
/** \brief adds a temporary variable */
|
/** \brief adds a temporary variable */
|
||||||
void addTempVariable(std::string name, jkmpResult value);
|
void addTempVariable(std::string name, jkmpResult value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** \brief class constructor */
|
/** \brief class constructor */
|
||||||
JKQTPMathParser();
|
JKQTPMathParser();
|
||||||
|
|
||||||
/** \brief class destructor */
|
/** \brief class destructor */
|
||||||
virtual ~JKQTPMathParser();
|
virtual ~JKQTPMathParser();
|
||||||
|
|
||||||
/*! \brief sets the property data to the specified \a __value.
|
/*! \brief sets the property data to the specified \a __value.
|
||||||
@ -840,42 +842,42 @@ class JKQTPMathParser
|
|||||||
return this->data;
|
return this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief register a new function
|
/** \brief register a new function
|
||||||
* \param name name of the new function
|
* \param name name of the new function
|
||||||
* \param function a pointer to the implementation
|
* \param function a pointer to the implementation
|
||||||
*/
|
*/
|
||||||
void addFunction(std::string name, jkmpEvaluateFunc function);
|
void addFunction(std::string name, jkmpEvaluateFunc function);
|
||||||
|
|
||||||
/** \brief register a new external variable of type double
|
/** \brief register a new external variable of type double
|
||||||
* \param name name of the new variable
|
* \param name name of the new variable
|
||||||
* \param v pointer to the variable memory
|
* \param v pointer to the variable memory
|
||||||
*/
|
*/
|
||||||
void addVariableDouble(std::string name, double* v);
|
void addVariableDouble(std::string name, double* v);
|
||||||
|
|
||||||
/** \brief register a new external variable of type string
|
/** \brief register a new external variable of type string
|
||||||
* \param name name of the new variable
|
* \param name name of the new variable
|
||||||
* \param v pointer to the variable memory
|
* \param v pointer to the variable memory
|
||||||
*/
|
*/
|
||||||
void addVariableString(std::string name, std::string* v);
|
void addVariableString(std::string name, std::string* v);
|
||||||
|
|
||||||
/** \brief register a new external variable of type boolean
|
/** \brief register a new external variable of type boolean
|
||||||
* \param name name of the new variable
|
* \param name name of the new variable
|
||||||
* \param v pointer to the variable memory
|
* \param v pointer to the variable memory
|
||||||
*/
|
*/
|
||||||
void addVariableBoolean(std::string name, bool* v);
|
void addVariableBoolean(std::string name, bool* v);
|
||||||
|
|
||||||
|
|
||||||
/** \brief register a new internal variable of type double
|
/** \brief register a new internal variable of type double
|
||||||
* \param name name of the new variable
|
* \param name name of the new variable
|
||||||
* \param v initial value of this variable
|
* \param v initial value of this variable
|
||||||
*/
|
*/
|
||||||
void addVariableDouble(std::string name, double v);
|
void addVariableDouble(std::string name, double v);
|
||||||
|
|
||||||
/** \brief register a new internal variable of type string
|
/** \brief register a new internal variable of type string
|
||||||
* \param name name of the new variable
|
* \param name name of the new variable
|
||||||
* \param v initial value of this variable
|
* \param v initial value of this variable
|
||||||
*/
|
*/
|
||||||
void addVariableString(std::string name, std::string v);
|
void addVariableString(std::string name, std::string v);
|
||||||
|
|
||||||
/** \brief register a new internal variable of type boolean
|
/** \brief register a new internal variable of type boolean
|
||||||
* \param name name of the new variable
|
* \param name name of the new variable
|
||||||
@ -951,14 +953,14 @@ class JKQTPMathParser
|
|||||||
/** \brief prints a list of all registered variables */
|
/** \brief prints a list of all registered variables */
|
||||||
void printVariables();
|
void printVariables();
|
||||||
|
|
||||||
/** \brief returns all registered variables */
|
/** \brief returns all registered variables */
|
||||||
std::vector<std::pair<std::string, jkmpVariable> > getVariables();
|
std::vector<std::pair<std::string, jkmpVariable> > getVariables();
|
||||||
|
|
||||||
/** \brief store programs command-line arguments, so they are available in the parser */
|
/** \brief store programs command-line arguments, so they are available in the parser */
|
||||||
void setArgCV(int argc, char **argv);
|
void setArgCV(int argc, char **argv);
|
||||||
|
|
||||||
/** \brief return one of programs command-line arguments, or \a defaultResult if it is not present */
|
/** \brief return one of programs command-line arguments, or \a defaultResult if it is not present */
|
||||||
std::string getArgCVParam(std::string name, std::string defaultResult);
|
std::string getArgCVParam(std::string name, std::string defaultResult);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // JKQTPMATHPARSER_H
|
#endif // JKQTPMATHPARSER_H
|
||||||
|
@ -46,7 +46,7 @@ Scatter Plots can have symbols where the shape/color/size is parametrized by a d
|
|||||||
|
|
||||||
|
|
||||||
## QuickFit 3.0 Screenshots
|
## QuickFit 3.0 Screenshots
|
||||||
The library JKQtPlotter was developed initially as a central part of the data evaluation software for biophysics [QuickFit 3.0](https://github.com/jkriege2/QuickFit3). The latter makes heavy use of `JKQtPlotter`, `JKQtMathText` and `JKQtFastPlotter`:
|
The library JKQtPlotter was developed initially as a central part of the data evaluation software for biophysics [QuickFit 3.0](https://github.com/jkriege2/QuickFit3). The latter makes heavy use of `JKQtPlotter`, `JKQTmathText` and `JKQtFastPlotter`:
|
||||||
|
|
||||||
![QuickFit 3.0 Screenshot](./QF3_screen_dcalc.png)
|
![QuickFit 3.0 Screenshot](./QF3_screen_dcalc.png)
|
||||||
![QuickFit 3.0 Screenshot](./QF3_screen_fccsfit.png)
|
![QuickFit 3.0 Screenshot](./QF3_screen_fccsfit.png)
|
||||||
|
Loading…
Reference in New Issue
Block a user