* improved class interface

* added simple example (also to documentation!)
This commit is contained in:
jkriege2 2015-08-02 13:36:54 +02:00
parent b22f7d1cb5
commit c4a217a500
24 changed files with 2356 additions and 268 deletions

86
.gitignore vendored Normal file
View File

@ -0,0 +1,86 @@
*.user
/test/build-*
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.d
*.dylib
# Qt-es
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
qrc_*.cpp
ui_*.h
Makefile*
*-build-*
# QtCreator
*.autosave
#QtCtreator Qml
*.qmlproject.user
*.qmlproject.user.*
*.Debug
*.Release
/compiledate.h
/compiler.h
*.def
.objs
.rccs
.uis
.mocs
.libs
*~#*#
.#*
.DS_Store
qrc_*.cpp
moc_*.cpp
*.save
*.layout
*.depend
*.log
object_script.*
.dep
*.lst
*.hex
*.elf
*.lst
*.lss
*.sym
*.d
Sicherungskopie_*.cdr
*.snm
*.toc
*.tps
*.t3r
*.dcu
*.~*
*.lck
*.synctex
*.tps
*.toc
*.out
*.snm
*.nav
*.aux
*.def
Thumbs.db
*.prf
*.exe

View File

@ -5,7 +5,79 @@ This software is licensed under the term of the GNU Lesser General Public Licens
(LGPL 2.1) or above. (LGPL 2.1) or above.
## Examples ## Examples
You can find usage examples for the classes in this repository in the subfolder "test". All test-projects are Qt-projects that use qmake to build. You can load them into QtCreator easily. This section assembles some simple examples of usage. You can find more (complex) examples for the classes in this repository in the subfolder "test". All test-projects are Qt-projects that use qmake to build. You can load them into QtCreator easily.
###Very simple line-graph
This project (see `./test/jkqtplotter_simpletest/`) simply creates a JKQtPlotter widget (as a new window) and adds a single line-graph (a sine-wave).
The QMake project looks like this:
```qmake
# source code for this simple demo
SOURCES = jkqtplotter_simpletest.cpp
# configure Qt
CONFIG += qt
QT += core gui svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# output executable name
TARGET = jkqtplotter_simpletest
# include JKQtPlotter source code
include(../../jkqtplotter.pri)
```
And the soruce code of the main application is:
```c++
#include <QApplication>
#include "jkqtplotter.h"
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;
JKQTPdatastore* ds=plot.getDatastore();
// 2. now we create data for a simple plot (a sine curve)
QVector<double> X, Y;
const int Ndata=100;
for (int i=0; i<Ndata; i++) {
const double x=double(i)/double(Ndata)*8.0*M_PI;
X<<x;
Y<<sin(x);
}
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
// Note: In this step the data is copied (of not specified otherwise), so you can
// reuse X and Y afterwards!
// the variables columnX and columnY will contain the internal column ID of the newly
// created columns with names "x" and "y" and the (copied) data from X and Y.
size_t columnX=ds->addCopiedColumn(X, "x");
size_t columnY=ds->addCopiedColumn(Y, "y");
// 4. create a graph in the plot, which plots the dataset X/Y:
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
graph1->set_title(QObject::tr("sine graph"));
// 5. add the graph to the plot, so it is actually displayed
plot.addGraph(graph1);
// 6. autoscale the plot so the graph is contained
plot.zoomToFit();
// show plotter and make it a decent size
plot.show();
plot.resize(600,400);
return app.exec();
}
```
The result looks like this:
![jkqtplotter_simpletest1](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1.png)
##Screenshots ##Screenshots
###Scatter Plots and Boxplots ###Scatter Plots and Boxplots

View File

@ -30,7 +30,7 @@
This file allows to export functions and classes from this directory in a dynamic/shared lib and to append the This file allows to export functions and classes from this directory in a dynamic/shared lib and to append the
correct __declspec() declaration on windows. If you want to export one, make sure you have set correct __declspec() declaration on windows. If you want to export one, make sure you have set
\code \code
#include "lib_imexport.h" #include "jkqtp_imexport.h"
class LIB_EXPORT exportedClassName { class LIB_EXPORT exportedClassName {
... ...

View File

@ -1888,7 +1888,7 @@ void JKQTPhorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
QRect rect(0,0, get_parent_plotwidth(), ascent+descent);//plotBorderLeft-30); QRect rect(0,0, get_parent_plotwidth(), ascent+descent);//plotBorderLeft-30);
painter.save(); painter.save();
painter.translate(QPointF(left, bottom+parent->pt2px(painter, tickOutsideLength+tickLabelDistance+labelDistance)+labelMax.height())); painter.translate(QPointF(left, bottom+parent->pt2px(painter, tickOutsideLength+tickLabelDistance+labelDistance)+labelMax.height()));
JKQTPEnhancedPainter::RenderHints h=painter.renderHints(); //JKQTPEnhancedPainter::RenderHints h=painter.renderHints();
//painter.drawRect(rect); //painter.drawRect(rect);
//painter.drawEllipse(-4, -4, 8, 8); //painter.drawEllipse(-4, -4, 8, 8);
switch(labelPosition) { switch(labelPosition) {
@ -1914,7 +1914,7 @@ void JKQTPhorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
QRect rect(0,0, get_parent_plotwidth(), get_parent_mathText()->getSize(painter).height());//plotBorderLeft-30); QRect rect(0,0, get_parent_plotwidth(), get_parent_mathText()->getSize(painter).height());//plotBorderLeft-30);
painter.save(); painter.save();
painter.translate(QPointF(left, top-parent->pt2px(painter, tickOutsideLength+tickLabelDistance+labelDistance)-labelMax.height()-rect.height())); painter.translate(QPointF(left, top-parent->pt2px(painter, tickOutsideLength+tickLabelDistance+labelDistance)-labelMax.height()-rect.height()));
JKQTPEnhancedPainter::RenderHints h=painter.renderHints(); //JKQTPEnhancedPainter::RenderHints h=painter.renderHints();
//painter.drawRect(rect); //painter.drawRect(rect);
//painter.drawEllipse(-4, -4, 8, 8); //painter.drawEllipse(-4, -4, 8, 8);
switch(labelPosition) { switch(labelPosition) {

View File

@ -950,7 +950,7 @@ void JKQtBasePlotter::plotSystemYAxis(JKQTPEnhancedPainter& painter) {
JKQtBasePlotter::JKQTPPen JKQtBasePlotter::getPlotStyle(int i){ JKQtBasePlotter::JKQTPPen JKQtBasePlotter::getPlotStyle(int i) const{
int colorI=-1; int colorI=-1;
int styleI=0; int styleI=0;
for (int k=0; k<=i; k++) { for (int k=0; k<=i; k++) {
@ -1581,8 +1581,8 @@ bool JKQtBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut
paintMagnification=1.0; paintMagnification=1.0;
gridPrintingCalc(); gridPrintingCalc();
double resolution=paintDevice->logicalDpiX(); //double resolution=paintDevice->logicalDpiX();
if (printer) resolution=printer->resolution(); //if (printer) resolution=printer->resolution();
printAspect=gridPrintingSize.height()/gridPrintingSize.width(); printAspect=gridPrintingSize.height()/gridPrintingSize.width();
if (printer) printPageSizeMM=printer->pageRect(QPrinter::Millimeter).size(); if (printer) printPageSizeMM=printer->pageRect(QPrinter::Millimeter).size();
@ -3560,7 +3560,7 @@ void JKQtBasePlotter::plotKeyContents(JKQTPEnhancedPainter& painter, double x, d
jkaaot.write(QString("multi-col: graph %1: %2").arg(i).arg(g->get_title())); jkaaot.write(QString("multi-col: graph %1: %2").arg(i).arg(g->get_title()));
#endif #endif
if (!g->get_title().isEmpty() && g->get_visible()) { if (!g->get_title().isEmpty() && g->get_visible()) {
QSizeF fs=getTextSizeSize(keyFont,keyFontSize*fontSizeMultiplier,g->get_title(),painter);// mt.getSize(painter); //QSizeF fs=getTextSizeSize(keyFont,keyFontSize*fontSizeMultiplier,g->get_title(),painter);// mt.getSize(painter);
double itheight=qMax(key_item_height*kfm.width('X'), key_text_height); double itheight=qMax(key_item_height*kfm.width('X'), key_text_height);
QRectF rect(xx, yy+1.5*lineWidthMultiplier, key_line_length*kfm.width('X'), itheight-3.0*lineWidthMultiplier); QRectF rect(xx, yy+1.5*lineWidthMultiplier, key_line_length*kfm.width('X'), itheight-3.0*lineWidthMultiplier);
g->drawKeyMarker(painter, rect); g->drawKeyMarker(painter, rect);

View File

@ -951,14 +951,14 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
double width() const { return m_width; } double width() const { return m_width; }
double widthF() const { return m_width; } double widthF() const { return m_width; }
QColor color() const { return m_color; } QColor color() const { return m_color; }
void setColor(QColor& col) {m_color=col; } void setColor(const QColor& col) {m_color=col; }
Qt::PenStyle style() const { return m_style; } Qt::PenStyle style() const { return m_style; }
void setStyle(Qt::PenStyle s) { m_style=s; } void setStyle(Qt::PenStyle s) { m_style=s; }
}; };
/** \brief returns a QPen object for the i-th plot style */ /** \brief returns a QPen object for the i-th plot style */
JKQTPPen getPlotStyle(int i); JKQTPPen getPlotStyle(int i) const;
/*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter
\param painter JKQTPEnhancedPainter to which the plot should be drawn \param painter JKQTPEnhancedPainter to which the plot should be drawn

View File

@ -448,6 +448,51 @@ size_t JKQTPdatastore::addCopiedColumn(const QVector<float> &data, QString name)
return addCopiedColumn(data.data(), data.size(), name); return addCopiedColumn(data.data(), data.size(), name);
} }
size_t JKQTPdatastore::addCopiedColumn(const QVector<bool> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<uint8_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<uint16_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<uint32_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<uint64_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<int8_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<int16_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<int32_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::addCopiedColumn(const QVector<int64_t> &data, QString name)
{
return addCopiedColumn(data.data(), data.size(), name);
}
size_t JKQTPdatastore::copyColumn(size_t old_column, unsigned long long start, unsigned long long stride, QString name) size_t JKQTPdatastore::copyColumn(size_t old_column, unsigned long long start, unsigned long long stride, QString name)
@ -467,6 +512,11 @@ size_t JKQTPdatastore::copyColumn(size_t old_column, unsigned long long start, u
return n; return n;
} }
size_t JKQTPdatastore::copyColumn(size_t old_column, QString name)
{
return copyColumn(old_column, 0, 1, name);
}
size_t JKQTPdatastore::addCopiedColumn(const bool *data, unsigned long long rows, QString name) { size_t JKQTPdatastore::addCopiedColumn(const bool *data, unsigned long long rows, QString name) {
double* d=(double*)calloc(rows, sizeof(double)); double* d=(double*)calloc(rows, sizeof(double));
if (data) { if (data) {
@ -612,6 +662,25 @@ size_t JKQTPdatastore::addCopiedColumnMasked(const float *data, const bool *mask
return col; return col;
} }
size_t JKQTPdatastore::addCopiedColumnMasked(const int64_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedColumnMasked(const double *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals) size_t JKQTPdatastore::addCopiedColumnMasked(const double *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{ {
double* d=(double*)calloc(rows, sizeof(double)); double* d=(double*)calloc(rows, sizeof(double));
@ -631,17 +700,319 @@ size_t JKQTPdatastore::addCopiedColumnMasked(const double *data, const bool *mas
return col; return col;
} }
size_t JKQTPdatastore::addCopiedImageAsColumn(double *data, unsigned long long width, unsigned long long height, QString name) size_t JKQTPdatastore::addCopiedColumnMasked(const uint8_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{ {
return addCopiedColumn(data, width*height, name); double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
} }
size_t JKQTPdatastore::addCopiedImageAsColumn(bool *data, unsigned long long width, unsigned long long height, QString name) size_t JKQTPdatastore::addCopiedColumnMasked(const int8_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{ {
return addCopiedColumn(data, width*height, name); double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
} }
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(double *data, unsigned long long width, unsigned long long height, QString name) size_t JKQTPdatastore::addCopiedColumnMasked(const int16_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedColumnMasked(const uint16_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedColumnMasked(const int32_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedColumnMasked(const uint32_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedColumnMasked(const uint64_t *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r];
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedColumnMasked(const bool *data, const bool *mask, unsigned long long rows, QString name, bool useIfMaskEquals)
{
double* d=(double*)calloc(rows, sizeof(double));
int rrs=0;
if (data) {
for (unsigned long long r=0; r<rows; r++) {
if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
d[rrs]=data[r]?1:0;
rrs++;
}
}
}
size_t col= addCopiedColumn(d, rrs, name);
free(d);
return col;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const double *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const float *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const bool *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x]?1:0;
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const uint64_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const int64_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const uint32_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const int32_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const uint16_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const int16_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const uint8_t *data, unsigned long long width, unsigned long long height, QString name)
{
double* temp=(double*)malloc(width*height*sizeof(double));
for (unsigned long long x=0; x<width; x++) {
for (unsigned long long y=0; y<height; y++) {
temp[x*height+y]=data[y*width+x];
}
}
size_t idx=addCopiedColumn(temp, width*height, name);
free(temp);
return idx;
}
size_t JKQTPdatastore::addCopiedImageAsColumnTranspose(const int8_t *data, unsigned long long width, unsigned long long height, QString name)
{ {
double* temp=(double*)malloc(width*height*sizeof(double)); double* temp=(double*)malloc(width*height*sizeof(double));
@ -707,7 +1078,7 @@ void JKQTPdatastore::saveCSV(QString filename, QSet<int> userColumns, QString se
// find out the decimal and the thousand separator // find out the decimal and the thousand separator
QLocale loc=QLocale::c(); QLocale loc=QLocale::c();
loc.setNumberOptions(QLocale::OmitGroupSeparator); loc.setNumberOptions(QLocale::OmitGroupSeparator);
QChar dsep=loc.decimalPoint(); //QChar dsep=loc.decimalPoint();
QFile f(filename); QFile f(filename);
if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return; if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return;
QTextStream txt(&f); QTextStream txt(&f);
@ -721,7 +1092,7 @@ void JKQTPdatastore::saveMatlab(QString filename, QSet<int> userColumns) {
// find out the decimal and the thousand separator // find out the decimal and the thousand separator
QLocale loc=QLocale::c(); QLocale loc=QLocale::c();
loc.setNumberOptions(QLocale::OmitGroupSeparator); loc.setNumberOptions(QLocale::OmitGroupSeparator);
QChar dsep=loc.decimalPoint(); //QChar dsep=loc.decimalPoint();
QFile f(filename); QFile f(filename);
if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return; if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return;
QTextStream txt(&f); QTextStream txt(&f);
@ -853,7 +1224,7 @@ void JKQTPdatastore::saveSYLK(QString filename, QSet<int> userColumns, QString f
// find out the decimal and the thousand separator // find out the decimal and the thousand separator
QLocale loc=QLocale::c(); QLocale loc=QLocale::c();
loc.setNumberOptions(QLocale::OmitGroupSeparator); loc.setNumberOptions(QLocale::OmitGroupSeparator);
QChar dsep=loc.decimalPoint(); //QChar dsep=loc.decimalPoint();
QFile f(filename); QFile f(filename);
if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return; if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return;
QTextStream txt(&f); QTextStream txt(&f);
@ -934,7 +1305,7 @@ void JKQTPdatastore::saveDIF(QString filename, QSet<int> userColumns, QString fl
// find out the decimal and the thousand separator // find out the decimal and the thousand separator
QLocale loc=QLocale::c(); QLocale loc=QLocale::c();
loc.setNumberOptions(QLocale::OmitGroupSeparator); loc.setNumberOptions(QLocale::OmitGroupSeparator);
QChar dsep=loc.decimalPoint(); //QChar dsep=loc.decimalPoint();
QFile f(filename); QFile f(filename);
if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return; if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return;
QTextStream txt(&f); QTextStream txt(&f);

View File

@ -220,6 +220,15 @@ class LIB_EXPORT JKQTPdatastore{
/** \brief add one external column to the datastore. It contains \a rows rows. This returns its logical column ID.*/ /** \brief add one external column to the datastore. It contains \a rows rows. This returns its logical column ID.*/
size_t addColumn(double* data, unsigned long long rows, QString name=QString("")); size_t addColumn(double* data, unsigned long long rows, QString name=QString(""));
/** \brief copies the given \A old_column into a new one, reading the data with the given start column and stride */
size_t copyColumn(size_t old_column, unsigned long long start, unsigned long long stride, QString name=QString(""));
/** \brief copies the given \A old_column into a new one */
size_t copyColumn(size_t old_column, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/ * afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const double* data, unsigned long long rows, QString name=QString("")); size_t addCopiedColumn(const double* data, unsigned long long rows, QString name=QString(""));
@ -242,11 +251,41 @@ class LIB_EXPORT JKQTPdatastore{
* afterwards you can delete the external arrayThis returns its logical column ID.*/ * afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<float>& data, QString name=QString("")); size_t addCopiedColumn(const QVector<float>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<bool>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<uint8_t>& data, QString name=QString(""));
/** \brief copies the given \A old_column into a new one, reading the data with the given start column and stride */ /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
size_t copyColumn(size_t old_column, unsigned long long start, unsigned long long stride, QString name=QString("")); * afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<uint16_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<uint32_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<uint64_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<int8_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<int16_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<int32_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedColumn(const QVector<int64_t>& data, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID. * afterwards you can delete the external arrayThis returns its logical column ID.
* *
@ -307,6 +346,7 @@ class LIB_EXPORT JKQTPdatastore{
* \note This function converts the input array \a data into an array of double! * \note This function converts the input array \a data into an array of double!
*/ */
size_t addCopiedColumn(const float* data, unsigned long long rows, QString name=QString("")); size_t addCopiedColumn(const float* data, unsigned long long rows, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID. * afterwards you can delete the external arrayThis returns its logical column ID.
* *
@ -314,6 +354,15 @@ class LIB_EXPORT JKQTPdatastore{
*/ */
size_t addCopiedColumnMasked(const float* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false); size_t addCopiedColumnMasked(const float* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<float>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID. * afterwards you can delete the external arrayThis returns its logical column ID.
* *
@ -321,22 +370,392 @@ class LIB_EXPORT JKQTPdatastore{
*/ */
size_t addCopiedColumnMasked(const double* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false); size_t addCopiedColumnMasked(const double* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<double>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const uint8_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<uint8_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const int8_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<int8_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const int16_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<int16_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const uint16_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<uint16_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const int32_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<int32_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const uint32_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<uint32_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const uint64_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<uint64_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const int64_t* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<int64_t>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
size_t addCopiedColumnMasked(const bool* data, const bool* mask, unsigned long long rows, QString name=QString(""), bool useIfMaskEquals=false);
/** \brief add one external column to the datastore. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.
*
* \note This function converts the input array \a data into an array of double!
*/
inline size_t addCopiedColumnMasked(const QVector<bool>& data, const QVector<bool>& mask, QString name=QString(""), bool useIfMaskEquals=false) {
return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so /** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/ * afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumn(double* data, unsigned long long width, unsigned long long height, QString name=QString("")); inline size_t addCopiedImageAsColumn(const double* data, unsigned long long width, unsigned long long height, QString name=QString("")){
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so return addCopiedColumn(data, width*height, name);
* afterwards you can delete the external arrayThis returns its logical column ID.*/ }
size_t addCopiedImageAsColumn(bool* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so /** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/ * afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(double* data, unsigned long long width, unsigned long long height, QString name=QString("")); size_t addCopiedImageAsColumnTranspose(const double* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<double>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<double>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const float* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const float* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<float>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<float>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const bool *data, unsigned long long width, unsigned long long height, QString name=QString("")) {
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const bool* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<bool>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<bool>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const uint64_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const uint64_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<uint64_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<uint64_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const int64_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const int64_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<int64_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<int64_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const uint32_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const uint32_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<uint32_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<uint32_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const int32_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const int32_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<int32_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<int32_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const uint16_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const uint16_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<uint16_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<uint16_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const int16_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const int16_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<int16_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<int16_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const uint8_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const uint8_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<uint8_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<uint8_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const int8_t* data, unsigned long long width, unsigned long long height, QString name=QString("")){
return addCopiedColumn(data, width*height, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
size_t addCopiedImageAsColumnTranspose(const int8_t* data, unsigned long long width, unsigned long long height, QString name=QString(""));
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumn(const QVector<int8_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumn(data.data(), width, data.size()/width, name);
}
/** \brief add one external column to the datastore. It contains \a width * \a height rows. The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so
* afterwards you can delete the external arrayThis returns its logical column ID.*/
inline size_t addCopiedImageAsColumnTranspose(const QVector<int8_t>& data, unsigned long long width, QString name=QString("")) {
return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name);
}
/** \brief add a column to the datastore that contains \a rows rows with increasing value starting at \a start and ending at \a end. /** \brief add a column to the datastore that contains \a rows rows with increasing value starting at \a start and ending at \a end.
* the values are equidistant between \a start end \a end */ * the values are equidistant between \a start end \a end */
size_t addLinearColumn(unsigned long long rows, double start, double end, QString name=QString("")); size_t addLinearColumn(unsigned long long rows, double start, double end, QString name=QString(""));
@ -481,7 +900,7 @@ class LIB_EXPORT JKQTPcolumn {
inline bool isValid() const { return valid; } inline bool isValid() const { return valid; }
/** \brief class destructor */ /** \brief class destructor */
virtual ~JKQTPcolumn() {}; virtual ~JKQTPcolumn() {}
JKQTPGET_SET_MACRO(QString, name) JKQTPGET_SET_MACRO(QString, name)
@ -509,7 +928,7 @@ class LIB_EXPORT JKQTPcolumn {
void setValue(unsigned long long n, double val); void setValue(unsigned long long n, double val);
/** \brief returns a pointer to the datastore item representing this column */ /** \brief returns a pointer to the datastore item representing this column */
inline JKQTPdatastoreItem* getDatastoreItem() const { return datastore->getItem(datastoreItem); }; inline JKQTPdatastoreItem* getDatastoreItem() const { return datastore->getItem(datastoreItem); }
/** \brief copy data from the given array into the column /** \brief copy data from the given array into the column
* *
@ -597,7 +1016,7 @@ class LIB_EXPORT JKQTPdatastoreItem {
return data[row*columns+column]; return data[row*columns+column];
} }
return 0; return 0;
}; }
/** \brief returns the data at the position (\a column, \a row ). The column index specifies the column inside THIS item, not the global column number. */ /** \brief returns the data at the position (\a column, \a row ). The column index specifies the column inside THIS item, not the global column number. */
@ -611,7 +1030,7 @@ class LIB_EXPORT JKQTPdatastoreItem {
return &(data[row*columns+column]); return &(data[row*columns+column]);
} }
return NULL; return NULL;
}; }
/** \brief set the data at the position (\a column, \a row ) to \a value. The column index specifies the column inside THIS item, not the global column number. */ /** \brief set the data at the position (\a column, \a row ) to \a value. The column index specifies the column inside THIS item, not the global column number. */
inline void set(size_t column, unsigned long long row, double value) { inline void set(size_t column, unsigned long long row, double value) {
if (data!=NULL) switch(dataformat) { if (data!=NULL) switch(dataformat) {
@ -625,7 +1044,7 @@ class LIB_EXPORT JKQTPdatastoreItem {
data[row*columns+column]=value; data[row*columns+column]=value;
return; return;
} }
}; }
}; };

View File

@ -26,6 +26,7 @@
#include "jkqtptools.h" #include "jkqtptools.h"
#include "jkqtpimageelements.h" #include "jkqtpimageelements.h"
#include "jkqtpbaseelements.h" #include "jkqtpbaseelements.h"
#include "jkqtplotter.h"
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz; #define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
JKQTPgraph::JKQTPgraph(JKQtBasePlotter* parent): JKQTPgraph::JKQTPgraph(JKQtBasePlotter* parent):
@ -37,6 +38,15 @@ JKQTPgraph::JKQTPgraph(JKQtBasePlotter* parent):
setParent(parent); setParent(parent);
} }
JKQTPgraph::JKQTPgraph(JKQtPlotter *parent):
QObject(parent->get_plotter())
{
datarange_end=datarange_start=-1;
title="";
visible=true;
setParent(parent->get_plotter());
}
QPointF JKQTPgraph::transform(const QPointF& x) { QPointF JKQTPgraph::transform(const QPointF& x) {
if (xAxis&&yAxis) return QPointF(xAxis->x2p(x.x()), yAxis->x2p(x.y())); if (xAxis&&yAxis) return QPointF(xAxis->x2p(x.x()), yAxis->x2p(x.y()));
return QPointF(); return QPointF();
@ -59,6 +69,11 @@ void JKQTPgraph::setParent(JKQtBasePlotter* parent) {
QObject::setParent(parent); QObject::setParent(parent);
} }
void JKQTPgraph::setParent(JKQtPlotter *parent)
{
setParent(parent->get_plotter());
}
QVector<QPointF> JKQTPgraph::transform(const QVector<QPointF>& x) { QVector<QPointF> JKQTPgraph::transform(const QVector<QPointF>& x) {
QVector<QPointF> res; QVector<QPointF> res;
for (int i=0; i<x.size(); i++) { for (int i=0; i<x.size(); i++) {
@ -157,6 +172,15 @@ JKQTPxyGraph::JKQTPxyGraph(JKQtBasePlotter* parent):
} }
JKQTPxyGraph::JKQTPxyGraph(JKQtPlotter *parent):
JKQTPgraph(parent)
{
sortData=Unsorted;
xColumn=-1;
yColumn=-1;
}
bool JKQTPxyGraph::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPxyGraph::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
bool start=true; bool start=true;
minx=0; minx=0;
@ -292,6 +316,77 @@ JKQTPsingleColumnGraph::JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt:
parentPlotStyle=-1; parentPlotStyle=-1;
} }
JKQTPsingleColumnGraph::JKQTPsingleColumnGraph(JKQtPlotter *parent):
JKQTPgraph(parent)
{
sortData=Unsorted;
dataColumn=-1;
color=QColor("red");
style=Qt::SolidLine;
lineWidth=2;
parentPlotStyle=-1;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
style=parent->getPlotStyle(parentPlotStyle).style();
}
}
JKQTPsingleColumnGraph::JKQTPsingleColumnGraph(int dataColumn, JKQtPlotter *parent):
JKQTPgraph(parent)
{
sortData=Unsorted;
this->dataColumn=dataColumn;
parentPlotStyle=-1;
color=QColor("red");
style=Qt::SolidLine;
lineWidth=2;
parentPlotStyle=-1;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
style=parent->getPlotStyle(parentPlotStyle).style();
}
}
JKQTPsingleColumnGraph::JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, double lineWidth, JKQtPlotter *parent):
JKQTPgraph(parent)
{
sortData=Unsorted;
this->dataColumn=dataColumn;
this->color=color;
this->style=style;
this->lineWidth=lineWidth;
parentPlotStyle=-1;
}
JKQTPsingleColumnGraph::JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, JKQtPlotter *parent):
JKQTPgraph(parent)
{
sortData=Unsorted;
this->dataColumn=dataColumn;
this->color=color;
this->style=style;
this->lineWidth=2.0;
parentPlotStyle=-1;
}
JKQTPsingleColumnGraph::JKQTPsingleColumnGraph(int dataColumn, QColor color, JKQtPlotter *parent):
JKQTPgraph(parent)
{
sortData=Unsorted;
this->dataColumn=dataColumn;
this->color=color;
this->style=Qt::SolidLine;
this->lineWidth=2.0;
parentPlotStyle=-1;
}
QColor JKQTPsingleColumnGraph::getKeyLabelColor() QColor JKQTPsingleColumnGraph::getKeyLabelColor()
{ {
return color; return color;
@ -401,6 +496,33 @@ JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, doub
} }
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(JKQtPlotter *parent):
JKQTPsingleColumnGraph(parent)
{
baseline=0;
yPeaks=true;
peakHeight=1;
drawBaseline=true;
}
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQtPlotter *parent):
JKQTPsingleColumnGraph(dataColumn, color, Qt::SolidLine, 2.0, parent)
{
yPeaks=true;
this->baseline=baseline;
this->peakHeight=peakHeight;
drawBaseline=true;
}
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQtPlotter *parent):
JKQTPsingleColumnGraph(dataColumn, parent)
{
yPeaks=true;
this->baseline=baseline;
this->peakHeight=peakHeight;
drawBaseline=true;
}
bool JKQTPPeakStreamGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) bool JKQTPPeakStreamGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{ {
if (yPeaks) { if (yPeaks) {
@ -682,9 +804,9 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
// x-errorpolygons // x-errorpolygons
if (/*pastFirst &&*/ (xErrorStyle==JKQTPerrorPolygons || xErrorStyle==JKQTPerrorBarsPolygons || xErrorStyle==JKQTPerrorSimpleBarsPolygons)) { if (/*pastFirst &&*/ (xErrorStyle==JKQTPerrorPolygons || xErrorStyle==JKQTPerrorBarsPolygons || xErrorStyle==JKQTPerrorSimpleBarsPolygons)) {
double xl1m=xmold; //double xl1m=xmold;
double xl1p=xpold; //double xl1p=xpold;
double yl1=yold; //double yl1=yold;
double xl2m=xAxis->x2p(xv+xrelshift*deltax-xl); double xl2m=xAxis->x2p(xv+xrelshift*deltax-xl);
double xl2p=xAxis->x2p(xv+xrelshift*deltax+xe); double xl2p=xAxis->x2p(xv+xrelshift*deltax+xe);
double yl2=y; double yl2=y;
@ -703,9 +825,9 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
// y-errorpolygons // y-errorpolygons
if (/*pastFirst &&*/ (yErrorStyle==JKQTPerrorPolygons || yErrorStyle==JKQTPerrorBarsPolygons || yErrorStyle==JKQTPerrorSimpleBarsPolygons)) { if (/*pastFirst &&*/ (yErrorStyle==JKQTPerrorPolygons || yErrorStyle==JKQTPerrorBarsPolygons || yErrorStyle==JKQTPerrorSimpleBarsPolygons)) {
double yl1m=ymold; //double yl1m=ymold;
double yl1p=ypold; //double yl1p=ypold;
double xl1=xold; //double xl1=xold;
double yl2m=yAxis->x2p(yv+yrelshift*deltay-yl); double yl2m=yAxis->x2p(yv+yrelshift*deltay-yl);
double yl2p=yAxis->x2p(yv+yrelshift*deltay+ye); double yl2p=yAxis->x2p(yv+yrelshift*deltay+ye);
double xl2=x; double xl2=x;
@ -1067,6 +1189,30 @@ double JKQTPxyGraphErrors::getYErrorL(int i, JKQTPdatastore *ds) const
JKQTPxyLineGraph::JKQTPxyLineGraph(JKQtPlotter* parent):
JKQTPxyGraph(parent)
{
sortData=JKQTPxyLineGraph::Unsorted;
drawSelectionLine=false;
selectionLineColor=Qt::transparent;
color=QColor("red");
style=Qt::SolidLine;
lineWidth=2;
parentPlotStyle=-1;
symbolSize=12;
symbolWidth=1;
symbol=JKQTPnoSymbol;
drawLine=true;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
style=parent->getPlotStyle(parentPlotStyle).style();
}
fillColor=color;
}
JKQTPxyLineGraph::JKQTPxyLineGraph(JKQtBasePlotter* parent): JKQTPxyLineGraph::JKQTPxyLineGraph(JKQtBasePlotter* parent):
JKQTPxyGraph(parent) JKQTPxyGraph(parent)
{ {
@ -1141,9 +1287,9 @@ void JKQTPxyLineGraph::draw(JKQTPEnhancedPainter& painter) {
if (imax<0) imax=0; if (imax<0) imax=0;
//qDebug()<<"JKQTPxyLineGraph::draw(): "<<3<<" imin="<<imin<<" imax="<<imax; //qDebug()<<"JKQTPxyLineGraph::draw(): "<<3<<" imin="<<imin<<" imax="<<imax;
double xold=-1; //double xold=-1;
double yold=-1; //double yold=-1;
bool first=false; //bool first=false;
//QVector<QLineF> lines; //QVector<QLineF> lines;
QPolygonF linesP; QPolygonF linesP;
intSortData(); intSortData();
@ -1173,9 +1319,9 @@ void JKQTPxyLineGraph::draw(JKQTPEnhancedPainter& painter) {
linesP<<QPointF(x,y); linesP<<QPointF(x,y);
} }
xold=x; // xold=x;
yold=y; // yold=y;
first=true; // first=true;
} }
} }
//qDebug()<<"JKQTPxyLineGraph::draw(): "<<4<<" lines="<<lines.size(); //qDebug()<<"JKQTPxyLineGraph::draw(): "<<4<<" lines="<<lines.size();
@ -1348,6 +1494,19 @@ JKQTPimpulsesHorizontalGraph::JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* pare
} }
} }
JKQTPimpulsesHorizontalGraph::JKQTPimpulsesHorizontalGraph(JKQtPlotter* parent):
JKQTPxyGraph(parent)
{
baseline=0;
color=QColor("red");
lineWidth=3;
parentPlotStyle=-1;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
color=parent->getPlotStyle(parentPlotStyle).color();
}
}
void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesHorizontalGraph::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesHorizontalGraph::draw");
@ -1383,20 +1542,20 @@ void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (imin<0) imin=0; if (imin<0) imin=0;
if (imax<0) imax=0; if (imax<0) imax=0;
double xold=-1; //double xold=-1;
double yold=-1; //double yold=-1;
double x0=xAxis->x2p(baseline); double x0=xAxis->x2p(baseline);
if (parent->getXAxis()->isLogAxis()) { if (parent->getXAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
else x0=xAxis->x2p(parent->getXAxis()->getMin()); else x0=xAxis->x2p(parent->getXAxis()->getMin());
} }
double y0=yAxis->x2p(baseline); // double y0=yAxis->x2p(baseline);
if (parent->getYAxis()->isLogAxis()) { // if (parent->getYAxis()->isLogAxis()) {
y0=yAxis->x2p(parent->getYAxis()->getMin()); // y0=yAxis->x2p(parent->getYAxis()->getMin());
if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); // if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline);
else y0=yAxis->x2p(parent->getYAxis()->getMin()); // else y0=yAxis->x2p(parent->getYAxis()->getMin());
} // }
bool first=false; //bool first=false;
QVector<QLineF> lines; QVector<QLineF> lines;
intSortData(); intSortData();
for (int iii=imin; iii<imax; iii++) { for (int iii=imin; iii<imax; iii++) {
@ -1410,9 +1569,9 @@ void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
lines.append(QLineF(x0, y, x, y)); lines.append(QLineF(x0, y, x, y));
xold=x; // xold=x;
yold=y; // yold=y;
first=true; //first=true;
} }
} }
painter.setPen(p); painter.setPen(p);
@ -1456,6 +1615,12 @@ JKQTPimpulsesVerticalGraph::JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent):
{ {
} }
JKQTPimpulsesVerticalGraph::JKQTPimpulsesVerticalGraph(JKQtPlotter *parent):
JKQTPimpulsesHorizontalGraph(parent)
{
}
void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) { void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesVerticalGraph::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesVerticalGraph::draw");
@ -1491,14 +1656,14 @@ void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
if (imin<0) imin=0; if (imin<0) imin=0;
if (imax<0) imax=0; if (imax<0) imax=0;
double xold=-1; //double xold=-1;
double yold=-1; //double yold=-1;
bool first=false; //bool first=false;
double x0=xAxis->x2p(baseline); // double x0=xAxis->x2p(baseline);
if (parent->getXAxis()->isLogAxis()) { // if (parent->getXAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); // if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
else x0=xAxis->x2p(parent->getXAxis()->getMin()); // else x0=xAxis->x2p(parent->getXAxis()->getMin());
} // }
double y0=yAxis->x2p(baseline); double y0=yAxis->x2p(baseline);
if (parent->getYAxis()->isLogAxis()) { if (parent->getYAxis()->isLogAxis()) {
y0=yAxis->x2p(parent->getYAxis()->getMin()); y0=yAxis->x2p(parent->getYAxis()->getMin());
@ -1518,9 +1683,9 @@ void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
lines.append(QLineF(x, y0, x, y)); lines.append(QLineF(x, y0, x, y));
xold=x; //xold=x;
yold=y; //yold=y;
first=true; //first=true;
} }
} }
painter.setPen(p); painter.setPen(p);
@ -1571,6 +1736,29 @@ JKQTPfilledCurveXGraph::JKQTPfilledCurveXGraph(JKQtBasePlotter* parent):
} }
} }
JKQTPfilledCurveXGraph::JKQTPfilledCurveXGraph(JKQtPlotter *parent):
JKQTPxyGraph(parent)
{
baseline=0.0;
drawSelectionLine=false;
selectionLineColor=Qt::transparent;
color=QColor("red");
fillColor=color.lighter();
style=Qt::SolidLine;
lineWidth=2;
parentPlotStyle=-1;
drawLine=true;
fillStyle=Qt::SolidPattern;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
style=parent->getPlotStyle(parentPlotStyle).style();
fillColor=color.lighter();
}
}
void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) { void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveXGraph::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveXGraph::draw");
@ -1615,12 +1803,12 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
QPainterPath pl, pf; QPainterPath pl, pf;
double xold=-1; double xold=-1;
double yold=-1; //double yold=-1;
double x0=xAxis->x2p(baseline); // double x0=xAxis->x2p(baseline);
if (parent->getXAxis()->isLogAxis()) { // if (parent->getXAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); // if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
else x0=xAxis->x2p(parent->getXAxis()->getMin()); // else x0=xAxis->x2p(parent->getXAxis()->getMin());
} // }
double y0=yAxis->x2p(baseline); double y0=yAxis->x2p(baseline);
if (parent->getYAxis()->isLogAxis()) { if (parent->getYAxis()->isLogAxis()) {
y0=yAxis->x2p(parent->getYAxis()->getMin()); y0=yAxis->x2p(parent->getYAxis()->getMin());
@ -1643,12 +1831,12 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
pf.lineTo(x, y); pf.lineTo(x, y);
if (drawLine) pl.lineTo(x, y); if (drawLine) pl.lineTo(x, y);
xold=x; xold=x;
yold=y; //yold=y;
} else if (xok&&!yok){ } else if (xok&&!yok){
pf.lineTo(x, y0); pf.lineTo(x, y0);
if (drawLine) pl.lineTo(x, y0); if (drawLine) pl.lineTo(x, y0);
xold=x; xold=x;
yold=y0; //yold=y0;
} }
} else { } else {
if (xok&&yok) { if (xok&&yok) {
@ -1656,13 +1844,13 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
pf.moveTo(x, y0); pf.moveTo(x, y0);
pf.lineTo(x, y); pf.lineTo(x, y);
xold=x; xold=x;
yold=y; //yold=y;
first=false; first=false;
} else if (xok&&!yok) { } else if (xok&&!yok) {
if (drawLine) pl.moveTo(x,y0); if (drawLine) pl.moveTo(x,y0);
pf.moveTo(x, y0); pf.moveTo(x, y0);
xold=x; xold=x;
yold=y0; //yold=y0;
first=false; first=false;
} }
} }
@ -1740,6 +1928,12 @@ JKQTPfilledCurveYGraph::JKQTPfilledCurveYGraph(JKQtBasePlotter* parent):
{ {
} }
JKQTPfilledCurveYGraph::JKQTPfilledCurveYGraph(JKQtPlotter *parent):
JKQTPfilledCurveXGraph(parent)
{
}
void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) { void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveYGraph::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveYGraph::draw");
@ -1784,7 +1978,7 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
QPainterPath pl, pf; QPainterPath pl, pf;
double xold=-1; //double xold=-1;
double yold=-1; double yold=-1;
double x0=xAxis->x2p(baseline); double x0=xAxis->x2p(baseline);
if (parent->getXAxis()->isLogAxis()) { if (parent->getXAxis()->isLogAxis()) {
@ -1812,12 +2006,12 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
if (xok&&yok) { if (xok&&yok) {
pf.lineTo(x, y); pf.lineTo(x, y);
if (drawLine) pl.lineTo(x, y); if (drawLine) pl.lineTo(x, y);
xold=x; //xold=x;
yold=y; yold=y;
} else if (!xok&&yok){ } else if (!xok&&yok){
pf.lineTo(x0, y); pf.lineTo(x0, y);
if (drawLine) pl.lineTo(x0, y); if (drawLine) pl.lineTo(x0, y);
xold=x0; //xold=x0;
yold=y; yold=y;
} }
} else { } else {
@ -1825,13 +2019,13 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
if (drawLine) pl.moveTo(x,y); if (drawLine) pl.moveTo(x,y);
pf.moveTo(x, y0); pf.moveTo(x, y0);
pf.lineTo(x, y); pf.lineTo(x, y);
xold=x; //xold=x;
yold=y; yold=y;
first=false; first=false;
} else if (!xok&&yok) { } else if (!xok&&yok) {
if (drawLine) pl.moveTo(x0,y); if (drawLine) pl.moveTo(x0,y);
pf.moveTo(x0, y); pf.moveTo(x0, y);
xold=x0; //xold=x0;
yold=y; yold=y;
first=false; first=false;
} }
@ -1907,6 +2101,37 @@ JKQTPboxplotVerticalGraph::JKQTPboxplotVerticalGraph(JKQtBasePlotter* parent):
} }
JKQTPboxplotVerticalGraph::JKQTPboxplotVerticalGraph(JKQtPlotter* parent):
JKQTPgraph(parent)
{
posColumn=-1;
medianColumn=-1;
meanColumn=-1;
minColumn=-1;
maxColumn=-1;
percentile25Column=-1;
percentile75Column=-1;
color=QColor("red");
fillColor=QColor("white");
fillStyle=Qt::SolidPattern;
whiskerStyle=Qt::SolidLine;
lineWidth=1;
boxWidth=0.4;
meanSymbol=JKQTPplus;
meanSymbolWidth=1;
meanSymbolSize=12;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
whiskerStyle=parent->getPlotStyle(parentPlotStyle).style();
}
}
void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) { void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPboxplotVerticalGraph::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPboxplotVerticalGraph::draw");
@ -1951,7 +2176,7 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
bool first=false; //bool first=false;
// 1. step find width of boxplots: // 1. step find width of boxplots:
double boxwidth_real=0; double boxwidth_real=0;
@ -2048,7 +2273,7 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
if (lines_pw.size()>0) painter.drawLines(lines_pw); if (lines_pw.size()>0) painter.drawLines(lines_pw);
painter.restore(); painter.restore();
first=true; //first=true;
} }
} }
painter.restore(); painter.restore();
@ -2425,7 +2650,7 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
// 2. plot: // 2. plot:
painter.save(); painter.save();
bool first=false; //bool first=false;
for (int i=imin; i<imax; i++) { for (int i=imin; i<imax; i++) {
double yv=datastore->get(posColumn,i); double yv=datastore->get(posColumn,i);
double p25v=datastore->get(percentile25Column,i); double p25v=datastore->get(percentile25Column,i);
@ -2499,7 +2724,7 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
plotSymbol(painter, mean, y, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->get_lineWidthMultiplier()), color, fillColor); plotSymbol(painter, mean, y, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->get_lineWidthMultiplier()), color, fillColor);
} }
first=true; //first=true;
painter.setPen(p); painter.setPen(p);
if (lines_p.size()>0) painter.drawLines(lines_p); if (lines_p.size()>0) painter.drawLines(lines_p);
painter.setPen(pw); painter.setPen(pw);
@ -2565,6 +2790,36 @@ JKQTPboxplotVerticalElement::JKQTPboxplotVerticalElement(JKQtBasePlotter* parent
} }
JKQTPboxplotVerticalElement::JKQTPboxplotVerticalElement(JKQtPlotter* parent):
JKQTPgraph(parent)
{
pos=0;
median=0;
mean=0;
min=-1;
max=1;
drawMean=true;
drawMinMax=true;
percentile25=-0.75;
percentile75=0.75;
color=QColor("red");
fillColor=QColor("white");
fillStyle=Qt::SolidPattern;
whiskerStyle=Qt::SolidLine;
lineWidth=1;
boxWidth=0.4;
meanSymbol=JKQTPplus;
meanSymbolWidth=1;
meanSymbolSize=12;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
whiskerStyle=parent->getPlotStyle(parentPlotStyle).style();
}
}
void JKQTPboxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) { void JKQTPboxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPboxplotVerticalElement::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPboxplotVerticalElement::draw");
@ -3019,6 +3274,55 @@ JKQTPxFunctionLineGraph::JKQTPxFunctionLineGraph(JKQtBasePlotter* parent):
errorFillColor.setAlphaF(0.5); errorFillColor.setAlphaF(0.5);
} }
JKQTPxFunctionLineGraph::JKQTPxFunctionLineGraph(JKQtPlotter* parent):
JKQTPgraph(parent)
{
color=QColor("red");
fillColor=color.lighter();
style=Qt::SolidLine;
lineWidth=2;
fillStyle=Qt::SolidPattern;
drawLine=true;
fillCurve=false;
plotFunction=NULL;
params=NULL;
minSamples=10;
maxRefinementDegree=7;
slopeTolerance=0.005;
minPixelPerSample=32;
plotRefinement=true;
displaySamplePoints=false;
data=NULL;
drawErrorPolygons=false;
drawErrorLines=false;
errorPlotFunction=NULL;
errorParams=NULL;
errorColor=color.lighter();
errorFillColor=color.lighter();
errorStyle=Qt::SolidLine;
errorLineWidth=1;
errorFillStyle=Qt::SolidPattern;
parameterColumn=-1;
errorParameterColumn=-1;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=color.lighter();
style=parent->getPlotStyle(parentPlotStyle).style();
errorColor=color.lighter();
errorFillColor=color.lighter();
errorStyle=style;
}
fillColor.setAlphaF(0.5);
errorFillColor.setAlphaF(0.5);
}
JKQTPxFunctionLineGraph::~JKQTPxFunctionLineGraph() { JKQTPxFunctionLineGraph::~JKQTPxFunctionLineGraph() {
clearData(); clearData();
} }
@ -3235,13 +3539,13 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
eb.setStyle(errorFillStyle); eb.setStyle(errorFillStyle);
double xold=-1; // double xold=-1;
double yold=-1; // double yold=-1;
double ypeold=-1; // double ypeold=-1;
double ymeold=-1; // double ymeold=-1;
double x0=xAxis->x2p(0); // double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin()); // if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0); double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin()); if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
bool first=false; bool first=false;
@ -3294,10 +3598,10 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
errorLineBottom<<QPointF(x, yme); errorLineBottom<<QPointF(x, yme);
} }
xold=x; // xold=x;
yold=y; // yold=y;
ypeold=ype; // ypeold=ype;
ymeold=yme; // ymeold=yme;
first=true; first=true;
} }
d=d->next; d=d->next;
@ -3425,12 +3729,11 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
double x0=xAxis->x2p(0); double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin()); if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0); // double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin()); // if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
bool first=false; bool first=false;
doublePair* d=data; doublePair* d=data;
QPainterPath pa, pfill;
QPainterPath pel, pef;
while (d!=NULL) { while (d!=NULL) {
double yv=d->x; double yv=d->x;
double xv=d->f; double xv=d->f;
@ -3600,6 +3903,29 @@ JKQTPstepHorizontalGraph::JKQTPstepHorizontalGraph(JKQtBasePlotter* parent):
} }
JKQTPstepHorizontalGraph::JKQTPstepHorizontalGraph(JKQtPlotter* parent):
JKQTPxyGraph(parent)
{
color=QColor("red");
fillColor=color.lighter();
style=Qt::SolidLine;
lineWidth=2;
fillStyle=Qt::SolidPattern;
drawLine=true;
fillCurve=true;
valuesCentered=false;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=color.lighter();
style=parent->getPlotStyle(parentPlotStyle).style();
}
}
void JKQTPstepHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { void JKQTPstepHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save(); painter.save();
QPen p=painter.pen(); QPen p=painter.pen();
@ -3670,12 +3996,12 @@ void JKQTPstepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double xold=-1; double xold=-1;
double yold=-1; double yold=-1;
double xstart=-1; // double xstart=-1;
double ystart=-1; // double ystart=-1;
double x0=xAxis->x2p(0); double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin()); if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0); // double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin()); // if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
bool subsequentItem=false; bool subsequentItem=false;
intSortData(); intSortData();
for (int iii=imin; iii<imax; iii++) { for (int iii=imin; iii<imax; iii++) {
@ -3716,8 +4042,8 @@ void JKQTPstepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (drawLine) pl.moveTo(x,y); if (drawLine) pl.moveTo(x,y);
pf.moveTo(x0, y); pf.moveTo(x0, y);
pf.lineTo(x, y); pf.lineTo(x, y);
xstart=x; //xstart=x;
ystart=y0; //ystart=y0;
} }
xold=x; xold=x;
yold=y; yold=y;
@ -3797,8 +4123,8 @@ void JKQTPstepVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double xold=-1; double xold=-1;
double yold=-1; double yold=-1;
double x0=xAxis->x2p(0); // double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin()); // if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0); double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin()); if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
bool first=false; bool first=false;
@ -3893,6 +4219,25 @@ JKQTPbarHorizontalGraph::JKQTPbarHorizontalGraph(JKQtBasePlotter* parent):
} }
JKQTPbarHorizontalGraph::JKQTPbarHorizontalGraph(JKQtPlotter* parent):
JKQTPxyGraph(parent), JKQTPxyGraphErrors()
{
baseline=0.0;
color=QColor("black");
fillColor=QColor("red");
style=Qt::SolidLine;
lineWidth=1;
fillStyle=Qt::SolidPattern;
width=0.9;
shift=0;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
fillColor=parent->getPlotStyle(parentPlotStyle).color();
}
}
void JKQTPbarHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { void JKQTPbarHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save(); painter.save();
QPen p=painter.pen(); QPen p=painter.pen();
@ -3952,8 +4297,8 @@ void JKQTPbarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (imax<0) imax=0; if (imax<0) imax=0;
painter.save(); painter.save();
double x0=xAxis->x2p(0); // double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin()); // if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0); double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin()); if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
double delta=1; double delta=1;
@ -4187,8 +4532,8 @@ void JKQTPbarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double x0=xAxis->x2p(0); double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin()); if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0); // double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin()); // if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
double delta=1; double delta=1;
double deltap=0; double deltap=0;
double deltam=0; double deltam=0;
@ -4385,6 +4730,41 @@ JKQTPhorizontalRange::JKQTPhorizontalRange(JKQtBasePlotter* parent):
fillRange=true; fillRange=true;
} }
JKQTPhorizontalRange::JKQTPhorizontalRange(JKQtPlotter* parent):
JKQTPgraph(parent)
{
color=QColor("red").darker();
fillColor=QColor("red").lighter();
style=Qt::DotLine;
lineWidth=1;
fillStyle=Qt::SolidPattern;
centerColor=QColor("red");
centerStyle=Qt::SolidLine;
centerLineWidth=2;
sizeMin=0;
sizeMax=1;
unlimitedSizeMin=true;
unlimitedSizeMax=true;
invertedRange=false;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
centerColor=parent->getPlotStyle(parentPlotStyle).color();
color=centerColor.darker();
fillColor=centerColor.lighter();
}
fillColor.setAlphaF(0.5);
rangeMin=rangeMax=0;
rangeCenter=0;
plotCenterLine=true;
plotRange=true;
plotRangeLines=true;
fillRange=true;
}
void JKQTPhorizontalRange::draw(JKQTPEnhancedPainter& painter) { void JKQTPhorizontalRange::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPhorizontalRange::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPhorizontalRange::draw");
@ -4505,6 +4885,11 @@ JKQTPverticalRange::JKQTPverticalRange(JKQtBasePlotter* parent):
{ {
} }
JKQTPverticalRange::JKQTPverticalRange(JKQtPlotter* parent):
JKQTPhorizontalRange(parent)
{
}
void JKQTPverticalRange::draw(JKQTPEnhancedPainter& painter) { void JKQTPverticalRange::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPverticalRange::draw"); JKQTPAutoOutputTimer jkaaot("JKQTPverticalRange::draw");
@ -4960,6 +5345,23 @@ JKQTPxyParametrizedScatterGraph::JKQTPxyParametrizedScatterGraph(JKQtBasePlotter
gridSymbolFractionSize=0.9; gridSymbolFractionSize=0.9;
} }
JKQTPxyParametrizedScatterGraph::JKQTPxyParametrizedScatterGraph(JKQtPlotter *parent):
JKQTPxyLineGraph(parent),
JKQTPColorPaletteTools(parent->get_plotter())
{
sizeColumn=-1;
colorColumn=-1;
symbolColumn=-1;
palette=JKQTPMathImageMATLAB;
colorColumnContainsRGB=false;
symbol=JKQTPfilledCircle;
drawLine=false;
gridModeForSymbolSize=false;
gridDeltaX=1;
gridDeltaY=1;
gridSymbolFractionSize=0.9;
}
void JKQTPxyParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter) void JKQTPxyParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
{ {
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER

View File

@ -42,6 +42,7 @@
// forward declarations // forward declarations
class JKQtBasePlotter; class JKQtBasePlotter;
class JKQtPlotter;
class JKQTPcoordinateAxis; class JKQTPcoordinateAxis;
class JKQTPdatastore; class JKQTPdatastore;
//class JKQTPColorPaletteTools; //class JKQTPColorPaletteTools;
@ -67,10 +68,12 @@ class LIB_EXPORT JKQTPgraph: public QObject {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPgraph(JKQtBasePlotter* parent=NULL); explicit JKQTPgraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
explicit JKQTPgraph(JKQtPlotter* parent);
/** \brief default wirtual destructor */ /** \brief default wirtual destructor */
virtual ~JKQTPgraph() {}; inline virtual ~JKQTPgraph() {}
/** \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)=0; virtual void draw(JKQTPEnhancedPainter& painter)=0;
@ -96,9 +99,11 @@ class LIB_EXPORT JKQTPgraph: public QObject {
JKQTPGET_SET_MACRO(bool, visible) JKQTPGET_SET_MACRO(bool, visible)
/** \brief returns the parent painter class */ /** \brief returns the parent painter class */
inline JKQtBasePlotter* getParent() { return parent; }; inline JKQtBasePlotter* getParent() { return parent; }
/** \brief sets the parent painter class */ /** \brief sets the parent painter class */
virtual void setParent(JKQtBasePlotter* parent); virtual void setParent(JKQtBasePlotter* parent);
/** \brief sets the parent painter class */
virtual void setParent(JKQtPlotter* parent);
/*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...) /*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
@ -124,13 +129,13 @@ class LIB_EXPORT JKQTPgraph: public QObject {
* By default this function does nothing. But children of this class may overwrite it to implement * By default this function does nothing. But children of this class may overwrite it to implement
* drawing error indicators. * drawing error indicators.
*/ */
virtual void drawErrorsBefore(JKQTPEnhancedPainter& /*painter*/) {}; inline virtual void drawErrorsBefore(JKQTPEnhancedPainter& /*painter*/) {}
/** \brief this function is used to plot error inidcators after plotting the graphs. /** \brief this function is used to plot error inidcators after plotting the graphs.
* *
* By default this function does nothing. But children of this class may overwrite it to implement * By default this function does nothing. But children of this class may overwrite it to implement
* drawing error indicators. * drawing error indicators.
*/ */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& /*painter*/) {}; inline virtual void drawErrorsAfter(JKQTPEnhancedPainter& /*painter*/) {}
@ -143,11 +148,11 @@ class LIB_EXPORT JKQTPgraph: public QObject {
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */ /** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
inline QPointF transform(double x, double y) { inline QPointF transform(double x, double y) {
return transform(QPointF(x,y)); return transform(QPointF(x,y));
}; }
/** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */ /** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */
inline QPointF backTransform(double x, double y) { inline QPointF backTransform(double x, double y) {
return backTransform(QPointF(x,y)); return backTransform(QPointF(x,y));
}; }
/** \brief tool routine that transforms a QVector<QPointF> according to the parent's transformation rules */ /** \brief tool routine that transforms a QVector<QPointF> according to the parent's transformation rules */
QVector<QPointF> transform(const QVector<QPointF>& x); QVector<QPointF> transform(const QVector<QPointF>& x);
@ -208,6 +213,8 @@ class LIB_EXPORT JKQTPxyGraph: public JKQTPgraph {
/** \brief class constructor */ /** \brief class constructor */
JKQTPxyGraph(JKQtBasePlotter* parent=NULL); JKQTPxyGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPxyGraph(JKQtPlotter* parent);
/** \brief get the maximum and minimum x-value of the graph /** \brief get the maximum and minimum x-value of the graph
* *
@ -267,6 +274,11 @@ class LIB_EXPORT JKQTPsingleColumnGraph: public JKQTPgraph {
JKQTPsingleColumnGraph(JKQtBasePlotter* parent=NULL); JKQTPsingleColumnGraph(JKQtBasePlotter* parent=NULL);
JKQTPsingleColumnGraph(int dataColumn, JKQtBasePlotter* parent=NULL); JKQTPsingleColumnGraph(int dataColumn, JKQtBasePlotter* parent=NULL);
JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style=Qt::SolidLine, double lineWidth=2.0, JKQtBasePlotter* parent=NULL); JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style=Qt::SolidLine, double lineWidth=2.0, JKQtBasePlotter* parent=NULL);
JKQTPsingleColumnGraph(JKQtPlotter* parent);
JKQTPsingleColumnGraph(int dataColumn, JKQtPlotter* parent);
JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, double lineWidth, JKQtPlotter* parent);
JKQTPsingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, JKQtPlotter* parent);
JKQTPsingleColumnGraph(int dataColumn, QColor color, JKQtPlotter* parent);
/** \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(); virtual QColor getKeyLabelColor();
@ -328,6 +340,9 @@ class LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPsingleColumnGraph {
JKQTPPeakStreamGraph(JKQtBasePlotter* parent=NULL); JKQTPPeakStreamGraph(JKQtBasePlotter* parent=NULL);
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQtBasePlotter* parent=NULL); JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQtBasePlotter* parent=NULL);
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQtBasePlotter* parent=NULL); JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQtBasePlotter* parent=NULL);
JKQTPPeakStreamGraph(JKQtPlotter* parent);
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQtPlotter* parent);
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQtPlotter* parent);
/** \brief get the maximum and minimum x-value of the graph /** \brief get the maximum and minimum x-value of the graph
* *
@ -446,13 +461,13 @@ class LIB_EXPORT JKQTPxGraphErrors: public JKQTPgraphErrors {
JKQTPGET_MACRO(int, xErrorColumn) JKQTPGET_MACRO(int, xErrorColumn)
JKQTPGET_SET_MACRO(JKQTPerrorPlotstyle, xErrorStyle) JKQTPGET_SET_MACRO(JKQTPerrorPlotstyle, xErrorStyle)
void set_xErrorColumn(int __value) { inline void set_xErrorColumn(int __value) {
if (this->xErrorColumn != __value) { \ if (this->xErrorColumn != __value) { \
this->xErrorColumn = __value; \ this->xErrorColumn = __value; \
if (xErrorColumn>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \ if (xErrorColumn>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \
} \ } \
} }
void set_xErrorColumnLower(int __value) { inline void set_xErrorColumnLower(int __value) {
if (this->xErrorColumnLower != __value) { \ if (this->xErrorColumnLower != __value) { \
this->xErrorColumnLower = __value; \ this->xErrorColumnLower = __value; \
if (xErrorColumnLower>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \ if (xErrorColumnLower>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \
@ -499,13 +514,13 @@ class LIB_EXPORT JKQTPyGraphErrors: public JKQTPgraphErrors {
/** \copydoc JKQTPgraphErrors::errorUsesColumn() */ /** \copydoc JKQTPgraphErrors::errorUsesColumn() */
virtual bool errorUsesColumn(int c); virtual bool errorUsesColumn(int c);
void set_yErrorColumn(int __value) { inline void set_yErrorColumn(int __value) {
if (this->yErrorColumn != __value) { \ if (this->yErrorColumn != __value) { \
this->yErrorColumn = __value; \ this->yErrorColumn = __value; \
if (yErrorColumn>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \ if (yErrorColumn>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \
} \ } \
} }
void set_yErrorColumnLower(int __value) { inline void set_yErrorColumnLower(int __value) {
if (this->yErrorColumnLower != __value) { \ if (this->yErrorColumnLower != __value) { \
this->yErrorColumnLower = __value; \ this->yErrorColumnLower = __value; \
if (yErrorColumnLower>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \ if (yErrorColumnLower>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \
@ -550,25 +565,25 @@ class LIB_EXPORT JKQTPxyGraphErrors: public JKQTPgraphErrors {
/** \copydoc JKQTPgraphErrors::errorUsesColumn() */ /** \copydoc JKQTPgraphErrors::errorUsesColumn() */
virtual bool errorUsesColumn(int c); virtual bool errorUsesColumn(int c);
void set_xErrorColumn(int __value) { inline void set_xErrorColumn(int __value) {
if (this->xErrorColumn != __value) { \ if (this->xErrorColumn != __value) { \
this->xErrorColumn = __value; \ this->xErrorColumn = __value; \
if (xErrorColumn>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \ if (xErrorColumn>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \
} \ } \
} }
void set_xErrorColumnLower(int __value) { inline void set_xErrorColumnLower(int __value) {
if (this->xErrorColumnLower != __value) { \ if (this->xErrorColumnLower != __value) { \
this->xErrorColumnLower = __value; \ this->xErrorColumnLower = __value; \
if (xErrorColumnLower>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \ if (xErrorColumnLower>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \
} \ } \
} }
void set_yErrorColumn(int __value) { inline void set_yErrorColumn(int __value) {
if (this->yErrorColumn != __value) { \ if (this->yErrorColumn != __value) { \
this->yErrorColumn = __value; \ this->yErrorColumn = __value; \
if (yErrorColumn>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \ if (yErrorColumn>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \
} \ } \
} }
void set_yErrorColumnLower(int __value) { inline void set_yErrorColumnLower(int __value) {
if (this->yErrorColumnLower != __value) { \ if (this->yErrorColumnLower != __value) { \
this->yErrorColumnLower = __value; \ this->yErrorColumnLower = __value; \
if (yErrorColumnLower>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \ if (yErrorColumnLower>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \
@ -617,6 +632,8 @@ class LIB_EXPORT JKQTPxyLineGraph: public JKQTPxyGraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPxyLineGraph(JKQtBasePlotter* parent=NULL); JKQTPxyLineGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPxyLineGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -689,6 +706,8 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPxyParametrizedScatterGraph(JKQtBasePlotter* parent=NULL); JKQTPxyParametrizedScatterGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPxyParametrizedScatterGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -700,10 +719,10 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi
JKQTPGET_SET_MACRO(int, colorColumn) JKQTPGET_SET_MACRO(int, colorColumn)
JKQTPGET_SET_MACRO(int, symbolColumn) JKQTPGET_SET_MACRO(int, symbolColumn)
JKQTPGET_SET_MACRO(bool, colorColumnContainsRGB) JKQTPGET_SET_MACRO(bool, colorColumnContainsRGB)
JKQTPGET_SET_MACRO(bool, gridModeForSymbolSize); JKQTPGET_SET_MACRO(bool, gridModeForSymbolSize)
JKQTPGET_SET_MACRO(double, gridDeltaX); JKQTPGET_SET_MACRO(double, gridDeltaX)
JKQTPGET_SET_MACRO(double, gridDeltaY); JKQTPGET_SET_MACRO(double, gridDeltaY)
JKQTPGET_SET_MACRO(double, gridSymbolFractionSize); JKQTPGET_SET_MACRO(double, gridSymbolFractionSize)
virtual void setParent(JKQtBasePlotter* parent); virtual void setParent(JKQtBasePlotter* parent);
@ -777,9 +796,13 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPxyLineErrorGraph(JKQtBasePlotter* parent=NULL): inline JKQTPxyLineErrorGraph(JKQtBasePlotter* parent=NULL):
JKQTPxyLineGraph(parent), JKQTPxyGraphErrors() JKQTPxyLineGraph(parent), JKQTPxyGraphErrors()
{ }; { }
/** \brief class constructor */
inline JKQTPxyLineErrorGraph(JKQtPlotter* parent=NULL):
JKQTPxyLineGraph(parent), JKQTPxyGraphErrors()
{ }
/** \brief get the maximum and minimum x-value of the graph /** \brief get the maximum and minimum x-value of the graph
* *
@ -796,7 +819,7 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG
protected: protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */ /** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) { inline virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) {
intSortData(); intSortData();
if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
@ -813,7 +836,10 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG
class LIB_EXPORT JKQTPxyParametrizedErrorScatterGraph: public JKQTPxyParametrizedScatterGraph, public JKQTPxyGraphErrors { class LIB_EXPORT JKQTPxyParametrizedErrorScatterGraph: public JKQTPxyParametrizedScatterGraph, public JKQTPxyGraphErrors {
Q_OBJECT Q_OBJECT
public: public:
JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter* parent=NULL): inline JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter* parent=NULL):
JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors()
{ }
inline JKQTPxyParametrizedErrorScatterGraph(JKQtPlotter* parent=NULL):
JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors() JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors()
{ } { }
@ -833,11 +859,11 @@ class LIB_EXPORT JKQTPxyParametrizedErrorScatterGraph: public JKQTPxyParametrize
protected: protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */ /** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) { inline virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) {
intSortData(); intSortData();
if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}; }
/** \brief this function can be used to set the color of the error indicators automatically /** \brief this function can be used to set the color of the error indicators automatically
* *
@ -857,6 +883,8 @@ class LIB_EXPORT JKQTPimpulsesHorizontalGraph: public JKQTPxyGraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent=NULL); JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPimpulsesHorizontalGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -895,7 +923,11 @@ class LIB_EXPORT JKQTPimpulsesHorizontalErrorGraph: public JKQTPimpulsesHorizont
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=NULL): inline JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=NULL):
JKQTPimpulsesHorizontalGraph(parent), JKQTPxGraphErrors()
{
}
inline JKQTPimpulsesHorizontalErrorGraph(JKQtPlotter* parent=NULL):
JKQTPimpulsesHorizontalGraph(parent), JKQTPxGraphErrors() JKQTPimpulsesHorizontalGraph(parent), JKQTPxGraphErrors()
{ {
} }
@ -904,12 +936,12 @@ class LIB_EXPORT JKQTPimpulsesHorizontalErrorGraph: public JKQTPimpulsesHorizont
protected: protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */ /** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) { inline virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) {
if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
//plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); //plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
}; }
}; };
@ -926,6 +958,8 @@ class LIB_EXPORT JKQTPimpulsesVerticalGraph: public JKQTPimpulsesHorizontalGraph
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent=NULL); JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPimpulsesVerticalGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -942,7 +976,12 @@ class LIB_EXPORT JKQTPimpulsesVerticalErrorGraph: public JKQTPimpulsesVerticalGr
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter* parent=NULL): inline JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter* parent=NULL):
JKQTPimpulsesVerticalGraph(parent), JKQTPyGraphErrors()
{
}
/** \brief class constructor */
inline JKQTPimpulsesVerticalErrorGraph(JKQtPlotter* parent=NULL):
JKQTPimpulsesVerticalGraph(parent), JKQTPyGraphErrors() JKQTPimpulsesVerticalGraph(parent), JKQTPyGraphErrors()
{ {
} }
@ -951,12 +990,12 @@ class LIB_EXPORT JKQTPimpulsesVerticalErrorGraph: public JKQTPimpulsesVerticalGr
protected: protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */ /** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) { inline virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) {
if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
//plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); //plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
}; }
}; };
@ -976,6 +1015,8 @@ class LIB_EXPORT JKQTPfilledCurveXGraph: public JKQTPxyGraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPfilledCurveXGraph(JKQtBasePlotter* parent=NULL); JKQTPfilledCurveXGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPfilledCurveXGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -1035,7 +1076,12 @@ class LIB_EXPORT JKQTPfilledCurveXErrorGraph: public JKQTPfilledCurveXGraph, pub
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPfilledCurveXErrorGraph(JKQtBasePlotter* parent=NULL): inline JKQTPfilledCurveXErrorGraph(JKQtBasePlotter* parent=NULL):
JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors()
{
}
/** \brief class constructor */
inline JKQTPfilledCurveXErrorGraph(JKQtPlotter* parent=NULL):
JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors() JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors()
{ {
} }
@ -1068,6 +1114,8 @@ class LIB_EXPORT JKQTPfilledCurveYGraph: public JKQTPfilledCurveXGraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPfilledCurveYGraph(JKQtBasePlotter* parent=NULL); JKQTPfilledCurveYGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPfilledCurveYGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -1084,7 +1132,11 @@ class LIB_EXPORT JKQTPfilledCurveYErrorGraph: public JKQTPfilledCurveYGraph, pub
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=NULL): inline JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=NULL):
JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors()
{
}
inline JKQTPfilledCurveYErrorGraph(JKQtPlotter* parent=NULL):
JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors() JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors()
{ {
} }
@ -1093,12 +1145,12 @@ class LIB_EXPORT JKQTPfilledCurveYErrorGraph: public JKQTPfilledCurveYGraph, pub
protected: protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */ /** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) { inline virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) {
//plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); //plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}; }
}; };
@ -1126,6 +1178,8 @@ class LIB_EXPORT JKQTPboxplotVerticalGraph: public JKQTPgraph {
/** \brief class constructor */ /** \brief class constructor */
JKQTPboxplotVerticalGraph(JKQtBasePlotter* parent=NULL); JKQTPboxplotVerticalGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPboxplotVerticalGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -1238,10 +1292,14 @@ class LIB_EXPORT JKQTPboxplotHorizontalGraph: public JKQTPboxplotVerticalGraph {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPboxplotHorizontalGraph(JKQtBasePlotter* parent=NULL): inline JKQTPboxplotHorizontalGraph(JKQtBasePlotter* parent=NULL):
JKQTPboxplotVerticalGraph(parent) JKQTPboxplotVerticalGraph(parent)
{ {
}; }
inline JKQTPboxplotHorizontalGraph(JKQtPlotter* parent=NULL):
JKQTPboxplotVerticalGraph(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -1282,6 +1340,8 @@ class LIB_EXPORT JKQTPboxplotVerticalElement: public JKQTPgraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPboxplotVerticalElement(JKQtBasePlotter* parent=NULL); JKQTPboxplotVerticalElement(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPboxplotVerticalElement(JKQtPlotter* parent=NULL);
/** \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);
@ -1384,10 +1444,15 @@ class LIB_EXPORT JKQTPboxplotHorizontalElement: public JKQTPboxplotVerticalEleme
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPboxplotHorizontalElement(JKQtBasePlotter* parent=NULL): inline JKQTPboxplotHorizontalElement(JKQtBasePlotter* parent=NULL):
JKQTPboxplotVerticalElement(parent) JKQTPboxplotVerticalElement(parent)
{ {
}; }
/** \brief class constructor */
inline JKQTPboxplotHorizontalElement(JKQtPlotter* parent=NULL):
JKQTPboxplotVerticalElement(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -1451,8 +1516,11 @@ class LIB_EXPORT JKQTPxFunctionLineGraph: public JKQTPgraph {
/** \brief class constructor */ /** \brief class constructor */
JKQTPxFunctionLineGraph(JKQtBasePlotter* parent=NULL); JKQTPxFunctionLineGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPxFunctionLineGraph(JKQtPlotter* parent=NULL);
/** \brief class destructor */ /** \brief class destructor */
~JKQTPxFunctionLineGraph(); virtual ~JKQTPxFunctionLineGraph();
/** \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);
@ -1466,10 +1534,10 @@ class LIB_EXPORT JKQTPxFunctionLineGraph: public JKQTPgraph {
* This functions returns 0 for both parameters, so that the plotter uses the predefined * This functions returns 0 for both parameters, so that the plotter uses the predefined
* min and max values. * min and max values.
*/ */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { smallestGreaterZero=minx=maxx=0; return false; }; inline virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { smallestGreaterZero=minx=maxx=0; return false; }
/** \brief get the maximum and minimum y-value of the graph /** \brief get the maximum and minimum y-value of the graph
*/ */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { smallestGreaterZero=miny=maxy=0; return false; }; inline virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { smallestGreaterZero=miny=maxy=0; return false; }
/** \brief clear the data sampled from the function. */ /** \brief clear the data sampled from the function. */
void clearData(); void clearData();
@ -1634,7 +1702,9 @@ class LIB_EXPORT JKQTPyFunctionLineGraph: public JKQTPxFunctionLineGraph {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPyFunctionLineGraph(JKQtBasePlotter* parent=NULL):JKQTPxFunctionLineGraph(parent) {}; inline JKQTPyFunctionLineGraph(JKQtBasePlotter* parent=NULL):JKQTPxFunctionLineGraph(parent) {}
/** \brief class constructor */
inline JKQTPyFunctionLineGraph(JKQtPlotter* parent=NULL):JKQTPxFunctionLineGraph(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -1675,6 +1745,8 @@ class LIB_EXPORT JKQTPstepHorizontalGraph: public JKQTPxyGraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPstepHorizontalGraph(JKQtBasePlotter* parent=NULL); JKQTPstepHorizontalGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPstepHorizontalGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -1741,7 +1813,9 @@ class LIB_EXPORT JKQTPstepVerticalGraph: public JKQTPstepHorizontalGraph {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPstepVerticalGraph(JKQtBasePlotter* parent=NULL): JKQTPstepHorizontalGraph(parent) {}; inline JKQTPstepVerticalGraph(JKQtBasePlotter* parent=NULL): JKQTPstepHorizontalGraph(parent) {}
/** \brief class constructor */
inline JKQTPstepVerticalGraph(JKQtPlotter* parent=NULL): JKQTPstepHorizontalGraph(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -1784,6 +1858,8 @@ class LIB_EXPORT JKQTPbarHorizontalGraph: public JKQTPxyGraph, public JKQTPxyGra
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPbarHorizontalGraph(JKQtBasePlotter* parent=NULL); JKQTPbarHorizontalGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPbarHorizontalGraph(JKQtPlotter* parent=NULL);
/** \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);
@ -1856,12 +1932,12 @@ class LIB_EXPORT JKQTPbarHorizontalGraph: public JKQTPxyGraph, public JKQTPxyGra
QPen getLinePen(JKQTPEnhancedPainter &painter) const; QPen getLinePen(JKQTPEnhancedPainter &painter) const;
protected: protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */ /** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) { inline virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) {
//plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0); //plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0);
if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0); if (sortData==JKQTPxyLineGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0, &sortedIndices); else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0, &sortedIndices);
}; }
}; };
@ -1882,7 +1958,9 @@ class LIB_EXPORT JKQTPbarVerticalGraph: public JKQTPbarHorizontalGraph {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPbarVerticalGraph(JKQtBasePlotter* parent=NULL): JKQTPbarHorizontalGraph(parent) {}; inline JKQTPbarVerticalGraph(JKQtBasePlotter* parent=NULL): JKQTPbarHorizontalGraph(parent) {}
/** \brief class constructor */
inline JKQTPbarVerticalGraph(JKQtPlotter* parent=NULL): JKQTPbarHorizontalGraph(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -1928,6 +2006,8 @@ class LIB_EXPORT JKQTPhorizontalRange: public JKQTPgraph {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPhorizontalRange(JKQtBasePlotter* parent=NULL); JKQTPhorizontalRange(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPhorizontalRange(JKQtPlotter* parent=NULL);
/** \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);
@ -1938,12 +2018,12 @@ class LIB_EXPORT JKQTPhorizontalRange: public JKQTPgraph {
* *
* The result is given in the two parameters which are call-by-reference parameters! * The result is given in the two parameters which are call-by-reference parameters!
*/ */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero){ smallestGreaterZero=minx=maxx=0; return false; }; inline virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero){ smallestGreaterZero=minx=maxx=0; return false; }
/** \brief get the maximum and minimum y-value of the graph /** \brief get the maximum and minimum y-value of the graph
* *
* The result is given in the two parameters which are call-by-reference parameters! * The result is given in the two parameters which are call-by-reference parameters!
*/ */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { inline virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
miny=rangeMin; miny=rangeMin;
maxy=rangeMax; maxy=rangeMax;
smallestGreaterZero=0; smallestGreaterZero=0;
@ -1951,7 +2031,7 @@ class LIB_EXPORT JKQTPhorizontalRange: public JKQTPgraph {
return true; return true;
} }
/** \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() { return color; }; inline virtual QColor getKeyLabelColor() { return color; }
void setDrawCenterLineOnly(); void setDrawCenterLineOnly();
@ -2037,6 +2117,8 @@ class LIB_EXPORT JKQTPverticalRange: public JKQTPhorizontalRange {
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPverticalRange(JKQtBasePlotter* parent=NULL); JKQTPverticalRange(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPverticalRange(JKQtPlotter* parent=NULL);
/** \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);
@ -2047,19 +2129,19 @@ class LIB_EXPORT JKQTPverticalRange: public JKQTPhorizontalRange {
* *
* The result is given in the two parameters which are call-by-reference parameters! * The result is given in the two parameters which are call-by-reference parameters!
*/ */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero){ inline virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero){
minx=rangeMin; minx=rangeMin;
maxx=rangeMax; maxx=rangeMax;
smallestGreaterZero=0; smallestGreaterZero=0;
if (rangeMin>0) smallestGreaterZero=rangeMin; if (rangeMin>0) smallestGreaterZero=rangeMin;
return true; return true;
}; }
/** \brief get the maximum and minimum y-value of the graph /** \brief get the maximum and minimum y-value of the graph
* *
* The result is given in the two parameters which are call-by-reference parameters! * The result is given in the two parameters which are call-by-reference parameters!
*/ */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { smallestGreaterZero=miny=maxy=0; return false; } inline virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { smallestGreaterZero=miny=maxy=0; return false; }
}; };
#endif // JKQTPELEMENTS_H #endif // JKQTPELEMENTS_H

View File

@ -35,6 +35,15 @@ JKQTPgeoBaseLine::JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle
title=""; title="";
} }
JKQTPgeoBaseLine::JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQtPlotter* parent):
JKQTPgraph(parent)
{
this->color=color;
this->lineWidth=lineWidth;
this->style=style;
title="";
}
QPen JKQTPgeoBaseLine::getPen(JKQTPEnhancedPainter& painter) { QPen JKQTPgeoBaseLine::getPen(JKQTPEnhancedPainter& painter) {
QPen p; QPen p;
p.setColor(color); p.setColor(color);
@ -63,6 +72,32 @@ JKQTPgeoBaseFilled::JKQTPgeoBaseFilled(QColor color, QColor fillColor, double li
this->fillStyle=fillStyle; this->fillStyle=fillStyle;
} }
JKQTPgeoBaseFilled::JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, Qt::BrushStyle fillStyle, JKQtPlotter* parent):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
this->fillColor=fillColor;
this->fillStyle=fillStyle;
}
JKQTPgeoBaseFilled::JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, JKQtPlotter* parent):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
this->fillColor=fillColor;
this->fillStyle=Qt::SolidPattern;
}
JKQTPgeoBaseFilled::JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, JKQtPlotter* parent):
JKQTPgeoBaseLine(color, lineWidth, Qt::SolidLine, parent)
{
this->fillColor=fillColor;
this->fillStyle=Qt::SolidPattern;
}
JKQTPgeoBaseFilled::JKQTPgeoBaseFilled(QColor color, QColor fillColor, JKQtPlotter* parent):
JKQTPgeoBaseLine(color, 2.0, Qt::SolidLine, parent)
{
this->fillColor=fillColor;
this->fillStyle=Qt::SolidPattern;
}
QBrush JKQTPgeoBaseFilled::getBrush(JKQTPEnhancedPainter &/*painter*/) { QBrush JKQTPgeoBaseFilled::getBrush(JKQTPEnhancedPainter &/*painter*/) {
QBrush b; QBrush b;
b.setColor(fillColor); b.setColor(fillColor);
@ -92,6 +127,15 @@ JKQTPgeoText::JKQTPgeoText(JKQtBasePlotter* parent, double x, double y, QString
this->color=color; this->color=color;
} }
JKQTPgeoText::JKQTPgeoText(JKQtPlotter* parent, double x, double y, QString text, double fontSize, QColor color):
JKQTPgraph(parent)
{
this->x=x;
this->y=y;
this->text=text;
this->fontSize=fontSize;
this->color=color;
}
bool JKQTPgeoText::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoText::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=maxx=x; minx=maxx=x;
smallestGreaterZero=0; smallestGreaterZero=0;
@ -148,6 +192,14 @@ JKQTPgeoLine::JKQTPgeoLine(JKQtBasePlotter* parent, double x1, double y1, double
this->y2=y2; this->y2=y2;
} }
JKQTPgeoLine::JKQTPgeoLine(JKQtPlotter* parent, double x1, double y1, double x2, double y2, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
this->x1=x1;
this->y1=y1;
this->x2=x2;
this->y2=y2;
}
bool JKQTPgeoLine::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoLine::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=qMin(x1, x2); minx=qMin(x1, x2);
maxx=qMax(x1, x2); maxx=qMax(x1, x2);
@ -191,6 +243,16 @@ JKQTPgeoInfiniteLine::JKQTPgeoInfiniteLine(JKQtBasePlotter* parent, double x, do
this->two_sided=false; this->two_sided=false;
} }
JKQTPgeoInfiniteLine::JKQTPgeoInfiniteLine(JKQtPlotter* parent, double x, double y, double dx, double dy, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
this->x=x;
this->y=y;
this->dx=dx;
this->dy=dy;
this->two_sided=false;
}
bool JKQTPgeoInfiniteLine::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoInfiniteLine::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=x; minx=x;
maxx=x; maxx=x;
@ -341,7 +403,11 @@ JKQTPgeoLines::JKQTPgeoLines(JKQtBasePlotter* parent, QVector<QPointF> points, Q
{ {
this->points=points; this->points=points;
} }
JKQTPgeoLines::JKQTPgeoLines(JKQtPlotter* parent, QVector<QPointF> points, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
this->points=points;
}
bool JKQTPgeoLines::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoLines::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=0; minx=0;
maxx=0; maxx=0;
@ -401,6 +467,16 @@ JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtBasePlotter* parent, double x, double y
this->height=height; this->height=height;
} }
JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtPlotter* parent, double x, double y, double width, double height, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
this->x=x;
this->y=y;
alpha=0;
this->width=width;
this->height=height;
}
QMatrix JKQTPgeoRectangle::getMatrix() { QMatrix JKQTPgeoRectangle::getMatrix() {
QMatrix trans; QMatrix trans;
trans.rotate(alpha); trans.rotate(alpha);
@ -472,6 +548,11 @@ JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtBasePlotter* parent, QVector<QPointF> point
{ {
this->points=points; this->points=points;
} }
JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtPlotter* parent, QVector<QPointF> points, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
this->points=points;
}
bool JKQTPgeoPolygon::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoPolygon::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=0; minx=0;
@ -528,6 +609,12 @@ JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtBasePlotter* parent, double x, double y, do
controlPoints=180; controlPoints=180;
} }
JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtPlotter* parent, double x, double y, double width, double height, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoRectangle(parent, x, y, width, height, color, lineWidth, style, fillColor, fillStyle)
{
controlPoints=180;
}
void JKQTPgeoEllipse::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoEllipse::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
@ -557,6 +644,19 @@ JKQTPgeoArc::JKQTPgeoArc(JKQtBasePlotter* parent, double x, double y, double wid
this->controlPoints=180; this->controlPoints=180;
} }
JKQTPgeoArc::JKQTPgeoArc(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
this->angleStart=angleStart;
this->angleStop=angleStop;
this->x=x;
this->y=y;
this->width=width;
this->height=height;
this->alpha=0;
this->controlPoints=180;
}
void JKQTPgeoArc::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoArc::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
@ -607,6 +707,13 @@ JKQTPgeoPie::JKQTPgeoPie(JKQtBasePlotter* parent, double x, double y, double wid
this->angleStop=angleStop; this->angleStop=angleStop;
} }
JKQTPgeoPie::JKQTPgeoPie(JKQtPlotter* parent, double x, double y, double width, double height,double angleStart, double angleStop, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoEllipse(parent, x, y, width, height, color, lineWidth, style, fillColor, fillStyle)
{
this->angleStart=angleStart;
this->angleStop=angleStop;
}
void JKQTPgeoPie::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoPie::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
@ -659,6 +766,12 @@ JKQTPgeoChord::JKQTPgeoChord(JKQtBasePlotter* parent, double x, double y, double
} }
JKQTPgeoChord::JKQTPgeoChord(JKQtPlotter* parent, double x, double y, double width, double height,double angleStart, double angleStop, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoPie(parent, x, y, width, height, angleStart, angleStop, color, lineWidth, style, fillColor, fillStyle)
{
}
void JKQTPgeoChord::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoChord::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;

View File

@ -56,7 +56,15 @@ class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPgraph {
\param style line style of drawing \param style line style of drawing
\param lineWidth lineWidth of drawing \param lineWidth lineWidth of drawing
*/ */
JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style=Qt::SolidLine, JKQtBasePlotter* parent=NULL); explicit JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style=Qt::SolidLine, JKQtBasePlotter* parent=NULL);
/*! \brief class contructor
\param color color of drawing
\param style line style of drawing
\param lineWidth lineWidth of drawing
*/
explicit JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQtPlotter* parent);
JKQTPGET_SET_MACRO(QColor, color) JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(Qt::PenStyle, style) JKQTPGET_SET_MACRO(Qt::PenStyle, style)
@ -97,6 +105,36 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
\param lineWidth lineWidth of drawing \param lineWidth lineWidth of drawing
*/ */
JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style=Qt::SolidLine, Qt::BrushStyle fillStyle=Qt::SolidPattern, JKQtBasePlotter* parent=NULL); JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style=Qt::SolidLine, Qt::BrushStyle fillStyle=Qt::SolidPattern, JKQtBasePlotter* parent=NULL);
/*! \brief class contructor
\param color color of drawing
\param fillCOlor color of the filling in the drawing
\param style line style of drawing
\param fillStyle filling style of the graph
\param lineWidth lineWidth of drawing
*/
JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, Qt::BrushStyle fillStyle, JKQtPlotter* parent);
/*! \brief class contructor
\param color color of drawing
\param fillCOlor color of the filling in the drawing
\param style line style of drawing
\param lineWidth lineWidth of drawing
*/
JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, JKQtPlotter* parent);
/*! \brief class contructor
\param color color of drawing
\param fillCOlor color of the filling in the drawing
\param lineWidth lineWidth of drawing
*/
JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, JKQtPlotter* parent);
/*! \brief class contructor
\param color color of drawing
\param fillCOlor color of the filling in the drawing
*/
JKQTPgeoBaseFilled(QColor color, QColor fillColor, JKQtPlotter* parent);
JKQTPGET_SET_MACRO(QColor, fillColor) JKQTPGET_SET_MACRO(QColor, fillColor)
JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle) JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle)
@ -134,6 +172,16 @@ class LIB_EXPORT JKQTPgeoText: public JKQTPgraph {
\param fontSize base font size of text \param fontSize base font size of text
*/ */
JKQTPgeoText(JKQtBasePlotter* parent, double x, double y, QString text, double fontSize=10, QColor color=QColor("black")); JKQTPgeoText(JKQtBasePlotter* parent, double x, double y, QString text, double fontSize=10, QColor color=QColor("black"));
/*! \brief class contructor
\param parent parent plotter widget
\param x x-coordinate of text
\param y y-coordinate of text
\param text the text to display
\param color color of drawing
\param fontSize base font size of text
*/
JKQTPgeoText(JKQtPlotter* parent, double x, double y, QString text, double fontSize=10, QColor color=QColor("black"));
JKQTPGET_SET_MACRO(QColor, color) JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(QString, text) JKQTPGET_SET_MACRO(QString, text)
@ -189,6 +237,18 @@ class LIB_EXPORT JKQTPgeoLine: public JKQTPgeoBaseLine {
\param style line style \param style line style
*/ */
JKQTPgeoLine(JKQtBasePlotter* parent, double x1, double y1, double x2, double y2, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPgeoLine(JKQtBasePlotter* parent, double x1, double y1, double x2, double y2, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor
\param parent the parent plotter class
\param x1 x-coordinate of first point of line
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoLine(JKQtPlotter* parent, double x1, double y1, double x2, double y2, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
@ -233,6 +293,18 @@ class LIB_EXPORT JKQTPgeoInfiniteLine: public JKQTPgeoBaseLine {
\param style line style \param style line style
*/ */
JKQTPgeoInfiniteLine(JKQtBasePlotter* parent, double x, double y, double dx, double dy, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPgeoInfiniteLine(JKQtBasePlotter* parent, double x, double y, double dx, double dy, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of start point of line
\param y y-coordinate of start point of line
\param dx x-direction of the line
\param dy y-direction of the line
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoInfiniteLine(JKQtPlotter* parent, double x, double y, double dx, double dy, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
@ -277,6 +349,18 @@ class LIB_EXPORT JKQTPgeoLines: public JKQTPgeoBaseLine {
\param style line style \param style line style
*/ */
JKQTPgeoLines(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPgeoLines(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor
\param parent the parent plotter class
\param x1 x-coordinate of first point of line
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoLines(JKQtPlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
@ -324,6 +408,20 @@ class LIB_EXPORT JKQTPgeoRectangle: public JKQTPgeoBaseFilled {
\param fillStyle filling style of rectangle \param fillStyle filling style of rectangle
*/ */
JKQTPgeoRectangle(JKQtBasePlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoRectangle(JKQtBasePlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of rectangle
\param y y-coordinate of center of rectangle
\param width width of rectangle
\param height of rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoRectangle(JKQtPlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
@ -374,6 +472,18 @@ class LIB_EXPORT JKQTPgeoPolygon: public JKQTPgeoBaseFilled {
\param style line style \param style line style
*/ */
JKQTPgeoPolygon(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoPolygon(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x1 x-coordinate of first point of line
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoPolygon(JKQtPlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
@ -426,6 +536,20 @@ class LIB_EXPORT JKQTPgeoEllipse: public JKQTPgeoRectangle {
*/ */
JKQTPgeoEllipse(JKQtBasePlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoEllipse(JKQtBasePlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of ellipse
\param y y-coordinate of center of ellipse
\param width width of ellipse (2 * half axis)
\param height of ellipse (2 * half axis)
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of ellipse
\param fillStyle filling style of ellipse
*/
JKQTPgeoEllipse(JKQtPlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
@ -459,6 +583,19 @@ class LIB_EXPORT JKQTPgeoArc: public JKQTPgeoBaseLine {
*/ */
JKQTPgeoArc(JKQtBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPgeoArc(JKQtBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of ellipse
\param y y-coordinate of center of ellipse
\param width width of ellipse (2 * half axis)
\param height of ellipse (2 * half axis)
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoArc(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero); virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
@ -523,6 +660,20 @@ class LIB_EXPORT JKQTPgeoPie: public JKQTPgeoEllipse {
\param fillStyle filling style of ellipse \param fillStyle filling style of ellipse
*/ */
JKQTPgeoPie(JKQtBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoPie(JKQtBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of ellipse
\param y y-coordinate of center of ellipse
\param width width of ellipse (2 * half axis)
\param height of ellipse (2 * half axis)
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of ellipse
\param fillStyle filling style of ellipse
*/
JKQTPgeoPie(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
@ -568,6 +719,20 @@ class LIB_EXPORT JKQTPgeoChord: public JKQTPgeoPie {
\param fillStyle filling style of ellipse \param fillStyle filling style of ellipse
*/ */
JKQTPgeoChord(JKQtBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoChord(JKQtBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of ellipse
\param y y-coordinate of center of ellipse
\param width width of ellipse (2 * half axis)
\param height of ellipse (2 * half axis)
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of ellipse
\param fillStyle filling style of ellipse
*/
JKQTPgeoChord(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPgraph::getXMinMax() */ /** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero); virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);

View File

@ -22,6 +22,7 @@
#include "jkqtpbaseplotter.h" #include "jkqtpbaseplotter.h"
#include "jkqtpimagetools.h" #include "jkqtpimagetools.h"
#include "jkqtptools.h" #include "jkqtptools.h"
#include "jkqtplotter.h"
#include <QDebug> #include <QDebug>
#include <QImageWriter> #include <QImageWriter>
#include <QFileDialog> #include <QFileDialog>
@ -53,6 +54,26 @@ JKQTPImageBase::JKQTPImageBase(JKQtBasePlotter *parent):
this->y=0; this->y=0;
} }
JKQTPImageBase::JKQTPImageBase(double x, double y, double width, double height, JKQtPlotter* parent):
JKQTPgraph(parent)
{
title="";
this->width=width;
this->height=height;
this->x=x;
this->y=y;
}
JKQTPImageBase::JKQTPImageBase(JKQtPlotter *parent):
JKQTPgraph(parent)
{
title="";
this->width=0;
this->height=0;
this->x=0;
this->y=0;
}
void JKQTPImageBase::drawKeyMarker(JKQTPEnhancedPainter& /*painter*/, QRectF& /*rect*/) { void JKQTPImageBase::drawKeyMarker(JKQTPEnhancedPainter& /*painter*/, QRectF& /*rect*/) {
} }
@ -133,15 +154,32 @@ void JKQTPImageBase::plotImage(JKQTPEnhancedPainter& painter, QImage& image, dou
JKQTPImage::JKQTPImage(JKQtBasePlotter *parent):
JKQTPImageBase(parent)
{
this->image=NULL;
createImageActions();
}
JKQTPImage::JKQTPImage(double x, double y, double width, double height, QImage* image, JKQtBasePlotter* parent): JKQTPImage::JKQTPImage(double x, double y, double width, double height, QImage* image, JKQtBasePlotter* parent):
JKQTPImageBase(x, y, width, height, parent) JKQTPImageBase(x, y, width, height, parent)
{ {
actSaveImage=new QAction(tr("Save JKQTPImage ..."), this);
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage()));
actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this);
connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage()));
this->image=image; this->image=image;
createImageActions();
}
JKQTPImage::JKQTPImage(JKQtPlotter *parent):
JKQTPImageBase(parent)
{
this->image=NULL;
createImageActions();
}
JKQTPImage::JKQTPImage(double x, double y, double width, double height, QImage* image, JKQtPlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
this->image=image;
createImageActions();
} }
@ -154,6 +192,15 @@ void JKQTPImage::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
painter.drawImage(rect, QPixmap(":/jkqtp_plot_image.png").toImage()); painter.drawImage(rect, QPixmap(":/jkqtp_plot_image.png").toImage());
} }
void JKQTPImage::createImageActions()
{
actSaveImage=new QAction(tr("Save JKQTPImage ..."), this);
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage()));
actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this);
connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage()));
}
void JKQTPImage::setParent(JKQtBasePlotter *parent) void JKQTPImage::setParent(JKQtBasePlotter *parent)
{ {
if (this->parent) { if (this->parent) {
@ -245,6 +292,18 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double
modifierMode=ModifyNone; modifierMode=ModifyNone;
} }
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
this->data=data;
this->datatype=datatype;
this->Nx=Nx;
this->Ny=Ny;
dataModifier=NULL;
datatypeModifier=DoubleArray;
modifierMode=ModifyNone;
}
void JKQTPMathImageBase::drawKeyMarker(JKQTPEnhancedPainter &/*painter*/, QRectF &/*rect*/) void JKQTPMathImageBase::drawKeyMarker(JKQTPEnhancedPainter &/*painter*/, QRectF &/*rect*/)
{ {
@ -274,6 +333,29 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double
modifierMode=ModifyNone; modifierMode=ModifyNone;
} }
JKQTPMathImageBase::JKQTPMathImageBase(JKQtPlotter *parent):
JKQTPImageBase(parent)
{
this->data=NULL;
this->Nx=0;
this->Ny=0;
this->datatype=DoubleArray;
dataModifier=NULL;
datatypeModifier=DoubleArray;
modifierMode=ModifyNone;
}
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQtPlotter *parent):
JKQTPImageBase(x,y,width,height,parent)
{
this->data=NULL;
this->Nx=0;
this->Ny=0;
this->datatype=DoubleArray;
dataModifier=NULL;
datatypeModifier=DoubleArray;
modifierMode=ModifyNone;
}
void JKQTPMathImageBase::set_data(void* data, uint32_t Nx, uint32_t Ny, DataType datatype) { void JKQTPMathImageBase::set_data(void* data, uint32_t Nx, uint32_t Ny, DataType datatype) {
this->data=data; this->data=data;
@ -515,11 +597,7 @@ void JKQTPMathImageBase::modifyImage(QImage &img, void *dataModifier, JKQTPMathI
void JKQTPMathImage::initJKQTPMathImage() {
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtBasePlotter* parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{
actSaveImage=new QAction(tr("Save JKQTPMathImage ..."), this); actSaveImage=new QAction(tr("Save JKQTPMathImage ..."), this);
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage())); connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage()));
actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this); actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this);
@ -570,7 +648,7 @@ JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height,
this->colorBarTopVisible=true; this->colorBarTopVisible=true;
this->colorBarRightVisible=true; this->colorBarRightVisible=true;
this->palette=palette; this->palette=JKQTPMathImageGRAY;
this->imageNameFontName=parent->get_keyFont(); this->imageNameFontName=parent->get_keyFont();
this->imageNameFontSize=parent->get_keyFontSize(); this->imageNameFontSize=parent->get_keyFontSize();
this->imageName=""; this->imageName="";
@ -592,80 +670,32 @@ JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height,
this->autoModifierRange=true; this->autoModifierRange=true;
} }
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtBasePlotter* parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{
initJKQTPMathImage();
this->palette=palette;
}
JKQTPMathImage::JKQTPMathImage(JKQtBasePlotter *parent): JKQTPMathImage::JKQTPMathImage(JKQtBasePlotter *parent):
JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, NULL, 0, 0, parent) JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, NULL, 0, 0, parent)
{ {
actSaveImage=new QAction(tr("Save JKQTPMathImage ..."), this); initJKQTPMathImage();
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage())); }
actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this);
connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage()));
colorBarRightAxis=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarRightAxis->loadSettings(parent->getYAxis());
colorBarRightAxis->set_drawMode1(JKQTPCADMline);
colorBarRightAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarRightAxis->set_axisLabel("");
colorBarRightAxis->set_minTicks(3);
colorBarRightAxis->set_showZeroAxis(false);
colorBarRightAxis->set_minorTicks(0);
colorBarRightAxis->set_tickOutsideLength(0);
colorBarRightAxis->set_minorTickOutsideLength(0);
colorBarTopAxis=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarTopAxis->loadSettings(parent->getXAxis());
colorBarTopAxis->set_drawMode1(JKQTPCADMline);
colorBarTopAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarTopAxis->set_axisLabel("");
colorBarTopAxis->set_minTicks(3);
colorBarTopAxis->set_showZeroAxis(false);
colorBarTopAxis->set_minorTicks(0);
colorBarTopAxis->set_tickOutsideLength(0);
colorBarTopAxis->set_minorTickOutsideLength(0);
modifierColorBarTopAxis=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) modifierColorBarTopAxis->loadSettings(parent->getXAxis());
modifierColorBarTopAxis->set_drawMode1(JKQTPCADMcomplete);
modifierColorBarTopAxis->set_drawMode2(JKQTPCADMline);
modifierColorBarTopAxis->set_axisLabel("");
modifierColorBarTopAxis->set_minTicks(3);
modifierColorBarTopAxis->set_showZeroAxis(false);
modifierColorBarTopAxis->set_minorTicks(0);
modifierColorBarTopAxis->set_tickOutsideLength(0);
modifierColorBarTopAxis->set_minorTickOutsideLength(0);
modifierColorBarRightAxis=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) modifierColorBarRightAxis->loadSettings(parent->getYAxis());
modifierColorBarRightAxis->set_drawMode1(JKQTPCADMcomplete);
modifierColorBarRightAxis->set_drawMode2(JKQTPCADMline);
modifierColorBarRightAxis->set_axisLabel("");
modifierColorBarRightAxis->set_minTicks(5);
modifierColorBarRightAxis->set_showZeroAxis(false);
modifierColorBarRightAxis->set_minorTicks(0);
modifierColorBarRightAxis->set_tickOutsideLength(0);
modifierColorBarRightAxis->set_minorTickOutsideLength(0);
this->colorBarModifiedWidth=80;
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtPlotter* parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{
initJKQTPMathImage();
this->palette=palette; this->palette=palette;
this->imageNameFontName=parent->get_keyFont(); }
this->imageNameFontSize=parent->get_keyFontSize();
this->imageName=""; JKQTPMathImage::JKQTPMathImage(JKQtPlotter *parent):
this->showColorBar=true; JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, NULL, 0, 0, parent)
this->colorBarWidth=14; {
this->colorBarRelativeHeight=0.75; initJKQTPMathImage();
this->autoImageRange=true;
this->imageMin=0;
this->imageMax=1;
this->autoModifierRange=true;
this->modifierMin=0;
this->modifierMax=1;
this->colorBarOffset=4;
this->rangeMinFailAction=JKQTPMathImageLastPaletteColor;
this->rangeMaxFailAction=JKQTPMathImageLastPaletteColor;
this->rangeMinFailColor=QColor("black");
this->rangeMaxFailColor=QColor("black");
this->nanColor=QColor("black");
this->infColor=QColor("black");
this->colorBarTopVisible=false;
this->colorBarRightVisible=true;
this->autoModifierRange=true;
} }
void JKQTPMathImage::setParent(JKQtBasePlotter* parent) { void JKQTPMathImage::setParent(JKQtBasePlotter* parent) {
@ -1169,6 +1199,32 @@ JKQTPOverlayImage::JKQTPOverlayImage(JKQtBasePlotter *parent):
this->trueColor=QColor("red"); this->trueColor=QColor("red");
} }
JKQTPOverlayImage::JKQTPOverlayImage(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtPlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
actSaveImage=new QAction(tr("Save JKQTPOverlayImage ..."), this);
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage()));
actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this);
connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage()));
this->Nx=Nx;
this->Ny=Ny;
this->data=data;
this->trueColor=colTrue;
this->falseColor=QColor(Qt::transparent);
}
JKQTPOverlayImage::JKQTPOverlayImage(JKQtPlotter *parent):
JKQTPImageBase(0,0,1,1, parent)
{
actSaveImage=new QAction(tr("Save JKQTPOverlayImage ..."), this);
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage()));
actCopyImage=new QAction(tr("Copy JKQTPOverlayImage ..."), this);
connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage()));
this->Nx=0;
this->Ny=0;
this->data=NULL;
this->trueColor=QColor("red");
}
void JKQTPOverlayImage::draw(JKQTPEnhancedPainter& painter) { void JKQTPOverlayImage::draw(JKQTPEnhancedPainter& painter) {
if (!data) return; if (!data) return;
@ -1247,6 +1303,25 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQtBasePlotter *parent):
rectanglesAsImageOverlay=false; rectanglesAsImageOverlay=false;
} }
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtPlotter* parent):
JKQTPOverlayImage(x, y, width, height, data, Nx, Ny, colTrue, parent)
{
symbol=JKQTPtarget;
symbolWidth=1;
drawAsRectangles=true;
symbolSizeFactor=0.9;
rectanglesAsImageOverlay=false;
}
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQtPlotter *parent):
JKQTPOverlayImage(0,0,1,1,NULL,0,0, QColor("red"), parent)
{
symbol=JKQTPtarget;
symbolWidth=1;
drawAsRectangles=true;
symbolSizeFactor=0.9;
rectanglesAsImageOverlay=false;
}
void JKQTPOverlayImageEnhanced::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { void JKQTPOverlayImageEnhanced::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
if (drawAsRectangles) JKQTPOverlayImage::drawKeyMarker(painter, rect); if (drawAsRectangles) JKQTPOverlayImage::drawKeyMarker(painter, rect);
else plotSymbol(painter, rect.center().x(), rect.center().y(), symbol, qMin(rect.width(), rect.height()), parent->pt2px(painter, symbolWidth*parent->get_lineWidthMultiplier()), trueColor, trueColor.lighter()); else plotSymbol(painter, rect.center().x(), rect.center().y(), symbol, qMin(rect.width(), rect.height()), parent->pt2px(painter, symbolWidth*parent->get_lineWidthMultiplier()), trueColor, trueColor.lighter());
@ -1310,10 +1385,7 @@ void JKQTPOverlayImageEnhanced::draw(JKQTPEnhancedPainter& painter) {
void JKQTPRGBMathImage::initObject()
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{ {
actSaveImage=new QAction(tr("Save JKQTPRGBMathImage ..."), this); actSaveImage=new QAction(tr("Save JKQTPRGBMathImage ..."), this);
connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage())); connect(actSaveImage, SIGNAL(triggered()), this, SLOT(saveImagePlotAsImage()));
@ -1406,6 +1478,34 @@ JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double he
this->colorbarsSideBySide=true; this->colorbarsSideBySide=true;
} }
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{
initObject();
}
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{
initObject();
}
JKQTPRGBMathImage::JKQTPRGBMathImage(JKQtBasePlotter *parent):
JKQTPMathImageBase(0,0,0,0, DoubleArray, NULL, 0, 0, parent)
{
initObject();
}
JKQTPRGBMathImage::JKQTPRGBMathImage(JKQtPlotter *parent):
JKQTPMathImageBase(0,0,0,0, DoubleArray, NULL, 0, 0, parent)
{
initObject();
}
void JKQTPRGBMathImage::setParent(JKQtBasePlotter* parent) { void JKQTPRGBMathImage::setParent(JKQtBasePlotter* parent) {
if (this->parent) { if (this->parent) {
this->parent->deregisterAdditionalAction(actSaveImage); this->parent->deregisterAdditionalAction(actSaveImage);
@ -2112,6 +2212,36 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, dou
this->datatype=JKQTPMathImageBase::DoubleArray; this->datatype=JKQTPMathImageBase::DoubleArray;
} }
JKQTPColumnMathImage::JKQTPColumnMathImage(JKQtPlotter *parent):
JKQTPMathImage(parent)
{
this->modifierColumn=-1;
this->imageColumn=-1;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,NULL,Nx,Ny,JKQTPMathImageGRAY,parent)
{
this->modifierColumn=-1;
this->imageColumn=-1;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtPlotter *parent):
JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,NULL,Nx,Ny,palette,parent)
{
this->modifierColumn=-1;
this->imageColumn=imageColumn;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,NULL,Nx,Ny,JKQTPMathImageGRAY,parent)
{
this->modifierColumn=-1;
this->imageColumn=imageColumn;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
bool JKQTPColumnMathImage::usesColumn(int c) bool JKQTPColumnMathImage::usesColumn(int c)
{ {
return (c==imageColumn)||(c==modifierColumn); return (c==imageColumn)||(c==modifierColumn);
@ -2144,6 +2274,11 @@ JKQTPColumnOverlayImageEnhanced::JKQTPColumnOverlayImageEnhanced(JKQtBasePlotter
imageColumn=-1; imageColumn=-1;
} }
JKQTPColumnOverlayImageEnhanced::JKQTPColumnOverlayImageEnhanced(JKQtPlotter *parent):
JKQTPOverlayImageEnhanced(parent)
{
imageColumn=-1;
}
void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) { void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) {
double* d=parent->getDatastore()->getColumn(imageColumn).getPointer(0); double* d=parent->getDatastore()->getColumn(imageColumn).getPointer(0);
int imgSize=parent->getDatastore()->getColumn(imageColumn).getRows(); int imgSize=parent->getDatastore()->getColumn(imageColumn).getRows();
@ -2212,6 +2347,55 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt
this->datatype=JKQTPMathImageBase::DoubleArray; this->datatype=JKQTPMathImageBase::DoubleArray;
} }
JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(JKQtPlotter *parent):
JKQTPRGBMathImage(0,0,0,0,DoubleArray,NULL,0,0,parent)
{
this->modifierColumn=-1;
this->imageRColumn=-1;
this->imageGColumn=-1;
this->imageBColumn=-1;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent)
{
this->modifierColumn=-1;
this->imageRColumn=-1;
this->imageGColumn=-1;
this->imageBColumn=-1;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent)
{
this->modifierColumn=-1;
this->imageRColumn=imageRColumn;
this->imageGColumn=-1;
this->imageBColumn=-1;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent)
{
this->modifierColumn=-1;
this->imageRColumn=imageRColumn;
this->imageGColumn=imageGColumn;
this->imageBColumn=-1;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter *parent):
JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent)
{
this->modifierColumn=-1;
this->imageRColumn=imageRColumn;
this->imageGColumn=imageGColumn;
this->imageBColumn=imageBColumn;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
bool JKQTPColumnRGBMathImage::usesColumn(int c) bool JKQTPColumnRGBMathImage::usesColumn(int c)
{ {
return (c==imageRColumn)||(c==imageBColumn)||(c==imageGColumn)||(c==modifierColumn); return (c==imageRColumn)||(c==imageBColumn)||(c==imageGColumn)||(c==modifierColumn);
@ -2693,6 +2877,36 @@ JKQTPContour::JKQTPContour(double x, double y, double width, double height, void
} }
JKQTPContour::JKQTPContour(JKQtPlotter *parent) :
JKQTPMathImage(parent)
{
lineColor=QColor("red");
colorBarRightVisible=false;
lineWidth=1;
style=Qt::SolidLine;
ignoreOnPlane=false;
numberOfLevels=1;
colorFromPalette=true;
datatype=JKQTPMathImageBase::DoubleArray;
relativeLevels=false;
if (parent) { // get style settings from parent object
lineColor=parent->getPlotStyle(parent->getNextStyle()).color();
}
}
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQtPlotter* parent) :
JKQTPMathImage( x, y, width, height, datatype, data, Nx, Ny, palette, parent)
{
lineColor=QColor("red");
colorBarRightVisible=false;
lineWidth=1;
style=Qt::SolidLine;
ignoreOnPlane=false;
numberOfLevels=1;
colorFromPalette=true;
relativeLevels=false;
}
int JKQTPContour::compare2level(const QVector3D &vertex, const double &level) int JKQTPContour::compare2level(const QVector3D &vertex, const double &level)
{ {
if (vertex.z() > level) if (vertex.z() > level)

View File

@ -57,6 +57,10 @@ class LIB_EXPORT JKQTPImageBase: public JKQTPgraph {
JKQTPImageBase(JKQtBasePlotter* parent=NULL); JKQTPImageBase(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */ /** \brief class constructor */
JKQTPImageBase(double x, double y, double width, double height, JKQtBasePlotter* parent=NULL); JKQTPImageBase(double x, double y, double width, double height, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPImageBase(JKQtPlotter* parent);
/** \brief class constructor */
JKQTPImageBase(double x, double y, double width, double height, JKQtPlotter* parent);
/** \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); virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
@ -151,6 +155,12 @@ class LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
JKQTPMathImageBase(double x, double y, double width, double height, JKQtBasePlotter* parent=NULL); JKQTPMathImageBase(double x, double y, double width, double height, JKQtBasePlotter* parent=NULL);
JKQTPMathImageBase(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); JKQTPMathImageBase(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPMathImageBase(JKQtPlotter* parent);
JKQTPMathImageBase(double x, double y, double width, double height, JKQtPlotter* parent=NULL);
JKQTPMathImageBase(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
/** \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); virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
@ -226,8 +236,14 @@ class LIB_EXPORT JKQTPImage: public JKQTPImageBase {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */
JKQTPImage(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPImage(JKQtPlotter* parent);
/** \brief class constructor */ /** \brief class constructor */
JKQTPImage(double x, double y, double width, double height, QImage* image, JKQtBasePlotter* parent=NULL); JKQTPImage(double x, double y, double width, double height, QImage* image, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPImage(double x, double y, double width, double height, QImage* image, 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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -242,6 +258,8 @@ class LIB_EXPORT JKQTPImage: public JKQTPImageBase {
/** \brief the image to be plotted */ /** \brief the image to be plotted */
QImage* image; QImage* image;
void createImageActions();
protected: protected:
QAction* actSaveImage; QAction* actSaveImage;
QAction* actCopyImage; QAction* actCopyImage;
@ -265,13 +283,11 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */
JKQTPMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQtBasePlotter* parent=NULL); JKQTPMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQtBasePlotter* parent=NULL);
JKQTPMathImage(JKQtBasePlotter* parent=NULL); JKQTPMathImage(JKQtBasePlotter* parent=NULL);
JKQTPMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtPlotter* parent);
JKQTPMathImage(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -361,6 +377,7 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect); virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
protected: protected:
void initJKQTPMathImage();
/** \brief top color bar visible */ /** \brief top color bar visible */
bool colorBarTopVisible; bool colorBarTopVisible;
/** \brief right color bar visible */ /** \brief right color bar visible */
@ -448,6 +465,15 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
/** \brief class constructor */ /** \brief class constructor */
JKQTPRGBMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); JKQTPRGBMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPRGBMathImage(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
/** \brief class constructor */
JKQTPRGBMathImage(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPRGBMathImage(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -530,6 +556,7 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect); virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
protected: protected:
void initObject();
/** \brief points to the data array, holding the image */ /** \brief points to the data array, holding the image */
void* dataG; void* dataG;
/** \brief datatype of the data array data */ /** \brief datatype of the data array data */
@ -624,6 +651,11 @@ class LIB_EXPORT JKQTPColumnMathImage: public JKQTPMathImage {
JKQTPColumnMathImage(JKQtBasePlotter* parent=NULL); JKQTPColumnMathImage(JKQtBasePlotter* parent=NULL);
JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL);
JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQtBasePlotter* parent=NULL); JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPColumnMathImage(JKQtPlotter* parent);
JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtPlotter* parent);
JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
JKQTPGET_SET_MACRO(int, imageColumn) JKQTPGET_SET_MACRO(int, imageColumn)
JKQTPGET_SET_MACRO(int, modifierColumn) JKQTPGET_SET_MACRO(int, modifierColumn)
@ -657,6 +689,12 @@ class LIB_EXPORT JKQTPColumnRGBMathImage: public JKQTPRGBMathImage {
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPColumnRGBMathImage(JKQtPlotter* parent);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
JKQTPGET_SET_MACRO(int, imageRColumn) JKQTPGET_SET_MACRO(int, imageRColumn)
JKQTPGET_SET_MACRO(int, imageGColumn) JKQTPGET_SET_MACRO(int, imageGColumn)
@ -691,6 +729,10 @@ class LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
JKQTPOverlayImage(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtBasePlotter* parent=NULL); JKQTPOverlayImage(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtBasePlotter* parent=NULL);
JKQTPOverlayImage(JKQtBasePlotter* parent=NULL); JKQTPOverlayImage(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPOverlayImage(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtPlotter* parent);
JKQTPOverlayImage(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -752,6 +794,9 @@ class LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage {
/** \brief class constructor */ /** \brief class constructor */
JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtBasePlotter* parent=NULL); JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtBasePlotter* parent=NULL);
JKQTPOverlayImageEnhanced(JKQtBasePlotter* parent=NULL); JKQTPOverlayImageEnhanced(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtPlotter* parent);
JKQTPOverlayImageEnhanced(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); virtual void draw(JKQTPEnhancedPainter& painter);
@ -795,6 +840,7 @@ class LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImageEnhanc
Q_OBJECT Q_OBJECT
public: public:
JKQTPColumnOverlayImageEnhanced(JKQtBasePlotter* parent=NULL); JKQTPColumnOverlayImageEnhanced(JKQtBasePlotter* parent=NULL);
JKQTPColumnOverlayImageEnhanced(JKQtPlotter* parent);
JKQTPGET_SET_MACRO(int, imageColumn) JKQTPGET_SET_MACRO(int, imageColumn)
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
@ -824,6 +870,8 @@ class LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImageEnhanc
* levels with createContourLevels(). The levels are linearly spaced between the maximum and minimum * 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 * value in your data. For logarithmic data, use createContourLevelsLog() to create contour levels
* with logarithmic spacing. * with logarithmic spacing.
*
* \author Sebastian Isbaner, 2013-2014
*/ */
class LIB_EXPORT JKQTPContour: public JKQTPMathImage { class LIB_EXPORT JKQTPContour: public JKQTPMathImage {
Q_OBJECT Q_OBJECT
@ -832,6 +880,10 @@ class LIB_EXPORT JKQTPContour: public JKQTPMathImage {
JKQTPContour(JKQtBasePlotter* parent=NULL); JKQTPContour(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */ /** \brief class constructor */
JKQTPContour(double x, double y, double width, double height, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, DataType datatype = JKQTPMathImageBase::DoubleArray, JKQtBasePlotter* parent=NULL); JKQTPContour(double x, double y, double width, double height, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, DataType datatype = JKQTPMathImageBase::DoubleArray, JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPContour(JKQtPlotter* parent);
/** \brief class constructor */
JKQTPContour(double x, double y, double width, double height, void* data, uint32_t Nx, uint32_t 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); virtual void draw(JKQTPEnhancedPainter& painter);

View File

@ -223,7 +223,9 @@ QStringList JKQTPimagePlot_getPredefinedPalettes() {
sl<<QObject::tr("blue-red"); sl<<QObject::tr("blue-red");
//sl<<QObject::tr(""); //sl<<QObject::tr("");
#ifdef QT_XML_LIB
int palID=sl.size(); int palID=sl.size();
#endif
for (int i=0; i<JKQTPimagePlot_palettesSearchPaths.size(); i++) { for (int i=0; i<JKQTPimagePlot_palettesSearchPaths.size(); i++) {
QDir d(JKQTPimagePlot_palettesSearchPaths[i]); QDir d(JKQTPimagePlot_palettesSearchPaths[i]);
QStringList nameFilters; QStringList nameFilters;
@ -305,7 +307,9 @@ QStringList JKQTPimagePlot_getPredefinedPalettes() {
qStableSort(pal.begin(), pal.end(), JKQTPimagePlot_QPairCompareFirst<double, QRgb>); qStableSort(pal.begin(), pal.end(), JKQTPimagePlot_QPairCompareFirst<double, QRgb>);
JKQTPimagePlot_lutsFromFiles[sl.size()-1]=pal; JKQTPimagePlot_lutsFromFiles[sl.size()-1]=pal;
//qDebug()<<" added as "<<sl.size()-1; //qDebug()<<" added as "<<sl.size()-1;
#ifdef QT_XML_LIB
palID=l.size(); palID=l.size();
#endif
} }
} }

View File

@ -92,7 +92,7 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
/** \brief class constructor /** \brief class constructor
*/ */
explicit JKQtPlotter(bool datastore_internal=true, QWidget* parent=NULL, JKQTPdatastore* datast=NULL); explicit JKQtPlotter(bool datastore_internal, QWidget* parent=NULL, JKQTPdatastore* datast=NULL);
explicit JKQtPlotter(QWidget* parent=NULL); explicit JKQtPlotter(QWidget* parent=NULL);
/** \brief class destructor */ /** \brief class destructor */
@ -115,7 +115,9 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
}; };
/** \brief returns the class internally used for plotting */ /** \brief returns the class internally used for plotting */
JKQtBasePlotter* get_plotter() { return plotter; } JKQtBasePlotter* get_plotter() const { return plotter; }
/** \brief returns the class internally used for plotting */
const JKQtBasePlotter* get_constplotter() const { return const_cast<const JKQtBasePlotter*>(plotter); }
JKQTPGET_SET_MACRO_I(bool, displayToolbar, updateToolbar()) JKQTPGET_SET_MACRO_I(bool, displayToolbar, updateToolbar())
JKQTPGET_SET_MACRO_I(bool, toolbarAlwaysOn, updateToolbar()) JKQTPGET_SET_MACRO_I(bool, toolbarAlwaysOn, updateToolbar())
@ -284,6 +286,25 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
inline double getMagnification() const { return magnification; } inline double getMagnification() const { return magnification; }
/** \brief gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles */
inline int getNextStyle() {
return get_plotter()->getNextStyle();
}
/** \brief returns a QPen object for the i-th plot style */
inline JKQtBasePlotter::JKQTPPen getPlotStyle(int i) const {
return get_constplotter()->getPlotStyle(i);
}
/** \brief font face for key labels */
inline QString get_keyFont() const {
return get_constplotter()->get_keyFont();
}
/** \brief font size for key labels [in points] */
inline double get_keyFontSize() const {
return get_constplotter()->get_keyFontSize();
}
public slots: public slots:
/** \brief set the plot magnification */ /** \brief set the plot magnification */
void setMagnification(double m); void setMagnification(double m);

View File

@ -15,7 +15,8 @@ HEADERS += $$PWD/jkqtpbaseplotter.h \
$$PWD/jkqtpparsedfunctionelements.h \ $$PWD/jkqtpparsedfunctionelements.h \
$$PWD/jkqtpoverlayelements.h \ $$PWD/jkqtpoverlayelements.h \
$$PWD/jkqtpgeoelements.h \ $$PWD/jkqtpgeoelements.h \
$$PWD/jkqtpjkmathparser.h $$PWD/jkqtpmathparser.h \
$$PWD/jkqtp_imexport.h
SOURCES += $$PWD/jkqtpbaseplotter.cpp \ SOURCES += $$PWD/jkqtpbaseplotter.cpp \
@ -31,17 +32,17 @@ SOURCES += $$PWD/jkqtpbaseplotter.cpp \
$$PWD/jkqtpparsedfunctionelements.cpp \ $$PWD/jkqtpparsedfunctionelements.cpp \
$$PWD/jkqtpoverlayelements.cpp \ $$PWD/jkqtpoverlayelements.cpp \
$$PWD/jkqtpgeoelements.cpp \ $$PWD/jkqtpgeoelements.cpp \
$$PWD/jkqtpjkmathparser.cpp $$PWD/jkqtpmathparser.cpp
RESOURCES += $$PWD/jkqtpbaseplotter.qrc RESOURCES += $$PWD/jkqtpbaseplotter.qrc
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
QT += gui QT += core gui svg
QT += core gui svg xml
win32:LIBS += -lgdi32 win32:LIBS += -lgdi32
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# for support of palettes stored as XML, use:
QT += xml

View File

@ -189,7 +189,7 @@ void JKQTPoverlayVerticalRange::draw(JKQTPEnhancedPainter &painter) {
QPointF p21=transform(position2, ymin); QPointF p21=transform(position2, ymin);
QPointF p22=transform(position2, ymax); QPointF p22=transform(position2, ymax);
QPointF p23=p2-QPointF(0, (p2.y()-p1.y())*0.1); //QPointF p23=p2-QPointF(0, (p2.y()-p1.y())*0.1);
painter.save(); painter.save();
if (fillColor!=QColor(Qt::transparent)) { if (fillColor!=QColor(Qt::transparent)) {
if (inverted) { if (inverted) {

View File

@ -75,6 +75,25 @@ JKQTPxParsedFunctionLineGraph::JKQTPxParsedFunctionLineGraph(JKQtBasePlotter *pa
set_errorPlotFunction(JKQTPxParsedFunctionLineGraphFunction); set_errorPlotFunction(JKQTPxParsedFunctionLineGraphFunction);
} }
JKQTPxParsedFunctionLineGraph::JKQTPxParsedFunctionLineGraph(JKQtPlotter *parent):
JKQTPxFunctionLineGraph(parent)
{
fdata.parser=new JKQTPMathParser();
fdata.node=NULL;
fdata.varcount=0;
function="";
parameterColumn=-1;
set_params(&fdata);
set_plotFunction(JKQTPxParsedFunctionLineGraphFunction);
efdata.parser=new JKQTPMathParser();
efdata.node=NULL;
efdata.varcount=0;
errorFunction="";
errorParameterColumn=-1;
set_errorParams(&efdata);
set_errorPlotFunction(JKQTPxParsedFunctionLineGraphFunction);
}
JKQTPxParsedFunctionLineGraph::~JKQTPxParsedFunctionLineGraph() JKQTPxParsedFunctionLineGraph::~JKQTPxParsedFunctionLineGraph()
{ {
if (fdata.node) delete fdata.node; if (fdata.node) delete fdata.node;
@ -87,8 +106,8 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
{ {
collectParameters(); collectParameters();
QElapsedTimer timer; //QElapsedTimer timer;
timer.start(); //timer.start();
for (int i=0; i<fdata.varcount; i++) { for (int i=0; i<fdata.varcount; i++) {
fdata.parser->deleteVariable(std::string("p")+jkqtp_inttostr(i+1)); fdata.parser->deleteVariable(std::string("p")+jkqtp_inttostr(i+1));
} }
@ -113,7 +132,7 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
} }
fdata.parser->addVariableDouble(std::string("x"), 0.0); fdata.parser->addVariableDouble(std::string("x"), 0.0);
if (fdata.node) delete fdata.node; if (fdata.node) delete fdata.node;
qint64 t=timer.elapsed(); //qint64 t=timer.elapsed();
//qDebug()<<"createPlotData(): adding variables: "<<t<<"ms"; //qDebug()<<"createPlotData(): adding variables: "<<t<<"ms";
@ -123,7 +142,7 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
//qDebug()<<QString("parser error: %1").arg(E.what()); //qDebug()<<QString("parser error: %1").arg(E.what());
} }
qint64 t0=timer.elapsed(); //qint64 t0=timer.elapsed();
for (int i=0; i<efdata.varcount; i++) { for (int i=0; i<efdata.varcount; i++) {
efdata.parser->deleteVariable(std::string("p")+jkqtp_inttostr(i+1)); efdata.parser->deleteVariable(std::string("p")+jkqtp_inttostr(i+1));
} }
@ -148,7 +167,7 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
} }
efdata.parser->addVariableDouble(std::string("x"), 0.0); efdata.parser->addVariableDouble(std::string("x"), 0.0);
if (efdata.node) delete efdata.node; if (efdata.node) delete efdata.node;
qint64 t=timer.elapsed(); //qint64 t=timer.elapsed();
//qDebug()<<"createPlotData(): adding variables: "<<t-t0<<"ms"; //qDebug()<<"createPlotData(): adding variables: "<<t-t0<<"ms";
efdata.node=efdata.parser->parse(errorFunction.toStdString()); efdata.node=efdata.parser->parse(errorFunction.toStdString());
//qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms"; //qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms";
@ -161,7 +180,7 @@ void JKQTPxParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
set_errorParams(&efdata); set_errorParams(&efdata);
set_errorPlotFunction(JKQTPxParsedFunctionLineGraphFunction); set_errorPlotFunction(JKQTPxParsedFunctionLineGraphFunction);
qint64 t=timer.elapsed(); //qint64 t=timer.elapsed();
JKQTPxFunctionLineGraph::createPlotData(false); JKQTPxFunctionLineGraph::createPlotData(false);
//qDebug()<<"createPlotData(): JKQTPxFunctionLineGraph::createPlotData(): "<<timer.elapsed()-t<<"ms"; //qDebug()<<"createPlotData(): JKQTPxFunctionLineGraph::createPlotData(): "<<timer.elapsed()-t<<"ms";

View File

@ -31,6 +31,7 @@
// forward declarations // forward declarations
class JKQtBasePlotter; class JKQtBasePlotter;
class JKQtPlotter;
struct JKQTPxParsedFunctionLineGraphFunctionData { struct JKQTPxParsedFunctionLineGraphFunctionData {
@ -53,9 +54,12 @@ class LIB_EXPORT JKQTPxParsedFunctionLineGraph: public JKQTPxFunctionLineGraph {
/** \brief class constructor */ /** \brief class constructor */
JKQTPxParsedFunctionLineGraph(JKQtBasePlotter* parent=NULL); JKQTPxParsedFunctionLineGraph(JKQtBasePlotter* parent=NULL);
/** \brief class constructor */
JKQTPxParsedFunctionLineGraph(JKQtPlotter* parent);
/** \brief class destructor */ /** \brief class destructor */
~JKQTPxParsedFunctionLineGraph(); virtual ~JKQTPxParsedFunctionLineGraph();
JKQTPGET_SET_MACRO(QList<double>, parameters) JKQTPGET_SET_MACRO(QList<double>, parameters)
JKQTPGET_SET_MACRO(QString, function) JKQTPGET_SET_MACRO(QString, function)

View File

@ -33,7 +33,7 @@
#ifndef JKQTTOOLS_H #ifndef JKQTTOOLS_H
#define JKQTTOOLS_H #define JKQTTOOLS_H
#include "../lib_imexport.h" #include "jkqtp_imexport.h"
#include <QSettings> #include <QSettings>
#include <QWidget> #include <QWidget>
#include <QSplitter> #include <QSplitter>

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,47 @@
#include <QApplication>
#include "jkqtplotter.h"
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;
JKQTPdatastore* ds=plot.getDatastore();
// 2. now we create data for a simple plot (a sine curve)
QVector<double> X, Y;
const int Ndata=100;
for (int i=0; i<Ndata; i++) {
const double x=double(i)/double(Ndata)*8.0*M_PI;
X<<x;
Y<<sin(x);
}
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
// Note: In this step the data is copied (of not specified otherwise), so you can
// reuse X and Y afterwards!
// the variables columnX and columnY will contain the internal column ID of the newly
// created columns with names "x" and "y" and the (copied) data from X and Y.
size_t columnX=ds->addCopiedColumn(X, "x");
size_t columnY=ds->addCopiedColumn(Y, "y");
// 4. create a graph in the plot, which plots the dataset X/Y:
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
graph1->set_title(QObject::tr("sine graph"));
// 5. add the graph to the plot, so it is actually displayed
plot.addGraph(graph1);
// 6. autoscale the plot so the graph is contained
plot.zoomToFit();
// show plotter and make it a decent size
plot.show();
plot.resize(600,400);
return app.exec();
}

View File

@ -0,0 +1,16 @@
# source code for this simple demo
SOURCES = jkqtplotter_simpletest.cpp
# configure Qt
CONFIG += qt
QT += core gui svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# output executable name
TARGET = jkqtplotter_simpletest
# include JKQtPlotter source code
include(../../jkqtplotter.pri)
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER