improved contour plots + added example for contour plots

split contour plot into two variant, one for C-array-data and one for image column data
improved doxygen annotation
This commit is contained in:
jkriege2 2019-05-18 22:41:38 +02:00
parent 028f192e7b
commit 5a4a778faf
53 changed files with 2147 additions and 2235 deletions

View File

@ -78,6 +78,7 @@ addSimpleTest(boxplot)
addSimpleTest(advancedlineandfillstyling) addSimpleTest(advancedlineandfillstyling)
addSimpleTest(imageplot_nodatastore) addSimpleTest(imageplot_nodatastore)
addSimpleTest(datastore) addSimpleTest(datastore)
addSimpleTest(contourplot)
#addSimpleTest(rgbimageplot_opencv) #addSimpleTest(rgbimageplot_opencv)
#addSimpleTest(imageplot_opencv) #addSimpleTest(imageplot_opencv)

View File

@ -113,6 +113,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
<tr><td> \image html jkqtplotter_simpletest_rgbimageplot_opencv_small.png <tr><td> \image html jkqtplotter_simpletest_rgbimageplot_opencv_small.png
<td> \subpage JKQTPlotterImagePlotRGBOpenCV <td> \subpage JKQTPlotterImagePlotRGBOpenCV
<td> `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore <br> inverted coordinate axes <td> `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore <br> inverted coordinate axes
<tr><td> \image html jkqtplotter_simpletest_contourplot_small.png
<td> \subpage JKQTPlotterContourPlot
<td> `JKQTPColumnContourPlot` <br> image data edited inside JKQTPDatastore
</table> </table>

View File

@ -353,10 +353,10 @@ Examples:
<td> JKQTPOverlayImageEnhanced, JKQTPColumnOverlayImageEnhanced <td> JKQTPOverlayImageEnhanced, JKQTPColumnOverlayImageEnhanced
<tr> <tr>
<td>\image html JKQTPContour_small.png <td>\image html JKQTPContour_small.png
<td> JKQTPContour <td> JKQTPContourPlot, JKQTPColumnContourPlot
</table> </table>
\defgroup jkqtplotter_imagelots_elements Matrix/Image Graphs \defgroup jkqtplotter_imagelots_elements Image Graphs
\ingroup jkqtplotter_imagelots \ingroup jkqtplotter_imagelots
@ -393,7 +393,7 @@ Examples:
\defgroup jkqtplotter_imagelots_tools Tool Functions & Classes for Image Drawing \defgroup jkqtplotter_imagelots_tools Tool Functions & Classes for Image Drawing
\ingroup jkqtplotter_imagelots \ingroup jkqtplotter_imagelots
\defgroup jkqtplotter_imagelots_contour Contour Graphs \defgroup jkqtplotter_imagelots_contour Contour Graphs (based on Image Data)
\ingroup jkqtplotter_imagelots \ingroup jkqtplotter_imagelots
<table> <table>
@ -402,7 +402,7 @@ Examples:
<th> Classes <th> Classes
<tr> <tr>
<td>\image html JKQTPContour_small.png <td>\image html JKQTPContour_small.png
<td> JKQTPContour <td> JKQTPContourPlot, JKQTPColumnContourPlot
</table> </table>
\defgroup jkqtplotter_overlays Overlay Elements \defgroup jkqtplotter_overlays Overlay Elements

View File

@ -50,6 +50,7 @@ Changes, compared to \ref page_whatsnew_V2018_08 "v2018.08" include:
<li> removed: Removed datarange-feature </li> <li> removed: Removed datarange-feature </li>
<li> update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API" </li> <li> update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API" </li>
<li> update: \ref jkqtplotter_basegraphserrors "reworked error indicator base classes" </li> <li> update: \ref jkqtplotter_basegraphserrors "reworked error indicator base classes" </li>
<li> update: improvements to contour plots (e.g. highlighting single contour levels, split into a class for simple C-arrays [JKQTPContourPlot] and one for image data in a JKQTPDatastore column [JKQTPColumnContourPlot]) + added example, see JKQTPColumnContourPlot and \ref JKQTPlotterContourPlot </li>
<li> fixed: colorbars at top were positioned over the plot label </li> <li> fixed: colorbars at top were positioned over the plot label </li>
<li> fixed: RGB-image plots now work properly with inverted axes (image is inverted, befor image was not shown at all) </li> <li> fixed: RGB-image plots now work properly with inverted axes (image is inverted, befor image was not shown at all) </li>
</ul></li> </ul></li>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -35,7 +35,6 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styledboxplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styledboxplot) | [Styling of Boxplots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styledboxplot) | Modifying different Aspects of the Styling of boxplots | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styledboxplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styledboxplot) | [Styling of Boxplots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styledboxplot) | Modifying different Aspects of the Styling of boxplots |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styling_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling) | [Styling of JKQTPlotter](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling) | Modifying different Aspects of the Styling of JKQTPlotter | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styling_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling) | [Styling of JKQTPlotter](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling) | Modifying different Aspects of the Styling of JKQTPlotter |
## Image data Plots ## Image data Plots
| Screenshot | Description | Notes | | Screenshot | Description | Notes |
@ -47,6 +46,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/jkqtplotter_simpletest_rgbimageplot) | [Simple 3-channel Math RGB/CMY Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/jkqtplotter_simpletest_rgbimageplot) | `JKQTPColumnRGBMathImage` <br> image data in a C-style row-major array, not using internal datastore <br> RGB/CMY color compositing | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/jkqtplotter_simpletest_rgbimageplot) | [Simple 3-channel Math RGB/CMY Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/jkqtplotter_simpletest_rgbimageplot) | `JKQTPColumnRGBMathImage` <br> image data in a C-style row-major array, not using internal datastore <br> RGB/CMY color compositing |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_opencv) | [1-channel OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_opencv) | `JKQTPColumnMathImage` <br> image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_opencv) | [1-channel OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_opencv) | `JKQTPColumnMathImage` <br> image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_opencv) | [RGB OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_opencv) | `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns <br> inverted coordinate axesof the internal datastore | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_opencv) | [RGB OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_opencv) | `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns <br> inverted coordinate axesof the internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_contourplot) | [Contour Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_contourplot) | `JKQTPColumnContourPlot` <br> image data edited inside JKQTPDatastore |

View File

@ -90,10 +90,10 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
plotContour->setGrid(false); plotContour->setGrid(false);
plotDensity->zoom(-0.1,1.1,-0.1,1.1); plotDensity->zoom(-0.1,1.1,-0.1,1.1);
QList<double> levels; QVector<double> levels;
// levels<<5<<10<<25; // levels<<5.1<<10.1; // levels<<5<<10<<25; // levels<<5.1<<10.1;
levels<<4<<5<<9<<14; levels<<4<<5<<9<<14;
JKQTPContour* cp=new JKQTPContour(plotContour->getPlotter()); JKQTPColumnContourPlot* cp=new JKQTPColumnContourPlot(plotContour->getPlotter());
cp->setX(-0.1); cp->setX(-0.1);
cp->setY(-0.1); cp->setY(-0.1);
cp->setWidth(1.1); cp->setWidth(1.1);

View File

@ -0,0 +1,131 @@
# Example (JKQTPlotter): Contour Plots {#JKQTPlotterContourPlot}
This project (see `./examples/simpletest_contourplot/`) shows how to draw contour plots with JKQTPlotter.
[TOC]
# Drawing a Contour Plot
The source code of the main application is (see [`jkqtplotter_simpletest_contourplot.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_contourplot/jkqtplotter_simpletest_contourplot.cpp) ).
First the electric potential from a quadrupole is calculated and stored in an image column inside the JKQTPDatastore:
```.cpp
JKQTPDatastore* ds=plot.getDatastore();
const int NX=500; // image dimension in x-direction [pixels]
const int NY=500; // image dimension in y-direction [pixels]
const double w=2.7e-6;
const double dx=w/static_cast<double>(NX);
const double h=NY*dx;
size_t cPotential=ds->addImageColumn(NX, NY, "imagedata");
double x;
double y=-h/2.0;
const double eps0=8.854187e-12;
const double Q1=1.6e-19; // charge of charged particle 1
const double Q1_x0=-0.5e-6; // x-position of charged particle 1
const double Q1_y0=-0.5e-6; // y-position of charged particle 1
const double Q2=1.6e-19; // charge of charged particle 2
const double Q2_x0=0.5e-6; // x-position of charged particle 2
const double Q2_y0=0.5e-6; // y-position of charged particle 2
const double Q3=-1.6e-19; // charge of charged particle 3
const double Q3_x0=-0.5e-6; // x-position of charged particle 3
const double Q3_y0=0.5e-6; // y-position of charged particle 3
const double Q4=-1.6e-19; // charge of charged particle 4
const double Q4_x0=0.5e-6; // x-position of charged particle 4
const double Q4_y0=-0.5e-6; // y-position of charged particle 4
for (size_t iy=0; iy<NY; iy++ ) {
x=-w/2.0;
for (size_t ix=0; ix<NX; ix++ ) {
const double r1=sqrt((x-Q1_x0)*(x-Q1_x0)+(y-Q1_y0)*(y-Q1_y0));
const double r2=sqrt((x-Q2_x0)*(x-Q2_x0)+(y-Q2_y0)*(y-Q2_y0));
const double r3=sqrt((x-Q3_x0)*(x-Q3_x0)+(y-Q3_y0)*(y-Q3_y0));
const double r4=sqrt((x-Q4_x0)*(x-Q4_x0)+(y-Q4_y0)*(y-Q4_y0));
ds->setPixel(cPotential, ix, iy, Q1/(4.0*M_PI*eps0)/r1+Q2/(4.0*M_PI*eps0)/r2+Q3/(4.0*M_PI*eps0)/r3+Q4/(4.0*M_PI*eps0)/r4);
x+=dx;
}
y+=dx;
}
```
Then this image column can be drawn with a `JKQTPColumnContourPlot`:
```.cpp
JKQTPColumnContourPlot* graph=new JKQTPColumnContourPlot(&plot);
graph->setTitle("");
// image column with the data
graph->setImageColumn(cPotential);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->setWidth(w);
graph->setHeight(h);
// color-map is "BlueGreenRed"
graph->setPalette(JKQTPMathImageBlueGreenRed);
// get coordinate axis of color-bar and set its label
graph->getColorBarRightAxis()->setAxisLabel("electric potential [V]");
// add some levels for the contours. These are chosen to be at the actual potential values
// at several specified relative distance from Q1, i.e. at phi(Q1_x0*reldist) (phi: potential of Q1)
QVector<double> reldists; reldists<<0.1<<0.25<<0.5<<1<<1.5<<2<<2.5<<3;
// finally contour levels with +1 and -1 sign are added to show the positive and negative potential:
for (auto reldist: reldists) {
const double level=fabs(Q1/(4.0*M_PI*eps0)/(Q1_x0*reldist));
graph->addContourLevel(-level);
graph->addContourLevel(level);
}
qDebug()<<graph->getContourLevels();
graph->setAutoImageRange(false);
graph->setImageMin(graph->getContourLevels().first());
graph->setImageMax(graph->getContourLevels().last());
```
Note that we created the list of contour levels to draw explicitly here using `JKQTPColumnContourPlot::addContourLevel()`. There are also methods `JKQTPColumnContourPlot::createContourLevels()` and `JKQTPColumnContourPlot::createContourLevelsLog()` to auto-generate these from the data-range with linear or logarithmic spacing, but both options do not yield good results here. The code above generates these contour levels:
```
-0.0287602, -0.0115041, -0.00575203, -0.00287602, -0.00191734, -0.00143801, -0.00115041, -0.000958672, 0.000958672, 0.00115041, 0.00143801, 0.00191734, 0.00287602, 0.00575203, 0.0115041, 0.0287602
```
The result looks like this:
![jkqtplotter_simpletest_contourplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot.png)
# Styling a Contour Plot
You can change the way that the colors for the contours are chosen by calling `JKQTPColumnContourPlot::setContourColoringMode()` with another mode:
- `JKQTPColumnContourPlot::SingleColorContours` uses the same color (set by `JKQTPColumnContourPlot::setLineColor()`) for all contours.<br>
![jkqtplotter_simpletest_contourplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot_SingleColorContours.png)
- `JKQTPColumnContourPlot::ColorContoursFromPaletteByValue` is the mode used for the example above, which chooses the color from the current color-palette based on the current image data range and the actual level of the contour line. <br>
![jkqtplotter_simpletest_contourplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot_ColorContoursFromPaletteByValue.png)
- `JKQTPColumnContourPlot::ColorContoursFromPalette` chooses the color by evenly spacing the contour lines over the full color palette. the line-color will then have no connection to the actual value of the level.<br>
![jkqtplotter_simpletest_contourplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot_ColorContoursFromPalette.png)
In all modes you can override the coloring of single levels by calling `JKQTPColumnContourPlot::setOverrideColor(level, color)`. In the example above this looks like this:
```.cpp
for (auto reldist: reldists) {
const double level=fabs(Q1/(4.0*M_PI*eps0)/(Q1_x0*reldist));
graph->addContourLevel(-level);
graph->addContourLevel(level);
// set a special color for some lines:
if (reldist==1) {
graph->setOverrideColor(-level, QColor("yellow"));
graph->setOverrideColor(level, QColor("yellow"));
}
}
```
This code results (in the default coloring mode `JKQTPColumnContourPlot::ColorContoursFromPaletteByValue`) in:
![jkqtplotter_simpletest_contourplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot_overridecolors.png)
# Gimmick: Animating a Contour Plot
In order to demonstrate the caching implemented in the contour plot, there is optional animation code inside this example, in the form of the class `ContourPlotAnimator` (see (see [`ContourPlotAnimator.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_contourplot/ContourPlotAnimator.cpp) ).
The code therein results in an animation like this:
![jkqtplotter_simpletest_contourplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_contourplot_animated.gif)
Note that zooming can still be perfomred without the need to recalculate the contour lines.

View File

@ -0,0 +1,51 @@
#include "contourplotanimator.h"
ContourPlotAnimator::ContourPlotAnimator(JKQTPDatastore *ds_, JKQTPlotter *pplot_, int NX_, int NY_, double w_, double h_, double dx_, size_t cPotential_):
QObject(pplot_), angle(0), ds(ds_), pplot(pplot_), NX(NX_), NY(NY_), w(w_), h(h_), dx(dx_), cPotential(cPotential_)
{
}
void ContourPlotAnimator::start(int delayMS) {
timerFR.start();
QTimer::singleShot(delayMS, this,&ContourPlotAnimator::step);
}
void ContourPlotAnimator::step() {
double x;
double y=-h/2.0;
const double eps0=8.854187e-12;
double r=1e-6*(5.0+cos(angle/4.0))/6.0;
double r2=1e-6*(5.0+sin(angle/4.0))/6.0;
const double Q1=1.6e-19; // charge of charged particle 1
const double Q1_x0=-r*cos(angle); // x-position of charged particle 1
const double Q1_y0=-r*sin(angle); // y-position of charged particle 1
const double Q2=1.6e-19; // charge of charged particle 2
const double Q2_x0=r*cos(angle); // x-position of charged particle 2
const double Q2_y0=r*sin(angle); // y-position of charged particle 2
const double Q3=-1.6e-19; // charge of charged particle 3
const double Q3_x0=-r2*cos(angle); // x-position of charged particle 3
const double Q3_y0=r2*sin(angle); // y-position of charged particle 3
const double Q4=-1.6e-19; // charge of charged particle 4
const double Q4_x0=r2*cos(angle); // x-position of charged particle 4
const double Q4_y0=-r2*sin(angle); // y-position of charged particle 4
for (size_t iy=0; iy<NY; iy++ ) {
x=-w/2.0;
for (size_t ix=0; ix<NX; ix++ ) {
const double r1=sqrt((x-Q1_x0)*(x-Q1_x0)+(y-Q1_y0)*(y-Q1_y0));
const double r2=sqrt((x-Q2_x0)*(x-Q2_x0)+(y-Q2_y0)*(y-Q2_y0));
const double r3=sqrt((x-Q3_x0)*(x-Q3_x0)+(y-Q3_y0)*(y-Q3_y0));
const double r4=sqrt((x-Q4_x0)*(x-Q4_x0)+(y-Q4_y0)*(y-Q4_y0));
ds->setPixel(cPotential, ix, iy, Q1/(4.0*M_PI*eps0)/r1+Q2/(4.0*M_PI*eps0)/r2+Q3/(4.0*M_PI*eps0)/r3+Q4/(4.0*M_PI*eps0)/r4);
x+=dx;
}
y+=dx;
}
pplot->redrawPlot();
qDebug()<<"animation step: angle="<<angle<<", framerate="<<1.0/(timerFR.elapsed()/1000.0)<<"fps <==> "<<timerFR.elapsed()<<"ms/frame";
pplot->setWindowTitle("JKQTPColumnContourPlot ["+QString::number(1.0/(timerFR.elapsed()/1000.0))+"fps]");
angle+=(2.0/180.0*M_PI);
timerFR.start();
QTimer::singleShot(1, this,SLOT(step()));
}

View File

@ -0,0 +1,35 @@
#ifndef CONTOURPLOTANIMATOR_H
#define CONTOURPLOTANIMATOR_H
#include <QObject>
#include <QTimer>
#include <QElapsedTimer>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
class ContourPlotAnimator: public QObject {
Q_OBJECT
public:
ContourPlotAnimator(JKQTPDatastore* ds_, JKQTPlotter* pplot_, int NX_, int NY_,double w_, double h_, double dx_, size_t cPotential_);
void start(int delayMS);
protected slots:
void step();
protected:
double angle;
JKQTPDatastore* ds;
JKQTPlotter* pplot;
int NX;
int NY;
double w;
double h;
double dx;
size_t cPotential;
QElapsedTimer timerFR;
};
#endif // CONTOURPLOTANIMATOR_H

View File

@ -0,0 +1,155 @@
/** \example jkqtplotter_simpletest_contourplot.cpp
* Shows how to plot a contour plot with JKQTPlotter
*
* \ref JKQTPlotterContourPlot
*/
#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphscontour.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
// if defined, an animation is shown
//#define ANIMATE
#ifdef ANIMATE
#include "contourplotanimator.h"
#endif
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter plot;
plot.getPlotter()->setUseAntiAliasingForGraphs(true); // nicer (but slower) plotting
plot.getPlotter()->setUseAntiAliasingForSystem(true); // nicer (but slower) plotting
plot.getPlotter()->setUseAntiAliasingForText(true); // nicer (but slower) text rendering
// 2. calculate image of the electric field of a quadrupolpol
JKQTPDatastore* ds=plot.getDatastore();
#ifdef ANIMATE
const int NX=200; // image dimension in x-direction [pixels]
const int NY=200; // image dimension in x-direction [pixels]
#else
const int NX=500; // image dimension in x-direction [pixels]
const int NY=500; // image dimension in x-direction [pixels]
#endif
const double w=2.7e-6;
const double dx=w/static_cast<double>(NX);
const double h=NY*dx;
size_t cPotential=ds->addImageColumn(NX, NY, "imagedata");
double x;
double y=-h/2.0;
const double eps0=8.854187e-12;
const double Q1=1.6e-19; // charge of charged particle 1
const double Q1_x0=-0.5e-6; // x-position of charged particle 1
const double Q1_y0=-0.5e-6; // y-position of charged particle 1
const double Q2=1.6e-19; // charge of charged particle 2
const double Q2_x0=0.5e-6; // x-position of charged particle 2
const double Q2_y0=0.5e-6; // y-position of charged particle 2
const double Q3=-1.6e-19; // charge of charged particle 3
const double Q3_x0=-0.5e-6; // x-position of charged particle 3
const double Q3_y0=0.5e-6; // y-position of charged particle 3
const double Q4=-1.6e-19; // charge of charged particle 4
const double Q4_x0=0.5e-6; // x-position of charged particle 4
const double Q4_y0=-0.5e-6; // y-position of charged particle 4
for (size_t iy=0; iy<NY; iy++ ) {
x=-w/2.0;
for (size_t ix=0; ix<NX; ix++ ) {
const double r1=sqrt((x-Q1_x0)*(x-Q1_x0)+(y-Q1_y0)*(y-Q1_y0));
const double r2=sqrt((x-Q2_x0)*(x-Q2_x0)+(y-Q2_y0)*(y-Q2_y0));
const double r3=sqrt((x-Q3_x0)*(x-Q3_x0)+(y-Q3_y0)*(y-Q3_y0));
const double r4=sqrt((x-Q4_x0)*(x-Q4_x0)+(y-Q4_y0)*(y-Q4_y0));
ds->setPixel(cPotential, ix, iy, Q1/(4.0*M_PI*eps0)/r1+Q2/(4.0*M_PI*eps0)/r2+Q3/(4.0*M_PI*eps0)/r3+Q4/(4.0*M_PI*eps0)/r4);
x+=dx;
}
y+=dx;
}
// the following code will plot a dipole potential instead of the quadrupole after 5s
// this tests the recognition of altered data
#ifdef ANIMATE
JKQTPlotter* pplot=&plot;
ContourPlotAnimator animation(ds,pplot,NX,NY,w,h,dx,cPotential);
animation.start(3000);
#endif
// 3. create a graph (JKQTPColumnContourPlot) with the column created above as data
JKQTPColumnContourPlot* graph=new JKQTPColumnContourPlot(&plot);
graph->setTitle("");
// image column with the data
graph->setImageColumn(cPotential);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->setWidth(w);
graph->setHeight(h);
// color-map is "BlueGreenRed"
graph->setPalette(JKQTPMathImageBlueGreenRed);
// get coordinate axis of color-bar and set its label
graph->getColorBarRightAxis()->setAxisLabel("electric potential [V]");
// add some levels for the contours. These are chosen to be at the actual potential values
// at several specified relative distance from Q1, i.e. at phi(Q1_x0*reldist) (phi: potential of Q1)
QVector<double> reldists; reldists<<0.1<<0.25<<0.5<<1<<1.5<<2<<2.5<<3;
// finally contour levels with +1 and -1 sign are added to show the positive and negative potential:
for (auto reldist: reldists) {
const double level=fabs(Q1/(4.0*M_PI*eps0)/(Q1_x0*reldist));
graph->addContourLevel(-level);
graph->addContourLevel(level);
// set a special color for some lines:
//if (reldist==1) {
// graph->setOverrideColor(-level, QColor("yellow"));
// graph->setOverrideColor(level, QColor("yellow"));
//}
}
qDebug()<<graph->getContourLevels();
graph->setAutoImageRange(false);
graph->setImageMin(graph->getContourLevels().first());
graph->setImageMax(graph->getContourLevels().last());
// all contour lines have the same color:
//graph->setContourColoringMode(JKQTPColumnContourPlot::SingleColorContours);
//graph->setLineColor(QColor("magenta"));
// color contour lines from palette, but wothout taking their actual level value into account:
//graph->setContourColoringMode(JKQTPColumnContourPlot::ColorContoursFromPalette);
// 4. add the graphs to the plot, so it is actually displayed
plot.addGraph(graph);
// 5. set axis labels
plot.getXAxis()->setAxisLabel("x [m]");
plot.getYAxis()->setAxisLabel("y [m]");
// 6. fix axis and plot aspect ratio to 1
plot.getPlotter()->setMaintainAspectRatio(true);
plot.getPlotter()->setAspectRatio(w/h);
plot.getPlotter()->setMaintainAxisAspectRatio(true);
plot.getPlotter()->setAxisAspectRatio(w/h);
// 7 autoscale the plot so the graph is contained
plot.zoomToFit();
// 8. show plotter and make it a decent size
plot.show();
plot.resize(800,800);
plot.setWindowTitle("JKQTPColumnContourPlot");
return app.exec();
}

View File

@ -0,0 +1,29 @@
# source code for this simple demo
SOURCES = jkqtplotter_simpletest_contourplot.cpp \
contourplotanimator.cpp
# configure Qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# output executable name
TARGET = jkqtplotter_simpletest_contourplot
# include JKQTPlotter source code
DEPENDPATH += ../../lib ../../staticlib/jkqtplotterlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/jkqtplotterlib/debug -ljkqtplotterlib_debug
} else {
LIBS += -L../../staticlib/jkqtplotterlib/release -ljkqtplotterlib
}
message("LIBS = $$LIBS")
HEADERS += \
contourplotanimator.h

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_contourplot
jkqtplotterlib.file = ../../staticlib/jkqtplotterlib/jkqtplotterlib.pro
jkqtplotter_simpletest_contourplot.file=$$PWD/jkqtplotter_simpletest_contourplot.pro
jkqtplotter_simpletest_contourplot.depends = jkqtplotterlib

View File

@ -715,6 +715,7 @@ JKQTP_LIB_EXPORT QPolygonF jkqtpRotateRect(QRectF r, double angle);
/*! \brief swap two elements \a l and \a r in an array \a a /*! \brief swap two elements \a l and \a r in an array \a a
\ingroup jkqtptools \ingroup jkqtptools
@ -1005,6 +1006,22 @@ inline T jkqtp_sqr(const T& v) {
return v*v; return v*v;
} }
/** \brief calculate the distance between two QPointF points
* \ingroup jkqtptools_math
*
*/
inline double jkqtp_distance(const QPointF& p1, const QPointF& p2){
return sqrt(jkqtp_sqr<double>(p1.x()-p2.x())+jkqtp_sqr<double>(p1.y()-p2.y()));
}
/** \brief calculate the distance between two QPoint points
* \ingroup jkqtptools_math
*
*/
inline double jkqtp_distance(const QPoint& p1, const QPoint& p2){
return sqrt(jkqtp_sqr<double>(p1.x()-p2.x())+jkqtp_sqr<double>(p1.y()-p2.y()));
}
#endif // JKQTPTOOLS_H_INCLUDED #endif // JKQTPTOOLS_H_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@ -477,15 +477,11 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
{ {
return this->fontEncoding; return this->fontEncoding;
} }
/*! \brief returns the property useSTIXfonts ( \copybrief useSTIXfonts ). /*! \copydoc useSTIXfonts */
\details Description of the parameter useSTIXfonts is: <BLOCKQUOTE>\copydoc useSTIXfonts </BLOCKQUOTE>.
\see useSTIXfonts for more information */
inline bool isUsingSTIXfonts() const { inline bool isUsingSTIXfonts() const {
return this->useSTIXfonts; return this->useSTIXfonts;
} }
/*! \brief returns the property useXITSfonts ( \copybrief useXITSfonts ). /*! \copydoc useXITSfonts */
\details Description of the parameter useXITSfonts is: <BLOCKQUOTE>\copydoc useXITSfonts </BLOCKQUOTE>.
\see useXITSfonts for more information */
inline bool isUsingXITSfonts() const { inline bool isUsingXITSfonts() const {
return this->useXITSfonts; return this->useXITSfonts;
} }
@ -649,9 +645,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
{ {
return this->useUnparsed; return this->useUnparsed;
} }
/*! \brief returns the property error_list ( \copybrief error_list ). /*! \copydoc error_list */
\details Description of the parameter error_list is: <BLOCKQUOTE>\copydoc error_list </BLOCKQUOTE>.
\see error_list for more information */
inline QStringList getErrorList() const { inline QStringList getErrorList() const {
return this->error_list; return this->error_list;
} }
@ -801,9 +795,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv, const MTnodeSize* prevNodeSize=nullptr) override; virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv, const MTnodeSize* prevNodeSize=nullptr) override;
/** \copydoc MTnode::toHtml() */ /** \copydoc MTnode::toHtml() */
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override; virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override;
/*! \brief returns the property text ( \copybrief text ). /*! \copydoc text */
\details Description of the parameter text is: <BLOCKQUOTE>\copydoc text </BLOCKQUOTE>.
\see text for more information */
inline QString getText() const { inline QString getText() const {
return this->text; return this->text;
} }
@ -849,9 +841,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv, const MTnodeSize* prevNodeSize=nullptr) override; virtual double draw(QPainter& painter, double x, double y, MTenvironment currentEv, const MTnodeSize* prevNodeSize=nullptr) override;
/** \copydoc MTnode::toHtml() */ /** \copydoc MTnode::toHtml() */
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override; virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override;
/*! \brief returns the property symbolName ( \copybrief symbolName ). /*! \copydoc symbolName */
\details Description of the parameter symbolName is: <BLOCKQUOTE>\copydoc symbolName </BLOCKQUOTE>.
\see symbolName for more information */
inline QString getSymbolName() const { inline QString getSymbolName() const {
return this->symbolName; return this->symbolName;
} }
@ -899,9 +889,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override; virtual bool toHtml(QString& html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv) override;
/** \copydoc MTnode::setDrawBoxes() */ /** \copydoc MTnode::setDrawBoxes() */
virtual void setDrawBoxes(bool draw) override; virtual void setDrawBoxes(bool draw) override;
/*! \brief returns the property nodes ( \copybrief nodes ). /*! \copydoc nodes */
\details Description of the parameter nodes is: <BLOCKQUOTE>\copydoc nodes </BLOCKQUOTE>.
\see nodes for more information */
inline QList<MTnode*> getNodes() const { inline QList<MTnode*> getNodes() const {
return this->nodes; return this->nodes;
} }
@ -930,15 +918,11 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline MTnode* getChild() const { inline MTnode* getChild() const {
return this->child; return this->child;
} }
/*! \brief returns the property name ( \copybrief name ). /*! \copydoc name */
\details Description of the parameter name is: <BLOCKQUOTE>\copydoc name </BLOCKQUOTE>.
\see name for more information */
inline QString getName() const { inline QString getName() const {
return this->name; return this->name;
} }
/*! \brief returns the property parameters ( \copybrief parameters ). /*! \copydoc parameters */
\details Description of the parameter parameters is: <BLOCKQUOTE>\copydoc parameters </BLOCKQUOTE>.
\see parameters for more information */
inline QStringList getParameters() const { inline QStringList getParameters() const {
return this->parameters; return this->parameters;
} }
@ -1024,21 +1008,15 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline MTnode* getChild() const { inline MTnode* getChild() const {
return this->child; return this->child;
} }
/*! \brief returns the property openbrace ( \copybrief openbrace ). /*! \copydoc openbrace */
\details Description of the parameter openbrace is: <BLOCKQUOTE>\copydoc openbrace </BLOCKQUOTE>.
\see openbrace for more information */
inline QString getOpenbrace() const { inline QString getOpenbrace() const {
return this->openbrace; return this->openbrace;
} }
/*! \brief returns the property closebrace ( \copybrief closebrace ). /*! \copydoc closebrace */
\details Description of the parameter closebrace is: <BLOCKQUOTE>\copydoc closebrace </BLOCKQUOTE>.
\see closebrace for more information */
inline QString getClosebrace() const { inline QString getClosebrace() const {
return this->closebrace; return this->closebrace;
} }
/*! \brief returns the property showRightBrace ( \copybrief showRightBrace ). /*! \copydoc showRightBrace */
\details Description of the parameter showRightBrace is: <BLOCKQUOTE>\copydoc showRightBrace </BLOCKQUOTE>.
\see showRightBrace for more information */
inline bool getShowRightBrace() const { inline bool getShowRightBrace() const {
return this->showRightBrace; return this->showRightBrace;
} }
@ -1070,9 +1048,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline MTnode* getChild() const { inline MTnode* getChild() const {
return this->child; return this->child;
} }
/*! \brief returns the property degree ( \copybrief degree ). /*! \copydoc degree */
\details Description of the parameter degree is: <BLOCKQUOTE>\copydoc degree </BLOCKQUOTE>.
\see degree for more information */
inline int getDegree() const { inline int getDegree() const {
return this->degree; return this->degree;
} }
@ -1118,9 +1094,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline MTnode* getChild2() const { inline MTnode* getChild2() const {
return this->child2; return this->child2;
} }
/*! \brief returns the property mode ( \copybrief mode ). /*! \copydoc mode */
\details Description of the parameter mode is: <BLOCKQUOTE>\copydoc mode </BLOCKQUOTE>.
\see mode for more information */
inline MTfracMode getMode() const { inline MTfracMode getMode() const {
return this->mode; return this->mode;
} }
@ -1145,15 +1119,11 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline QVector<QVector<MTnode*> > getChildren() const { inline QVector<QVector<MTnode*> > getChildren() const {
return this->children; return this->children;
} }
/*! \brief returns the property columns ( \copybrief columns ). /*! \copydoc columns */
\details Description of the parameter columns is: <BLOCKQUOTE>\copydoc columns </BLOCKQUOTE>.
\see columns for more information */
inline int getColumns() const { inline int getColumns() const {
return this->columns; return this->columns;
} }
/*! \brief returns the property lines ( \copybrief lines ). /*! \copydoc lines */
\details Description of the parameter lines is: <BLOCKQUOTE>\copydoc lines </BLOCKQUOTE>.
\see lines for more information */
inline int getLines() const { inline int getLines() const {
return this->lines; return this->lines;
} }
@ -1199,9 +1169,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline MTnode* getChild() const { inline MTnode* getChild() const {
return this->child; return this->child;
} }
/*! \brief returns the property decoration ( \copybrief decoration ). /*! \copydoc decoration */
\details Description of the parameter decoration is: <BLOCKQUOTE>\copydoc decoration </BLOCKQUOTE>.
\see decoration for more information */
inline MTdecoration getDecoration() const { inline MTdecoration getDecoration() const {
return this->decoration; return this->decoration;
} }
@ -1439,9 +1407,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
public: public:
/*! \brief returns the property parsedNode ( \copybrief parsedNode ). /*! \copydoc parsedNode */
\details Description of the parameter parsedNode is: <BLOCKQUOTE>\copydoc parsedNode </BLOCKQUOTE>.
\see parsedNode for more information */
inline MTnode* getParsedNode() const { inline MTnode* getParsedNode() const {
return this->parsedNode; return this->parsedNode;
} }

View File

@ -766,43 +766,25 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/*! \copydoc JKQTBasePlotterStyle::plotFrameRounding */ /*! \copydoc JKQTBasePlotterStyle::plotFrameRounding */
double getPlotFrameRounding() const; double getPlotFrameRounding() const;
/*! \brief returns the property plotLabelFontSize ( \copybrief plotLabelFontSize ). /*! \copydoc plotLabelFontSize */
\details Description of the parameter plotLabelFontSize is: <BLOCKQUOTE>\copydoc plotLabelFontSize </BLOCKQUOTE>
\see plotLabelFontSize for more information */
double getPlotLabelFontSize() const; double getPlotLabelFontSize() const;
/*! \brief returns the property plotLabelFontName ( \copybrief plotLabelFontName ). /*! \copydoc plotLabelFontName */
\details Description of the parameter plotLabelFontName is: <BLOCKQUOTE>\copydoc plotLabelFontName </BLOCKQUOTE>
\see plotLabelFontName for more information */
QString getplotLabelFontName() const; QString getplotLabelFontName() const;
/*! \brief returns the property plotLabel ( \copybrief plotLabel ). /*! \copydoc plotLabel */
\details Description of the parameter plotLabel is: <BLOCKQUOTE>\copydoc plotLabel </BLOCKQUOTE>
\see plotLabel for more information */
QString getPlotLabel() const; QString getPlotLabel() const;
/*! \brief sets the property gridPrinting ( \copybrief gridPrinting ) to the specified \a __value. /*! \copydoc gridPrinting */
\details Description of the parameter gridPrinting is: <BLOCKQUOTE>\copydoc gridPrinting </BLOCKQUOTE>
\see gridPrinting for more information */
void setGridPrinting(bool __value); void setGridPrinting(bool __value);
/*! \brief returns the property gridPrinting ( \copybrief gridPrinting ). /*! \copydoc gridPrinting */
\details Description of the parameter gridPrinting is: <BLOCKQUOTE>\copydoc gridPrinting </BLOCKQUOTE>
\see gridPrinting for more information */
bool getGridPrinting() const; bool getGridPrinting() const;
/*! \brief sets the property gridPrintingCurrentX ( \copybrief gridPrintingCurrentX ) to the specified \a __value. /*! \copydoc gridPrintingCurrentX */
\details Description of the parameter gridPrintingCurrentX is: <BLOCKQUOTE>\copydoc gridPrintingCurrentX </BLOCKQUOTE>
\see gridPrintingCurrentX for more information */
void setGridPrintingCurrentX(size_t __value); void setGridPrintingCurrentX(size_t __value);
/*! \brief returns the property gridPrintingCurrentX ( \copybrief gridPrintingCurrentX ). /*! \copydoc gridPrintingCurrentX */
\details Description of the parameter gridPrintingCurrentX is: <BLOCKQUOTE>\copydoc gridPrintingCurrentX </BLOCKQUOTE>
\see gridPrintingCurrentX for more information */
size_t getGridPrintingCurrentX() const; size_t getGridPrintingCurrentX() const;
/*! \brief sets the property gridPrintingCurrentY ( \copybrief gridPrintingCurrentY ) to the specified \a __value. /*! \copydoc gridPrintingCurrentY */
\details Description of the parameter gridPrintingCurrentY is: <BLOCKQUOTE>\copydoc gridPrintingCurrentY </BLOCKQUOTE>
\see gridPrintingCurrentY for more information */
void setGridPrintingCurrentY(size_t __value); void setGridPrintingCurrentY(size_t __value);
/*! \brief returns the property gridPrintingCurrentY ( \copybrief gridPrintingCurrentY ). /*! \copydoc gridPrintingCurrentY */
\details Description of the parameter gridPrintingCurrentY is: <BLOCKQUOTE>\copydoc gridPrintingCurrentY </BLOCKQUOTE>
\see gridPrintingCurrentY for more information */
size_t getGridPrintingCurrentY() const; size_t getGridPrintingCurrentY() const;
/** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid /** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid
@ -821,13 +803,13 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/** \brief set the string used to introduce comments in text output when exporting data */ /** \brief set the string used to introduce comments in text output when exporting data */
QString getCSVcommentInitializer() const; QString getCSVcommentInitializer() const;
/*! \brief returns the property internalPlotBorderTop ( \copybrief internalPlotBorderTop ). \details Description of the parameter internalPlotBorderTop is: <BLOCKQUOTE>\copydoc internalPlotBorderTop </BLOCKQUOTE>. \see internalPlotBorderTop for more information */ /*! \copydoc internalPlotBorderTop */
inline double getInternalPlotBorderTop() const { return this->internalPlotBorderTop; } inline double getInternalPlotBorderTop() const { return this->internalPlotBorderTop; }
/*! \brief returns the property internalPlotBorderLeft ( \copybrief internalPlotBorderLeft ). \details Description of the parameter internalPlotBorderLeft is: <BLOCKQUOTE>\copydoc internalPlotBorderLeft </BLOCKQUOTE>. \see internalPlotBorderLeft for more information */ /*! \copydoc internalPlotBorderLeft */
inline double getInternalPlotBorderLeft() const { return this->internalPlotBorderLeft; } inline double getInternalPlotBorderLeft() const { return this->internalPlotBorderLeft; }
/*! \brief returns the property internalPlotBorderBottom ( \copybrief internalPlotBorderBottom ). \details Description of the parameter internalPlotBorderBottom is: <BLOCKQUOTE>\copydoc internalPlotBorderBottom </BLOCKQUOTE>. \see internalPlotBorderBottom for more information */ /*! \copydoc internalPlotBorderBottom */
inline double getInternalPlotBorderBottom() const { return this->internalPlotBorderBottom; } inline double getInternalPlotBorderBottom() const { return this->internalPlotBorderBottom; }
/*! \brief returns the property internalPlotBorderRight ( \copybrief internalPlotBorderRight ). \details Description of the parameter internalPlotBorderRight is: <BLOCKQUOTE>\copydoc internalPlotBorderRight </BLOCKQUOTE>. \see internalPlotBorderRight for more information */ /*! \copydoc internalPlotBorderRight */
inline double getInternalPlotBorderRight() const { return this->internalPlotBorderRight; } inline double getInternalPlotBorderRight() const { return this->internalPlotBorderRight; }
/*! \copydoc internalPlotWidth */ /*! \copydoc internalPlotWidth */
inline int getPlotWidth() const { return this->internalPlotWidth; } inline int getPlotWidth() const { return this->internalPlotWidth; }
@ -847,39 +829,39 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
const JKQTPVerticalAxis *getYAxis() const; const JKQTPVerticalAxis *getYAxis() const;
/*! \brief returns the property actSavePlot ( \copybrief actSavePlot ). \details Description of the parameter actSavePlot is: <BLOCKQUOTE>\copydoc actSavePlot </BLOCKQUOTE>. \see actSavePlot for more information */ /*! \copydoc actSavePlot */
QAction* getActionSavePlot() const; QAction* getActionSavePlot() const;
/*! \brief returns the property actSaveData ( \copybrief actSaveData ). \details Description of the parameter actSaveData is: <BLOCKQUOTE>\copydoc actSaveData </BLOCKQUOTE>. \see actSaveData for more information */ /*! \copydoc actSaveData */
QAction* getActionSaveData() const; QAction* getActionSaveData() const;
/*! \brief returns the property actCopyData ( \copybrief actCopyData ). \details Description of the parameter actCopyData is: <BLOCKQUOTE>\copydoc actCopyData </BLOCKQUOTE>. \see actCopyData for more information */ /*! \copydoc actCopyData */
QAction* getActionCopyData() const; QAction* getActionCopyData() const;
/*! \brief returns the property actCopyPixelImage ( \copybrief actCopyPixelImage ). \details Description of the parameter actCopyPixelImage is: <BLOCKQUOTE>\copydoc actCopyPixelImage </BLOCKQUOTE>. \see actCopyPixelImage for more information */ /*! \copydoc actCopyPixelImage */
QAction* getActionCopyPixelImage() const; QAction* getActionCopyPixelImage() const;
/*! \brief returns the property actCopyMatlab ( \copybrief actCopyMatlab ). \details Description of the parameter actCopyMatlab is: <BLOCKQUOTE>\copydoc actCopyMatlab </BLOCKQUOTE>. \see actCopyMatlab for more information */ /*! \copydoc actCopyMatlab */
QAction* getActionCopyMatlab() const; QAction* getActionCopyMatlab() const;
/*! \brief returns the property actSavePDF ( \copybrief actSavePDF ). \details Description of the parameter actSavePDF is: <BLOCKQUOTE>\copydoc actSavePDF </BLOCKQUOTE>. \see actSavePDF for more information */ /*! \copydoc actSavePDF */
QAction* getActionSavePDF() const; QAction* getActionSavePDF() const;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
/*! \brief returns the property actSavePS ( \copybrief actSavePS ). \details Description of the parameter actSavePS is: <BLOCKQUOTE>\copydoc actSavePS </BLOCKQUOTE>. \see actSavePS for more information */ /*! \copydoc actSavePS */
QAction* getActionSavePS() const; QAction* getActionSavePS() const;
#endif #endif
/*! \brief returns the property actSavePix ( \copybrief actSavePix ). \details Description of the parameter actSavePix is: <BLOCKQUOTE>\copydoc actSavePix </BLOCKQUOTE>. \see actSavePix for more information */ /*! \copydoc actSavePix */
QAction* getActionSavePix() const; QAction* getActionSavePix() const;
/*! \brief returns the property actSaveSVG ( \copybrief actSaveSVG ). \details Description of the parameter actSaveSVG is: <BLOCKQUOTE>\copydoc actSaveSVG </BLOCKQUOTE>. \see actSaveSVG for more information */ /*! \copydoc actSaveSVG */
QAction* getActionSaveSVG() const; QAction* getActionSaveSVG() const;
/*! \brief returns the property actPrint ( \copybrief actPrint ). \details Description of the parameter actPrint is: <BLOCKQUOTE>\copydoc actPrint </BLOCKQUOTE>. \see actPrint for more information */ /*! \copydoc actPrint */
QAction* getActionPrint() const; QAction* getActionPrint() const;
/*! \brief returns the property actSaveCSV ( \copybrief actSaveCSV ). \details Description of the parameter actSaveCSV is: <BLOCKQUOTE>\copydoc actSaveCSV </BLOCKQUOTE>. \see actSaveCSV for more information */ /*! \copydoc actSaveCSV */
QAction* getActionSaveCSV() const; QAction* getActionSaveCSV() const;
/*! \brief returns the property actZoomAll ( \copybrief actZoomAll ). \details Description of the parameter actZoomAll is: <BLOCKQUOTE>\copydoc actZoomAll </BLOCKQUOTE>. \see actZoomAll for more information */ /*! \copydoc actZoomAll */
QAction* getActionZoomAll() const; QAction* getActionZoomAll() const;
/*! \brief returns the property actZoomIn ( \copybrief actZoomIn ). \details Description of the parameter actZoomIn is: <BLOCKQUOTE>\copydoc actZoomIn </BLOCKQUOTE>. \see actZoomIn for more information */ /*! \copydoc actZoomIn */
QAction* getActionZoomIn() const; QAction* getActionZoomIn() const;
/*! \brief returns the property actZoomOut ( \copybrief actZoomOut ). \details Description of the parameter actZoomOut is: <BLOCKQUOTE>\copydoc actZoomOut </BLOCKQUOTE>. \see actZoomOut for more information */ /*! \copydoc actZoomOut */
QAction *getActionZoomOut() const; QAction *getActionZoomOut() const;
/*! \brief returns the property actShowPlotData ( \copybrief actShowPlotData ). \details Description of the parameter actShowPlotData is: <BLOCKQUOTE>\copydoc actShowPlotData </BLOCKQUOTE>. \see actShowPlotData for more information */ /*! \copydoc actShowPlotData */
QAction *getActionShowPlotData() const; QAction *getActionShowPlotData() const;
/*! \brief returns the property lstAdditionalPlotterActions ( \copybrief lstAdditionalPlotterActions ). \details Description of the parameter lstAdditionalPlotterActions is: <BLOCKQUOTE>\copydoc lstAdditionalPlotterActions </BLOCKQUOTE>. \see lstAdditionalPlotterActions for more information */ /*! \copydoc lstAdditionalPlotterActions */
AdditionalActionsMap getLstAdditionalPlotterActions() const; AdditionalActionsMap getLstAdditionalPlotterActions() const;
/** \brief this function registers additional actions to lstAdditionalPlotterActions, which are displayed in the context-menu */ /** \brief this function registers additional actions to lstAdditionalPlotterActions, which are displayed in the context-menu */
@ -890,29 +872,21 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
*/ */
void deregisterAdditionalAction(QAction* act); void deregisterAdditionalAction(QAction* act);
/*! \brief returns the property masterSynchronizeWidth ( \copybrief masterSynchronizeWidth ). \details Description of the parameter masterSynchronizeWidth is: <BLOCKQUOTE>\copydoc masterSynchronizeWidth </BLOCKQUOTE>. \see masterSynchronizeWidth for more information */ /*! \copydoc masterSynchronizeWidth */
bool getMasterSynchronizeWidth() const; bool getMasterSynchronizeWidth() const;
/*! \brief returns the property masterSynchronizeHeight ( \copybrief masterSynchronizeHeight ). \details Description of the parameter masterSynchronizeHeight is: <BLOCKQUOTE>\copydoc masterSynchronizeHeight </BLOCKQUOTE>. \see masterSynchronizeHeight for more information */ /*! \copydoc masterSynchronizeHeight */
bool getMasterSynchronizeHeight() const; bool getMasterSynchronizeHeight() const;
/*! \brief sets the property fontSizePrintMultiplier ( \copybrief fontSizePrintMultiplier ) to the specified \a __value. /*! \copydoc fontSizePrintMultiplier */
\details Description of the parameter fontSizePrintMultiplier is: <BLOCKQUOTE>\copydoc fontSizePrintMultiplier </BLOCKQUOTE>
\see fontSizePrintMultiplier for more information */
void setFontSizePrintMultiplier(double __value); void setFontSizePrintMultiplier(double __value);
/*! \brief returns the property fontSizePrintMultiplier ( \copybrief fontSizePrintMultiplier ). /*! \copydoc fontSizePrintMultiplier */
\details Description of the parameter fontSizePrintMultiplier is: <BLOCKQUOTE>\copydoc fontSizePrintMultiplier </BLOCKQUOTE>
\see fontSizePrintMultiplier for more information */
double getFontSizePrintMultiplier() const; double getFontSizePrintMultiplier() const;
/*! \brief sets the property lineWidthPrintMultiplier ( \copybrief lineWidthPrintMultiplier ) to the specified \a __value. /*! \copydoc lineWidthPrintMultiplier */
\details Description of the parameter lineWidthPrintMultiplier is: <BLOCKQUOTE>\copydoc lineWidthPrintMultiplier </BLOCKQUOTE>
\see lineWidthPrintMultiplier for more information */
void setLineWidthPrintMultiplier(double __value); void setLineWidthPrintMultiplier(double __value);
/*! \brief returns the property lineWidthPrintMultiplier ( \copybrief lineWidthPrintMultiplier ). /*! \copydoc lineWidthPrintMultiplier */
\details Description of the parameter lineWidthPrintMultiplier is: <BLOCKQUOTE>\copydoc lineWidthPrintMultiplier </BLOCKQUOTE>
\see lineWidthPrintMultiplier for more information */
double getLineWidthPrintMultiplier() const; double getLineWidthPrintMultiplier() const;
/*! \brief returns the property fontSizeMultiplier ( \copybrief fontSizeMultiplier ). \details Description of the parameter fontSizeMultiplier is: <BLOCKQUOTE>\copydoc fontSizeMultiplier </BLOCKQUOTE>. \see fontSizeMultiplier for more information */ /*! \copydoc fontSizeMultiplier */
double getFontSizeMultiplier() const; double getFontSizeMultiplier() const;
/*! \brief returns the property lineWidthMultiplier ( \copybrief lineWidthMultiplier ). \details Description of the parameter lineWidthMultiplier is: <BLOCKQUOTE>\copydoc lineWidthMultiplier </BLOCKQUOTE>. \see lineWidthMultiplier for more information */ /*! \copydoc lineWidthMultiplier */
double getLineWidthMultiplier() const; double getLineWidthMultiplier() const;
@ -1823,29 +1797,17 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/** \brief show the export preview window for a given page size \a pageSize, either in pixels (\a unitIsMM \c ==false ) or in millimeters (\a unitIsMM \c ==true ) */ /** \brief show the export preview window for a given page size \a pageSize, either in pixels (\a unitIsMM \c ==false ) or in millimeters (\a unitIsMM \c ==true ) */
bool exportpreview(QSizeF pageSize, bool unitIsMM=false); bool exportpreview(QSizeF pageSize, bool unitIsMM=false);
/*! \brief sets the property fontSizeMultiplier ( \copybrief fontSizeMultiplier ) to the specified \a __value. /*! \copydoc fontSizeMultiplier */
\details Description of the parameter fontSizeMultiplier is: <BLOCKQUOTE>\copydoc fontSizeMultiplier </BLOCKQUOTE>
\see fontSizeMultiplier for more information */
void setFontSizeMultiplier(double __value); void setFontSizeMultiplier(double __value);
/*! \brief sets the property lineWidthMultiplier ( \copybrief lineWidthMultiplier ) to the specified \a __value. /*! \copydoc lineWidthMultiplier */
\details Description of the parameter lineWidthMultiplier is: <BLOCKQUOTE>\copydoc lineWidthMultiplier </BLOCKQUOTE>
\see lineWidthMultiplier for more information */
void setLineWidthMultiplier(double __value); void setLineWidthMultiplier(double __value);
/*! \brief sets the property printMagnification ( \copybrief printMagnification ) to the specified \a __value. /*! \copydoc printMagnification */
\details Description of the parameter printMagnification is: <BLOCKQUOTE>\copydoc printMagnification </BLOCKQUOTE>
\see printMagnification for more information */
void setPrintMagnification(double __value); void setPrintMagnification(double __value);
/*! \brief returns the property printMagnification ( \copybrief printMagnification ). /*! \copydoc printMagnification */
\details Description of the parameter printMagnification is: <BLOCKQUOTE>\copydoc printMagnification </BLOCKQUOTE>
\see printMagnification for more information */
double getPrintMagnification() const; double getPrintMagnification() const;
/*! \brief sets the property paintMagnification ( \copybrief paintMagnification ) to the specified \a __value. /*! \copydoc paintMagnification */
\details Description of the parameter paintMagnification is: <BLOCKQUOTE>\copydoc paintMagnification </BLOCKQUOTE>
\see paintMagnification for more information */
void setPaintMagnification(double __value); void setPaintMagnification(double __value);
/*! \brief returns the property paintMagnification ( \copybrief paintMagnification ). /*! \copydoc paintMagnification */
\details Description of the parameter paintMagnification is: <BLOCKQUOTE>\copydoc paintMagnification </BLOCKQUOTE>
\see paintMagnification for more information */
double getPaintMagnification() const; double getPaintMagnification() const;

View File

@ -330,18 +330,14 @@ class JKQTP_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
} }
/*! \copydoc parent */ /*! \copydoc parent */
inline const JKQTBasePlotter* getParent() const { return this->parent; } inline const JKQTBasePlotter* getParent() const { return this->parent; }
/*! \brief returns the property parent ( \copybrief parent ). \details Description of the parameter parent is: <BLOCKQUOTE>\copydoc parent </BLOCKQUOTE>. \see parent for more information */ /*! \copydoc parent */
inline JKQTBasePlotter* getParent() { return this->parent; } inline JKQTBasePlotter* getParent() { return this->parent; }
/*! \brief sets the property doUpdateScaling ( \copybrief doUpdateScaling ) to the specified \a __value. /*! \copydoc doUpdateScaling */
\details Description of the parameter doUpdateScaling is: <BLOCKQUOTE>\copydoc doUpdateScaling </BLOCKQUOTE>
\see doUpdateScaling for more information */
inline void setDoUpdateScaling(bool __value) inline void setDoUpdateScaling(bool __value)
{ {
this->doUpdateScaling = __value; this->doUpdateScaling = __value;
} }
/*! \brief returns the property doUpdateScaling ( \copybrief doUpdateScaling ). /*! \copydoc doUpdateScaling */
\details Description of the parameter doUpdateScaling is: <BLOCKQUOTE>\copydoc doUpdateScaling </BLOCKQUOTE>
\see doUpdateScaling for more information */
inline bool getDoUpdateScaling() const inline bool getDoUpdateScaling() const
{ {
return this->doUpdateScaling; return this->doUpdateScaling;

View File

@ -348,6 +348,12 @@ void JKQTPDatastore::deleteAllPrefixedColumns(QString prefix, bool removeItems)
} }
////////////////////////////////////////////////////////////////////////////////////////////////
quint16 JKQTPDatastore::getColumnChecksum(int column) const
{
return getColumn(column).calculateChecksum();
}
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
void JKQTPDatastore::deleteColumn(size_t column, bool removeItems) { void JKQTPDatastore::deleteColumn(size_t column, bool removeItems) {

View File

@ -239,6 +239,8 @@ class JKQTP_LIB_EXPORT JKQTPDatastore{
inline size_t getColumnImageWidth(int column) const; inline size_t getColumnImageWidth(int column) const;
/** \brief returns the height of the image, represented by \a column (in row-major ordering) */ /** \brief returns the height of the image, represented by \a column (in row-major ordering) */
inline size_t getColumnImageHeight(int column) const; inline size_t getColumnImageHeight(int column) const;
/** \brief returns the data checksum of the given column */
quint16 getColumnChecksum(int column) const;
/** \brief returns the value at position (\c column, \c row). \c column is the logical column and will be mapped to the according memory block internally!) */ /** \brief returns the value at position (\c column, \c row). \c column is the logical column and will be mapped to the according memory block internally!) */
inline double get(size_t column, size_t row) const ; inline double get(size_t column, size_t row) const ;
@ -990,9 +992,9 @@ class JKQTP_LIB_EXPORT JKQTPColumn {
/** \brief class destructor */ /** \brief class destructor */
~JKQTPColumn() =default; ~JKQTPColumn() =default;
/*! \brief sets the property name ( \copybrief name ) to the specified \a __value. \details Description of the parameter name is: <BLOCKQUOTE>\copydoc JKQTPColumn::name </BLOCKQUOTE> \see JKQTPColumn::name for more information */ /*! \copydoc name */
void setName (const QString& __value); void setName (const QString& __value);
/*! \brief returns the property name ( \copybrief name ). \see name for more information */ /*! \copydoc name */
QString getName () const; QString getName () const;
/*! \copydoc imageColumns */ /*! \copydoc imageColumns */
@ -1096,11 +1098,13 @@ class JKQTP_LIB_EXPORT JKQTPColumn {
/** \brief set all values in the column to a specific \a value */ /** \brief set all values in the column to a specific \a value */
void setAll(double value); void setAll(double value);
/** \brief calculates a checksum over the contents of the column (using <a href="https://doc.qt.io/qt-5/qbytearray.html#qChecksum">qChecksum()</a>) */
inline quint16 calculateChecksum() const;
/*! \brief returns the property datastoreItem ( \copybrief datastoreItem ). \details Description of the parameter datastoreItem is: <BLOCKQUOTE>\copydoc JKQTPColumn::datastoreItem </BLOCKQUOTE>. \see JKQTPColumn::datastoreItem for more information */ \ /*! \copydoc datastoreItem */ \
inline size_t getDatastoreItemNum() const \ inline size_t getDatastoreItemNum() const \
{ return this->datastoreItem; } { return this->datastoreItem; }
/*! \brief returns the property datastoreOffset ( \copybrief datastoreOffset ). \details Description of the parameter datastoreOffset is: <BLOCKQUOTE>\copydoc JKQTPColumn::datastoreOffset </BLOCKQUOTE>. \see JKQTPColumn::datastoreOffset for more information */ \ /*! \copydoc datastoreOffset */ \
inline size_t getDatastoreOffset() const \ inline size_t getDatastoreOffset() const \
{ return this->datastoreOffset; } { return this->datastoreOffset; }
}; };
@ -1318,6 +1322,14 @@ inline void JKQTPColumn::incValue(size_t n, double increment){
datastore->getItem(datastoreItem)->set(datastoreOffset, n, datastore->getItem(datastoreItem)->get(datastoreOffset, n)+increment); datastore->getItem(datastoreItem)->set(datastoreOffset, n, datastore->getItem(datastoreItem)->get(datastoreOffset, n)+increment);
} }
////////////////////////////////////////////////////////////////////////////////////////////////
quint16 JKQTPColumn::calculateChecksum() const
{
if (!datastore) return 0;
if (!datastore->getItem(datastoreItem)) return 0;
return qChecksum(reinterpret_cast<const char*>(getPointer(0)), static_cast<uint>(getRows()*sizeof(double)));
}
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
inline double JKQTPColumn::getValue(size_t n) const { inline double JKQTPColumn::getValue(size_t n) const {
if (!datastore) return JKQTP_NAN; if (!datastore) return JKQTP_NAN;

View File

@ -54,11 +54,9 @@ class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
/*! \copydoc visible /*! \copydoc visible */
\see see visible for details */
void setVisible(bool __value); void setVisible(bool __value);
/*! \copydoc visible /*! \copydoc visible */
\see see visible for details */
bool isVisible() const; bool isVisible() const;
protected: protected:
@ -113,29 +111,21 @@ class JKQTP_LIB_EXPORT JKQTPOverlayTwoPositionOverlay : public JKQTPOverlayEleme
public: public:
explicit JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr); explicit JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr);
/*! \copydoc x1 /*! \copydoc x1 */
\see see x1 for details */
void setX1(double __value); void setX1(double __value);
/*! \copydoc x1 /*! \copydoc x1 */
\see see x1 for details */
double getX1() const; double getX1() const;
/*! \copydoc x2 /*! \copydoc x2 */
\see see x2 for details */
void setX2(double __value); void setX2(double __value);
/*! \copydoc x2 /*! \copydoc x2 */
\see see x2 for details */
double getX2() const; double getX2() const;
/*! \copydoc y1 /*! \copydoc y1 */
\see see y1 for details */
void setY1(double __value); void setY1(double __value);
/*! \copydoc y1 /*! \copydoc y1 */
\see see y1 for details */
double getY1() const; double getY1() const;
/*! \copydoc y2 /*! \copydoc y2 */
\see see y2 for details */
void setY2(double __value); void setY2(double __value);
/*! \copydoc y2 /*! \copydoc y2 */
\see see y2 for details */
double getY2() const; double getY2() const;
protected: protected:
/** \brief x-coordinate of first point of overlay */ /** \brief x-coordinate of first point of overlay */
@ -158,11 +148,9 @@ class JKQTP_LIB_EXPORT JKQTPOverlayOneCoordOverlay : public JKQTPOverlayElement
public: public:
explicit JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlotter *parent = nullptr); explicit JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlotter *parent = nullptr);
/*! \copydoc position /*! \copydoc position */
\see see position for details */
void setPosition(double __value); void setPosition(double __value);
/*! \copydoc position /*! \copydoc position */
\see see position for details */
double getPosition() const; double getPosition() const;
protected: protected:
/** \brief second position for the element */ /** \brief second position for the element */
@ -179,11 +167,9 @@ class JKQTP_LIB_EXPORT JKQTPOverlayTwoCoordOverlay : public JKQTPOverlayOneCoord
public: public:
explicit JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent = nullptr); explicit JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent = nullptr);
/*! \copydoc position2 /*! \copydoc position2 */
\see see position2 for details */
void setPosition2(double __value); void setPosition2(double __value);
/*! \copydoc position2 /*! \copydoc position2 */
\see see position2 for details */
double getPosition2() const; double getPosition2() const;
protected: protected:
/** \brief second position for the element */ /** \brief second position for the element */
@ -209,11 +195,9 @@ class JKQTP_LIB_EXPORT JKQTPOverlayVerticalLine : public JKQTPOverlayOneCoordOve
/** \brief set element color */ /** \brief set element color */
virtual void setColor(QColor c); virtual void setColor(QColor c);
/*! \copydoc text /*! \copydoc text */
\see see text for details */
void setText(const QString & __value); void setText(const QString & __value);
/*! \copydoc text /*! \copydoc text */
\see see text for details */
QString getText() const; QString getText() const;
protected: protected:
/** \brief a text to display next to the vertical line */ /** \brief a text to display next to the vertical line */
@ -238,18 +222,14 @@ class JKQTP_LIB_EXPORT JKQTPOverlayVerticalRange : public JKQTPOverlayTwoCoordOv
/** \brief set element color */ /** \brief set element color */
virtual void setColor(QColor c); virtual void setColor(QColor c);
/*! \copydoc inverted /*! \copydoc inverted */
\see see inverted for details */
void setInverted(bool __value); void setInverted(bool __value);
/*! \copydoc inverted /*! \copydoc inverted */
\see see inverted for details */
bool getInverted() const; bool getInverted() const;
/*! \copydoc text /*! \copydoc text */
\see see text for details */
void setText(const QString & __value); void setText(const QString & __value);
/*! \copydoc text /*! \copydoc text */
\see see text for details */
QString getText() const; QString getText() const;
protected: protected:
/** \brief a text to display next to the range */ /** \brief a text to display next to the range */
@ -270,11 +250,9 @@ class JKQTP_LIB_EXPORT JKQTPOverlayLine : public JKQTPOverlayTwoPositionOverlay,
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter); virtual void draw(JKQTPEnhancedPainter& painter);
/*! \copydoc infinite /*! \copydoc infinite */
\see see infinite for details */
void setInfinite(bool __value); void setInfinite(bool __value);
/*! \copydoc infinite /*! \copydoc infinite */
\see see infinite for details */
bool getInfinite() const; bool getInfinite() const;
/** \brief set element color */ /** \brief set element color */
virtual void setColor(QColor c); virtual void setColor(QColor c);

View File

@ -103,23 +103,17 @@ class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph, public JKQTPG
*/ */
virtual void setColor(QColor c); virtual void setColor(QColor c);
/*! \copydoc shift /*! \copydoc shift */
\see see shift for details */
void setShift(double __value); void setShift(double __value);
/*! \copydoc shift /*! \copydoc shift */
\see see shift for details */
double getShift() const; double getShift() const;
/*! \copydoc width /*! \copydoc width */
\see see width for details */
void setWidth(double __value); void setWidth(double __value);
/*! \copydoc width /*! \copydoc width */
\see see width for details */
double getWidth() const; double getWidth() const;
/*! \copydoc baseline /*! \copydoc baseline */
\see see baseline for details */
void setBaseline(double __value); void setBaseline(double __value);
/*! \copydoc baseline /*! \copydoc baseline */
\see see baseline for details */
double getBaseline() const; double getBaseline() const;
/** \brief sets the fill color and the color together, where fillColor is set to \a fill and the line-color is set to \c fill.darker(colorDarker) /** \brief sets the fill color and the color together, where fillColor is set to \a fill and the line-color is set to \c fill.darker(colorDarker)
* \see setColor() * \see setColor()

View File

@ -502,33 +502,23 @@ class JKQTP_LIB_EXPORT JKQTPXYGraph: public JKQTPGraph {
/** \copydoc JKQTPGraph::usesColumn() */ /** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int column) const override; virtual bool usesColumn(int column) const override;
/*! \copydoc xColumn /*! \copydoc xColumn */
\see see xColumn for details */
void setXColumn(int __value); void setXColumn(int __value);
/*! \copydoc xColumn /*! \copydoc xColumn */
\see see xColumn for details */
int getXColumn() const; int getXColumn() const;
/*! \brief sets the property xColumn ( \copybrief xColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc xColumn */
\details Description of the parameter xColumn is: <BLOCKQUOTE>\copydoc xColumn </BLOCKQUOTE>
\see xColumn for more information */
void setXColumn (size_t __value); void setXColumn (size_t __value);
/*! \copydoc yColumn /*! \copydoc yColumn */
\see see yColumn for details */
void setYColumn(int __value); void setYColumn(int __value);
/*! \copydoc yColumn /*! \copydoc yColumn */
\see see yColumn for details */
int getYColumn() const; int getYColumn() const;
/*! \brief sets the property yColumn ( \copybrief yColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc yColumn */
\details Description of the parameter yColumn is: <BLOCKQUOTE>\copydoc yColumn </BLOCKQUOTE>
\see yColumn for more information */
void setYColumn (size_t __value); void setYColumn (size_t __value);
/*! \copydoc sortData /*! \copydoc sortData */
\see see sortData for details */
void setDataSortOrder(DataSortOrder __value); void setDataSortOrder(DataSortOrder __value);
/*! \copydoc sortData /*! \copydoc sortData */
\see see sortData for details */
DataSortOrder getDataSortOrder() const; DataSortOrder getDataSortOrder() const;
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */ /*! \copydoc sortData */
void setDataSortOrder(int __value); void setDataSortOrder(int __value);
/** \brief sets xColumn and yColumn at the same time */ /** \brief sets xColumn and yColumn at the same time */
@ -622,32 +612,24 @@ class JKQTP_LIB_EXPORT JKQTPSingleColumnGraph: public JKQTPGraph {
JKQTPSingleColumnGraph(JKQTBasePlotter* parent=nullptr); JKQTPSingleColumnGraph(JKQTBasePlotter* parent=nullptr);
JKQTPSingleColumnGraph(JKQTPlotter* parent); JKQTPSingleColumnGraph(JKQTPlotter* parent);
/*! \copydoc dataColumn /*! \copydoc dataColumn */
\see see dataColumn for details */
void setDataColumn(int __value); void setDataColumn(int __value);
/*! \copydoc dataColumn /*! \copydoc dataColumn */
\see see dataColumn for details */
int getDataColumn() const; int getDataColumn() const;
/*! \brief sets the property dataColumn ( \copybrief dataColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc dataColumn */
\details Description of the parameter dataColumn is: <BLOCKQUOTE>\copydoc dataColumn </BLOCKQUOTE>
\see dataColumn for more information */
void setDataColumn (size_t __value); void setDataColumn (size_t __value);
/*! \copydoc sortData /*! \copydoc sortData */
\see see sortData for details */
void setDataSortOrder(DataSortOrder __value); void setDataSortOrder(DataSortOrder __value);
/*! \copydoc sortData /*! \copydoc sortData */
\see see sortData for details */
DataSortOrder getDataSortOrder() const; DataSortOrder getDataSortOrder() const;
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */ /*! \copydoc sortData */
void setDataSortOrder(int __value); void setDataSortOrder(int __value);
/*! \copydoc dataDirection /*! \copydoc dataDirection */
\see see dataDirection for details */
void setDataDirection(DataDirection __value); void setDataDirection(DataDirection __value);
/*! \copydoc dataDirection /*! \copydoc dataDirection */
\see see dataDirection for details */
DataDirection getDataDirection() const; DataDirection getDataDirection() const;
/** \copydoc JKQTPGraph::usesColumn() */ /** \copydoc JKQTPGraph::usesColumn() */

View File

@ -139,106 +139,69 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph, public JKQT
/** \copydoc JKQTPGraph::usesColumn() */ /** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int c) const override; virtual bool usesColumn(int c) const override;
/*! \copydoc sortData /*! \copydoc sortData */
\see see sortData for details */
void setDataSortOrder(DataSortOrder __value); void setDataSortOrder(DataSortOrder __value);
/*! \copydoc sortData /*! \copydoc sortData */
\see see sortData for details */
DataSortOrder getDataSortOrder() const; DataSortOrder getDataSortOrder() const;
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */ /*! \copydoc sortData */
void setDataSortOrder(int __value); void setDataSortOrder(int __value);
/*! \copydoc posColumn /*! \copydoc posColumn */
\see see posColumn for details */
void setPositionColumn(int __value); void setPositionColumn(int __value);
/*! \copydoc posColumn /*! \copydoc posColumn */
\see see posColumn for details */
int getPositionColumn() const; int getPositionColumn() const;
/*! \brief sets the property posColumn ( \copybrief posColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc posColumn */
\details Description of the parameter posColumn is: <BLOCKQUOTE>\copydoc posColumn </BLOCKQUOTE>
\see posColumn for more information */
void setPositionColumn (size_t __value); void setPositionColumn (size_t __value);
/*! \copydoc medianColumn /*! \copydoc medianColumn */
\see see medianColumn for details */
void setMedianColumn(int __value); void setMedianColumn(int __value);
/*! \copydoc medianColumn /*! \copydoc medianColumn */
\see see medianColumn for details */
int getMedianColumn() const; int getMedianColumn() const;
/*! \brief sets the property medianColumn ( \copybrief medianColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc medianColumn */
\details Description of the parameter medianColumn is: <BLOCKQUOTE>\copydoc medianColumn </BLOCKQUOTE>
\see medianColumn for more information */
void setMedianColumn (size_t __value); void setMedianColumn (size_t __value);
/*! \copydoc meanColumn /*! \copydoc meanColumn */
\see see meanColumn for details */
void setMeanColumn(int __value); void setMeanColumn(int __value);
/*! \copydoc meanColumn /*! \copydoc meanColumn */
\see see meanColumn for details */
int getMeanColumn() const; int getMeanColumn() const;
/*! \brief sets the property meanColumn ( \copybrief meanColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc meanColumn */
\details Description of the parameter meanColumn is: <BLOCKQUOTE>\copydoc meanColumn </BLOCKQUOTE>
\see meanColumn for more information */
void setMeanColumn (size_t __value); void setMeanColumn (size_t __value);
/*! \copydoc minColumn /*! \copydoc minColumn */
\see see minColumn for details */
void setMinColumn(int __value); void setMinColumn(int __value);
/*! \copydoc minColumn /*! \copydoc minColumn */
\see see minColumn for details */
int getMinColumn() const; int getMinColumn() const;
/*! \brief sets the property minColumn ( \copybrief minColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc minColumn */
\details Description of the parameter minColumn is: <BLOCKQUOTE>\copydoc minColumn </BLOCKQUOTE>
\see minColumn for more information */
void setMinColumn( size_t __value); void setMinColumn( size_t __value);
/*! \copydoc maxColumn /*! \copydoc maxColumn */
\see see maxColumn for details */
void setMaxColumn(int __value); void setMaxColumn(int __value);
/*! \copydoc maxColumn /*! \copydoc maxColumn */
\see see maxColumn for details */
int getMaxColumn() const; int getMaxColumn() const;
/*! \brief sets the property maxColumn ( \copybrief maxColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc maxColumn */
\details Description of the parameter maxColumn is: <BLOCKQUOTE>\copydoc maxColumn </BLOCKQUOTE>
\see maxColumn for more information */
void setMaxColumn (size_t __value); void setMaxColumn (size_t __value);
/*! \copydoc percentile25Column /*! \copydoc percentile25Column */
\see see percentile25Column for details */
void setPercentile25Column(int __value); void setPercentile25Column(int __value);
/*! \copydoc percentile25Column /*! \copydoc percentile25Column */
\see see percentile25Column for details */
int getPercentile25Column() const; int getPercentile25Column() const;
/*! \brief sets the property percentile25Column ( \copybrief percentile25Column ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc percentile25Column */
\details Description of the parameter percentile25Column is: <BLOCKQUOTE>\copydoc percentile25Column </BLOCKQUOTE>
\see percentile25Column for more information */
void setPercentile25Column (size_t __value); void setPercentile25Column (size_t __value);
/*! \copydoc percentile75Column /*! \copydoc percentile75Column */
\see see percentile75Column for details */
void setPercentile75Column(int __value); void setPercentile75Column(int __value);
/*! \copydoc percentile75Column /*! \copydoc percentile75Column */
\see see percentile75Column for details */
int getPercentile75Column() const; int getPercentile75Column() const;
/*! \brief sets the property percentile75Column ( \copybrief percentile75Column ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc percentile75Column */
\details Description of the parameter percentile75Column is: <BLOCKQUOTE>\copydoc percentile75Column </BLOCKQUOTE>
\see percentile75Column for more information */
void setPercentile75Column (size_t __value); void setPercentile75Column (size_t __value);
/*! \copydoc medianConfidenceColumn /*! \copydoc medianConfidenceColumn */
\see see medianConfidenceColumn for details */
int getMedianConfidenceColumn() const; int getMedianConfidenceColumn() const;
/*! \brief sets the property medianConfidenceColumn ( \copybrief medianConfidenceColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc medianConfidenceColumn */
\details Description of the parameter medianConfidenceColumn is: <BLOCKQUOTE>\copydoc medianConfidenceColumn </BLOCKQUOTE>
\see medianConfidenceColumn for more information */
void setMedianConfidenceColumn (size_t __value); void setMedianConfidenceColumn (size_t __value);
/*! \copydoc boxWidthRelative /*! \copydoc boxWidthRelative */
\see see boxWidthRelative for details */
void setBoxWidthRelative(double __value); void setBoxWidthRelative(double __value);
/*! \copydoc boxWidthRelative /*! \copydoc boxWidthRelative */
\see see boxWidthRelative for details */
double getBoxWidthRelative() const; double getBoxWidthRelative() const;
/*! \copydoc useRelativeBoxWidth /*! \copydoc useRelativeBoxWidth */
\see see useRelativeBoxWidth for details */
void setUseRelativeBoxWidth(bool __value); void setUseRelativeBoxWidth(bool __value);
/*! \copydoc useRelativeBoxWidth /*! \copydoc useRelativeBoxWidth */
\see see useRelativeBoxWidth for details */
bool getUseRelativeBoxWidth() const; bool getUseRelativeBoxWidth() const;
protected: protected:
/** \brief width of box in percent of distance between the current two posColumn values /** \brief width of box in percent of distance between the current two posColumn values
@ -372,79 +335,55 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject, publ
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/*! \copydoc pos /*! \copydoc pos */
\see see pos for details */
void setPos(double __value); void setPos(double __value);
/*! \copydoc pos /*! \copydoc pos */
\see see pos for details */
double getPos() const; double getPos() const;
/*! \copydoc median /*! \copydoc median */
\see see median for details */
void setMedian(double __value); void setMedian(double __value);
/*! \copydoc median /*! \copydoc median */
\see see median for details */
double getMedian() const; double getMedian() const;
/*! \copydoc mean /*! \copydoc mean */
\see see mean for details */
void setMean(double __value); void setMean(double __value);
/*! \copydoc mean /*! \copydoc mean */
\see see mean for details */
double getMean() const; double getMean() const;
/*! \copydoc min /*! \copydoc min */
\see see min for details */
void setMin(double __value); void setMin(double __value);
/*! \copydoc min /*! \copydoc min */
\see see min for details */
double getMin() const; double getMin() const;
/*! \copydoc max /*! \copydoc max */
\see see max for details */
void setMax(double __value); void setMax(double __value);
/*! \copydoc max /*! \copydoc max */
\see see max for details */
double getMax() const; double getMax() const;
/*! \copydoc percentile25 /*! \copydoc percentile25 */
\see see percentile25 for details */
void setPercentile25(double __value); void setPercentile25(double __value);
/*! \copydoc percentile25 /*! \copydoc percentile25 */
\see see percentile25 for details */
double getPercentile25() const; double getPercentile25() const;
/*! \copydoc percentile75 /*! \copydoc percentile75 */
\see see percentile75 for details */
void setPercentile75(double __value); void setPercentile75(double __value);
/*! \copydoc percentile75 /*! \copydoc percentile75 */
\see see percentile75 for details */
double getPercentile75() const; double getPercentile75() const;
/*! \copydoc drawMean /*! \copydoc drawMean */
\see see drawMean for details */
void setDrawMean(bool __value); void setDrawMean(bool __value);
/*! \copydoc drawMean /*! \copydoc drawMean */
\see see drawMean for details */
bool getDrawMean() const; bool getDrawMean() const;
/*! \copydoc drawMedian /*! \copydoc drawMedian */
\see see drawMedian for details */
void setDrawMedian(bool __value); void setDrawMedian(bool __value);
/*! \copydoc drawMedian /*! \copydoc drawMedian */
\see see drawMedian for details */
bool getDrawMedian() const; bool getDrawMedian() const;
/*! \copydoc drawMinMax /*! \copydoc drawMinMax */
\see see drawMinMax for details */
void setDrawMinMax(bool __value); void setDrawMinMax(bool __value);
/*! \copydoc drawMinMax /*! \copydoc drawMinMax */
\see see drawMinMax for details */
bool getDrawMinMax() const; bool getDrawMinMax() const;
/*! \copydoc drawNotch /*! \copydoc drawNotch */
\see see drawNotch for details */
void setDrawNotch(bool __value); void setDrawNotch(bool __value);
/*! \copydoc drawNotch /*! \copydoc drawNotch */
\see see drawNotch for details */
bool getDrawNotch() const; bool getDrawNotch() const;
/*! \copydoc medianConfidenceIntervalWidth /*! \copydoc medianConfidenceIntervalWidth */
\see see medianConfidenceIntervalWidth for details */
double getMedianConfidenceIntervalWidth() const; double getMedianConfidenceIntervalWidth() const;
/*! \copydoc medianConfidenceIntervalWidth /*! \copydoc medianConfidenceIntervalWidth */
\see see medianConfidenceIntervalWidth for details */
void setMedianConfidenceIntervalWidth(double __value); void setMedianConfidenceIntervalWidth(double __value);
protected: protected:

View File

@ -49,32 +49,24 @@ class JKQTP_LIB_EXPORT JKQTPGraphBoxplotStyleMixin: public JKQTPGraphLineStyleMi
JKQTPGraphBoxplotStyleMixin(); JKQTPGraphBoxplotStyleMixin();
void initBoxplotStyle(JKQTBasePlotter* parent, int &parentPlotStyle); void initBoxplotStyle(JKQTBasePlotter* parent, int &parentPlotStyle);
/*! \copydoc boxWidthAbsolute /*! \copydoc boxWidthAbsolute */
\see see boxWidthAbsolute for details */
void setBoxWidthAbsolute(double __value); void setBoxWidthAbsolute(double __value);
/*! \copydoc boxWidthAbsolute /*! \copydoc boxWidthAbsolute */
\see see boxWidthAbsolute for details */
double getBoxWidthAbsolute() const; double getBoxWidthAbsolute() const;
/*! \copydoc drawBox /*! \copydoc drawBox */
\see see drawBox for details */
void setDrawBox(bool __value); void setDrawBox(bool __value);
/*! \copydoc drawBox /*! \copydoc drawBox */
\see see drawBox for details */
bool getDrawBox() const; bool getDrawBox() const;
/*! \copydoc relativeWhiskerWidth /*! \copydoc relativeWhiskerWidth */
\see see relativeWhiskerWidth for details */
void setRelativeWhiskerWidth(double __value); void setRelativeWhiskerWidth(double __value);
/*! \copydoc relativeWhiskerWidth /*! \copydoc relativeWhiskerWidth */
\see see relativeWhiskerWidth for details */
double getRelativeWhiskerWidth() const; double getRelativeWhiskerWidth() const;
/*! \copydoc relativeNotchIndent /*! \copydoc relativeNotchIndent */
\see see relativeNotchIndent for details */
void setRelativeNotchIndent(double __value); void setRelativeNotchIndent(double __value);
/*! \copydoc relativeNotchIndent /*! \copydoc relativeNotchIndent */
\see see relativeNotchIndent for details */
double getRelativeNotchIndent() const; double getRelativeNotchIndent() const;
@ -209,11 +201,9 @@ class JKQTP_LIB_EXPORT JKQTPGraphBoxplotStyleMixin: public JKQTPGraphLineStyleMi
MeanAsLine /*!< \brief draw mean as a lie (specified by the pen settings in JKQTPGraphSymbolStyleMixin) */ MeanAsLine /*!< \brief draw mean as a lie (specified by the pen settings in JKQTPGraphSymbolStyleMixin) */
}; };
/*! \copydoc meanMode /*! \copydoc meanMode */
\see see meanMode for details */
void setMeanMode(MeanMode __value); void setMeanMode(MeanMode __value);
/*! \copydoc meanMode /*! \copydoc meanMode */
\see see meanMode for details */
MeanMode getMeanMode() const; MeanMode getMeanMode() const;

View File

@ -24,6 +24,7 @@
#include "jkqtcommon/jkqtptools.h" #include "jkqtcommon/jkqtptools.h"
#include "jkqtplottertools/jkqtpenhancedpainter.h" #include "jkqtplottertools/jkqtpenhancedpainter.h"
#include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/jkqtplotter.h"
#include "jkqtpgraphscontour.h"
#include <QDebug> #include <QDebug>
#include <QImageWriter> #include <QImageWriter>
#include <QFileDialog> #include <QFileDialog>
@ -32,60 +33,54 @@
#include <QClipboard> #include <QClipboard>
# include <QVector3D> # include <QVector3D>
JKQTPContour::JKQTPContour(JKQTBasePlotter *parent) : JKQTPContourPlot::JKQTPContourPlot(JKQTBasePlotter *parent) :
JKQTPMathImage(parent) JKQTPMathImage(parent)
{ {
colorBarRightVisible=false;
ignoreOnPlane=false; ignoreOnPlane=false;
numberOfLevels=1; contourColoringMode=ColorContoursFromPaletteByValue;
colorFromPalette=true;
datatype=JKQTPMathImageBase::DoubleArray;
relativeLevels=false;
initLineStyle(parent, parentPlotStyle);
}
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQTBasePlotter* parent) :
JKQTPMathImage( x, y, width, height, datatype, data, Nx, Ny, palette, parent)
{
colorBarRightVisible=false;
ignoreOnPlane=false;
numberOfLevels=1;
colorFromPalette=true;
relativeLevels=false; relativeLevels=false;
initLineStyle(parent, parentPlotStyle); initLineStyle(parent, parentPlotStyle);
} }
JKQTPContour::JKQTPContour(JKQTPlotter *parent) : JKQTPContourPlot::JKQTPContourPlot(JKQTPlotter *parent) :
JKQTPContour(parent->getPlotter()) JKQTPContourPlot(parent->getPlotter())
{ {
} }
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQTPlotter* parent) :
JKQTPContour( x, y, width, height, data, Nx, Ny, palette, datatype, parent->getPlotter())
{
}
void JKQTPContour::draw(JKQTPEnhancedPainter &painter) void JKQTPContourPlot::draw(JKQTPEnhancedPainter &painter)
{ {
//qDebug()<<"JKQTPContourPlot::draw"; //qDebug()<<"JKQTPContourPlot::draw";
ensureImageData();
if(contourLevels.isEmpty()) createContourLevels(numberOfLevels); int numberOfLevels=contourLevels.size();
else {
numberOfLevels=contourLevels.size(); if (numberOfLevels<=0) return;
// qSort(contourLevels);
int64_t colChecksum=-1;
if (data && Nx*Ny>0) {
colChecksum=static_cast<int64_t>(qChecksum(reinterpret_cast<char*>(data), Nx*Ny* getSampleSize()));
} }
/*if (parent && parent->getDatastore() && imageColumn>=0) {
colChecksum=static_cast<int64_t>(parent->getDatastore()->getColumnChecksum(imageColumn));
}*/
if(contourLines.isEmpty()) { // contour lines are only calculated once if(contourLinesCache.isEmpty() || (contourLinesCachedForChecksum!=colChecksum) || (contourLinesCachedForChecksum<0)) { // contour lines are only calculated once
QList<QVector<QLineF> > lines;
lines.reserve(contourLevels.size());
for(int i =0; i<contourLevels.size();++i) { for(int i =0; i<contourLevels.size();++i) {
contourLines.append(QVector<QLineF> (0)); lines.append(QVector<QLineF> (0));
}
this->calcContourLines(lines);
contourLinesCache.clear();
contourLinesCachedForChecksum=colChecksum;
for (const QVector<QLineF>& l: lines) {
contourLinesCache.push_back(JKQTPUnifyLinesToPolygons(l, qMin(getWidth()/static_cast<double>(getNx()),getHeight()/static_cast<double>(getNy()))/4.0));
} }
this->calcContourLines(contourLines);
} }
@ -95,29 +90,53 @@ void JKQTPContour::draw(JKQTPEnhancedPainter &painter)
QPen p=getLinePen(painter, parent); QPen p=getLinePen(painter, parent);
painter.setPen(p); painter.setPen(p);
QImage colorLevels = getPaletteImage(palette,numberOfLevels); // calculate an image with one pixel per contour level and fill it with the appropriate colors
QVector<QLineF> contourLinesTransformedSingleLevel; QImage colorLevels = getPaletteImage(palette,numberOfLevels); // (contourColoringMode==ContourColoringMode::ColorContoursFromPalette)
QLineF lineTranformed; if (contourColoringMode==ContourColoringMode::SingleColorContours) {
for(int i =0; i<numberOfLevels;++i) { for (int i=0; i<numberOfLevels; i++) colorLevels.setPixel(i, 0, getLineColor().rgba());
if(colorFromPalette) { } else if (contourColoringMode==ContourColoringMode::ColorContoursFromPaletteByValue) {
QImage colorDataLevels = getPaletteImage(palette,2000);
for (int i=0; i<numberOfLevels; i++) {
colorLevels.setPixel(i, 0, colorDataLevels.pixel(qBound<int>(0, (internalDataMax-contourLevels.value(i, 0))*static_cast<double>(colorDataLevels.width())/(internalDataMax-internalDataMin), colorDataLevels.width()-1),0));
}
}
// set override colors
for (int i=0; i<numberOfLevels; i++) {
if (contourOverrideColor.contains(contourLevels[i])) {
colorLevels.setPixel(i, 0, contourOverrideColor[contourLevels[i]].rgba());
}
}
getDataMinMax(internalDataMin, internalDataMax);
{
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaat(QString("JKQTPContourPlot::draw(): draw lines (incl. unify)"));
#endif
for(int i =0; i<numberOfLevels;++i) {
//qDebug()<<"============================================================\n== LEVEL "<<i<<"\n============================================================";
QVector<QPolygonF> contourLinesTransformedSingleLevel;
p.setColor(QColor(colorLevels.pixel(i,0))); p.setColor(QColor(colorLevels.pixel(i,0)));
painter.setPen(p); painter.setPen(p);
// transform into plot coordinates
for(auto polygon =contourLinesCache.at(i).begin(); polygon!=contourLinesCache.at(i).end();++polygon ) {
contourLinesTransformedSingleLevel.push_back(QPolygonF());
for (auto& p: *polygon) {
contourLinesTransformedSingleLevel.last().append(transform(x+p.x()/double(Nx-1)*width, y+p.y()/double(Ny-1)*height));
}
//qDebug()<<lineTranformed;
}
for (const QPolygonF& p: contourLinesTransformedSingleLevel) {
painter.drawPolyline(p);
}
} }
// transform into plot coordinates
for(QVector<QLineF >::const_iterator line =contourLines.at(i).begin(); line!=contourLines.at(i).end();++line ) {
lineTranformed.setP1(transform(x+line->p1().x()/double(Nx-1)*width, y+line->p1().y()/double(Ny-1)*height));
lineTranformed.setP2(transform(x+line->p2().x()/double(Nx-1)*width, y+line->p2().y()/double(Ny-1)*height));
contourLinesTransformedSingleLevel.append(lineTranformed);
}
painter.drawLines(contourLinesTransformedSingleLevel);
contourLinesTransformedSingleLevel.clear();
} }
} }
void JKQTPContour::createContourLevels(int nLevels) void JKQTPContourPlot::createContourLevels(int nLevels)
{ {
ensureImageData();
clearContourLevel();
if (!data) return; if (!data) return;
if (nLevels<1) return; if (nLevels<1) return;
double min,max; double min,max;
@ -129,10 +148,14 @@ void JKQTPContour::createContourLevels(int nLevels)
} }
relativeLevels=false; relativeLevels=false;
clearCachedContours();
} }
void JKQTPContour::createContourLevelsLog(int nLevels, int m) void JKQTPContourPlot::createContourLevelsLog(int nLevels, int m)
{ {
ensureImageData();
clearContourLevel();
if (!data) return; if (!data) return;
if (nLevels<1) return; if (nLevels<1) return;
double min,max; double min,max;
@ -161,217 +184,122 @@ void JKQTPContour::createContourLevelsLog(int nLevels, int m)
} }
relativeLevels=false; relativeLevels=false;
clearCachedContours();
} }
void JKQTPContour::setIgnoreOnPlane(bool __value) void JKQTPContourPlot::setIgnoreOnPlane(bool __value)
{ {
this->ignoreOnPlane = __value; this->ignoreOnPlane = __value;
clearCachedContours();
} }
bool JKQTPContour::getIgnoreOnPlane() const bool JKQTPContourPlot::getIgnoreOnPlane() const
{ {
return this->ignoreOnPlane; return this->ignoreOnPlane;
} }
void JKQTPContour::setNumberOfLevels(int __value) int JKQTPContourPlot::getNumberOfLevels() const
{ {
this->numberOfLevels = __value; return this->contourLevels.size();
} }
int JKQTPContour::getNumberOfLevels() const void JKQTPContourPlot::setContourColoringMode(ContourColoringMode __value)
{ {
return this->numberOfLevels; this->contourColoringMode = __value;
} }
void JKQTPContour::setColorFromPalette(bool __value) JKQTPContourPlot::ContourColoringMode JKQTPContourPlot::getContourColoringMode() const
{ {
this->colorFromPalette = __value; return this->contourColoringMode;
} }
bool JKQTPContour::getColorFromPalette() const QVector<double> JKQTPContourPlot::getContourLevels() const
{
return this->colorFromPalette;
}
void JKQTPContour::setContourLevels(const QList<double> &__value)
{
this->contourLevels = __value;
}
QList<double> JKQTPContour::getContourLevels() const
{ {
return this->contourLevels; return this->contourLevels;
} }
void JKQTPContour::setRelativeLevels(bool __value) void JKQTPContourPlot::setRelativeLevels(bool __value)
{ {
this->relativeLevels = __value; this->relativeLevels = __value;
} }
bool JKQTPContour::getRelativeLevels() const bool JKQTPContourPlot::getRelativeLevels() const
{ {
return this->relativeLevels; return this->relativeLevels;
} }
void JKQTPContour::setImageColumn(size_t columnID) void JKQTPContourPlot::addContourLevel(double level)
{ {
datatype=JKQTPMathImageBase::DoubleArray; contourLevels.append(level);
data=parent->getDatastore()->getColumnPointer(columnID,0); qSort(contourLevels);
if (parent && columnID>=0 && parent->getDatastore()) { clearCachedContours();
setNx(parent->getDatastore()->getColumnImageWidth(columnID)); }
setNy(parent->getDatastore()->getColumnImageHeight(columnID));
void JKQTPContourPlot::addContourLevel(double level, QColor overrideColor)
{
addContourLevel(level);
setOverrideColor(level, overrideColor);
}
void JKQTPContourPlot::setOverrideColor(double level, QColor overrideColor)
{
contourOverrideColor[level]=overrideColor;
}
QColor JKQTPContourPlot::getOverrideColor(int level) const
{
if (level>=0 && level<contourLevels.size()) {
if (contourOverrideColor.contains(contourLevels.at(level))) {
return contourOverrideColor.value(contourLevels.at(level));
}
}
return getLineColor();
}
bool JKQTPContourPlot::hasOverrideColor(int level) const
{
if (level>=0 && level<contourLevels.size()) {
if (contourOverrideColor.contains(contourLevels.at(level))) {
return true;
}
}
return false;
}
void JKQTPContourPlot::removeOverrideColor(int level)
{
if (level>=0 && level<contourLevels.size()) {
if (contourOverrideColor.contains(contourLevels.at(level))) {
contourOverrideColor.remove(contourLevels.at(level));
}
} }
} }
void JKQTPContourPlot::clearContourLevel()
void JKQTPContour::ensureImageData()
{ {
contourLevels.clear();
contourOverrideColor.clear();
clearCachedContours();
} }
double JKQTPContour::value(int xIdx, int yIdx) void JKQTPContourPlot::clearCachedContours()
{ {
// row-major in datastore contourLinesCache.clear();
ensureImageData(); contourLinesCachedForChecksum=-1;
if (!data) return 0;
switch(datatype) {
case JKQTPMathImageBase::DoubleArray:
return (static_cast<double*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::FloatArray:
return (static_cast<float*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt8Array:
return (static_cast<uint8_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt16Array:
return (static_cast<uint16_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt32Array:
return (static_cast<uint32_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt64Array:
return (static_cast<uint64_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int8Array:
return (static_cast<int8_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int16Array:
return (static_cast<int16_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int32Array:
return (static_cast<int32_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int64Array:
return (static_cast<int64_t*>(data))[yIdx*getNx()+xIdx];
default:
return 0;
}
}
bool JKQTPContour::intersect(QLineF &line, const QVector3D &vertex1,const QVector3D &vertex2,const QVector3D &vertex3,double level)
{
bool found = true;
// Are the vertices below (-1), on (0) or above (1) the plane ?
const int eq1 = compare2level(vertex1,level);
const int eq2 = compare2level(vertex2,level);
const int eq3 = compare2level(vertex3,level);
/*
(a) All the vertices lie below the contour level.
(b) Two vertices lie below and one on the contour level.
(c) Two vertices lie below and one above the contour level.
(d) One vertex lies below and two on the contour level.
(e) One vertex lies below, one on and one above the contour level.
(f) One vertex lies below and two above the contour level.
(g) Three vertices lie on the contour level.
(h) Two vertices lie on and one above the contour level.
(i) One vertex lies on and two above the contour level.
(j) All the vertices lie above the contour level.
*/
static const int caseLUT[3][3][3] =
{
// jump table to avoid nested case statements
{ { 0, 0, 8 }, { 0, 2, 5 }, { 7, 6, 9 } },
{ { 0, 3, 4 }, { 1, 10, 1 }, { 4, 3, 0 } },
{ { 9, 6, 7 }, { 5, 2, 0 }, { 8, 0, 0 } }
};
const int caseType = caseLUT[eq1+1][eq2+1][eq3+1];
switch (caseType)
{
case 1:
// d(0,0,-1), h(0,0,1)
line.setP1(vertex1.toPointF());
line.setP2(vertex2.toPointF());
break;
case 2:
// d(-1,0,0), h(1,0,0)
line.setP1(vertex2.toPointF());
line.setP2(vertex3.toPointF());
break;
case 3:
// d(0,-1,0), h(0,1,0)
line.setP1(vertex3.toPointF());
line.setP2(vertex1.toPointF());
break;
case 4:
// e(0,-1,1), e(0,1,-1)
line.setP1(vertex1.toPointF());
line.setP2(interpolatePoint(vertex2, vertex3, level));
break;
case 5:
// e(-1,0,1), e(1,0,-1)
line.setP1(vertex2.toPointF());
line.setP2(interpolatePoint(vertex3, vertex1, level));
break;
case 6:
// e(-1,1,0), e(1,0,-1)
line.setP1(vertex3.toPointF());
line.setP2(interpolatePoint(vertex1, vertex2, level));
break;
case 7:
// c(-1,1,-1), f(1,1,-1)
line.setP1(interpolatePoint(vertex1, vertex2, level));
line.setP2(interpolatePoint(vertex2, vertex3, level));
break;
case 8:
// c(-1,-1,1), f(1,1,-1)
line.setP1(interpolatePoint(vertex2, vertex3, level));
line.setP2(interpolatePoint(vertex3, vertex1, level));
break;
case 9:
// f(-1,1,1), c(1,-1,-1)
line.setP1(interpolatePoint(vertex3, vertex1, level));
line.setP2(interpolatePoint(vertex1, vertex2, level));
break;
case 10:
// g(0,0,0)
// The CONREC algorithm has no satisfying solution for
// what to do, when all vertices are on the plane.
if ( ignoreOnPlane )
found = false;
else
{
line.setP1(vertex3.toPointF());
line.setP2(vertex1.toPointF());
}
break;
default:
found = false;
}
// qDebug()<<caseType;
// qDebug()<<line;
return found;
} }
int JKQTPContour::compare2level(const QVector3D &vertex, double level)
{
if (vertex.z() > level)
return 1; void JKQTPContourPlot::calcContourLines(QList<QVector<QLineF> > &ContourLines)
if (vertex.z() < level)
return -1;
return 0;
}
void JKQTPContour::calcContourLines(QList<QVector<QLineF> > &ContourLines)
{ {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaat(QString("JKQTPContourPlot::calcContourLines()"));
#else
qDebug()<<"JKQTPContourPlot::calcContourLines()";
#endif
double scale=1; ///< scale of the contour levels; double scale=1; ///< scale of the contour levels;
@ -410,20 +338,20 @@ void JKQTPContour::calcContourLines(QList<QVector<QLineF> > &ContourLines)
for ( int yp = 0; yp < (int64_t)getNy() - 1; ++yp ) { // go through image (pixel coordinates) in row major order for ( int yp = 0; yp < (int64_t)getNy() - 1; ++yp ) { // go through image (pixel coordinates) in row major order
QVector<QVector3D> vertices(NumPositions); QVector<QVector3D> vertices(NumPositions);
for ( int xp = 0; xp < (int64_t)getNy() - 1; ++xp ) { for ( int xp = 0; xp < (int64_t)getNx() - 1; ++xp ) {
if ( xp == 0 ) if ( xp == 0 )
{ {
vertices[TopRight].setX(xp); // will be used for TopLeft later vertices[TopRight].setX(xp); // will be used for TopLeft later
vertices[TopRight].setY(yp); vertices[TopRight].setY(yp);
vertices[TopRight].setZ( vertices[TopRight].setZ(
value( vertices[TopRight].x(), vertices[TopRight].y())*scale getPixelValue( vertices[TopRight].x(), vertices[TopRight].y())*scale
); );
vertices[BottomRight].setX(xp); vertices[BottomRight].setX(xp);
vertices[BottomRight].setY(yp+1); vertices[BottomRight].setY(yp+1);
vertices[BottomRight].setZ( vertices[BottomRight].setZ(
value(vertices[BottomRight].x(), vertices[BottomRight].y())*scale getPixelValue(vertices[BottomRight].x(), vertices[BottomRight].y())*scale
); );
} }
@ -433,13 +361,13 @@ void JKQTPContour::calcContourLines(QList<QVector<QLineF> > &ContourLines)
vertices[TopRight].setX(xp + 1); vertices[TopRight].setX(xp + 1);
vertices[TopRight].setY(yp); // <---- vertices[TopRight].setY(yp); // <----
vertices[TopRight].setZ( vertices[TopRight].setZ(
value(vertices[TopRight].x(), vertices[TopRight].y())*scale getPixelValue(vertices[TopRight].x(), vertices[TopRight].y())*scale
); );
vertices[BottomRight].setX(xp + 1); vertices[BottomRight].setX(xp + 1);
vertices[BottomRight].setY(yp + 1); vertices[BottomRight].setY(yp + 1);
vertices[BottomRight].setZ( vertices[BottomRight].setZ(
value(vertices[BottomRight].x(), vertices[BottomRight].y())*scale getPixelValue(vertices[BottomRight].x(), vertices[BottomRight].y())*scale
); );
double zMin = vertices[TopLeft].z(); double zMin = vertices[TopLeft].z();
@ -495,25 +423,49 @@ void JKQTPContour::calcContourLines(QList<QVector<QLineF> > &ContourLines)
} }
} }
QPointF JKQTPContour::interpolatePoint(const QVector3D &point1, const QVector3D &point2,double level)
{
const double h1 = point1.z() - level; // height above contour level
const double h2 = point2.z() - level;
// // check if h1 or h2 is zero
// Division by zero is not possible (the intersect function is not called if h2-h1 is zero, !)
// if(h2-h1==0||h1==0||h2==0) {
// qDebug()<<h1<<h2;
// qDebug()<<"interpolate p1="<<point1<<", p2="<<point2<<" level="<<level;
// }
const double x = (h2 * point1.x() - h1 * point2.x()) / (h2 - h1); // linear interpolation in x.direction (independent of y)
const double y = (h2 * point1.y() - h1 * point2.y()) / (h2 - h1);
// const double alpha=(level-point1.z())/(point2.z()-point1.z()); JKQTPColumnContourPlot::JKQTPColumnContourPlot(JKQTBasePlotter *parent):
// const double x=point1.x()+alpha*(point2.x()-point1.x()); JKQTPContourPlot(parent)
// const double y=point1.y()+alpha*(point2.y()-point1.y()); {
this->imageColumn=imageColumn;
return QPointF(x, y); this->datatype=JKQTPMathImageBase::DoubleArray;
} }
JKQTPColumnContourPlot::JKQTPColumnContourPlot(JKQTPlotter *parent):
JKQTPColumnContourPlot(parent->getPlotter())
{
}
void JKQTPColumnContourPlot::setImageColumn(int __value)
{
this->imageColumn = __value;
if (parent && __value>=0 && parent->getDatastore()) {
setNx(parent->getDatastore()->getColumnImageWidth(__value));
setNy(parent->getDatastore()->getColumnImageHeight(__value));
}
}
int JKQTPColumnContourPlot::getImageColumn() const
{
return this->imageColumn;
}
bool JKQTPColumnContourPlot::usesColumn(int c) const
{
return (c==imageColumn);
}
void JKQTPColumnContourPlot::ensureImageData()
{
if (this->Nx==0 || imageColumn<0 || !parent->getDatastore()->getColumnPointer(imageColumn,0)) {
this->Ny=0;
this->data=nullptr;
this->datatype=JKQTPMathImageBase::DoubleArray;
} else {
this->datatype=JKQTPMathImageBase::DoubleArray;
this->data=parent->getDatastore()->getColumnPointer(imageColumn,0);
this->Ny=parent->getDatastore()->getRows(imageColumn)/this->Nx;
}
}

View File

@ -25,6 +25,7 @@
#include <QString> #include <QString>
#include <QPainter> #include <QPainter>
#include <QImage> #include <QImage>
#include <QVector3D>
#include <QIcon> #include <QIcon>
#include "jkqtplotter/jkqtpgraphsscatter.h" #include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtcommon/jkqtptools.h" #include "jkqtcommon/jkqtptools.h"
@ -38,33 +39,54 @@
/*! \brief class for a contour plot /*! \brief class for a contour plot
* \ingroup jkqtplotter_imagelots_contour * \ingroup jkqtplotter_imagelots_contour
* calculates the contour of a given image using the CONREC algorithm
* <a href="http://paulbourke.net/papers/conrec/">http://paulbourke.net/papers/conrec/</a>
* The implementation for Qt is adapted from Qwt
* <a href="http://qwt.sourceforge.net/">http://qwt.sourceforge.net/</a>
* *
* The contour lines are calculated only once and then redrawn to save plotting time. * This class calculates the contour plot for a given image \f$ f(x,y) \f$ , i.e. it
* Make sure you add a new graph when your data changes. The contour levels can be defined in * finds the iso lines/polygons, connecting all neighboring points \f$ \{(x,y)|f(x,y)\equiv L_i\} \f$
* contourLevels, each elemt in the list represents a contour plane. You can also create contour * that equal a given set of contour levels \f$ \{L_i\} \f$ .
* levels with createContourLevels(). The levels are linearly spaced between the maximum and minimum
* value in your data. For logarithmic data, use createContourLevelsLog() to create contour levels
* with logarithmic spacing.
* *
* \author Sebastian Isbaner, 2013-2014 * For its calculations, this class implements the CONREC algorithm
* (see <a href="http://paulbourke.net/papers/conrec/">http://paulbourke.net/papers/conrec/</a>).
*
* In order to use this class, you first have to set an image column with the data for this plot and then
* define several contour levels for which to plot the contour lines. See \ref JKQTPlotterContourPlot for a
* detailed example!
*
* \note Although this class is derived from JKQTPColumnMathImage, which supports a modifier to the data,
* (see JKQTPColumnMathImage::modifierColumn), these features do not make sense for a contour plot
* and are not used here. The access functions are hidden in this class, but may be accessible
* via a down-cast! Still they do not have any effect on the plotted graph!
*
* \see See \ref JKQTPlotterContourPlot for a detailed example.
* See https://en.wikipedia.org/wiki/Contour_line for details on Contour Lines and Plots.
* The implementation for Qt is adapted from Qwt: <a href="http://qwt.sourceforge.net/">http://qwt.sourceforge.net/</a>
*
* \author Sebastian Isbaner (2013-2014) & Jan Krieger (2019)
* *
* \image html JKQTPContour.png * \image html JKQTPContour.png
*
* \image html jkqtplotter_simpletest_contourplot.png
*
* \note This class uses a caching strategy to determine whether contour lines need to be recalculated (which is time-consuming):
* Whenever contours have been calculated, these contours are stored in the member contourLinesCache and can then be used for
* redrawing. In addition the checksum of the data column is stored in contourLinesCachedForChecksum. On every redraw,
* the checksum is recalculated and compared to the value in contourLinesCachedForChecksum. If it matches, no recalculation
* is necessary. If it doesn't match, the contours are recalculated. In addition several methods that change certain
* properties of the plot will force a recalculation. Finally you can call clearCachedContours() to force a recalculation!
*/ */
class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage, public JKQTPGraphLineStyleMixin { class JKQTP_LIB_EXPORT JKQTPContourPlot: public JKQTPMathImage, public JKQTPGraphLineStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/** \brief options of how the colors for the contours are chosen (note that all images in the documentation show the same graph, just with different coloring modes!)*/
enum ContourColoringMode {
SingleColorContours, /*!< \brief each contour line has the same color \image html jkqtplotter_simpletest_contourplot_SingleColorContours.png */
ColorContoursFromPaletteByValue, /*!< \brief the color for each contour line is determined by the current color palette, image range and the value associated with each contour line \image html jkqtplotter_simpletest_contourplot_ColorContoursFromPaletteByValue.png */
ColorContoursFromPalette, /*!< \brief the color for each contour line is chosen from the current color palette, distributing the contour lines evenly over the palette, wirhout any connection to the value associated with each contour line \image html jkqtplotter_simpletest_contourplot_ColorContoursFromPalette.png */
};
/** \brief class constructor */ /** \brief class constructor */
JKQTPContour(JKQTBasePlotter* parent=nullptr); JKQTPContourPlot(JKQTBasePlotter* parent=nullptr);
/** \brief class constructor */ /** \brief class constructor */
JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, DataType datatype = JKQTPMathImageBase::DoubleArray, JKQTBasePlotter* parent=nullptr); JKQTPContourPlot(JKQTPlotter* parent);
/** \brief class constructor */
JKQTPContour(JKQTPlotter* parent);
/** \brief class constructor */
JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype , JKQTPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
@ -73,61 +95,114 @@ class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage, public JKQTPGraphLin
/** \brief creates at least nLevels contour levels with logarithmic spacing. FIXME: Has not been tested yet */ /** \brief creates at least nLevels contour levels with logarithmic spacing. FIXME: Has not been tested yet */
void createContourLevelsLog(int nLevels=3,int m=2); void createContourLevelsLog(int nLevels=3,int m=2);
/*! \copydoc ignoreOnPlane /*! \copydoc ignoreOnPlane */
\see see ignoreOnPlane for details */
void setIgnoreOnPlane(bool __value); void setIgnoreOnPlane(bool __value);
/*! \copydoc ignoreOnPlane /*! \copydoc ignoreOnPlane */
\see see ignoreOnPlane for details */
bool getIgnoreOnPlane() const; bool getIgnoreOnPlane() const;
/*! \copydoc numberOfLevels /*! \copydoc numberOfLevels */
\see see numberOfLevels for details */
void setNumberOfLevels(int __value);
/*! \copydoc numberOfLevels
\see see numberOfLevels for details */
int getNumberOfLevels() const; int getNumberOfLevels() const;
/*! \copydoc colorFromPalette /*! \copydoc contourColoringMode */
\see see colorFromPalette for details */ void setContourColoringMode(ContourColoringMode __value);
void setColorFromPalette(bool __value); /*! \copydoc contourColoringMode */
/*! \copydoc colorFromPalette ContourColoringMode getContourColoringMode() const;
\see see colorFromPalette for details */ /** \brief sets new contour levels from a container \a levels
bool getColorFromPalette() const; *
/*! \copydoc contourLevels * \tparam TConatiner any standard container with c++ standard iterators. The contents needs to be convertible to double via jkqtp_todouble()
\see see contourLevels for details */ * \param levels the container to copy from
void setContourLevels(const QList<double> & __value); */
/*! \copydoc contourLevels template <class TContainer>
\see see contourLevels for details */ void setContourLevels(const TContainer &levels);
QList<double> getContourLevels() const; /** \brief sets new contour levels from a container \a levels
/*! \copydoc relativeLevels *
\see see relativeLevels for details */ * \tparam TConatiner any standard container with c++ standard iterators. The contents needs to be convertible to double via jkqtp_todouble()
* \tparam TColorContainer any standard container with c++ standard iterators. The contents needs to be convertible to QColor
* \param levels the container to copy from
* \param colors a container with QColors inside, which define the line colors
*/
template <class TContainer, class TColorContainer>
void setContourLevels(const TContainer &levels, const TColorContainer& colors);
/*! \copydoc contourLevels */
QVector<double> getContourLevels() const;
/*! \copydoc relativeLevels */
void setRelativeLevels(bool __value); void setRelativeLevels(bool __value);
/*! \copydoc relativeLevels /*! \copydoc relativeLevels */
\see see relativeLevels for details */
bool getRelativeLevels() const; bool getRelativeLevels() const;
/** \brief convenience function to work with JKQTPDatastore */ /** \brief add another level for which to draw a contour
void setImageColumn(size_t columnID); * \see setOverrideColor(), addContourLevel(), hasOverrideColor(), removeOverrideColor(), getOverrideColor()
/** \brief add another level for which to draw a contour */ */
void addContourLevel(double &level); void addContourLevel(double level);
/** \brief add another level for which to draw a contour and define an override color for this line
*
* \image html jkqtplotter_simpletest_contourplot_overridecolors.png
*
* \see setOverrideColor(), addContourLevel(), hasOverrideColor(), removeOverrideColor(), getOverrideColor()
*/
void addContourLevel(double level, QColor overrideColor);
/** \brief define an override color for the contour line at the given level
*
* \image html jkqtplotter_simpletest_contourplot_overridecolors.png
*
* \see setOverrideColor(), addContourLevel(), hasOverrideColor(), removeOverrideColor(), getOverrideColor()
*/
void setOverrideColor(double level, QColor overrideColor);
/** \brief returns the override color for contour level \a level
* \see setOverrideColor(), addContourLevel(), hasOverrideColor(), removeOverrideColor(), getOverrideColor()
*/
QColor getOverrideColor(int level) const;
/** \brief returns the override color for contour level \a level
* \see setOverrideColor(), addContourLevel(), hasOverrideColor(), removeOverrideColor(), getOverrideColor()
*/
bool hasOverrideColor(int level) const;
/** \brief removes the override color for contour level \a level
* \see setOverrideColor(), addContourLevel(), hasOverrideColor(), removeOverrideColor(), getOverrideColor()
*/
void removeOverrideColor(int level) ;
/** \brief clear all currently defined contour levels */
void clearContourLevel();
/** \brief overrides the caching strategy and forces a recalculation of the contours */
void clearCachedContours();
protected: protected:
/** \brief if true, vertices that all lie on the contour plane will be ignored*/ /** \brief if true, vertices that all lie on the contour plane will be ignored*/
bool ignoreOnPlane; bool ignoreOnPlane;
/** \brief if true, the colors of the \a palette are used for the contour lines */ /** \brief defines how the colors for the contours are chosen */
bool colorFromPalette; ContourColoringMode contourColoringMode;
/** \brief the number of contour levels. Is only used if contourLevels is empty*/
int numberOfLevels;
/** \brief the list of contour levels */ /** \brief the list of contour levels */
QList<double> contourLevels; QVector<double> contourLevels;
/** \brief override contour level colors for specific levels, when \c contourColoringMode==SingleColorContours */
QMap<double,QColor> contourOverrideColor;
/** \brief indicates wether the contour levels are absolute values or relative to the maximum (max-min) */ /** \brief indicates wether the contour levels are absolute values or relative to the maximum (max-min) */
bool relativeLevels; bool relativeLevels;
virtual void ensureImageData() override;
// hide unusable members (this class does not provide data modifier functionality
using JKQTPMathImage::setDataModifier;
using JKQTPMathImage::getDataModifier;
using JKQTPMathImage::setDatatypeModifier;
using JKQTPMathImage::getDatatypeModifier;
using JKQTPMathImage::setModifierMode;
using JKQTPMathImage::getModifierMode;
using JKQTPMathImage::getModifierMinMax;
using JKQTPMathImage::getDataModifierAsDoubleVector;
using JKQTPMathImage::setColorBarModifiedWidth;
using JKQTPMathImage::getColorBarModifiedWidth;
using JKQTPMathImage::getModifierColorBarTopAxis;
using JKQTPMathImage::getModifierColorBarRightAxis;
using JKQTPMathImage::setModifierMin;
using JKQTPMathImage::getModifierMin;
using JKQTPMathImage::setAutoModifierRange;
using JKQTPMathImage::getAutoModifierRange;
using JKQTPMathImage::setModifierMax;
using JKQTPMathImage::getModifierMax;
using JKQTPMathImage::getModifierValueAt;
using JKQTPMathImage::getModifierSampleSize;
using JKQTPMathImage::getModifierPixelValue;
private: private:
double value(int xIdx, int yIdx); /** \brief gives the intersection line of a plane defined by three vertices with a contour level in the x-y plane of heigth level */
/// gives the intersection line of a plane defined by three vertices with a contour level in the x-y plane of heigth level inline bool intersect(QLineF &line, const QVector3D &vertex1,const QVector3D &vertex2,const QVector3D &vertex3,double level) const;
bool intersect(QLineF &line, const QVector3D &vertex1,const QVector3D &vertex2,const QVector3D &vertex3,double level);
/** /**
* @brief interpolatePoint linear interpolation of a line to the x-y plane using the z-value relative to level * @brief interpolatePoint linear interpolation of a line to the x-y plane using the z-value relative to level
* @param point1 start point of the line * @param point1 start point of the line
@ -135,20 +210,32 @@ class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage, public JKQTPGraphLin
* @param level the heigth for the interpolation (this z-value is projected onto the xy-plane) * @param level the heigth for the interpolation (this z-value is projected onto the xy-plane)
* @return the interpolated point in the x-y plane * @return the interpolated point in the x-y plane
*/ */
QPointF interpolatePoint(const QVector3D &point1, const QVector3D &point2,double level); inline QPointF interpolatePoint(const QVector3D &point1, const QVector3D &point2,double level) const ;
/** /**
* @brief compare2level checks if the vertex lies above, under or on the contour plane level * @brief compare2level checks if the vertex lies above, under or on the contour plane level
* @param vertex * @param vertex
* @param level contour plane * @param level contour plane
* @return above (1), on the plane (0), below (-1); * @return above (1), on the plane (0), below (-1);
*/ */
int compare2level(const QVector3D &vertex, double level); inline int compare2level(const QVector3D &vertex, double level) const ;
/** /** \brief calcContourLines calculates the contour lines using the CONREC algorithm */
* @brief calcContourLines calculates the contour lines using the CONREC algorithm
*/
void calcContourLines(QList<QVector<QLineF > > &ContourLines); void calcContourLines(QList<QVector<QLineF > > &ContourLines);
/// the contour lines as vector of single lines (one for each triangle). the list index refers to the contour level. /** \brief For Caching: the contour lines as vector of single lines (one for each triangle). the list index refers to the contour level.
QList<QVector<QLineF > > contourLines; // contour levels, squares on grid, line * \internal
*
* This property is used to store the last result of the contour line calculation. This is done, because
* calculating contour lines is rather expensive. In order to determine the need for a recalculation,
* the data in the column is converted to a checksum, which can be compared to the sum value stored in
* contourLinesCachedForChecksum.
*
* \see contourLinesCachedForChecksum
*/
QList<QVector<QPolygonF > > contourLinesCache; // contour levels, squares on grid, line
/** \brief if (>=0) checksum of the column for which contours were cached in contourLinesCache
* \internal
* \see contourLinesCache
*/
int64_t contourLinesCachedForChecksum;
}; };
@ -156,5 +243,219 @@ class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage, public JKQTPGraphLin
/** \brief class for a contour plots (same as JKQTPContourPlot) of images stored in a JKQTPDatastore column
* \ingroup jkqtplotter_imagelots_contour
*
* \copydetails JKQTPContourPlot
*/
class JKQTP_LIB_EXPORT JKQTPColumnContourPlot: public JKQTPContourPlot {
Q_OBJECT
public:
/** \brief class constructor */
JKQTPColumnContourPlot(JKQTBasePlotter* parent=nullptr);
/** \brief class constructor */
JKQTPColumnContourPlot(JKQTPlotter* parent);
/*! \copydoc imageColumn */
virtual void setImageColumn(int __value);
/*! \copydoc imageColumn */
int getImageColumn() const;
/** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int c) const override;
protected:
/** \brief column containing the displayed image */
int imageColumn;
virtual void ensureImageData() override;
};
////////////////////////////////////////////////////////////////////////////////////////////////
template<class TContainer, class TColorContainer>
void JKQTPContourPlot::setContourLevels(const TContainer &levels, const TColorContainer &colors)
{
contourLevels.clear();
contourOverrideColor.clear();
auto itc=colors.begin();
for (auto it=levels.begin(); it!=levels.end(); ++it) {
const double v=jkqtp_todouble(*it);
contourLevels<<v;
contourOverrideColor[v]=*itc;
++itc;
}
qSort(contourLevels);
clearCachedContours();
}
////////////////////////////////////////////////////////////////////////////////////////////////
template<class TContainer>
void JKQTPContourPlot::setContourLevels(const TContainer &levels)
{
contourLevels.clear();
contourOverrideColor.clear();
for (auto it=levels.begin(); it!=levels.end(); ++it) {
contourLevels<<jkqtp_todouble(*it);
}
qSort(contourLevels);
clearCachedContours();
}
////////////////////////////////////////////////////////////////////////////////////////////////
bool JKQTPContourPlot::intersect(QLineF &line, const QVector3D &vertex1, const QVector3D &vertex2, const QVector3D &vertex3, double level) const
{
bool found = true;
// Are the vertices below (-1), on (0) or above (1) the plane ?
const int eq1 = compare2level(vertex1,level);
const int eq2 = compare2level(vertex2,level);
const int eq3 = compare2level(vertex3,level);
/*
(a) All the vertices lie below the contour level.
(b) Two vertices lie below and one on the contour level.
(c) Two vertices lie below and one above the contour level.
(d) One vertex lies below and two on the contour level.
(e) One vertex lies below, one on and one above the contour level.
(f) One vertex lies below and two above the contour level.
(g) Three vertices lie on the contour level.
(h) Two vertices lie on and one above the contour level.
(i) One vertex lies on and two above the contour level.
(j) All the vertices lie above the contour level.
*/
static const int caseLUT[3][3][3] =
{
// jump table to avoid nested case statements
{ { 0, 0, 8 }, { 0, 2, 5 }, { 7, 6, 9 } },
{ { 0, 3, 4 }, { 1, 10, 1 }, { 4, 3, 0 } },
{ { 9, 6, 7 }, { 5, 2, 0 }, { 8, 0, 0 } }
};
const int caseType = caseLUT[eq1+1][eq2+1][eq3+1];
switch (caseType)
{
case 1:
// d(0,0,-1), h(0,0,1)
line.setP1(vertex1.toPointF());
line.setP2(vertex2.toPointF());
break;
case 2:
// d(-1,0,0), h(1,0,0)
line.setP1(vertex2.toPointF());
line.setP2(vertex3.toPointF());
break;
case 3:
// d(0,-1,0), h(0,1,0)
line.setP1(vertex3.toPointF());
line.setP2(vertex1.toPointF());
break;
case 4:
// e(0,-1,1), e(0,1,-1)
line.setP1(vertex1.toPointF());
line.setP2(interpolatePoint(vertex2, vertex3, level));
break;
case 5:
// e(-1,0,1), e(1,0,-1)
line.setP1(vertex2.toPointF());
line.setP2(interpolatePoint(vertex3, vertex1, level));
break;
case 6:
// e(-1,1,0), e(1,0,-1)
line.setP1(vertex3.toPointF());
line.setP2(interpolatePoint(vertex1, vertex2, level));
break;
case 7:
// c(-1,1,-1), f(1,1,-1)
line.setP1(interpolatePoint(vertex1, vertex2, level));
line.setP2(interpolatePoint(vertex2, vertex3, level));
break;
case 8:
// c(-1,-1,1), f(1,1,-1)
line.setP1(interpolatePoint(vertex2, vertex3, level));
line.setP2(interpolatePoint(vertex3, vertex1, level));
break;
case 9:
// f(-1,1,1), c(1,-1,-1)
line.setP1(interpolatePoint(vertex3, vertex1, level));
line.setP2(interpolatePoint(vertex1, vertex2, level));
break;
case 10:
// g(0,0,0)
// The CONREC algorithm has no satisfying solution for
// what to do, when all vertices are on the plane.
if ( ignoreOnPlane )
found = false;
else
{
line.setP1(vertex3.toPointF());
line.setP2(vertex1.toPointF());
}
break;
default:
found = false;
}
// qDebug()<<caseType;
// qDebug()<<line;
return found;
}
////////////////////////////////////////////////////////////////////////////////////////////////
QPointF JKQTPContourPlot::interpolatePoint(const QVector3D &point1, const QVector3D &point2, double level) const
{
const double h1 = point1.z() - level; // height above contour level
const double h2 = point2.z() - level;
// // check if h1 or h2 is zero
// Division by zero is not possible (the intersect function is not called if h2-h1 is zero, !)
// if(h2-h1==0||h1==0||h2==0) {
// qDebug()<<h1<<h2;
// qDebug()<<"interpolate p1="<<point1<<", p2="<<point2<<" level="<<level;
// }
const double x = (h2 * point1.x() - h1 * point2.x()) / (h2 - h1); // linear interpolation in x.direction (independent of y)
const double y = (h2 * point1.y() - h1 * point2.y()) / (h2 - h1);
// const double alpha=(level-point1.z())/(point2.z()-point1.z());
// const double x=point1.x()+alpha*(point2.x()-point1.x());
// const double y=point1.y()+alpha*(point2.y()-point1.y());
return QPointF(x, y);
}
////////////////////////////////////////////////////////////////////////////////////////////////
int JKQTPContourPlot::compare2level(const QVector3D &vertex, double level) const {
if (vertex.z() > level)
return 1;
if (vertex.z() < level)
return -1;
return 0;
}
#endif // JKQTPGRAPHSCONTOUR_H #endif // JKQTPGRAPHSCONTOUR_H

View File

@ -111,11 +111,9 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph, public JKQTPG
/*! \brief set color, fill color and error color at the same time */ /*! \brief set color, fill color and error color at the same time */
void setColor(QColor c); void setColor(QColor c);
/*! \copydoc drawLine /*! \copydoc drawLine */
\see see drawLine for details */
void setDrawLine(bool __value); void setDrawLine(bool __value);
/*! \copydoc drawLine /*! \copydoc drawLine */
\see see drawLine for details */
bool getDrawLine() const; bool getDrawLine() const;
/** \brief sets the property plotFunction ( \copybrief plotFunction ) to the specified \a __value. /** \brief sets the property plotFunction ( \copybrief plotFunction ) to the specified \a __value.
@ -138,16 +136,14 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph, public JKQTPG
* \details Description of the parameter plotFunction is: <BLOCKQUOTE>\copydoc plotFunction </BLOCKQUOTE> * \details Description of the parameter plotFunction is: <BLOCKQUOTE>\copydoc plotFunction </BLOCKQUOTE>
* \see plotFunction for more information */ * \see plotFunction for more information */
virtual void setPlotFunctionFunctor (const jkqtpSimplePlotFunctionType & __value); virtual void setPlotFunctionFunctor (const jkqtpSimplePlotFunctionType & __value);
/*! \brief returns the property plotFunction ( \copybrief plotFunction ). \see plotFunction for more information */ \ /*! \copydoc plotFunction */ \
virtual jkqtpPlotFunctionType getPlotFunctionFunctor () const; virtual jkqtpPlotFunctionType getPlotFunctionFunctor () const;
/*! \brief returns the property simplePlotFunction ( \copybrief simplePlotFunction ). \see simplePlotFunction for more information */ \ /*! \copydoc simplePlotFunction */ \
virtual jkqtpSimplePlotFunctionType getSimplePlotFunction () const; virtual jkqtpSimplePlotFunctionType getSimplePlotFunction () const;
/*! \copydoc params /*! \copydoc params */
\see see params for details */
virtual void setParams(void* __value); virtual void setParams(void* __value);
/*! \copydoc params /*! \copydoc params */
\see see params for details */
void* getParams() const; void* getParams() const;
/** \brief sets the params as a pointer to an internal COPY of the given vector (not the data of the vector, as then the size would be unknown!!!) */ /** \brief sets the params as a pointer to an internal COPY of the given vector (not the data of the vector, as then the size would be unknown!!!) */
virtual void setParams(const QVector<double>& params); virtual void setParams(const QVector<double>& params);
@ -168,53 +164,37 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph, public JKQTPG
QVector<double> getInternalParams() const; QVector<double> getInternalParams() const;
/** \brief returns the currently set internal parameter vector */ /** \brief returns the currently set internal parameter vector */
QVector<double> getInternalErrorParams() const; QVector<double> getInternalErrorParams() const;
/*! \copydoc minSamples /*! \copydoc minSamples */
\see see minSamples for details */
void setMinSamples(const unsigned int & __value); void setMinSamples(const unsigned int & __value);
/*! \copydoc minSamples /*! \copydoc minSamples */
\see see minSamples for details */
unsigned int getMinSamples() const; unsigned int getMinSamples() const;
/*! \copydoc maxRefinementDegree /*! \copydoc maxRefinementDegree */
\see see maxRefinementDegree for details */
void setMaxRefinementDegree(const unsigned int & __value); void setMaxRefinementDegree(const unsigned int & __value);
/*! \copydoc maxRefinementDegree /*! \copydoc maxRefinementDegree */
\see see maxRefinementDegree for details */
unsigned int getMaxRefinementDegree() const; unsigned int getMaxRefinementDegree() const;
/*! \copydoc slopeTolerance /*! \copydoc slopeTolerance */
\see see slopeTolerance for details */
void setSlopeTolerance(double __value); void setSlopeTolerance(double __value);
/*! \copydoc slopeTolerance /*! \copydoc slopeTolerance */
\see see slopeTolerance for details */
double getSlopeTolerance() const; double getSlopeTolerance() const;
/*! \copydoc minPixelPerSample /*! \copydoc minPixelPerSample */
\see see minPixelPerSample for details */
void setMinPixelPerSample(double __value); void setMinPixelPerSample(double __value);
/*! \copydoc minPixelPerSample /*! \copydoc minPixelPerSample */
\see see minPixelPerSample for details */
double getMinPixelPerSample() const; double getMinPixelPerSample() const;
/*! \copydoc plotRefinement /*! \copydoc plotRefinement */
\see see plotRefinement for details */
void setPlotRefinement(bool __value); void setPlotRefinement(bool __value);
/*! \copydoc plotRefinement /*! \copydoc plotRefinement */
\see see plotRefinement for details */
bool getPlotRefinement() const; bool getPlotRefinement() const;
/*! \copydoc displaySamplePoints /*! \copydoc displaySamplePoints */
\see see displaySamplePoints for details */
void setDisplaySamplePoints(bool __value); void setDisplaySamplePoints(bool __value);
/*! \copydoc displaySamplePoints /*! \copydoc displaySamplePoints */
\see see displaySamplePoints for details */
bool getDisplaySamplePoints() const; bool getDisplaySamplePoints() const;
/*! \copydoc drawErrorPolygons /*! \copydoc drawErrorPolygons */
\see see drawErrorPolygons for details */
void setDrawErrorPolygons(bool __value); void setDrawErrorPolygons(bool __value);
/*! \copydoc drawErrorPolygons /*! \copydoc drawErrorPolygons */
\see see drawErrorPolygons for details */
bool getDrawErrorPolygons() const; bool getDrawErrorPolygons() const;
/*! \copydoc drawErrorLines /*! \copydoc drawErrorLines */
\see see drawErrorLines for details */
void setDrawErrorLines(bool __value); void setDrawErrorLines(bool __value);
/*! \copydoc drawErrorLines /*! \copydoc drawErrorLines */
\see see drawErrorLines for details */
bool getDrawErrorLines() const; bool getDrawErrorLines() const;
/** \brief sets the property errorPlotFunction ( \copybrief errorPlotFunction ) to the specified \a __value. /** \brief sets the property errorPlotFunction ( \copybrief errorPlotFunction ) to the specified \a __value.
* *
@ -226,7 +206,7 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph, public JKQTPG
* \details Description of the parameter errorPlotFunction is: <BLOCKQUOTE>\copydoc errorPlotFunction </BLOCKQUOTE> * \details Description of the parameter errorPlotFunction is: <BLOCKQUOTE>\copydoc errorPlotFunction </BLOCKQUOTE>
* \see errorPlotFunction for more information */ * \see errorPlotFunction for more information */
virtual void setErrorPlotFunction (const jkqtpPlotFunctionType & __value); virtual void setErrorPlotFunction (const jkqtpPlotFunctionType & __value);
/*! \brief returns the property errorPlotFunction ( \copybrief errorPlotFunction ). \see errorPlotFunction for more information */ \ /*! \copydoc errorPlotFunction */ \
virtual jkqtpPlotFunctionType getErrorPlotFunction () const; virtual jkqtpPlotFunctionType getErrorPlotFunction () const;
/** \brief sets the property errorPlotFunction ( \copybrief errorPlotFunction ) to the specified \a __value. /** \brief sets the property errorPlotFunction ( \copybrief errorPlotFunction ) to the specified \a __value.
* *
@ -238,94 +218,74 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph, public JKQTPG
* \details Description of the parameter errorPlotFunction is: <BLOCKQUOTE>\copydoc errorPlotFunction </BLOCKQUOTE> * \details Description of the parameter errorPlotFunction is: <BLOCKQUOTE>\copydoc errorPlotFunction </BLOCKQUOTE>
* \see errorPlotFunction for more information */ * \see errorPlotFunction for more information */
virtual void setErrorPlotFunction (const jkqtpSimplePlotFunctionType & __value); virtual void setErrorPlotFunction (const jkqtpSimplePlotFunctionType & __value);
/*! \brief returns the property errorSimplePlotFunction ( \copybrief errorSimplePlotFunction ). \see errorSimplePlotFunction for more information */ \ /*! \copydoc errorSimplePlotFunction */ \
virtual jkqtpSimplePlotFunctionType getErrorSimplePlotFunction () const; virtual jkqtpSimplePlotFunctionType getErrorSimplePlotFunction () const;
/*! \copydoc errorParams /*! \copydoc errorParams */
\see see errorParams for details */
virtual void setErrorParams(void* __value); virtual void setErrorParams(void* __value);
/*! \copydoc errorParams /*! \copydoc errorParams */
\see see errorParams for details */
void *getErrorParams() const; void *getErrorParams() const;
/** \brief sets the error params as a pointer to an internal COPY of the given vector (not the data of the vector, as then the size would be unknown!!!) */ /** \brief sets the error params as a pointer to an internal COPY of the given vector (not the data of the vector, as then the size would be unknown!!!) */
void setErrorParams(const QVector<double>& errorParams); void setErrorParams(const QVector<double>& errorParams);
/*! \copydoc parameterColumn /*! \copydoc parameterColumn */
\see see parameterColumn for details */
void setParameterColumn(int __value); void setParameterColumn(int __value);
/*! \copydoc parameterColumn /*! \copydoc parameterColumn */
\see see parameterColumn for details */
int getParameterColumn() const; int getParameterColumn() const;
/*! \brief sets the property parameterColumn ( \copybrief parameterColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc parameterColumn */
\details Description of the parameter parameterColumn is: <BLOCKQUOTE>\copydoc parameterColumn </BLOCKQUOTE>
\see parameterColumn for more information */
void setParameterColumn (size_t __value); void setParameterColumn (size_t __value);
/*! \copydoc errorParameterColumn /*! \copydoc errorParameterColumn */
\see see errorParameterColumn for details */
void setErrorParameterColumn(int __value); void setErrorParameterColumn(int __value);
/*! \copydoc errorParameterColumn /*! \copydoc errorParameterColumn */
\see see errorParameterColumn for details */
int getErrorParameterColumn() const; int getErrorParameterColumn() const;
/*! \brief sets the property errorParameterColumn ( \copybrief errorParameterColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc errorParameterColumn */
\details Description of the parameter errorParameterColumn is: <BLOCKQUOTE>\copydoc errorParameterColumn </BLOCKQUOTE>
\see errorParameterColumn for more information */
void setErrorParameterColumn (size_t __value); void setErrorParameterColumn (size_t __value);
/*! \copydoc errorColor /*! \copydoc errorColor */
\see see errorColor for details */
inline virtual void setErrorLineColor(const QColor & __value) inline virtual void setErrorLineColor(const QColor & __value)
{ {
this->errorColor = __value; this->errorColor = __value;
} }
/*! \copydoc errorColor /*! \copydoc errorColor */
\see see errorColor for details */
inline virtual QColor getErrorLineColor() const inline virtual QColor getErrorLineColor() const
{ {
return this->errorColor; return this->errorColor;
} }
/*! \copydoc errorFillColor /*! \copydoc errorFillColor */
\see see errorFillColor for details */
inline virtual void setErrorFillColor(const QColor & __value) inline virtual void setErrorFillColor(const QColor & __value)
{ {
this->errorFillColor = __value; this->errorFillColor = __value;
} }
/*! \copydoc errorFillColor /*! \copydoc errorFillColor */
\see see errorFillColor for details */
inline virtual QColor getErrorFillColor() const inline virtual QColor getErrorFillColor() const
{ {
return this->errorFillColor; return this->errorFillColor;
} }
/*! \copydoc errorFillStyle /*! \copydoc errorFillStyle */
\see see errorFillStyle for details */
inline virtual void setErrorFillStyle(Qt::BrushStyle __value) inline virtual void setErrorFillStyle(Qt::BrushStyle __value)
{ {
this->errorFillStyle = __value; this->errorFillStyle = __value;
} }
/*! \copydoc errorFillStyle /*! \copydoc errorFillStyle */
\see see errorFillStyle for details */
inline virtual Qt::BrushStyle getErrorFillStyle() const inline virtual Qt::BrushStyle getErrorFillStyle() const
{ {
return this->errorFillStyle; return this->errorFillStyle;
} }
/*! \copydoc errorStyle /*! \copydoc errorStyle */
\see see errorStyle for details */
inline virtual void setErrorLineStyle(Qt::PenStyle __value) inline virtual void setErrorLineStyle(Qt::PenStyle __value)
{ {
this->errorStyle = __value; this->errorStyle = __value;
} }
/*! \copydoc errorStyle /*! \copydoc errorStyle */
\see see errorStyle for details */
inline virtual Qt::PenStyle getErrorLineStyle() const inline virtual Qt::PenStyle getErrorLineStyle() const
{ {
return this->errorStyle; return this->errorStyle;
} }
/*! \copydoc errorLineWidth /*! \copydoc errorLineWidth */
\see see errorLineWidth for details */
inline virtual void setErrorLineWidth(double __value) inline virtual void setErrorLineWidth(double __value)
{ {
this->errorLineWidth = __value; this->errorLineWidth = __value;
} }
/*! \copydoc errorLineWidth /*! \copydoc errorLineWidth */
\see see errorLineWidth for details */
inline virtual double getErrorLineWidth() const inline virtual double getErrorLineWidth() const
{ {
return this->errorLineWidth; return this->errorLineWidth;

View File

@ -162,22 +162,16 @@ class JKQTP_LIB_EXPORT JKQTPFilledVerticalRangeGraph: public JKQTPXYGraph, publi
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
/*! \copydoc yColumn2 /*! \copydoc yColumn2 */
\see see yColumn2 for details */
void setYColumn2(int __value); void setYColumn2(int __value);
/*! \copydoc yColumn2 /*! \copydoc yColumn2 */
\see see yColumn2 for details */
int getYColumn2() const; int getYColumn2() const;
/*! \brief sets the property yColumn2 ( \copybrief yColumn2 ) to the specified \a __value, where __value is static_cast'ed from size_t to int. /*! \copydoc yColumn2 */
\details Description of the parameter yColumn2 is: <BLOCKQUOTE>\copydoc yColumn2 </BLOCKQUOTE>
\see yColumn2 for more information */
void setYColumn2 (size_t __value); void setYColumn2 (size_t __value);
/*! \copydoc drawLine /*! \copydoc drawLine */
\see see drawLine for details */
void setDrawLine(bool __value); void setDrawLine(bool __value);
/*! \copydoc drawLine /*! \copydoc drawLine */
\see see drawLine for details */
bool getDrawLine() const; bool getDrawLine() const;

View File

@ -181,17 +181,13 @@ class JKQTP_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQTPGraph
/*! set the symbol color and symbol fill color */ /*! set the symbol color and symbol fill color */
virtual void setColor(QColor c); virtual void setColor(QColor c);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
void setX(double __value); void setX(double __value);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
double getX() const; double getX() const;
/*! \copydoc y /*! \copydoc y */
\see see y for details */
void setY(double __value); void setY(double __value);
/*! \copydoc y /*! \copydoc y */
\see see y for details */
double getY() const; double getY() const;
/** \copydoc JKQTPGraph::getXMinMax() */ /** \copydoc JKQTPGraph::getXMinMax() */
@ -261,23 +257,17 @@ class JKQTP_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject, public JKQTPGraphTe
*/ */
JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text); JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text);
/*! \copydoc text /*! \copydoc text */
\see see text for details */
void setText(const QString & __value); void setText(const QString & __value);
/*! \copydoc text /*! \copydoc text */
\see see text for details */
QString getText() const; QString getText() const;
/*! \copydoc x /*! \copydoc x */
\see see x for details */
void setX(double __value); void setX(double __value);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
double getX() const; double getX() const;
/*! \copydoc y /*! \copydoc y */
\see see y for details */
void setY(double __value); void setY(double __value);
/*! \copydoc y /*! \copydoc y */
\see see y for details */
double getY() const; double getY() const;
/** \brief set line and fill color */ /** \brief set line and fill color */
@ -373,29 +363,21 @@ class JKQTP_LIB_EXPORT JKQTPGeoLine: public JKQTPGeoBaseLine {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc x1 /*! \copydoc x1 */
\see see x1 for details */
void setX1(double __value); void setX1(double __value);
/*! \copydoc x1 /*! \copydoc x1 */
\see see x1 for details */
double getX1() const; double getX1() const;
/*! \copydoc y1 /*! \copydoc y1 */
\see see y1 for details */
void setY1(double __value); void setY1(double __value);
/*! \copydoc y1 /*! \copydoc y1 */
\see see y1 for details */
double getY1() const; double getY1() const;
/*! \copydoc x2 /*! \copydoc x2 */
\see see x2 for details */
void setX2(double __value); void setX2(double __value);
/*! \copydoc x2 /*! \copydoc x2 */
\see see x2 for details */
double getX2() const; double getX2() const;
/*! \copydoc y2 /*! \copydoc y2 */
\see see y2 for details */
void setY2(double __value); void setY2(double __value);
/*! \copydoc y2 /*! \copydoc y2 */
\see see y2 for details */
double getY2() const; double getY2() const;
protected: protected:
/** \brief x-coordinate of first point of line */ /** \brief x-coordinate of first point of line */
@ -457,35 +439,25 @@ class JKQTP_LIB_EXPORT JKQTPGeoInfiniteLine: public JKQTPGeoBaseLine {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc x /*! \copydoc x */
\see see x for details */
void setX(double __value); void setX(double __value);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
double getX() const; double getX() const;
/*! \copydoc y /*! \copydoc y */
\see see y for details */
void setY(double __value); void setY(double __value);
/*! \copydoc y /*! \copydoc y */
\see see y for details */
double getY() const; double getY() const;
/*! \copydoc dx /*! \copydoc dx */
\see see dx for details */
void setDx(double __value); void setDx(double __value);
/*! \copydoc dx /*! \copydoc dx */
\see see dx for details */
double getDx() const; double getDx() const;
/*! \copydoc dy /*! \copydoc dy */
\see see dy for details */
void setDy(double __value); void setDy(double __value);
/*! \copydoc dy /*! \copydoc dy */
\see see dy for details */
double getDy() const; double getDy() const;
/*! \copydoc two_sided /*! \copydoc two_sided */
\see see two_sided for details */
void setTwoSided(bool __value); void setTwoSided(bool __value);
/*! \copydoc two_sided /*! \copydoc two_sided */
\see see two_sided for details */
bool getTwoSided() const; bool getTwoSided() const;
protected: protected:
/** \brief x-coordinate of a point on the line */ /** \brief x-coordinate of a point on the line */
@ -555,11 +527,9 @@ class JKQTP_LIB_EXPORT JKQTPGeoPolyLines: public JKQTPGeoBaseLine {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc points /*! \copydoc points */
\see see points for details */
void setPoints(const QVector<QPointF> & __value); void setPoints(const QVector<QPointF> & __value);
/*! \copydoc points /*! \copydoc points */
\see see points for details */
QVector<QPointF> getPoints() const; QVector<QPointF> getPoints() const;
/** \brief append a point to the polygon */ /** \brief append a point to the polygon */
@ -673,35 +643,25 @@ class JKQTP_LIB_EXPORT JKQTPGeoRectangle: public JKQTPGeoBaseFilled {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc x /*! \copydoc x */
\see see x for details */
void setX(double __value); void setX(double __value);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
double getX() const; double getX() const;
/*! \copydoc y /*! \copydoc y */
\see see y for details */
void setY(double __value); void setY(double __value);
/*! \copydoc y /*! \copydoc y */
\see see y for details */
double getY() const; double getY() const;
/*! \copydoc width /*! \copydoc width */
\see see width for details */
void setWidth(double __value); void setWidth(double __value);
/*! \copydoc width /*! \copydoc width */
\see see width for details */
double getWidth() const; double getWidth() const;
/*! \copydoc height /*! \copydoc height */
\see see height for details */
void setHeight(double __value); void setHeight(double __value);
/*! \copydoc height /*! \copydoc height */
\see see height for details */
double getHeight() const; double getHeight() const;
/*! \copydoc angle /*! \copydoc angle */
\see see angle for details */
void setAngle(double __value); void setAngle(double __value);
/*! \copydoc angle /*! \copydoc angle */
\see see angle for details */
double getAngle() const; double getAngle() const;
/** \brief set the rectangle using the bottom-left corner, as well as its width and height */ /** \brief set the rectangle using the bottom-left corner, as well as its width and height */
void setBottomleftrectangle(double x, double y, double width, double height); void setBottomleftrectangle(double x, double y, double width, double height);
@ -787,11 +747,9 @@ class JKQTP_LIB_EXPORT JKQTPGeoPolygon: public JKQTPGeoBaseFilled {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc points /*! \copydoc points */
\see see points for details */
void setPoints(const QVector<QPointF> & __value); void setPoints(const QVector<QPointF> & __value);
/*! \copydoc points /*! \copydoc points */
\see see points for details */
QVector<QPointF> getPoints() const; QVector<QPointF> getPoints() const;
/** \brief append a point to the polygon */ /** \brief append a point to the polygon */
@ -904,11 +862,9 @@ class JKQTP_LIB_EXPORT JKQTPGeoEllipse: public JKQTPGeoRectangle {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc controlPoints /*! \copydoc controlPoints */
\see see controlPoints for details */
void setControlPoints(const unsigned int & __value); void setControlPoints(const unsigned int & __value);
/*! \copydoc controlPoints /*! \copydoc controlPoints */
\see see controlPoints for details */
unsigned int getControlPoints() const; unsigned int getControlPoints() const;
protected: protected:
/** \brief number of steps/control points to draw the ellipse */ /** \brief number of steps/control points to draw the ellipse */
@ -964,53 +920,37 @@ class JKQTP_LIB_EXPORT JKQTPGeoArc: public JKQTPGeoBaseLine {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc controlPoints /*! \copydoc controlPoints */
\see see controlPoints for details */
void setControlPoints(const unsigned int & __value); void setControlPoints(const unsigned int & __value);
/*! \copydoc controlPoints /*! \copydoc controlPoints */
\see see controlPoints for details */
unsigned int getControlPoints() const; unsigned int getControlPoints() const;
/*! \copydoc angleStart /*! \copydoc angleStart */
\see see angleStart for details */
void setAngleStart(double __value); void setAngleStart(double __value);
/*! \copydoc angleStart /*! \copydoc angleStart */
\see see angleStart for details */
double getAngleStart() const; double getAngleStart() const;
/*! \copydoc angleStop /*! \copydoc angleStop */
\see see angleStop for details */
void setAngleStop(double __value); void setAngleStop(double __value);
/*! \copydoc angleStop /*! \copydoc angleStop */
\see see angleStop for details */
double getAngleStop() const; double getAngleStop() const;
/*! \copydoc x /*! \copydoc x */
\see see x for details */
void setX(double __value); void setX(double __value);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
double getX() const; double getX() const;
/*! \copydoc y /*! \copydoc y */
\see see y for details */
void setY(double __value); void setY(double __value);
/*! \copydoc y /*! \copydoc y */
\see see y for details */
double getY() const; double getY() const;
/*! \copydoc width /*! \copydoc width */
\see see width for details */
void setWidth(double __value); void setWidth(double __value);
/*! \copydoc width /*! \copydoc width */
\see see width for details */
double getWidth() const; double getWidth() const;
/*! \copydoc height /*! \copydoc height */
\see see height for details */
void setHeight(double __value); void setHeight(double __value);
/*! \copydoc height /*! \copydoc height */
\see see height for details */
double getHeight() const; double getHeight() const;
/*! \copydoc angle /*! \copydoc angle */
\see see angle for details */
void setAngle(double __value); void setAngle(double __value);
/*! \copydoc angle /*! \copydoc angle */
\see see angle for details */
double getAngle() const; double getAngle() const;
protected: protected:
/** \brief x-coordinate of a center of the rectangle */ /** \brief x-coordinate of a center of the rectangle */
@ -1092,17 +1032,13 @@ class JKQTP_LIB_EXPORT JKQTPGeoPie: public JKQTPGeoEllipse {
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \copydoc angleStart /*! \copydoc angleStart */
\see see angleStart for details */
void setAngleStart(double __value); void setAngleStart(double __value);
/*! \copydoc angleStart /*! \copydoc angleStart */
\see see angleStart for details */
double getAngleStart() const; double getAngleStart() const;
/*! \copydoc angleStop /*! \copydoc angleStop */
\see see angleStop for details */
void setAngleStop(double __value); void setAngleStop(double __value);
/*! \copydoc angleStop /*! \copydoc angleStop */
\see see angleStop for details */
double getAngleStop() const; double getAngleStop() const;
protected: protected:
/** \brief if we only draw an arc, this is the starting angle */ /** \brief if we only draw an arc, this is the starting angle */

View File

@ -1252,26 +1252,7 @@ void JKQTPMathImage::getModifierMinMax(double &imin, double &imax)
} }
} }
double JKQTPMathImage::getValueAt(double x, double y)
{
ensureImageData();
int xx=trunc((x-this->x)/width*double(Nx));
int yy=trunc((y-this->y)/height*double(Ny));
if (xx>=0 && xx<(int64_t)Nx && yy>=0 && yy<(int64_t)Ny) {
switch(datatype) {
case JKQTPMathImageBase::DoubleArray: return (static_cast<double*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::FloatArray: return (static_cast<float*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt8Array: return (static_cast<uint8_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt16Array: return (static_cast<uint16_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt32Array: return (static_cast<uint32_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt64Array: return (static_cast<uint64_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int8Array: return (static_cast<int8_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int16Array: return (static_cast<int16_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int32Array: return (static_cast<int32_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int64Array: return (static_cast<int64_t*>(data))[yy*Nx+xx]; break;
} }
return 0.0;
}
void JKQTPMathImage::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect) void JKQTPMathImage::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
{ {

View File

@ -1,7 +1,7 @@
/* /*
Copyright (c) 2008-2019 Jan W. Krieger Copyright (c) 2008-2019 Jan W. Krieger
This software is free software: you can redistribute it and/or modify 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 it under the terms of the GNU Lesser General Public License (LGPL) as published by
@ -64,29 +64,21 @@ class JKQTP_LIB_EXPORT JKQTPImageBase: public JKQTPGraph {
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
/*! \copydoc x /*! \copydoc x */
\see see x for details */
void setX(double __value); void setX(double __value);
/*! \copydoc x /*! \copydoc x */
\see see x for details */
double getX() const; double getX() const;
/*! \copydoc y /*! \copydoc y */
\see see y for details */
void setY(double __value); void setY(double __value);
/*! \copydoc y /*! \copydoc y */
\see see y for details */
double getY() const; double getY() const;
/*! \copydoc width /*! \copydoc width */
\see see width for details */
void setWidth(double __value); void setWidth(double __value);
/*! \copydoc width /*! \copydoc width */
\see see width for details */
double getWidth() const; double getWidth() const;
/*! \copydoc height /*! \copydoc height */
\see see height for details */
void setHeight(double __value); void setHeight(double __value);
/*! \copydoc height /*! \copydoc height */
\see see height for details */
double getHeight() const; double getHeight() const;
protected: protected:
@ -166,47 +158,33 @@ class JKQTP_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
/** \brief plots a key marker inside the specified rectangle \a rect */ /** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/*! \copydoc Nx /*! \copydoc Nx */
\see see Nx for details */
void setNx(int __value); void setNx(int __value);
/*! \copydoc Nx /*! \copydoc Nx */
\see see Nx for details */
int getNx() const; int getNx() const;
/*! \copydoc Ny /*! \copydoc Ny */
\see see Ny for details */
void setNy(int __value); void setNy(int __value);
/*! \copydoc Ny /*! \copydoc Ny */
\see see Ny for details */
int getNy() const; int getNy() const;
/*! \copydoc data /*! \copydoc data */
\see see data for details */
virtual void setData(void* __value); virtual void setData(void* __value);
/*! \copydoc data /*! \copydoc data */
\see see data for details */
virtual void *getData() const; virtual void *getData() const;
/*! \copydoc datatype /*! \copydoc datatype */
\see see datatype for details */
virtual void setDatatype(DataType __value); virtual void setDatatype(DataType __value);
/*! \copydoc datatype /*! \copydoc datatype */
\see see datatype for details */
virtual DataType getDatatype() const; virtual DataType getDatatype() const;
/*! \copydoc dataModifier /*! \copydoc dataModifier */
\see see dataModifier for details */
virtual void setDataModifier(void* __value); virtual void setDataModifier(void* __value);
/*! \copydoc dataModifier /*! \copydoc dataModifier */
\see see dataModifier for details */
virtual void *getDataModifier() const; virtual void *getDataModifier() const;
/*! \copydoc datatypeModifier /*! \copydoc datatypeModifier */
\see see datatypeModifier for details */
virtual void setDatatypeModifier(DataType __value); virtual void setDatatypeModifier(DataType __value);
/*! \copydoc datatypeModifier /*! \copydoc datatypeModifier */
\see see datatypeModifier for details */
virtual DataType getDatatypeModifier() const; virtual DataType getDatatypeModifier() const;
/*! \copydoc modifierMode /*! \copydoc modifierMode */
\see see modifierMode for details */
void setModifierMode(const ModifierMode & __value); void setModifierMode(const ModifierMode & __value);
/*! \copydoc modifierMode /*! \copydoc modifierMode */
\see see modifierMode for details */
ModifierMode getModifierMode() const; ModifierMode getModifierMode() const;
virtual void setDataModifier(void* data, DataType datatype); virtual void setDataModifier(void* data, DataType datatype);
@ -290,7 +268,7 @@ class JKQTP_LIB_EXPORT JKQTPImage: public JKQTPImageBase {
/** \brief deletes the internal image */ /** \brief deletes the internal image */
void clear_image(); void clear_image();
/*! \brief returns the property image ( \copybrief image ). \details Description of the parameter image is: <BLOCKQUOTE>\copydoc image </BLOCKQUOTE>. \see image for more information */ /*! \copydoc image */
inline QImage* getImage() const { return this->image; } inline QImage* getImage() const { return this->image; }
protected: protected:
/** \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) */ /** \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) */
@ -360,153 +338,109 @@ class JKQTP_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
static QImage getPaletteKeyImage(JKQTPMathImageColorPalette palette, int width, int height) ; static QImage getPaletteKeyImage(JKQTPMathImageColorPalette palette, int width, int height) ;
/*! \copydoc palette /*! \copydoc palette */
\see see palette for details */
void setPalette(const JKQTPMathImageColorPalette & __value); void setPalette(const JKQTPMathImageColorPalette & __value);
/*! \copydoc palette /*! \copydoc palette */
\see see palette for details */
JKQTPMathImageColorPalette getPalette() const; JKQTPMathImageColorPalette getPalette() const;
/*! \copydoc rangeMinFailAction /*! \copydoc rangeMinFailAction */
\see see rangeMinFailAction for details */
void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value); void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value);
/*! \copydoc rangeMinFailAction /*! \copydoc rangeMinFailAction */
\see see rangeMinFailAction for details */
JKQTPMathImageColorRangeFailAction getActionRangeMinFail() const; JKQTPMathImageColorRangeFailAction getActionRangeMinFail() const;
/*! \copydoc rangeMaxFailAction /*! \copydoc rangeMaxFailAction */
\see see rangeMaxFailAction for details */
void setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value); void setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value);
/*! \copydoc rangeMaxFailAction /*! \copydoc rangeMaxFailAction */
\see see rangeMaxFailAction for details */
JKQTPMathImageColorRangeFailAction getActionRangeMaxFail() const; JKQTPMathImageColorRangeFailAction getActionRangeMaxFail() const;
/*! \copydoc rangeMinFailColor /*! \copydoc rangeMinFailColor */
\see see rangeMinFailColor for details */
void setRangeMinFailColor(const QColor & __value); void setRangeMinFailColor(const QColor & __value);
/*! \copydoc rangeMinFailColor /*! \copydoc rangeMinFailColor */
\see see rangeMinFailColor for details */
QColor getRangeMinFailColor() const; QColor getRangeMinFailColor() const;
/*! \copydoc rangeMaxFailColor /*! \copydoc rangeMaxFailColor */
\see see rangeMaxFailColor for details */
void setRangeMaxFailColor(const QColor & __value); void setRangeMaxFailColor(const QColor & __value);
/*! \copydoc rangeMaxFailColor /*! \copydoc rangeMaxFailColor */
\see see rangeMaxFailColor for details */
QColor getRangeMaxFailColor() const; QColor getRangeMaxFailColor() const;
/*! \copydoc nanColor /*! \copydoc nanColor */
\see see nanColor for details */
void setNanColor(const QColor & __value); void setNanColor(const QColor & __value);
/*! \copydoc nanColor /*! \copydoc nanColor */
\see see nanColor for details */
QColor getNanColor() const; QColor getNanColor() const;
/*! \copydoc infColor /*! \copydoc infColor */
\see see infColor for details */
void setInfColor(const QColor & __value); void setInfColor(const QColor & __value);
/*! \copydoc infColor /*! \copydoc infColor */
\see see infColor for details */
QColor getInfColor() const; QColor getInfColor() const;
/*! \copydoc showColorBar /*! \copydoc showColorBar */
\see see showColorBar for details */
void setShowColorBar(bool __value); void setShowColorBar(bool __value);
/*! \copydoc showColorBar /*! \copydoc showColorBar */
\see see showColorBar for details */
bool getShowColorBar() const; bool getShowColorBar() const;
/*! \copydoc colorBarWidth /*! \copydoc colorBarWidth */
\see see colorBarWidth for details */
void setColorBarWidth(double __value); void setColorBarWidth(double __value);
/*! \copydoc colorBarWidth /*! \copydoc colorBarWidth */
\see see colorBarWidth for details */
double getColorBarWidth() const; double getColorBarWidth() const;
/*! \copydoc colorBarModifiedWidth /*! \copydoc colorBarModifiedWidth */
\see see colorBarModifiedWidth for details */
void setColorBarModifiedWidth(double __value); void setColorBarModifiedWidth(double __value);
/*! \copydoc colorBarModifiedWidth /*! \copydoc colorBarModifiedWidth */
\see see colorBarModifiedWidth for details */
double getColorBarModifiedWidth() const; double getColorBarModifiedWidth() const;
/*! \copydoc colorBarOffset /*! \copydoc colorBarOffset */
\see see colorBarOffset for details */
void setColorBarOffset(double __value); void setColorBarOffset(double __value);
/*! \copydoc colorBarOffset /*! \copydoc colorBarOffset */
\see see colorBarOffset for details */
double getColorBarOffset() const; double getColorBarOffset() const;
/*! \copydoc colorBarRelativeHeight /*! \copydoc colorBarRelativeHeight */
\see see colorBarRelativeHeight for details */
void setColorBarRelativeHeight(double __value); void setColorBarRelativeHeight(double __value);
/*! \copydoc colorBarRelativeHeight /*! \copydoc colorBarRelativeHeight */
\see see colorBarRelativeHeight for details */
double getColorBarRelativeHeight() const; double getColorBarRelativeHeight() const;
/*! \copydoc imageMin /*! \copydoc imageMin */
\see see imageMin for details */
void setImageMin(double __value); void setImageMin(double __value);
/*! \copydoc imageMin /*! \copydoc imageMin */
\see see imageMin for details */
double getImageMin() const; double getImageMin() const;
/*! \copydoc imageMax /*! \copydoc imageMax */
\see see imageMax for details */
void setImageMax(double __value); void setImageMax(double __value);
/*! \copydoc imageMax /*! \copydoc imageMax */
\see see imageMax for details */
double getImageMax() const; double getImageMax() const;
/*! \copydoc autoImageRange /*! \copydoc autoImageRange */
\see see autoImageRange for details */
void setAutoImageRange(bool __value); void setAutoImageRange(bool __value);
/*! \copydoc autoImageRange /*! \copydoc autoImageRange */
\see see autoImageRange for details */
bool getAutoImageRange() const; bool getAutoImageRange() const;
/*! \copydoc imageName /*! \copydoc imageName */
\see see imageName for details */
void setImageName(const QString & __value); void setImageName(const QString & __value);
/*! \copydoc imageName /*! \copydoc imageName */
\see see imageName for details */
QString getImageName() const; QString getImageName() const;
/*! \copydoc imageNameFontSize /*! \copydoc imageNameFontSize */
\see see imageNameFontSize for details */
void setImageNameFontSize(double __value); void setImageNameFontSize(double __value);
/*! \copydoc imageNameFontSize /*! \copydoc imageNameFontSize */
\see see imageNameFontSize for details */
double getImageNameFontSize() const; double getImageNameFontSize() const;
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */ /*! \copydoc colorBarRightAxis */
JKQTPVerticalIndependentAxis* getColorBarRightAxis(); JKQTPVerticalIndependentAxis* getColorBarRightAxis();
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */ /*! \copydoc colorBarTopAxis */
JKQTPHorizontalIndependentAxis* getColorBarTopAxis(); JKQTPHorizontalIndependentAxis* getColorBarTopAxis();
/*! \brief returns the property modifierColorBarTopAxis ( \copybrief modifierColorBarTopAxis ). \details Description of the parameter modifierColorBarTopAxis is: <BLOCKQUOTE>\copydoc modifierColorBarTopAxis </BLOCKQUOTE>. \see modifierColorBarTopAxis for more information */ /*! \copydoc modifierColorBarTopAxis */
JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis(); JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis();
/*! \brief returns the property modifierColorBarRightAxis ( \copybrief modifierColorBarRightAxis ). \details Description of the parameter modifierColorBarRightAxis is: <BLOCKQUOTE>\copydoc modifierColorBarRightAxis </BLOCKQUOTE>. \see modifierColorBarRightAxis for more information */ /*! \copydoc modifierColorBarRightAxis */
JKQTPHorizontalIndependentAxis* getModifierColorBarRightAxis(); JKQTPHorizontalIndependentAxis* getModifierColorBarRightAxis();
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */ /*! \copydoc colorBarRightAxis */
const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const; const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const;
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */ /*! \copydoc colorBarTopAxis */
const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const; const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const;
/*! \brief returns the property modifierColorBarTopAxis ( \copybrief modifierColorBarTopAxis ). \details Description of the parameter modifierColorBarTopAxis is: <BLOCKQUOTE>\copydoc modifierColorBarTopAxis </BLOCKQUOTE>. \see modifierColorBarTopAxis for more information */ /*! \copydoc modifierColorBarTopAxis */
const JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis() const; const JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis() const;
/*! \brief returns the property modifierColorBarRightAxis ( \copybrief modifierColorBarRightAxis ). \details Description of the parameter modifierColorBarRightAxis is: <BLOCKQUOTE>\copydoc modifierColorBarRightAxis </BLOCKQUOTE>. \see modifierColorBarRightAxis for more information */ /*! \copydoc modifierColorBarRightAxis */
const JKQTPHorizontalIndependentAxis *getModifierColorBarRightAxis() const; const JKQTPHorizontalIndependentAxis *getModifierColorBarRightAxis() const;
/*! \copydoc colorBarTopVisible /*! \copydoc colorBarTopVisible */
\see see colorBarTopVisible for details */
void setColorBarTopVisible(bool __value); void setColorBarTopVisible(bool __value);
/*! \copydoc colorBarTopVisible /*! \copydoc colorBarTopVisible */
\see see colorBarTopVisible for details */
bool getColorBarTopVisible() const; bool getColorBarTopVisible() const;
/*! \copydoc colorBarRightVisible /*! \copydoc colorBarRightVisible */
\see see colorBarRightVisible for details */
void setColorBarRightVisible(bool __value); void setColorBarRightVisible(bool __value);
/*! \copydoc colorBarRightVisible /*! \copydoc colorBarRightVisible */
\see see colorBarRightVisible for details */
bool getColorBarRightVisible() const; bool getColorBarRightVisible() const;
/*! \copydoc autoModifierRange /*! \copydoc autoModifierRange */
\see see autoModifierRange for details */
void setAutoModifierRange(bool __value); void setAutoModifierRange(bool __value);
/*! \copydoc autoModifierRange /*! \copydoc autoModifierRange */
\see see autoModifierRange for details */
bool getAutoModifierRange() const; bool getAutoModifierRange() const;
/*! \copydoc modifierMin /*! \copydoc modifierMin */
\see see modifierMin for details */
void setModifierMin(double __value); void setModifierMin(double __value);
/*! \copydoc modifierMin /*! \copydoc modifierMin */
\see see modifierMin for details */
double getModifierMin() const; double getModifierMin() const;
/*! \copydoc modifierMax /*! \copydoc modifierMax */
\see see modifierMax for details */
void setModifierMax(double __value); void setModifierMax(double __value);
/*! \copydoc modifierMax /*! \copydoc modifierMax */
\see see modifierMax for details */
double getModifierMax() const; double getModifierMax() const;
void setPalette(int pal); void setPalette(int pal);
@ -538,7 +472,20 @@ class JKQTP_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
virtual void getModifierMinMax(double& imin, double& imax) override; virtual void getModifierMinMax(double& imin, double& imax) override;
/** \brief return the value (raw data!) of the contained image at the given coordinate */ /** \brief return the value (raw data!) of the contained image at the given coordinate */
double getValueAt(double x, double y); inline double getValueAt(double x, double y);
/** \brief retrieve size of a single sample in the image data (i.e. size of the datatype) */
inline int getSampleSize() const;
/** \brief retrieve image data at a given position as double */
inline double getPixelValue(int xIdx, int yIdx) const;
/** \brief return the value (raw data!) of the contained modifier image at the given coordinate */
inline double getModifierValueAt(double x, double y);
/** \brief retrieve size of a single sample in the modifier image data (i.e. size of the datatype) */
inline int getModifierSampleSize() const;
/** \brief retrieve modifier image data at a given position as double */
inline double getModifierPixelValue(int xIdx, int yIdx) const;
/** \brief plots a key marker inside the specified rectangle \a rect */ /** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
@ -615,9 +562,173 @@ class JKQTP_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
}; };
////////////////////////////////////////////////////////////////////////////////////////////////
double JKQTPMathImage::getValueAt(double x, double y)
{
ensureImageData();
int xx=trunc((x-this->x)/width*double(Nx));
int yy=trunc((y-this->y)/height*double(Ny));
if (xx>=0 && xx<(int64_t)Nx && yy>=0 && yy<(int64_t)Ny) {
switch(datatype) {
case JKQTPMathImageBase::DoubleArray: return (static_cast<double*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::FloatArray: return (static_cast<float*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt8Array: return (static_cast<uint8_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt16Array: return (static_cast<uint16_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt32Array: return (static_cast<uint32_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt64Array: return (static_cast<uint64_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int8Array: return (static_cast<int8_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int16Array: return (static_cast<int16_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int32Array: return (static_cast<int32_t*>(data))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int64Array: return (static_cast<int64_t*>(data))[yy*Nx+xx]; break;
} }
return 0.0;
}
////////////////////////////////////////////////////////////////////////////////////////////////
double JKQTPMathImage::getPixelValue(int xIdx, int yIdx) const {
// row-major in datastore
//ensureImageData();
if (!data) return 0;
switch(datatype) {
case JKQTPMathImageBase::DoubleArray:
return (static_cast<double*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::FloatArray:
return (static_cast<float*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt8Array:
return (static_cast<uint8_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt16Array:
return (static_cast<uint16_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt32Array:
return (static_cast<uint32_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt64Array:
return (static_cast<uint64_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int8Array:
return (static_cast<int8_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int16Array:
return (static_cast<int16_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int32Array:
return (static_cast<int32_t*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int64Array:
return (static_cast<int64_t*>(data))[yIdx*getNx()+xIdx];
default:
return 0;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
int JKQTPMathImage::getSampleSize() const {
switch(datatype) {
case JKQTPMathImageBase::DoubleArray:
return sizeof(double);
case JKQTPMathImageBase::FloatArray:
return sizeof(float);
case JKQTPMathImageBase::UInt8Array:
return sizeof(uint8_t);
case JKQTPMathImageBase::UInt16Array:
return sizeof(uint16_t);
case JKQTPMathImageBase::UInt32Array:
return sizeof(uint32_t);
case JKQTPMathImageBase::UInt64Array:
return sizeof(uint64_t);
case JKQTPMathImageBase::Int8Array:
return sizeof(int8_t);
case JKQTPMathImageBase::Int16Array:
return sizeof(int16_t);
case JKQTPMathImageBase::Int32Array:
return sizeof(int32_t);
case JKQTPMathImageBase::Int64Array:
return sizeof(int64_t);
default:
return 0;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
double JKQTPMathImage::getModifierValueAt(double x, double y)
{
ensureImageData();
int xx=trunc((x-this->x)/width*double(Nx));
int yy=trunc((y-this->y)/height*double(Ny));
if (xx>=0 && xx<(int64_t)Nx && yy>=0 && yy<(int64_t)Ny) {
switch(datatypeModifier) {
case JKQTPMathImageBase::DoubleArray: return (static_cast<double*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::FloatArray: return (static_cast<float*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt8Array: return (static_cast<uint8_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt16Array: return (static_cast<uint16_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt32Array: return (static_cast<uint32_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::UInt64Array: return (static_cast<uint64_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int8Array: return (static_cast<int8_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int16Array: return (static_cast<int16_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int32Array: return (static_cast<int32_t*>(dataModifier))[yy*Nx+xx]; break;
case JKQTPMathImageBase::Int64Array: return (static_cast<int64_t*>(dataModifier))[yy*Nx+xx]; break;
} }
return 0.0;
}
////////////////////////////////////////////////////////////////////////////////////////////////
double JKQTPMathImage::getModifierPixelValue(int xIdx, int yIdx) const {
// row-major in datastore
//ensureImageData();
if (!dataModifier) return 0;
switch(datatypeModifier) {
case JKQTPMathImageBase::DoubleArray:
return (static_cast<double*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::FloatArray:
return (static_cast<float*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt8Array:
return (static_cast<uint8_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt16Array:
return (static_cast<uint16_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt32Array:
return (static_cast<uint32_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::UInt64Array:
return (static_cast<uint64_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int8Array:
return (static_cast<int8_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int16Array:
return (static_cast<int16_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int32Array:
return (static_cast<int32_t*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageBase::Int64Array:
return (static_cast<int64_t*>(dataModifier))[yIdx*getNx()+xIdx];
default:
return 0;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
int JKQTPMathImage::getModifierSampleSize() const {
switch(datatypeModifier) {
case JKQTPMathImageBase::DoubleArray:
return sizeof(double);
case JKQTPMathImageBase::FloatArray:
return sizeof(float);
case JKQTPMathImageBase::UInt8Array:
return sizeof(uint8_t);
case JKQTPMathImageBase::UInt16Array:
return sizeof(uint16_t);
case JKQTPMathImageBase::UInt32Array:
return sizeof(uint32_t);
case JKQTPMathImageBase::UInt64Array:
return sizeof(uint64_t);
case JKQTPMathImageBase::Int8Array:
return sizeof(int8_t);
case JKQTPMathImageBase::Int16Array:
return sizeof(int16_t);
case JKQTPMathImageBase::Int32Array:
return sizeof(int32_t);
case JKQTPMathImageBase::Int64Array:
return sizeof(int64_t);
default:
return 0;
}
}
@ -644,17 +755,13 @@ class JKQTP_LIB_EXPORT JKQTPColumnMathImage: public JKQTPMathImage {
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, JKQTPMathImageColorPalette palette, JKQTPlotter* parent);
JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, int Nx, int Ny, JKQTPlotter* parent); JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, int Nx, int Ny, JKQTPlotter* parent);
/*! \copydoc imageColumn /*! \copydoc imageColumn */
\see see imageColumn for details */
virtual void setImageColumn(int __value); virtual void setImageColumn(int __value);
/*! \copydoc imageColumn /*! \copydoc imageColumn */
\see see imageColumn for details */
int getImageColumn() const; int getImageColumn() const;
/*! \copydoc modifierColumn /*! \copydoc modifierColumn */
\see see modifierColumn for details */
virtual void setModifierColumn(int __value); virtual void setModifierColumn(int __value);
/*! \copydoc modifierColumn /*! \copydoc modifierColumn */
\see see modifierColumn for details */
int getModifierColumn() const; int getModifierColumn() const;
/** \copydoc JKQTPGraph::usesColumn() */ /** \copydoc JKQTPGraph::usesColumn() */

View File

@ -64,35 +64,25 @@ class JKQTP_LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
/*! \copydoc trueColor /*! \copydoc trueColor */
\see see trueColor for details */
void setTrueColor(const QColor & __value); void setTrueColor(const QColor & __value);
/*! \copydoc trueColor /*! \copydoc trueColor */
\see see trueColor for details */
QColor getTrueColor() const; QColor getTrueColor() const;
/*! \copydoc falseColor /*! \copydoc falseColor */
\see see falseColor for details */
void setFalseColor(const QColor & __value); void setFalseColor(const QColor & __value);
/*! \copydoc falseColor /*! \copydoc falseColor */
\see see falseColor for details */
QColor getFalseColor() const; QColor getFalseColor() const;
/*! \copydoc Nx /*! \copydoc Nx */
\see see Nx for details */
void setNx(int __value); void setNx(int __value);
/*! \copydoc Nx /*! \copydoc Nx */
\see see Nx for details */
int getNx() const; int getNx() const;
/*! \copydoc Ny /*! \copydoc Ny */
\see see Ny for details */
void setNy(int __value); void setNy(int __value);
/*! \copydoc Ny /*! \copydoc Ny */
\see see Ny for details */
int getNy() const; int getNy() const;
/*! \copydoc data /*! \copydoc data */
\see see data for details */
virtual void setData(bool* __value); virtual void setData(bool* __value);
/*! \copydoc data /*! \copydoc data */
\see see data for details */
bool *getData() const; bool *getData() const;
/** \brief set the plot-data to a given array \a data with size \a Nx * \a Ny in row-major ordering */ /** \brief set the plot-data to a given array \a data with size \a Nx * \a Ny in row-major ordering */
@ -163,29 +153,21 @@ class JKQTP_LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage {
/** \brief plots a key marker inside the specified rectangle \a rect */ /** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/*! \copydoc symbol /*! \copydoc symbol */
\see see symbol for details */
void setSymbolType(JKQTPGraphSymbols __value); void setSymbolType(JKQTPGraphSymbols __value);
/*! \copydoc symbol /*! \copydoc symbol */
\see see symbol for details */
JKQTPGraphSymbols getSymbol() const; JKQTPGraphSymbols getSymbol() const;
/*! \copydoc symbolLineWidth /*! \copydoc symbolLineWidth */
\see see symbolLineWidth for details */
void setSymbolLineWidth(double __value); void setSymbolLineWidth(double __value);
/*! \copydoc symbolLineWidth /*! \copydoc symbolLineWidth */
\see see symbolLineWidth for details */
double getSymbolLineWidth() const; double getSymbolLineWidth() const;
/*! \copydoc drawMode /*! \copydoc drawMode */
\see see drawMode for details */
void setDrawMode(OverlayImageEnhancedDrawMode __value); void setDrawMode(OverlayImageEnhancedDrawMode __value);
/*! \copydoc drawMode /*! \copydoc drawMode */
\see see drawMode for details */
OverlayImageEnhancedDrawMode getDrawMode() const; OverlayImageEnhancedDrawMode getDrawMode() const;
/*! \copydoc symbolSizeFactor /*! \copydoc symbolSizeFactor */
\see see symbolSizeFactor for details */
void setSymbolSizeFactor(double __value); void setSymbolSizeFactor(double __value);
/*! \copydoc symbolSizeFactor /*! \copydoc symbolSizeFactor */
\see see symbolSizeFactor for details */
double getSymbolSizeFactor() const; double getSymbolSizeFactor() const;
protected: protected:
@ -221,11 +203,9 @@ class JKQTP_LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImage
JKQTPColumnOverlayImageEnhanced(JKQTBasePlotter* parent=nullptr); JKQTPColumnOverlayImageEnhanced(JKQTBasePlotter* parent=nullptr);
JKQTPColumnOverlayImageEnhanced(JKQTPlotter* parent); JKQTPColumnOverlayImageEnhanced(JKQTPlotter* parent);
/*! \copydoc imageColumn /*! \copydoc imageColumn */
\see see imageColumn for details */
virtual void setImageColumn(int __value); virtual void setImageColumn(int __value);
/*! \copydoc imageColumn /*! \copydoc imageColumn */
\see see imageColumn for details */
int getImageColumn() const; int getImageColumn() const;
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;

View File

@ -1247,6 +1247,7 @@ bool JKQTPColumnRGBMathImage::usesColumn(int c) const
void JKQTPColumnRGBMathImage::ensureImageData() void JKQTPColumnRGBMathImage::ensureImageData()
{ {
JKQTPRGBMathImage::ensureImageData();
this->datatype=JKQTPMathImageBase::DoubleArray; this->datatype=JKQTPMathImageBase::DoubleArray;
this->datatypeG=JKQTPMathImageBase::DoubleArray; this->datatypeG=JKQTPMathImageBase::DoubleArray;
this->datatypeB=JKQTPMathImageBase::DoubleArray; this->datatypeB=JKQTPMathImageBase::DoubleArray;

View File

@ -81,206 +81,150 @@ class JKQTP_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
virtual void getDataMinMax(double& imin, double& imax) override; virtual void getDataMinMax(double& imin, double& imax) override;
/*! \copydoc data /*! \copydoc data */
\see see data for details */
virtual void setDataR(void* __value); virtual void setDataR(void* __value);
/*! \copydoc data /*! \copydoc data */
\see see data for details */
void* getDataR() const; void* getDataR() const;
/*! \copydoc datatype /*! \copydoc datatype */
\see see datatype for details */
void setDatatypeR(DataType __value); void setDatatypeR(DataType __value);
/*! \copydoc datatype /*! \copydoc datatype */
\see see datatype for details */
DataType getDatatypeR() const; DataType getDatatypeR() const;
/*! \copydoc dataG /*! \copydoc dataG */
\see see dataG for details */
virtual void setDataG(void* __value); virtual void setDataG(void* __value);
/*! \copydoc dataG /*! \copydoc dataG */
\see see dataG for details */
void* getDataG() const; void* getDataG() const;
/*! \copydoc datatypeG /*! \copydoc datatypeG */
\see see datatypeG for details */
void setDatatypeG(DataType __value); void setDatatypeG(DataType __value);
/*! \copydoc datatypeG /*! \copydoc datatypeG */
\see see datatypeG for details */
DataType getDatatypeG() const; DataType getDatatypeG() const;
/*! \copydoc dataB /*! \copydoc dataB */
\see see dataB for details */
virtual void setDataB(void* __value); virtual void setDataB(void* __value);
/*! \copydoc dataB /*! \copydoc dataB */
\see see dataB for details */
void* getDataB() const; void* getDataB() const;
/*! \copydoc datatypeB /*! \copydoc datatypeB */
\see see datatypeB for details */
void setDatatypeB(DataType __value); void setDatatypeB(DataType __value);
/*! \copydoc datatypeB /*! \copydoc datatypeB */
\see see datatypeB for details */
DataType getDatatypeB() const; DataType getDatatypeB() const;
/*! \copydoc showColorBar /*! \copydoc showColorBar */
\see see showColorBar for details */
void setShowColorBar(bool __value); void setShowColorBar(bool __value);
/*! \copydoc showColorBar /*! \copydoc showColorBar */
\see see showColorBar for details */
bool getShowColorBar() const; bool getShowColorBar() const;
/*! \copydoc colorBarWidth /*! \copydoc colorBarWidth */
\see see colorBarWidth for details */
void setColorBarWidth(int __value); void setColorBarWidth(int __value);
/*! \copydoc colorBarWidth /*! \copydoc colorBarWidth */
\see see colorBarWidth for details */
int getColorBarWidth() const; int getColorBarWidth() const;
/*! \copydoc colorBarOffset /*! \copydoc colorBarOffset */
\see see colorBarOffset for details */
void setColorBarOffset(int __value); void setColorBarOffset(int __value);
/*! \copydoc colorBarOffset /*! \copydoc colorBarOffset */
\see see colorBarOffset for details */
int getColorBarOffset() const; int getColorBarOffset() const;
/*! \copydoc colorBarRelativeHeight /*! \copydoc colorBarRelativeHeight */
\see see colorBarRelativeHeight for details */
void setColorBarRelativeHeight(double __value); void setColorBarRelativeHeight(double __value);
/*! \copydoc colorBarRelativeHeight /*! \copydoc colorBarRelativeHeight */
\see see colorBarRelativeHeight for details */
double getColorBarRelativeHeight() const; double getColorBarRelativeHeight() const;
/*! \copydoc imageMinR /*! \copydoc imageMinR */
\see see imageMinR for details */
void setImageMin(double __value); void setImageMin(double __value);
/*! \copydoc imageMinR /*! \copydoc imageMinR */
\see see imageMinR for details */
double getImageMin() const; double getImageMin() const;
/*! \copydoc imageMinR /*! \copydoc imageMinR */
\see see imageMinR for details */
void setImageMinR(double m); void setImageMinR(double m);
/*! \copydoc imageMaxR /*! \copydoc imageMaxR */
\see see imageMaxR for details */
void setImageMax(double __value); void setImageMax(double __value);
/*! \copydoc imageMaxR /*! \copydoc imageMaxR */
\see see imageMaxR for details */
double getImageMax() const; double getImageMax() const;
/*! \copydoc imageMaxR /*! \copydoc imageMaxR */
\see see imageMaxR for details */
void setImageMaxR(double m); void setImageMaxR(double m);
/*! \copydoc imageMinG /*! \copydoc imageMinG */
\see see imageMinG for details */
void setImageMinG(double __value); void setImageMinG(double __value);
/*! \copydoc imageMinG /*! \copydoc imageMinG */
\see see imageMinG for details */
double getImageMinG() const; double getImageMinG() const;
/*! \copydoc imageMaxG /*! \copydoc imageMaxG */
\see see imageMaxG for details */
void setImageMaxG(double __value); void setImageMaxG(double __value);
/*! \copydoc imageMaxG /*! \copydoc imageMaxG */
\see see imageMaxG for details */
double getImageMaxG() const; double getImageMaxG() const;
/*! \copydoc imageMinB /*! \copydoc imageMinB */
\see see imageMinB for details */
void setImageMinB(double __value); void setImageMinB(double __value);
/*! \copydoc imageMinB /*! \copydoc imageMinB */
\see see imageMinB for details */
double getImageMinB() const; double getImageMinB() const;
/*! \copydoc imageMaxB /*! \copydoc imageMaxB */
\see see imageMaxB for details */
void setImageMaxB(double __value); void setImageMaxB(double __value);
/*! \copydoc imageMaxB /*! \copydoc imageMaxB */
\see see imageMaxB for details */
double getImageMaxB() const; double getImageMaxB() const;
/*! \copydoc autoImageRange /*! \copydoc autoImageRange */
\see see autoImageRange for details */
void setAutoImageRange(bool __value); void setAutoImageRange(bool __value);
/*! \copydoc autoImageRange /*! \copydoc autoImageRange */
\see see autoImageRange for details */
bool getAutoImageRange() const; bool getAutoImageRange() const;
/*! \copydoc imageNameR /*! \copydoc imageNameR */
\see see imageNameR for details */
void setImageName(const QString & __value); void setImageName(const QString & __value);
/*! \copydoc imageNameR /*! \copydoc imageNameR */
\see see imageNameR for details */
QString getImageName() const; QString getImageName() const;
/*! \copydoc imageNameR /*! \copydoc imageNameR */
\see see imageNameR for details */
QString getImageNameR() const; QString getImageNameR() const;
/*! \copydoc imageNameR /*! \copydoc imageNameR */
\see see imageNameR for details */
void setImageNameR(const QString& m); void setImageNameR(const QString& m);
/*! \copydoc imageNameG /*! \copydoc imageNameG */
\see see imageNameG for details */
void setImageNameG(const QString & __value); void setImageNameG(const QString & __value);
/*! \copydoc imageNameG /*! \copydoc imageNameG */
\see see imageNameG for details */
QString getImageNameG() const; QString getImageNameG() const;
/*! \copydoc imageNameB /*! \copydoc imageNameB */
\see see imageNameB for details */
void setImageNameB(const QString & __value); void setImageNameB(const QString & __value);
/*! \copydoc imageNameB /*! \copydoc imageNameB */
\see see imageNameB for details */
QString getImageNameB() const; QString getImageNameB() const;
/*! \copydoc imageNameFontName /*! \copydoc imageNameFontName */
\see see imageNameFontName for details */
void setImageNameFontName(const QString & __value); void setImageNameFontName(const QString & __value);
/*! \copydoc imageNameFontName /*! \copydoc imageNameFontName */
\see see imageNameFontName for details */
QString getImageNameFontName() const; QString getImageNameFontName() const;
/*! \copydoc imageNameFontSize /*! \copydoc imageNameFontSize */
\see see imageNameFontSize for details */
void setImageNameFontSize(double __value); void setImageNameFontSize(double __value);
/*! \copydoc imageNameFontSize /*! \copydoc imageNameFontSize */
\see see imageNameFontSize for details */
double getImageNameFontSize() const; double getImageNameFontSize() const;
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */ /*! \copydoc colorBarRightAxis */
JKQTPVerticalIndependentAxis* getColorBarRightAxis(); JKQTPVerticalIndependentAxis* getColorBarRightAxis();
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */ /*! \copydoc colorBarTopAxis */
JKQTPHorizontalIndependentAxis* getColorBarTopAxis(); JKQTPHorizontalIndependentAxis* getColorBarTopAxis();
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */ /*! \copydoc colorBarRightAxis */
JKQTPVerticalIndependentAxis* getColorBarRightAxisR(); JKQTPVerticalIndependentAxis* getColorBarRightAxisR();
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */ /*! \copydoc colorBarTopAxis */
JKQTPHorizontalIndependentAxis *getColorBarTopAxisR(); JKQTPHorizontalIndependentAxis *getColorBarTopAxisR();
/*! \brief returns the property colorBarRightAxisG ( \copybrief colorBarRightAxisG ). \details Description of the parameter colorBarRightAxisG is: <BLOCKQUOTE>\copydoc colorBarRightAxisG </BLOCKQUOTE>. \see colorBarRightAxisG for more information */ /*! \copydoc colorBarRightAxisG */
JKQTPVerticalIndependentAxis* getColorBarRightAxisG(); JKQTPVerticalIndependentAxis* getColorBarRightAxisG();
/*! \brief returns the property colorBarTopAxisG ( \copybrief colorBarTopAxisG ). \details Description of the parameter colorBarTopAxisG is: <BLOCKQUOTE>\copydoc colorBarTopAxisG </BLOCKQUOTE>. \see colorBarTopAxisG for more information */ /*! \copydoc colorBarTopAxisG */
JKQTPHorizontalIndependentAxis* getColorBarTopAxisG(); JKQTPHorizontalIndependentAxis* getColorBarTopAxisG();
/*! \brief returns the property colorBarRightAxisB ( \copybrief colorBarRightAxisB ). \details Description of the parameter colorBarRightAxisB is: <BLOCKQUOTE>\copydoc colorBarRightAxisB </BLOCKQUOTE>. \see colorBarRightAxisB for more information */ /*! \copydoc colorBarRightAxisB */
JKQTPVerticalIndependentAxis* getColorBarRightAxisB(); JKQTPVerticalIndependentAxis* getColorBarRightAxisB();
/*! \brief returns the property colorBarTopAxisB ( \copybrief colorBarTopAxisB ). \details Description of the parameter colorBarTopAxisB is: <BLOCKQUOTE>\copydoc colorBarTopAxisB </BLOCKQUOTE>. \see colorBarTopAxisB for more information */ /*! \copydoc colorBarTopAxisB */
JKQTPHorizontalIndependentAxis* getColorBarTopAxisB(); JKQTPHorizontalIndependentAxis* getColorBarTopAxisB();
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */ /*! \copydoc colorBarRightAxis */
const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const; const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const;
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */ /*! \copydoc colorBarTopAxis */
const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const; const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const;
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */ /*! \copydoc colorBarRightAxis */
const JKQTPVerticalIndependentAxis* getColorBarRightAxisR() const; const JKQTPVerticalIndependentAxis* getColorBarRightAxisR() const;
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */ /*! \copydoc colorBarTopAxis */
const JKQTPHorizontalIndependentAxis* getColorBarTopAxisR() const; const JKQTPHorizontalIndependentAxis* getColorBarTopAxisR() const;
/*! \brief returns the property colorBarRightAxisG ( \copybrief colorBarRightAxisG ). \details Description of the parameter colorBarRightAxisG is: <BLOCKQUOTE>\copydoc colorBarRightAxisG </BLOCKQUOTE>. \see colorBarRightAxisG for more information */ /*! \copydoc colorBarRightAxisG */
const JKQTPVerticalIndependentAxis* getColorBarRightAxisG() const; const JKQTPVerticalIndependentAxis* getColorBarRightAxisG() const;
/*! \brief returns the property colorBarTopAxisG ( \copybrief colorBarTopAxisG ). \details Description of the parameter colorBarTopAxisG is: <BLOCKQUOTE>\copydoc colorBarTopAxisG </BLOCKQUOTE>. \see colorBarTopAxisG for more information */ /*! \copydoc colorBarTopAxisG */
const JKQTPHorizontalIndependentAxis *getColorBarTopAxisG() const; const JKQTPHorizontalIndependentAxis *getColorBarTopAxisG() const;
/*! \brief returns the property colorBarRightAxisB ( \copybrief colorBarRightAxisB ). \details Description of the parameter colorBarRightAxisB is: <BLOCKQUOTE>\copydoc colorBarRightAxisB </BLOCKQUOTE>. \see colorBarRightAxisB for more information */ /*! \copydoc colorBarRightAxisB */
const JKQTPVerticalIndependentAxis* getColorBarRightAxisB() const; const JKQTPVerticalIndependentAxis* getColorBarRightAxisB() const;
/*! \brief returns the property colorBarTopAxisB ( \copybrief colorBarTopAxisB ). \details Description of the parameter colorBarTopAxisB is: <BLOCKQUOTE>\copydoc colorBarTopAxisB </BLOCKQUOTE>. \see colorBarTopAxisB for more information */ /*! \copydoc colorBarTopAxisB */
const JKQTPHorizontalIndependentAxis *getColorBarTopAxisB() const; const JKQTPHorizontalIndependentAxis *getColorBarTopAxisB() const;
/*! \copydoc colorBarTopVisible /*! \copydoc colorBarTopVisible */
\see see colorBarTopVisible for details */
void setColorBarTopVisible(bool __value); void setColorBarTopVisible(bool __value);
/*! \copydoc colorBarTopVisible /*! \copydoc colorBarTopVisible */
\see see colorBarTopVisible for details */
bool getColorBarTopVisible() const; bool getColorBarTopVisible() const;
/*! \copydoc colorBarRightVisible /*! \copydoc colorBarRightVisible */
\see see colorBarRightVisible for details */
void setColorBarRightVisible(bool __value); void setColorBarRightVisible(bool __value);
/*! \copydoc colorBarRightVisible /*! \copydoc colorBarRightVisible */
\see see colorBarRightVisible for details */
bool getColorBarRightVisible() const; bool getColorBarRightVisible() const;
/*! \copydoc colorbarsSideBySide /*! \copydoc colorbarsSideBySide */
\see see colorbarsSideBySide for details */
void setColorbarsSideBySide(bool __value); void setColorbarsSideBySide(bool __value);
/*! \copydoc colorbarsSideBySide /*! \copydoc colorbarsSideBySide */
\see see colorbarsSideBySide for details */
bool getColorbarsSideBySide() const; bool getColorbarsSideBySide() const;
/*! \copydoc rgbMode /*! \copydoc rgbMode */
\see see rgbMode for details */
void setRgbMode(JKQTPRGBMathImageRGBMode __value); void setRgbMode(JKQTPRGBMathImageRGBMode __value);
/*! \copydoc rgbMode /*! \copydoc rgbMode */
\see see rgbMode for details */
JKQTPRGBMathImageRGBMode getRgbMode() const; JKQTPRGBMathImageRGBMode getRgbMode() const;
/** \brief return the data of the green channel used for plotting as a QVector<double> in row-major data-ordering */ /** \brief return the data of the green channel used for plotting as a QVector<double> in row-major data-ordering */
@ -435,29 +379,21 @@ class JKQTP_LIB_EXPORT JKQTPColumnRGBMathImage: public JKQTPRGBMathImage {
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int Nx, int Ny, JKQTPlotter* parent); JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int Nx, int Ny, JKQTPlotter* parent);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, int Nx, int Ny, JKQTPlotter* parent); JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, int Nx, int Ny, JKQTPlotter* parent);
/*! \copydoc imageRColumn /*! \copydoc imageRColumn */
\see see imageRColumn for details */
virtual void setImageRColumn(int __value); virtual void setImageRColumn(int __value);
/*! \copydoc imageRColumn /*! \copydoc imageRColumn */
\see see imageRColumn for details */
int getImageRColumn() const; int getImageRColumn() const;
/*! \copydoc imageGColumn /*! \copydoc imageGColumn */
\see see imageGColumn for details */
virtual void setImageGColumn(int __value); virtual void setImageGColumn(int __value);
/*! \copydoc imageGColumn /*! \copydoc imageGColumn */
\see see imageGColumn for details */
int getImageGColumn() const; int getImageGColumn() const;
/*! \copydoc imageBColumn /*! \copydoc imageBColumn */
\see see imageBColumn for details */
virtual void setImageBColumn(int __value); virtual void setImageBColumn(int __value);
/*! \copydoc imageBColumn /*! \copydoc imageBColumn */
\see see imageBColumn for details */
int getImageBColumn() const; int getImageBColumn() const;
/*! \copydoc modifierColumn /*! \copydoc modifierColumn */
\see see modifierColumn for details */
virtual void setModifierColumn(int __value); virtual void setModifierColumn(int __value);
/*! \copydoc modifierColumn /*! \copydoc modifierColumn */
\see see modifierColumn for details */
int getModifierColumn() const; int getModifierColumn() const;
/** \copydoc JKQTPGraph::usesColumn() */ /** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int c) const override; virtual bool usesColumn(int c) const override;

View File

@ -50,18 +50,14 @@ class JKQTP_LIB_EXPORT JKQTPImpulsesHorizontalGraph: public JKQTPXYGraph, public
/*! \brief color of symbols and impulses in one call */ /*! \brief color of symbols and impulses in one call */
virtual void setColor(QColor c); virtual void setColor(QColor c);
/*! \copydoc baseline /*! \copydoc baseline */
\see see baseline for details */
void setBaseline(double __value); void setBaseline(double __value);
/*! \copydoc baseline /*! \copydoc baseline */
\see see baseline for details */
double getBaseline() const; double getBaseline() const;
/*! \copydoc drawSymbols /*! \copydoc drawSymbols */
\see see drawSymbols for details */
void setDrawSymbols(bool __value); void setDrawSymbols(bool __value);
/*! \copydoc drawSymbols /*! \copydoc drawSymbols */
\see see drawSymbols for details */
bool getDrawSymbols() const; bool getDrawSymbols() const;
protected: protected:

View File

@ -57,18 +57,14 @@ class JKQTP_LIB_EXPORT JKQTPXParsedFunctionLineGraph: public JKQTPXFunctionLineG
/** \brief class destructor */ /** \brief class destructor */
virtual ~JKQTPXParsedFunctionLineGraph() override; virtual ~JKQTPXParsedFunctionLineGraph() override;
/*! \copydoc function /*! \copydoc function */
\see see function for details */
void setFunction(const QString & __value); void setFunction(const QString & __value);
/*! \copydoc function /*! \copydoc function */
\see see function for details */
QString getFunction() const; QString getFunction() const;
/*! \copydoc errorFunction /*! \copydoc errorFunction */
\see see errorFunction for details */
void setErrorFunction(const QString & __value); void setErrorFunction(const QString & __value);
/*! \copydoc errorFunction /*! \copydoc errorFunction */
\see see errorFunction for details */
QString getErrorFunction() const; QString getErrorFunction() const;
/** \brief INTERNAL data structure /** \brief INTERNAL data structure
@ -127,18 +123,14 @@ class JKQTP_LIB_EXPORT JKQTPYParsedFunctionLineGraph: public JKQTPYFunctionLineG
/** \brief class destructor */ /** \brief class destructor */
virtual ~JKQTPYParsedFunctionLineGraph() override; virtual ~JKQTPYParsedFunctionLineGraph() override;
/*! \copydoc function /*! \copydoc function */
\see see function for details */
void setFunction(const QString & __value); void setFunction(const QString & __value);
/*! \copydoc function /*! \copydoc function */
\see see function for details */
QString getFunction() const; QString getFunction() const;
/*! \copydoc errorFunction /*! \copydoc errorFunction */
\see see errorFunction for details */
void setErrorFunction(const QString & __value); void setErrorFunction(const QString & __value);
/*! \copydoc errorFunction /*! \copydoc errorFunction */
\see see errorFunction for details */
QString getErrorFunction() const; QString getErrorFunction() const;
/** \brief INTERNAL data structure /** \brief INTERNAL data structure

View File

@ -70,29 +70,21 @@ class JKQTP_LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPSingleColumnGraph, publ
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
/** \brief set symbol color and fill color at the same time */ /** \brief set symbol color and fill color at the same time */
void setColor(QColor col); void setColor(QColor col);
/*! \copydoc baseline /*! \copydoc baseline */
\see see baseline for details */
void setBaseline(double __value); void setBaseline(double __value);
/*! \copydoc baseline /*! \copydoc baseline */
\see see baseline for details */
double getBaseline() const; double getBaseline() const;
/*! \copydoc peakHeight /*! \copydoc peakHeight */
\see see peakHeight for details */
void setPeakHeight(double __value); void setPeakHeight(double __value);
/*! \copydoc peakHeight /*! \copydoc peakHeight */
\see see peakHeight for details */
double getPeakHeight() const; double getPeakHeight() const;
/*! \copydoc yPeaks /*! \copydoc yPeaks */
\see see yPeaks for details */
void setYPeaks(bool __value); void setYPeaks(bool __value);
/*! \copydoc yPeaks /*! \copydoc yPeaks */
\see see yPeaks for details */
bool getYPeaks() const; bool getYPeaks() const;
/*! \copydoc drawBaseline /*! \copydoc drawBaseline */
\see see drawBaseline for details */
void setDrawBaseline(bool __value); void setDrawBaseline(bool __value);
/*! \copydoc drawBaseline /*! \copydoc drawBaseline */
\see see drawBaseline for details */
bool getDrawBaseline() const; bool getDrawBaseline() const;
protected: protected:

View File

@ -82,96 +82,66 @@ class JKQTP_LIB_EXPORT JKQTPHorizontalRange: public JKQTPGraph, public JKQTPGrap
/*! \brief set the color of the graph (all lines and filling) */ /*! \brief set the color of the graph (all lines and filling) */
virtual void setColor(QColor c); virtual void setColor(QColor c);
/*! \copydoc centerColor /*! \copydoc centerColor */
\see see centerColor for details */
void setCenterColor(const QColor & __value); void setCenterColor(const QColor & __value);
/*! \copydoc centerColor /*! \copydoc centerColor */
\see see centerColor for details */
QColor getCenterColor() const; QColor getCenterColor() const;
/*! \copydoc centerStyle /*! \copydoc centerStyle */
\see see centerStyle for details */
void setCenterStyle(Qt::PenStyle __value); void setCenterStyle(Qt::PenStyle __value);
/*! \copydoc centerStyle /*! \copydoc centerStyle */
\see see centerStyle for details */
Qt::PenStyle getCenterStyle() const; Qt::PenStyle getCenterStyle() const;
/*! \copydoc centerLineWidth /*! \copydoc centerLineWidth */
\see see centerLineWidth for details */
void setCenterLineWidth(double __value); void setCenterLineWidth(double __value);
/*! \copydoc centerLineWidth /*! \copydoc centerLineWidth */
\see see centerLineWidth for details */
double getCenterLineWidth() const; double getCenterLineWidth() const;
/*! \copydoc rangeMin /*! \copydoc rangeMin */
\see see rangeMin for details */
void setRangeMin(double __value); void setRangeMin(double __value);
/*! \copydoc rangeMin /*! \copydoc rangeMin */
\see see rangeMin for details */
double getRangeMin() const; double getRangeMin() const;
/*! \copydoc rangeMax /*! \copydoc rangeMax */
\see see rangeMax for details */
void setRangeMax(double __value); void setRangeMax(double __value);
/*! \copydoc rangeMax /*! \copydoc rangeMax */
\see see rangeMax for details */
double getRangeMax() const; double getRangeMax() const;
/*! \copydoc sizeMin /*! \copydoc sizeMin */
\see see sizeMin for details */
void setSizeMin(double __value); void setSizeMin(double __value);
/*! \copydoc sizeMin /*! \copydoc sizeMin */
\see see sizeMin for details */
double getSizeMin() const; double getSizeMin() const;
/*! \copydoc sizeMax /*! \copydoc sizeMax */
\see see sizeMax for details */
void setSizeMax(double __value); void setSizeMax(double __value);
/*! \copydoc sizeMax /*! \copydoc sizeMax */
\see see sizeMax for details */
double getSizeMax() const; double getSizeMax() const;
/*! \copydoc unlimitedSizeMin /*! \copydoc unlimitedSizeMin */
\see see unlimitedSizeMin for details */
void setUnlimitedSizeMin(bool __value); void setUnlimitedSizeMin(bool __value);
/*! \copydoc unlimitedSizeMin /*! \copydoc unlimitedSizeMin */
\see see unlimitedSizeMin for details */
bool getUnlimitedSizeMin() const; bool getUnlimitedSizeMin() const;
/*! \copydoc unlimitedSizeMax /*! \copydoc unlimitedSizeMax */
\see see unlimitedSizeMax for details */
void setUnlimitedSizeMax(bool __value); void setUnlimitedSizeMax(bool __value);
/*! \copydoc unlimitedSizeMax /*! \copydoc unlimitedSizeMax */
\see see unlimitedSizeMax for details */
bool getUnlimitedSizeMax() const; bool getUnlimitedSizeMax() const;
/*! \copydoc rangeCenter /*! \copydoc rangeCenter */
\see see rangeCenter for details */
void setRangeCenter(double __value); void setRangeCenter(double __value);
/*! \copydoc rangeCenter /*! \copydoc rangeCenter */
\see see rangeCenter for details */
double getRangeCenter() const; double getRangeCenter() const;
/*! \copydoc plotCenterLine /*! \copydoc plotCenterLine */
\see see plotCenterLine for details */
void setPlotCenterLine(bool __value); void setPlotCenterLine(bool __value);
/*! \copydoc plotCenterLine /*! \copydoc plotCenterLine */
\see see plotCenterLine for details */
bool getPlotCenterLine() const; bool getPlotCenterLine() const;
/*! \copydoc invertedRange /*! \copydoc invertedRange */
\see see invertedRange for details */
void setInvertedRange(bool __value); void setInvertedRange(bool __value);
/*! \copydoc invertedRange /*! \copydoc invertedRange */
\see see invertedRange for details */
bool getInvertedRange() const; bool getInvertedRange() const;
/*! \copydoc plotRange /*! \copydoc plotRange */
\see see plotRange for details */
void setPlotRange(bool __value); void setPlotRange(bool __value);
/*! \copydoc plotRange /*! \copydoc plotRange */
\see see plotRange for details */
bool getPlotRange() const; bool getPlotRange() const;
/*! \copydoc fillRange /*! \copydoc fillRange */
\see see fillRange for details */
void setFillRange(bool __value); void setFillRange(bool __value);
/*! \copydoc fillRange /*! \copydoc fillRange */
\see see fillRange for details */
bool getFillRange() const; bool getFillRange() const;
/*! \copydoc plotRangeLines /*! \copydoc plotRangeLines */
\see see plotRangeLines for details */
void setPlotRangeLines(bool __value); void setPlotRangeLines(bool __value);
/*! \copydoc plotRangeLines /*! \copydoc plotRangeLines */
\see see plotRangeLines for details */
bool getPlotRangeLines() const; bool getPlotRangeLines() const;
protected: protected:
/** \brief min-value of range */ /** \brief min-value of range */

View File

@ -66,11 +66,9 @@ class JKQTP_LIB_EXPORT JKQTPXYLineGraph: public JKQTPXYGraph, public JKQTPGraphL
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
/*! \copydoc drawLine /*! \copydoc drawLine */
\see see drawLine for details */
void setDrawLine(bool __value); void setDrawLine(bool __value);
/*! \copydoc drawLine /*! \copydoc drawLine */
\see see drawLine for details */
bool getDrawLine() const; bool getDrawLine() const;
/** \brief set color of line and symbol */ /** \brief set color of line and symbol */
@ -135,14 +133,11 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
/*! \copydoc sizeColumn /*! \copydoc sizeColumn */
\see see sizeColumn for details */
void setSizeColumn(int __value); void setSizeColumn(int __value);
/*! \copydoc sizeColumn /*! \copydoc sizeColumn */
\see see sizeColumn for details */
void setSizeColumn (size_t __value); void setSizeColumn (size_t __value);
/*! \copydoc sizeColumn /*! \copydoc sizeColumn */
\see see sizeColumn for details */
int getSizeColumn() const; int getSizeColumn() const;
/** \brief defines a functor, which converts a value from the sizeColumn into an actual symbol size in pt /** \brief defines a functor, which converts a value from the sizeColumn into an actual symbol size in pt
* *
@ -165,25 +160,19 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
FunctorToSize getSizeColumnFunctor(); FunctorToSize getSizeColumnFunctor();
/*! \copydoc colorColumn /*! \copydoc colorColumn */
\see see colorColumn for details */
void setColorColumn(int __value); void setColorColumn(int __value);
/*! \copydoc colorColumn /*! \copydoc colorColumn */
\see see colorColumn for details */
int getColorColumn() const; int getColorColumn() const;
/*! \copydoc colorColumn /*! \copydoc colorColumn */
\see see colorColumn for details */
void setColorColumn (size_t __value); void setColorColumn (size_t __value);
/*! \copydoc symbolColumn /*! \copydoc symbolColumn */
\see see symbolColumn for details */
void setSymbolColumn(int __value); void setSymbolColumn(int __value);
/*! \copydoc symbolColumn /*! \copydoc symbolColumn */
\see see symbolColumn for details */
int getSymbolColumn() const; int getSymbolColumn() const;
/*! \copydoc symbolColumn /*! \copydoc symbolColumn */
\see see symbolColumn for details */
void setSymbolColumn (size_t __value); void setSymbolColumn (size_t __value);
/** \brief defines a functor, which converts a value from the symbolColumn into an actual symbol type /** \brief defines a functor, which converts a value from the symbolColumn into an actual symbol type
* *
@ -235,14 +224,11 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
FunctorToSymbol getSymbolColumnFunctor(); FunctorToSymbol getSymbolColumnFunctor();
/*! \copydoc linewidthColumn /*! \copydoc linewidthColumn */
\see see linewidthColumn for details */
void setLinewidthColumn(int __value); void setLinewidthColumn(int __value);
/*! \copydoc linewidthColumn /*! \copydoc linewidthColumn */
\see see linewidthColumn for details */
int getLinewidthColumn() const; int getLinewidthColumn() const;
/*! \copydoc linewidthColumn /*! \copydoc linewidthColumn */
\see see linewidthColumn for details */
void setLinewidthColumn( size_t __value); void setLinewidthColumn( size_t __value);
/** \brief defines a functor, which converts a value from the symbolColumn into an actual line width in pt /** \brief defines a functor, which converts a value from the symbolColumn into an actual line width in pt
* *
@ -272,43 +258,31 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
/*! \copydoc colorColumnContainsRGB /*! \copydoc colorColumnContainsRGB */
\see see colorColumnContainsRGB for details */
void setColorColumnContainsRGB(bool __value); void setColorColumnContainsRGB(bool __value);
/*! \copydoc colorColumnContainsRGB /*! \copydoc colorColumnContainsRGB */
\see see colorColumnContainsRGB for details */
bool getColorColumnContainsRGB() const; bool getColorColumnContainsRGB() const;
/*! \copydoc gridModeForSymbolSize /*! \copydoc gridModeForSymbolSize */
\see see gridModeForSymbolSize for details */
void setGridModeForSymbolSize(bool __value); void setGridModeForSymbolSize(bool __value);
/*! \copydoc gridModeForSymbolSize /*! \copydoc gridModeForSymbolSize */
\see see gridModeForSymbolSize for details */
bool getGridModeForSymbolSize() const; bool getGridModeForSymbolSize() const;
/*! \copydoc gridDeltaX /*! \copydoc gridDeltaX */
\see see gridDeltaX for details */
void setGridDeltaX(double __value); void setGridDeltaX(double __value);
/*! \copydoc gridDeltaX /*! \copydoc gridDeltaX */
\see see gridDeltaX for details */
double getGridDeltaX() const; double getGridDeltaX() const;
/*! \copydoc gridDeltaY /*! \copydoc gridDeltaY */
\see see gridDeltaY for details */
void setGridDeltaY(double __value); void setGridDeltaY(double __value);
/*! \copydoc gridDeltaY /*! \copydoc gridDeltaY */
\see see gridDeltaY for details */
double getGridDeltaY() const; double getGridDeltaY() const;
/*! \copydoc gridSymbolFractionSize /*! \copydoc gridSymbolFractionSize */
\see see gridSymbolFractionSize for details */
void setGridSymbolFractionSize(double __value); void setGridSymbolFractionSize(double __value);
/*! \copydoc gridSymbolFractionSize /*! \copydoc gridSymbolFractionSize */
\see see gridSymbolFractionSize for details */
double getGridSymbolFractionSize() const; double getGridSymbolFractionSize() const;
/*! \copydoc symbolFillDerivationMode /*! \copydoc symbolFillDerivationMode */
\see see symbolFillDerivationMode for details */
JKQTPColorDerivationMode getSymbolFillDerivationMode() const; JKQTPColorDerivationMode getSymbolFillDerivationMode() const;
/*! \copydoc symbolFillDerivationMode /*! \copydoc symbolFillDerivationMode */
\see see symbolFillDerivationMode for details */
void setSymbolFillDerivationMode(JKQTPColorDerivationMode m); void setSymbolFillDerivationMode(JKQTPColorDerivationMode m);
/** \copydoc JKQTPGraph::setParent() */ /** \copydoc JKQTPGraph::setParent() */

View File

@ -84,27 +84,21 @@ class JKQTP_LIB_EXPORT JKQTPSingleColumnSymbolsGraph: public JKQTPSingleColumnGr
/** \brief set symbol color and fill color at the same time */ /** \brief set symbol color and fill color at the same time */
void setColor(QColor col); void setColor(QColor col);
/*! \copydoc position /*! \copydoc position */
\see see position for details */
void setPosition(double __value); void setPosition(double __value);
/*! \copydoc position /*! \copydoc position */
\see see position for details */
double getPosition() const; double getPosition() const;
/*! \copydoc width /*! \copydoc width */
\see see width for details */
void setWidth(double __value); void setWidth(double __value);
/*! \copydoc width /*! \copydoc width */
\see see width for details */
double getWidth() const; double getWidth() const;
/*! \copydoc positionScatterStyle /*! \copydoc positionScatterStyle */
\see see positionScatterStyle for details */
void setPositionScatterStyle(ScatterStyle __value); void setPositionScatterStyle(ScatterStyle __value);
/*! \copydoc positionScatterStyle /*! \copydoc positionScatterStyle */
\see see positionScatterStyle for details */
ScatterStyle getPositionScatterStyle() const; ScatterStyle getPositionScatterStyle() const;

View File

@ -19,12 +19,9 @@ Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>)
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "jkqtplottertools/jkqtpdrawingtools.h" #include "jkqtplottertools/jkqtpdrawingtools.h"
#include "jkqtplottertools/jkqtpenhancedpainter.h" #include "jkqtplottertools/jkqtpenhancedpainter.h"
#include <QDebug>
const double JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH= 0.02; const double JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH= 0.02;
@ -664,3 +661,116 @@ void JKQTPDrawTooltip(JKQTPEnhancedPainter &painter, double x, double y, const Q
painter.drawRect(rect); painter.drawRect(rect);
} }
} }
QVector<QPolygonF> JKQTPUnifyLinesToPolygons(const QVector<QLineF> &lines, double distanceThreshold, int searchMaxSurroundingElements)
{
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaat(QString("JKQTPUnifyLinesToPolygons(%1, %2, %3)").arg(lines.size()).arg(distanceThreshold).arg(searchMaxSurroundingElements));
#endif
QList<QPolygonF> res;
res.reserve(lines.size());
// first simply convert all lines to polygons
for (const QLineF& l: lines) {
QPolygonF p;
p<<l.p1()<<l.p2();
res<<p;
}
//return res.toVector();
// clean the resulting polygon
for (QPolygonF& p: res) {
p=JKQTPCleanPolygon(p, distanceThreshold);
}
int maxIterations=100;
int iter=0;
bool found=true;
//qDebug()<<" iter "<<-1<<" -> polygons start "<<res.size();
while (found && iter<maxIterations) {
found=false;
int i=0;
while (i<res.size()-1) {
int j=i+1;
while (j<res.size() && j<i+searchMaxSurroundingElements) {
if (jkqtp_distance(res[i].first(),res[j].first())<=distanceThreshold) {
found=true;
for (int k=1; k<res[j].size(); k++) {
res[i].prepend(res[j].at(k));
}
res.removeAt(j);
} else if (jkqtp_distance(res[i].first(),res[j].last())<=distanceThreshold) {
found=true;
for (int k=res[j].size()-2; k>=0; k--) {
res[i].prepend(res[j].at(k));
}
res.removeAt(j);
} else if (jkqtp_distance(res[i].last(),res[j].first())<=distanceThreshold) {
found=true;
for (int k=1; k<res[j].size(); k++) {
res[i].append(res[j].at(k));
}
res.removeAt(j);
} else if (jkqtp_distance(res[i].last(),res[j].last())<=distanceThreshold) {
found=true;
for (int k=res[j].size()-2; k>=0; k--) {
res[i].append(res[j].at(k));
}
res.removeAt(j);
} else {
j++;
}
}
res[i]=JKQTPCleanPolygon(res[i], distanceThreshold);
i++;
}
//qDebug()<<" iter "<<iter<<" -> polygons left "<<res.size();
iter++;
}
return res.toVector();
}
QPolygonF JKQTPCleanPolygon(const QPolygonF &poly, double distanceThreshold)
{
if (poly.size()<=2) return poly;
QPolygonF p;
QPointF p0=poly[0];
p<<p0;
QVector<QPointF> inbetween;
int i=1;
while (i<poly.size()) {
if ((jkqtp_distance(poly[i], p0)<=distanceThreshold)) {
inbetween<<poly[i];
} else {
QPointF pmean(0,0);
if (inbetween.size()>0) {
for (const QPointF& pi: inbetween) {
pmean=QPointF(pmean.x()+pi.x()/static_cast<double>(inbetween.size()), pmean.y()+pi.y()/static_cast<double>(inbetween.size()));
}
} else {
pmean=poly[i];
}
p<<pmean;
p0=pmean;
inbetween.clear();
}
i++;
}
// maybe we have something left to add
QPointF pmean(0,0);
if (inbetween.size()>0) {
for (const QPointF& pi: inbetween) {
pmean=QPointF(pmean.x()+pi.x()/static_cast<double>(inbetween.size()), pmean.y()+pi.y()/static_cast<double>(inbetween.size()));
}
} else {
pmean=p0;
}
if (jkqtp_distance(pmean, poly.last())>distanceThreshold) {
p<<pmean<<poly.last();
} else {
if (p.last()!=poly.last()) p<<poly.last();
}
return p;
}

View File

@ -112,4 +112,25 @@ JKQTP_LIB_EXPORT QVector<QPointF> JKQTPDrawEllipse(double x, double y, double a,
JKQTP_LIB_EXPORT void JKQTPDrawTooltip(JKQTPEnhancedPainter& painter, double x, double y, const QRectF& rect); JKQTP_LIB_EXPORT void JKQTPDrawTooltip(JKQTPEnhancedPainter& painter, double x, double y, const QRectF& rect);
/** \brief cleans a polygon by uniting all consecutive points that were closer than distanceThreshold are united
* \ingroup jkqtptools_drawing
*
* \param poly polygon to clean
* \param distanceThreshold if two end-points are closer together as this value, they are united to a single point
* \return a cleaned polygon, where all consecutive points that were closer than distanceThreshold are united
*/
JKQTP_LIB_EXPORT QPolygonF JKQTPCleanPolygon(const QPolygonF& poly, double distanceThreshold=0.3);
/** \brief takes a list of QLineF objesct \a lines and tries to combine as many of them as possible to QPolygonF objects.
* <b>Note: This method implements an incomplete algorithm with \a searchMaxSurroundingElements>0, as solving
* the complete problem is very time-consuming (cubic runtime)
* \ingroup jkqtptools_drawing
*
* \param lines line segments to unify
* \param distanceThreshold if two end-points are closer together as this value, they are united to a single point
* \param searchMaxSurroundingElements limits the search for a connected polygon to at most this number of neighbors
* \return a vector of QPolygonF objects, which contain longer line-segments formed from \a lines
*/
JKQTP_LIB_EXPORT QVector<QPolygonF> JKQTPUnifyLinesToPolygons(const QVector<QLineF>& lines, double distanceThreshold=0.3, int searchMaxSurroundingElements=10);
#endif // JKQTPDRAWINGTOOLS_H_INCLUDED #endif // JKQTPDRAWINGTOOLS_H_INCLUDED

View File

@ -925,292 +925,208 @@ class JKQTP_LIB_EXPORT JKQTPColorPaletteTools {
public: public:
/*! \brief sets the property palette ( \copybrief palette ) to the specified \a __value. /*! \copydoc palette */
\details Description of the parameter palette is: <BLOCKQUOTE>\copydoc palette </BLOCKQUOTE>
\see palette for more information */
inline virtual void setPalette(const JKQTPMathImageColorPalette & __value) inline virtual void setPalette(const JKQTPMathImageColorPalette & __value)
{ {
this->palette = __value; this->palette = __value;
} }
/*! \brief returns the property palette ( \copybrief palette ). /*! \copydoc palette */
\details Description of the parameter palette is: <BLOCKQUOTE>\copydoc palette </BLOCKQUOTE>
\see palette for more information */
inline virtual JKQTPMathImageColorPalette getPalette() const inline virtual JKQTPMathImageColorPalette getPalette() const
{ {
return this->palette; return this->palette;
} }
/*! \brief sets the property rangeMinFailAction ( \copybrief rangeMinFailAction ) to the specified \a __value. /*! \copydoc rangeMinFailAction */
\details Description of the parameter rangeMinFailAction is: <BLOCKQUOTE>\copydoc rangeMinFailAction </BLOCKQUOTE>
\see rangeMinFailAction for more information */
inline virtual void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value) inline virtual void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value)
{ {
this->rangeMinFailAction = __value; this->rangeMinFailAction = __value;
} }
/*! \brief returns the property rangeMinFailAction ( \copybrief rangeMinFailAction ). /*! \copydoc rangeMinFailAction */
\details Description of the parameter rangeMinFailAction is: <BLOCKQUOTE>\copydoc rangeMinFailAction </BLOCKQUOTE>
\see rangeMinFailAction for more information */
inline virtual JKQTPMathImageColorRangeFailAction getActionRangeMinFail() const inline virtual JKQTPMathImageColorRangeFailAction getActionRangeMinFail() const
{ {
return this->rangeMinFailAction; return this->rangeMinFailAction;
} }
/*! \brief sets the property rangeMaxFailAction ( \copybrief rangeMaxFailAction ) to the specified \a __value. /*! \copydoc rangeMaxFailAction */
\details Description of the parameter rangeMaxFailAction is: <BLOCKQUOTE>\copydoc rangeMaxFailAction </BLOCKQUOTE>
\see rangeMaxFailAction for more information */
inline virtual void setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value) inline virtual void setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value)
{ {
this->rangeMaxFailAction = __value; this->rangeMaxFailAction = __value;
} }
/*! \brief returns the property rangeMaxFailAction ( \copybrief rangeMaxFailAction ). /*! \copydoc rangeMaxFailAction */
\details Description of the parameter rangeMaxFailAction is: <BLOCKQUOTE>\copydoc rangeMaxFailAction </BLOCKQUOTE>
\see rangeMaxFailAction for more information */
inline virtual JKQTPMathImageColorRangeFailAction getActionRangeMaxFail() const inline virtual JKQTPMathImageColorRangeFailAction getActionRangeMaxFail() const
{ {
return this->rangeMaxFailAction; return this->rangeMaxFailAction;
} }
/*! \brief sets the property rangeMinFailColor ( \copybrief rangeMinFailColor ) to the specified \a __value. /*! \copydoc rangeMinFailColor */
\details Description of the parameter rangeMinFailColor is: <BLOCKQUOTE>\copydoc rangeMinFailColor </BLOCKQUOTE>
\see rangeMinFailColor for more information */
inline virtual void setRangeMinFailColor(const QColor & __value) inline virtual void setRangeMinFailColor(const QColor & __value)
{ {
this->rangeMinFailColor = __value; this->rangeMinFailColor = __value;
} }
/*! \brief returns the property rangeMinFailColor ( \copybrief rangeMinFailColor ). /*! \copydoc rangeMinFailColor */
\details Description of the parameter rangeMinFailColor is: <BLOCKQUOTE>\copydoc rangeMinFailColor </BLOCKQUOTE>
\see rangeMinFailColor for more information */
inline virtual QColor getRangeMinFailColor() const inline virtual QColor getRangeMinFailColor() const
{ {
return this->rangeMinFailColor; return this->rangeMinFailColor;
} }
/*! \brief sets the property rangeMaxFailColor ( \copybrief rangeMaxFailColor ) to the specified \a __value. /*! \copydoc rangeMaxFailColor */
\details Description of the parameter rangeMaxFailColor is: <BLOCKQUOTE>\copydoc rangeMaxFailColor </BLOCKQUOTE>
\see rangeMaxFailColor for more information */
inline virtual void setRangeMaxFailColor(const QColor & __value) inline virtual void setRangeMaxFailColor(const QColor & __value)
{ {
this->rangeMaxFailColor = __value; this->rangeMaxFailColor = __value;
} }
/*! \brief returns the property rangeMaxFailColor ( \copybrief rangeMaxFailColor ). /*! \copydoc rangeMaxFailColor */
\details Description of the parameter rangeMaxFailColor is: <BLOCKQUOTE>\copydoc rangeMaxFailColor </BLOCKQUOTE>
\see rangeMaxFailColor for more information */
inline virtual QColor getRangeMaxFailColor() const inline virtual QColor getRangeMaxFailColor() const
{ {
return this->rangeMaxFailColor; return this->rangeMaxFailColor;
} }
/*! \brief sets the property nanColor ( \copybrief nanColor ) to the specified \a __value. /*! \copydoc nanColor */
\details Description of the parameter nanColor is: <BLOCKQUOTE>\copydoc nanColor </BLOCKQUOTE>
\see nanColor for more information */
inline virtual void setNanColor(const QColor & __value) inline virtual void setNanColor(const QColor & __value)
{ {
this->nanColor = __value; this->nanColor = __value;
} }
/*! \brief returns the property nanColor ( \copybrief nanColor ). /*! \copydoc nanColor */
\details Description of the parameter nanColor is: <BLOCKQUOTE>\copydoc nanColor </BLOCKQUOTE>
\see nanColor for more information */
inline virtual QColor getNanColor() const inline virtual QColor getNanColor() const
{ {
return this->nanColor; return this->nanColor;
} }
/*! \brief sets the property infColor ( \copybrief infColor ) to the specified \a __value. /*! \copydoc infColor */
\details Description of the parameter infColor is: <BLOCKQUOTE>\copydoc infColor </BLOCKQUOTE>
\see infColor for more information */
inline virtual void setInfColor(const QColor & __value) inline virtual void setInfColor(const QColor & __value)
{ {
this->infColor = __value; this->infColor = __value;
} }
/*! \brief returns the property infColor ( \copybrief infColor ). /*! \copydoc infColor */
\details Description of the parameter infColor is: <BLOCKQUOTE>\copydoc infColor </BLOCKQUOTE>
\see infColor for more information */
inline virtual QColor getInfColor() const inline virtual QColor getInfColor() const
{ {
return this->infColor; return this->infColor;
} }
/*! \brief sets the property showColorBar ( \copybrief showColorBar ) to the specified \a __value. /*! \copydoc showColorBar */
\details Description of the parameter showColorBar is: <BLOCKQUOTE>\copydoc showColorBar </BLOCKQUOTE>
\see showColorBar for more information */
inline virtual void setShowColorBar(bool __value) inline virtual void setShowColorBar(bool __value)
{ {
this->showColorBar = __value; this->showColorBar = __value;
} }
/*! \brief returns the property showColorBar ( \copybrief showColorBar ). /*! \copydoc showColorBar */
\details Description of the parameter showColorBar is: <BLOCKQUOTE>\copydoc showColorBar </BLOCKQUOTE>
\see showColorBar for more information */
inline virtual bool getShowColorBar() const inline virtual bool getShowColorBar() const
{ {
return this->showColorBar; return this->showColorBar;
} }
/*! \brief sets the property colorBarWidth ( \copybrief colorBarWidth ) to the specified \a __value. /*! \copydoc colorBarWidth */
\details Description of the parameter colorBarWidth is: <BLOCKQUOTE>\copydoc colorBarWidth </BLOCKQUOTE>
\see colorBarWidth for more information */
inline virtual void setColorBarWidth(int __value) inline virtual void setColorBarWidth(int __value)
{ {
this->colorBarWidth = __value; this->colorBarWidth = __value;
} }
/*! \brief returns the property colorBarWidth ( \copybrief colorBarWidth ). /*! \copydoc colorBarWidth */
\details Description of the parameter colorBarWidth is: <BLOCKQUOTE>\copydoc colorBarWidth </BLOCKQUOTE>
\see colorBarWidth for more information */
inline virtual int getColorBarWidth() const inline virtual int getColorBarWidth() const
{ {
return this->colorBarWidth; return this->colorBarWidth;
} }
/*! \brief sets the property colorBarOffset ( \copybrief colorBarOffset ) to the specified \a __value. /*! \copydoc colorBarOffset */
\details Description of the parameter colorBarOffset is: <BLOCKQUOTE>\copydoc colorBarOffset </BLOCKQUOTE>
\see colorBarOffset for more information */
inline virtual void setColorBarOffset(int __value) inline virtual void setColorBarOffset(int __value)
{ {
this->colorBarOffset = __value; this->colorBarOffset = __value;
} }
/*! \brief returns the property colorBarOffset ( \copybrief colorBarOffset ). /*! \copydoc colorBarOffset */
\details Description of the parameter colorBarOffset is: <BLOCKQUOTE>\copydoc colorBarOffset </BLOCKQUOTE>
\see colorBarOffset for more information */
inline virtual int getColorBarOffset() const inline virtual int getColorBarOffset() const
{ {
return this->colorBarOffset; return this->colorBarOffset;
} }
/*! \brief sets the property colorBarRelativeHeight ( \copybrief colorBarRelativeHeight ) to the specified \a __value. /*! \copydoc colorBarRelativeHeight */
\details Description of the parameter colorBarRelativeHeight is: <BLOCKQUOTE>\copydoc colorBarRelativeHeight </BLOCKQUOTE>
\see colorBarRelativeHeight for more information */
inline virtual void setColorBarRelativeHeight(double __value) inline virtual void setColorBarRelativeHeight(double __value)
{ {
this->colorBarRelativeHeight = __value; this->colorBarRelativeHeight = __value;
} }
/*! \brief returns the property colorBarRelativeHeight ( \copybrief colorBarRelativeHeight ). /*! \copydoc colorBarRelativeHeight */
\details Description of the parameter colorBarRelativeHeight is: <BLOCKQUOTE>\copydoc colorBarRelativeHeight </BLOCKQUOTE>
\see colorBarRelativeHeight for more information */
inline virtual double getColorBarRelativeHeight() const inline virtual double getColorBarRelativeHeight() const
{ {
return this->colorBarRelativeHeight; return this->colorBarRelativeHeight;
} }
/*! \brief sets the property imageMin ( \copybrief imageMin ) to the specified \a __value. /*! \copydoc imageMin */
\details Description of the parameter imageMin is: <BLOCKQUOTE>\copydoc imageMin </BLOCKQUOTE>
\see imageMin for more information */
inline virtual void setImageMin(double __value) inline virtual void setImageMin(double __value)
{ {
this->imageMin = __value; this->imageMin = __value;
} }
/*! \brief returns the property imageMin ( \copybrief imageMin ). /*! \copydoc imageMin */
\details Description of the parameter imageMin is: <BLOCKQUOTE>\copydoc imageMin </BLOCKQUOTE>
\see imageMin for more information */
inline virtual double getImageMin() const inline virtual double getImageMin() const
{ {
return this->imageMin; return this->imageMin;
} }
/*! \brief sets the property imageMax ( \copybrief imageMax ) to the specified \a __value. /*! \copydoc imageMax */
\details Description of the parameter imageMax is: <BLOCKQUOTE>\copydoc imageMax </BLOCKQUOTE>
\see imageMax for more information */
inline virtual void setImageMax(double __value) inline virtual void setImageMax(double __value)
{ {
this->imageMax = __value; this->imageMax = __value;
} }
/*! \brief returns the property imageMax ( \copybrief imageMax ). /*! \copydoc imageMax */
\details Description of the parameter imageMax is: <BLOCKQUOTE>\copydoc imageMax </BLOCKQUOTE>
\see imageMax for more information */
inline virtual double getImageMax() const inline virtual double getImageMax() const
{ {
return this->imageMax; return this->imageMax;
} }
/*! \brief sets the property autoImageRange ( \copybrief autoImageRange ) to the specified \a __value. /*! \copydoc autoImageRange */
\details Description of the parameter autoImageRange is: <BLOCKQUOTE>\copydoc autoImageRange </BLOCKQUOTE>
\see autoImageRange for more information */
inline virtual void setAutoImageRange(bool __value) inline virtual void setAutoImageRange(bool __value)
{ {
this->autoImageRange = __value; this->autoImageRange = __value;
} }
/*! \brief returns the property autoImageRange ( \copybrief autoImageRange ). /*! \copydoc autoImageRange */
\details Description of the parameter autoImageRange is: <BLOCKQUOTE>\copydoc autoImageRange </BLOCKQUOTE>
\see autoImageRange for more information */
inline virtual bool getAutoImageRange() const inline virtual bool getAutoImageRange() const
{ {
return this->autoImageRange; return this->autoImageRange;
} }
/*! \brief sets the property imageName ( \copybrief imageName ) to the specified \a __value. /*! \copydoc imageName */
\details Description of the parameter imageName is: <BLOCKQUOTE>\copydoc imageName </BLOCKQUOTE>
\see imageName for more information */
inline virtual void setImageName(const QString & __value) inline virtual void setImageName(const QString & __value)
{ {
this->imageName = __value; this->imageName = __value;
} }
/*! \brief returns the property imageName ( \copybrief imageName ). /*! \copydoc imageName */
\details Description of the parameter imageName is: <BLOCKQUOTE>\copydoc imageName </BLOCKQUOTE>
\see imageName for more information */
inline virtual QString getImageName() const inline virtual QString getImageName() const
{ {
return this->imageName; return this->imageName;
} }
/*! \brief sets the property imageNameFontName ( \copybrief imageNameFontName ) to the specified \a __value. /*! \copydoc imageNameFontName */
\details Description of the parameter imageNameFontName is: <BLOCKQUOTE>\copydoc imageNameFontName </BLOCKQUOTE>
\see imageNameFontName for more information */
inline virtual void setImageNameFontName(const QString & __value) inline virtual void setImageNameFontName(const QString & __value)
{ {
this->imageNameFontName = __value; this->imageNameFontName = __value;
} }
/*! \brief returns the property imageNameFontName ( \copybrief imageNameFontName ). /*! \copydoc imageNameFontName */
\details Description of the parameter imageNameFontName is: <BLOCKQUOTE>\copydoc imageNameFontName </BLOCKQUOTE>
\see imageNameFontName for more information */
inline virtual QString getImageNameFontName() const inline virtual QString getImageNameFontName() const
{ {
return this->imageNameFontName; return this->imageNameFontName;
} }
/*! \brief sets the property imageNameFontSize ( \copybrief imageNameFontSize ) to the specified \a __value. /*! \copydoc imageNameFontSize */
\details Description of the parameter imageNameFontSize is: <BLOCKQUOTE>\copydoc imageNameFontSize </BLOCKQUOTE>
\see imageNameFontSize for more information */
inline virtual void setImageNameFontSize(double __value) inline virtual void setImageNameFontSize(double __value)
{ {
this->imageNameFontSize = __value; this->imageNameFontSize = __value;
} }
/*! \brief returns the property imageNameFontSize ( \copybrief imageNameFontSize ). /*! \copydoc imageNameFontSize */
\details Description of the parameter imageNameFontSize is: <BLOCKQUOTE>\copydoc imageNameFontSize </BLOCKQUOTE>
\see imageNameFontSize for more information */
inline virtual double getImageNameFontSize() const inline virtual double getImageNameFontSize() const
{ {
return this->imageNameFontSize; return this->imageNameFontSize;
} }
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). /*! \copydoc colorBarRightAxis */
\details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>.
\see colorBarRightAxis for more information */
inline JKQTPVerticalIndependentAxis* getColorBarRightAxis() { inline JKQTPVerticalIndependentAxis* getColorBarRightAxis() {
return this->colorBarRightAxis; return this->colorBarRightAxis;
} }
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). /*! \copydoc colorBarTopAxis */
\details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>.
\see colorBarTopAxis for more information */
inline JKQTPHorizontalIndependentAxis* getColorBarTopAxis() { inline JKQTPHorizontalIndependentAxis* getColorBarTopAxis() {
return this->colorBarTopAxis; return this->colorBarTopAxis;
} }
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). /*! \copydoc colorBarRightAxis */
\details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>.
\see colorBarRightAxis for more information */
inline const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const { inline const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const {
return this->colorBarRightAxis; return this->colorBarRightAxis;
} }
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). /*! \copydoc colorBarTopAxis */
\details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>.
\see colorBarTopAxis for more information */
inline const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const { inline const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const {
return this->colorBarTopAxis; return this->colorBarTopAxis;
} }
/*! \brief sets the property colorBarTopVisible ( \copybrief colorBarTopVisible ) to the specified \a __value. /*! \copydoc colorBarTopVisible */
\details Description of the parameter colorBarTopVisible is: <BLOCKQUOTE>\copydoc colorBarTopVisible </BLOCKQUOTE>
\see colorBarTopVisible for more information */
inline virtual void setColorBarTopVisible(bool __value) inline virtual void setColorBarTopVisible(bool __value)
{ {
this->colorBarTopVisible = __value; this->colorBarTopVisible = __value;
} }
/*! \brief returns the property colorBarTopVisible ( \copybrief colorBarTopVisible ). /*! \copydoc colorBarTopVisible */
\details Description of the parameter colorBarTopVisible is: <BLOCKQUOTE>\copydoc colorBarTopVisible </BLOCKQUOTE>
\see colorBarTopVisible for more information */
inline virtual bool getColorBarTopVisible() const inline virtual bool getColorBarTopVisible() const
{ {
return this->colorBarTopVisible; return this->colorBarTopVisible;
} }
/*! \brief sets the property colorBarRightVisible ( \copybrief colorBarRightVisible ) to the specified \a __value. /*! \copydoc colorBarRightVisible */
\details Description of the parameter colorBarRightVisible is: <BLOCKQUOTE>\copydoc colorBarRightVisible </BLOCKQUOTE>
\see colorBarRightVisible for more information */
inline virtual void setColorBarRightVisible(bool __value) inline virtual void setColorBarRightVisible(bool __value)
{ {
this->colorBarRightVisible = __value; this->colorBarRightVisible = __value;
} }
/*! \brief returns the property colorBarRightVisible ( \copybrief colorBarRightVisible ). /*! \copydoc colorBarRightVisible */
\details Description of the parameter colorBarRightVisible is: <BLOCKQUOTE>\copydoc colorBarRightVisible </BLOCKQUOTE>
\see colorBarRightVisible for more information */
inline virtual bool getColorBarRightVisible() const inline virtual bool getColorBarRightVisible() const
{ {
return this->colorBarRightVisible; return this->colorBarRightVisible;

View File

@ -827,16 +827,12 @@ class JKQTPMathParser
/** \brief class destructor */ /** \brief class destructor */
virtual ~JKQTPMathParser(); virtual ~JKQTPMathParser();
/*! \brief sets the property data ( \copybrief data ) to the specified \a __value. /*! \copydoc data */
\details Description of the parameter data is: <BLOCKQUOTE>\copydoc data </BLOCKQUOTE>
\see data for more information */
inline virtual void setData(void* __value) inline virtual void setData(void* __value)
{ {
this->data = __value; this->data = __value;
} }
/*! \brief returns the property data ( \copybrief data ). /*! \copydoc data */
\details Description of the parameter data is: <BLOCKQUOTE>\copydoc data </BLOCKQUOTE>
\see data for more information */
inline virtual void* getData() const inline virtual void* getData() const
{ {
return this->data; return this->data;

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB