From 3c8bdd71c7f8c65714252dc67fd43b5ade0d1dfc Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sun, 18 Nov 2018 11:59:30 +0100 Subject: [PATCH] modernization of code: C++11, removed warnings, using templates in JKQTPDatastore --- jkqtmathtext.cpp | 88 +- jkqtmathtext.h | 6 +- jkqtpbaseelements.h | 2 +- jkqtpbaseplotter.cpp | 126 +-- jkqtpbaseplotter.h | 48 +- jkqtpdatastorage.cpp | 758 +++--------------- jkqtpdatastorage.h | 756 +++++------------ jkqtpelements.cpp | 466 +++++------ jkqtpelements.h | 74 +- jkqtpgeoelements.h | 4 +- jkqtpimageelements.cpp | 94 +-- jkqtpimageelements.h | 56 +- jkqtpimagetools.cpp | 258 +++--- jkqtpimagetools.h | 8 +- jkqtplotter.cpp | 4 +- jkqtplotter.h | 8 +- jkqtpmathparser.cpp | 76 +- jkqtpmathparser.h | 10 +- jkqtpparsedfunctionelements.cpp | 10 +- jkqtpparsedfunctionelements.h | 2 +- jkqtpplotsmodel.cpp | 10 +- jkqtptools.cpp | 6 +- jkqtptools.h | 79 +- .../jkqtplot_test/EmfEngine/src/EmfEngine.cpp | 12 +- test/jkqtplot_test/EmfEngine/src/EmfEngine.h | 2 +- test/jkqtplot_test/testmain.cpp | 14 +- 26 files changed, 1071 insertions(+), 1906 deletions(-) diff --git a/jkqtmathtext.cpp b/jkqtmathtext.cpp index 780d5dcf48..5819ae2a9b 100644 --- a/jkqtmathtext.cpp +++ b/jkqtmathtext.cpp @@ -443,7 +443,7 @@ JKQTmathText::MTinstruction1Node::MTinstruction1Node(JKQTmathText* parent, QStri } JKQTmathText::MTinstruction1Node::~MTinstruction1Node() { - if (child!=NULL) delete child; + if (child!=nullptr) delete child; } void JKQTmathText::MTinstruction1Node::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -569,7 +569,7 @@ JKQTmathText::MTsubscriptNode::MTsubscriptNode(JKQTmathText* parent, MTnode* chi } JKQTmathText::MTsubscriptNode::~MTsubscriptNode() { - if (child!=NULL) delete child; + if (child!=nullptr) delete child; } void JKQTmathText::MTsubscriptNode::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -629,7 +629,7 @@ JKQTmathText::MTsqrtNode::MTsqrtNode(JKQTmathText* parent, MTnode* child, int de } JKQTmathText::MTsqrtNode::~MTsqrtNode() { - if (child!=NULL) delete child; + if (child!=nullptr) delete child; } void JKQTmathText::MTsqrtNode::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -711,8 +711,8 @@ JKQTmathText::MTfracNode::MTfracNode(JKQTmathText* parent, MTnode* child_top, MT } JKQTmathText::MTfracNode::~MTfracNode() { - if (child1!=NULL) delete child1; - if (child2!=NULL) delete child2; + if (child1!=nullptr) delete child1; + if (child2!=nullptr) delete child2; } void JKQTmathText::MTfracNode::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -990,7 +990,7 @@ double JKQTmathText::MTmatrixNode::draw(QPainter& painter, double x, double y, J //widths[i].resize(columns); //baselines[i]=heights[i]=widths[i]; for (int j=0; jgetSize(painter, ev1, width1, baselineHeight1, overallHeight1, strikeoutPos);; + if (children[i].at(j)!=nullptr) children[i].at(j)->getSize(painter, ev1, width1, baselineHeight1, overallHeight1, strikeoutPos);; /*widths[i].operator[](j)=width1; baselines[i].operator[](j)=baselineHeight; heights[i].operator[](j)=overallHeight1;*/ @@ -1054,7 +1054,7 @@ JKQTmathText::MTdecoratedNode::MTdecoratedNode(JKQTmathText* parent, MTdecoratio } JKQTmathText::MTdecoratedNode::~MTdecoratedNode() { - if (child!=NULL) delete child; + if (child!=nullptr) delete child; } void JKQTmathText::MTdecoratedNode::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -1209,7 +1209,7 @@ JKQTmathText::MTsuperscriptNode::MTsuperscriptNode(JKQTmathText* parent, MTnode* } JKQTmathText::MTsuperscriptNode::~MTsuperscriptNode() { - if (child!=NULL) delete child; + if (child!=nullptr) delete child; } void JKQTmathText::MTsuperscriptNode::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -1272,7 +1272,7 @@ JKQTmathText::MTbraceNode::MTbraceNode(JKQTmathText* parent, QString openbrace, } JKQTmathText::MTbraceNode::~MTbraceNode() { - if (child!=NULL) delete child; + if (child!=nullptr) delete child; } void JKQTmathText::MTbraceNode::getSizeInternal(QPainter& painter, JKQTmathText::MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos) { @@ -1621,9 +1621,9 @@ void JKQTmathText::MTlistNode::getSizeInternal(QPainter& painter, JKQTmathText:: } else if (smb) { QString s=smb->get_symbolName(); if (subsupOperations.contains(s)) { - MTsubscriptNode* subn=NULL; + MTsubscriptNode* subn=nullptr; if (i+1(nodes[i+1]); - MTsuperscriptNode* supn=NULL; + MTsuperscriptNode* supn=nullptr; if (i+2(nodes[i+2]); //std::cout<<"symbol ='"<get_symbolName(); if (subsupOperations.contains(s)) { - MTsubscriptNode* subn=NULL; + MTsubscriptNode* subn=nullptr; if (i+1(nodes[i+1]); - MTsuperscriptNode* supn=NULL; + MTsuperscriptNode* supn=nullptr; if (i+2(nodes[i+2]); //std::cout<<"symbol ='"<addNode(new MTfracNode(this, n1, n2, MTFMfrac)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="dfrac") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMdfrac)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="tfrac") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMtfrac)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="stackrel") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMstackrel)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="binom") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTbraceNode(this, "(", ")", new MTfracNode(this, n1, n2, MTFMstackrel))); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="underbrace") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMunderbrace)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="underset") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMunderset)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="overbrace") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMoverbrace)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); } else if (name=="overset") { MTnode* n1=parseLatexString(true); - MTnode* n2=NULL; + MTnode* n2=nullptr; if (getToken()==MTTopenbrace) n2=parseLatexString(true); if (n1 && n2) nl->addNode(new MTfracNode(this, n1, n2, MTFMoverset)); else error_list.append(tr("error @ ch. %1: expected two arguments in '{' braces after '%2' command").arg(currentTokenID).arg(name)); @@ -3757,8 +3757,8 @@ JKQTmathText::MTnode* JKQTmathText::parseLatexString(bool get, QString quitOnClo if (!parsingMathEnvironment) nl->addNode(new MTwhitespaceNode(this)); } else if (currentToken==MTTunderscore) { getToken(); - MTnode* child=NULL; - MTnode* child2=NULL; + MTnode* child=nullptr; + MTnode* child2=nullptr; if (currentToken==MTTinstruction) { QString name=currentTokenName; getToken(); // look at next token @@ -3783,12 +3783,12 @@ JKQTmathText::MTnode* JKQTmathText::parseLatexString(bool get, QString quitOnClo } else { getNew=false; } - if (child!=NULL) nl->addNode(new MTsubscriptNode(this, child)); - if (child2!=NULL) nl->addNode(child2); + if (child!=nullptr) nl->addNode(new MTsubscriptNode(this, child)); + if (child2!=nullptr) nl->addNode(child2); } else if (currentToken==MTThat) { getToken(); - MTnode* child=NULL; - MTnode* child2=NULL; + MTnode* child=nullptr; + MTnode* child2=nullptr; if (currentToken==MTTinstruction) { QString name=currentTokenName; getToken(); // look at next token @@ -3813,8 +3813,8 @@ JKQTmathText::MTnode* JKQTmathText::parseLatexString(bool get, QString quitOnClo } else { getNew=false; } - if (child!=NULL) nl->addNode(new MTsuperscriptNode(this, child)); - if (child2!=NULL) nl->addNode(child2); + if (child!=nullptr) nl->addNode(new MTsuperscriptNode(this, child)); + if (child2!=nullptr) nl->addNode(child2); } else if (currentToken==MTTopenbrace) { nl->addNode(parseLatexString(true)); } else if (currentToken==MTTclosebrace) { @@ -3872,8 +3872,8 @@ bool JKQTmathText::parse(QString text){ if (parsedNode && parseString==ntext) return true; - if (parsedNode!=NULL) delete parsedNode; - if (unparsedNode!=NULL) delete unparsedNode; + if (parsedNode!=nullptr) delete parsedNode; + if (unparsedNode!=nullptr) delete unparsedNode; parseString=ntext; currentTokenID=-1; @@ -3883,12 +3883,12 @@ bool JKQTmathText::parse(QString text){ error_list.clear(); parsedNode=parseLatexString(true); unparsedNode=new MTplainTextNode(this, text, false); - return (parsedNode!=NULL); + return (parsedNode!=nullptr); } QSizeF JKQTmathText::getSize(QPainter& painter){ - if (getTree()!=NULL) { + if (getTree()!=nullptr) { double w=0, a=0, d=0, s=0; getSizeDetail(painter, w, a, d, s); return QSizeF(w, a+d); @@ -3913,7 +3913,7 @@ void JKQTmathText::getSizeDetail(QPainter& painter, double& width, double& ascen ascent=0; descent=0; strikeoutPos=0; - if (getTree()!=NULL) { + if (getTree()!=nullptr) { MTenvironment ev; ev.color=fontColor; ev.fontSize=fontSize; @@ -3928,7 +3928,7 @@ void JKQTmathText::getSizeDetail(QPainter& painter, double& width, double& ascen } void JKQTmathText::draw(QPainter& painter, double x, double y, bool drawBoxes){ - if (getTree()!=NULL) { + if (getTree()!=nullptr) { MTenvironment ev; ev.color=fontColor; ev.fontSize=fontSize; @@ -3938,7 +3938,7 @@ void JKQTmathText::draw(QPainter& painter, double x, double y, bool drawBoxes){ } void JKQTmathText::draw(QPainter& painter, int flags, QRectF rect, bool drawBoxes) { - if (getTree()!=NULL) { + if (getTree()!=nullptr) { MTenvironment ev; ev.color=fontColor; ev.fontSize=fontSize; diff --git a/jkqtmathtext.h b/jkqtmathtext.h index a03e22c99d..1a2013dc45 100644 --- a/jkqtmathtext.h +++ b/jkqtmathtext.h @@ -139,7 +139,7 @@ class LIB_EXPORT JKQTmathText : public QObject { Q_OBJECT public: /** \brief class constructor */ - JKQTmathText(QObject * parent = NULL); + JKQTmathText(QObject * parent = nullptr); /** \brief class destructor */ ~JKQTmathText(); /** \brief load the object settings from the given QSettings object with the given name prefix */ @@ -179,7 +179,7 @@ class LIB_EXPORT JKQTmathText : public QObject { void useLatexFonts(QString prefix=QString(""), QString postfix=QString("")); /** \brief convert LaTeX to HTML. returns \c ok=true on success and \c ok=false else. */ - QString toHtml(bool* ok=NULL, double fontPointSize=10); + QString toHtml(bool* ok=nullptr, double fontPointSize=10); /*! \brief used to specify the font encoding used for drawing @@ -713,7 +713,7 @@ inline uint qHash(const JKQTmathText::tbrDataH& data) { class LIB_EXPORT JKQTMathTextLabel: public QLabel { Q_OBJECT public: - explicit JKQTMathTextLabel(QWidget* parent=NULL); + explicit JKQTMathTextLabel(QWidget* parent=nullptr); virtual ~JKQTMathTextLabel(); JKQTmathText* getMathText() const; diff --git a/jkqtpbaseelements.h b/jkqtpbaseelements.h index f1b0434c5e..62d935fd6a 100644 --- a/jkqtpbaseelements.h +++ b/jkqtpbaseelements.h @@ -973,7 +973,7 @@ class LIB_EXPORT JKQTPcoordinateAxis: public QObject { /** \brief calculates the maximum width and height (returned as QSize) of all tick labels. * Ascent and descent may also be returned in the two additional pointer arguments- */ - QSizeF getMaxTickLabelSize(JKQTPEnhancedPainter& painter, double* ascent=NULL, double* descent=NULL); + QSizeF getMaxTickLabelSize(JKQTPEnhancedPainter& painter, double* ascent=nullptr, double* descent=nullptr); }; diff --git a/jkqtpbaseplotter.cpp b/jkqtpbaseplotter.cpp index 9e9211e72b..348ce944b5 100644 --- a/jkqtpbaseplotter.cpp +++ b/jkqtpbaseplotter.cpp @@ -148,7 +148,7 @@ JKQtBasePlotter::JKQtBasePlotter(bool datastore_internal, QObject* parent, JKQTP QObject(parent), m_plotsModel(nullptr), xAxis(nullptr), yAxis(nullptr) { - dataColumnsListWidget=NULL; + dataColumnsListWidget=nullptr; printMagnification=1.0; printZoomFactor=1.0; printSizeX_Millimeter=1.0; @@ -157,7 +157,7 @@ JKQtBasePlotter::JKQtBasePlotter(bool datastore_internal, QObject* parent, JKQTP printDoUpdate=true; emitPlotSignals=true; - masterPlotter=NULL; + masterPlotter=nullptr; masterSynchronizeWidth=false; masterSynchronizeHeight=false; fontSizePrintMultiplier=1; @@ -268,7 +268,7 @@ JKQtBasePlotter::JKQtBasePlotter(bool datastore_internal, QObject* parent, JKQTP JKQtBasePlotter::~JKQtBasePlotter(){ clearGraphs(false); - if (datastoreInternal && datastore!=NULL) delete datastore; + if (datastoreInternal && datastore!=nullptr) delete datastore; delete xAxis; delete yAxis; } @@ -279,18 +279,18 @@ void JKQtBasePlotter::setGrid(bool val) { }; void JKQtBasePlotter::useExternalDatastore(JKQTPdatastore* newStore){ - if (datastoreInternal && datastore!=NULL) { + if (datastoreInternal && datastore!=nullptr) { delete datastore; - datastore=NULL; + datastore=nullptr; } datastore=newStore; datastoreInternal=false; }; void JKQtBasePlotter::useAsInternalDatastore(JKQTPdatastore* newStore){ - if (datastoreInternal && datastore!=NULL) { + if (datastoreInternal && datastore!=nullptr) { delete datastore; - datastore=NULL; + datastore=nullptr; } datastore=newStore; datastoreInternal=true; @@ -306,9 +306,9 @@ void JKQtBasePlotter::useInternalDatastore(){ } void JKQtBasePlotter::forceInternalDatastore(){ - if (datastoreInternal && datastore!=NULL) { + if (datastoreInternal && datastore!=nullptr) { delete datastore; - datastore=NULL; + datastore=nullptr; } datastore=new JKQTPdatastore(); datastoreInternal=true; @@ -418,10 +418,10 @@ void JKQtBasePlotter::initSettings() { void JKQtBasePlotter::zoomIn(double factor) { //std::cout<<(double)event->delta()/120.0<<": "<(round(static_cast(plotWidth)/2.0-static_cast(plotWidth)/(2.0*factor)))); + double xmax=p2x(static_cast(round(static_cast(plotWidth)/2.0+static_cast(plotWidth)/(2.0*factor)))); + double ymin=p2y(static_cast(round(static_cast(plotHeight)/2.0+static_cast(plotHeight)/(2.0*factor)))); + double ymax=p2y(static_cast(round(static_cast(plotHeight)/2.0-static_cast(plotHeight)/(2.0*factor)))); xAxis->setRange(xmin, xmax); @@ -791,7 +791,7 @@ void JKQtBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){ QFontMetrics fm=fontMetrics(); QString test="�Aquator"; int labelHeight=fm.size(Qt::TextSingleLine, test).height()*1.5; - //if (mousePosLabel!=NULL) labelHeight=mousePosLabel->height(); + //if (mousePosLabel!=nullptr) labelHeight=mousePosLabel->height(); iplotBorderTop=iplotBorderTop+(labelHeight-plotBorderTop)*1.1; }*/ @@ -852,24 +852,24 @@ void JKQtBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){ // ENSURE ASPECT RATIO (if activated) //////////////////////////////////////////////////////////////////// if (maintainAspectRatio && (!xAxis->isLogAxis()) && (!xAxis->isLogAxis())) { - double currRatio=(double)plotWidth/(double)plotHeight; + double currRatio=static_cast(plotWidth)/static_cast(plotHeight); double newPlotWidth=plotWidth; double newPlotHeight=plotHeight; double dx=0; double dy=0; if (currRatio!=aspectRatio) { if (aspectRatio>=currRatio) { - newPlotWidth=aspectRatio*(double)plotHeight; + newPlotWidth=aspectRatio*static_cast(plotHeight); } else { - newPlotHeight=(double)plotWidth/aspectRatio; + newPlotHeight=static_cast(plotWidth)/aspectRatio; } dx=plotWidth-newPlotWidth; dy=plotHeight-newPlotHeight; if (dx<0) { newPlotWidth=plotWidth; - newPlotHeight=(double)plotWidth/aspectRatio; + newPlotHeight=static_cast(plotWidth)/aspectRatio; } else if (dy<0) { - newPlotWidth=aspectRatio*(double)plotHeight; + newPlotWidth=aspectRatio*static_cast(plotHeight); newPlotHeight=plotHeight; } dx=plotWidth-newPlotWidth; @@ -1399,12 +1399,12 @@ void JKQtBasePlotter::print(QPrinter* printer, bool displayPreview) { // select a printer - if (p==NULL) { + if (p==nullptr) { p=new QPrinter(); p->setPrinterName(currentPrinter); delP=true; - QPrintDialog *dialog = new QPrintDialog(p, NULL); + QPrintDialog *dialog = new QPrintDialog(p, nullptr); dialog->setWindowTitle(tr("Print Plot")); if (dialog->exec() != QDialog::Accepted) { delete p; @@ -1437,7 +1437,7 @@ void JKQtBasePlotter::printpreview(QPrinter *p, bool setabsolutesize) { backgroundColor=exportBackgroundColor; lineWidthMultiplier=lineWidthPrintMultiplier; fontSizeMultiplier=fontSizePrintMultiplier; - exportPreviewLabel=NULL; + exportPreviewLabel=nullptr; printSizeX_Millimeter=widgetWidth; printSizeY_Millimeter=widgetHeight; printAspect=1; @@ -1446,7 +1446,7 @@ void JKQtBasePlotter::printpreview(QPrinter *p, bool setabsolutesize) { printSetAbsolutePageSize=setabsolutesize; printKeepAbsoluteFontSizes=false; printScaleToPagesize=true; - QDialog* dlg=new QDialog(NULL, Qt::WindowMinMaxButtonsHint); + QDialog* dlg=new QDialog(nullptr, Qt::WindowMinMaxButtonsHint); dlg->setSizeGripEnabled(true); //printZoomFactor=0.95; //printMagnification=1.5; @@ -1565,7 +1565,7 @@ void JKQtBasePlotter::printpreview(QPrinter *p, bool setabsolutesize) { printpreviewPaintRequested(p); } delete dlg; - printPreview=NULL; + printPreview=nullptr; lineWidthMultiplier=lw; fontSizeMultiplier=fs; backgroundColor=bc; @@ -1582,7 +1582,7 @@ bool JKQtBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut backgroundColor=exportBackgroundColor; lineWidthMultiplier=lineWidthPrintMultiplier; fontSizeMultiplier=fontSizePrintMultiplier; - exportPreviewLabel=NULL; + exportPreviewLabel=nullptr; printMagnification=1.0; paintMagnification=1.0; gridPrintingCalc(); @@ -1610,7 +1610,7 @@ bool JKQtBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut printSetAbsolutePageSize=setAbsolutePaperSize; printKeepAbsoluteFontSizes=true; printScaleToPagesize=false; - QDialog* dlg=new QDialog(NULL, Qt::WindowMinMaxButtonsHint); + QDialog* dlg=new QDialog(nullptr, Qt::WindowMinMaxButtonsHint); dlg->setSizeGripEnabled(true); //printZoomFactor=0.95; //printMagnification=1.5; @@ -1780,7 +1780,7 @@ bool JKQtBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut delete printer; } delete dlg; - printPreview=NULL; + printPreview=nullptr; lineWidthMultiplier=lw; fontSizeMultiplier=fs; backgroundColor=bc; @@ -1793,7 +1793,7 @@ bool JKQtBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolut } bool JKQtBasePlotter::exportpreview(QSizeF pageSize, bool unitIsMM) { - printPreview=NULL; + printPreview=nullptr; printSizeX_Millimeter=pageSize.width(); printSizeY_Millimeter=pageSize.height(); printAspect=1; @@ -1803,7 +1803,7 @@ bool JKQtBasePlotter::exportpreview(QSizeF pageSize, bool unitIsMM) { printSetAbsolutePageSize=true; printScaleToPagesize=false; printKeepAbsoluteFontSizes=true; - QDialog* dlg=new QDialog(NULL, Qt::WindowMinMaxButtonsHint); + QDialog* dlg=new QDialog(nullptr, Qt::WindowMinMaxButtonsHint); dlg->setSizeGripEnabled(true); //printZoomFactor=0.95; //printMagnification=1.5; @@ -2560,7 +2560,7 @@ void JKQtBasePlotter::saveData(QString filename, QString format) { if (fn.isEmpty()) { QString selectedFilter=currentDataFileFormat; //qDebug()<<"before: currentSaveDirectory="<(plotWidth)/(double)(key_item_width*kfm.width('X'))); bool colfirst=true; if (keyPosition==JKQTPkeyInsideTopLeft || keyPosition==JKQTPkeyInsideTopRight @@ -3633,13 +3633,13 @@ void JKQtBasePlotter::getKeyExtent(JKQTPEnhancedPainter& painter, double* width, f.setFamily(keyFont); f.setPointSizeF(keyFontSize*fontSizeMultiplier); QFontMetricsF kfm(f); - if (text_height!=NULL) *text_height=key_item_height*kfm.width('X'); + if (text_height!=nullptr) *text_height=key_item_height*kfm.width('X'); if (keyLayout==JKQTPkeyLayoutOneColumn) { int keyHeight=graphs.size(); double w=0; double h=0; painter.setFont(f); - if (text_height!=NULL) *text_height=0; + if (text_height!=nullptr) *text_height=0; for (int i=0; ikeyYSeparation*kfm.width('X')) h=h-keyYSeparation*kfm.width('X'); if (height) *height=h;//keyHeight*key_item_height*kfm.width('X'); @@ -3670,7 +3670,7 @@ void JKQtBasePlotter::getKeyExtent(JKQTPEnhancedPainter& painter, double* width, double w=0; double h=0; painter.setFont(f); - if (text_width!=NULL) *text_width=0; + if (text_width!=nullptr) *text_width=0; for (int i=0; i(keyXSeparation)*kfm.width('X')) w=w-(keyXSeparation)*kfm.width('X'); if (width) *width=w;//keyHeight*key_item_height*kfm.width('X'); @@ -3736,9 +3736,9 @@ void JKQtBasePlotter::getKeyExtent(JKQTPEnhancedPainter& painter, double* width, if (keyPosition==JKQTPkeyInsideTopLeft || keyPosition==JKQTPkeyInsideTopRight || keyPosition==JKQTPkeyOutsideTopLeft || keyPosition==JKQTPkeyOutsideTopRight) { if (keyAutosize) { - lines=(int)floor((double)plotHeight/(double)(txtH+(keyYSeparation)*kfm.width('X'))); + lines=(int)floor(static_cast(plotHeight)/(double)(txtH+(keyYSeparation)*kfm.width('X'))); } else { - lines=(int)floor((double)plotHeight/(double)((key_item_height+keyYSeparation)*kfm.width('X'))); + lines=(int)floor(static_cast(plotHeight)/(double)((key_item_height+keyYSeparation)*kfm.width('X'))); } columns=(int)ceil((double)keyHeight/(double)lines); lines=qMin((double)lines, keyHeight); @@ -3752,12 +3752,12 @@ void JKQtBasePlotter::getKeyExtent(JKQTPEnhancedPainter& painter, double* width, if (width) *width=(w+(key_line_length+3.0*keyXSeparation)*kfm.width('X'))*columns; if (height) *height=lines*(txtH+keyYSeparation*kfm.width('X')); if (lines>0) *height=*height-keyYSeparation*kfm.width('X'); - if (text_width!=NULL) *text_width=w; + if (text_width!=nullptr) *text_width=w; } else { if (width) *width=(key_item_width+2.0*keyXSeparation)*kfm.width('X')*columns; if (height) *height=lines*(key_item_height+keyYSeparation)*kfm.width('X'); if (lines>0) *height=*height-keyYSeparation*kfm.width('X'); - if (text_width!=NULL) *text_width=(key_item_width-(key_line_length+keyXSeparation))*kfm.width('X'); + if (text_width!=nullptr) *text_width=(key_item_width-(key_line_length+keyXSeparation))*kfm.width('X'); } #ifdef SHOW_JKQTPLOTTER_DEBUG qDebug()<<"getKeyExtent(): mult-column: columns="<count(); i++) { @@ -4361,7 +4361,7 @@ void JKQtBasePlotter::getDataColumnsByUserItemChanged(QListWidgetItem */*widgeti } void JKQtBasePlotter::showPlotData() { - QDialog* dlg=new QDialog(NULL,Qt::Dialog|Qt::WindowCloseButtonHint|Qt::WindowMinMaxButtonsHint); + QDialog* dlg=new QDialog(nullptr,Qt::Dialog|Qt::WindowCloseButtonHint|Qt::WindowMinMaxButtonsHint); dlg->setWindowTitle(tr("Plot data table")); dlg->setSizeGripEnabled(true); diff --git a/jkqtpbaseplotter.h b/jkqtpbaseplotter.h index ca26c83625..fdb8d93505 100644 --- a/jkqtpbaseplotter.h +++ b/jkqtpbaseplotter.h @@ -202,14 +202,14 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { /** \brief used to plot LaTeX markup */ JKQTmathText mathText; + /** \brief model representing all Plots in this plotter and showing their visible/invisible state */ + JKQTPPlotsModel* m_plotsModel; + /** \brief object used for the x-axis */ JKQTPhorizontalAxis* xAxis; /** \brief object used for the y-axis */ JKQTPverticalAxis* yAxis; - /** \brief model representing all Plots in this plotter and showing their visible/invisible state */ - JKQTPPlotsModel* m_plotsModel; - /** \brief filename for the ini file in which to save the user settings * \see jkqtplotter_base_userprops */ @@ -502,7 +502,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { * * The implementation in here returns zero size! */ - virtual void getKeyExtent(JKQTPEnhancedPainter& painter, double *width, double *height, double *text_width=NULL, double *text_height=NULL, int *columns_count=NULL, int* lines_count=NULL); + virtual void getKeyExtent(JKQTPEnhancedPainter& painter, double *width, double *height, double *text_width=nullptr, double *text_height=nullptr, int *columns_count=nullptr, int* lines_count=nullptr); /** \brief QAction which triggers saving of the plot as an image */ QAction* actSavePlot; /** \brief QAction which triggers saving of the data used for the plot */ @@ -689,8 +689,8 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { /** \brief save the current plot data as a Semicolon Separated Values (CSV) file for german Excel, i.e. with comma as decimal separator*/ virtual void saveAsGerExcelCSV(QString filename=QString("")); - /** \brief print the current plot, if printer is \c NULL a printer selection dialog is displayed */ - void print(QPrinter* printer=NULL, bool displayPreview=true); + /** \brief print the current plot, if printer is \c nullptr a printer selection dialog is displayed */ + void print(QPrinter* printer=nullptr, bool displayPreview=true); /** \brief this method zooms the graph so that all plotted datapoints are visible. * @@ -711,7 +711,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { /** \brief zooms out of the graph (the same as turning the mouse wheel) by the given factor */ void zoomOut(double factor=2.0) { zoomIn(1.0/factor); - }; + } /** \brief set the datarange of all current graphs to the given values */ void setGraphsDataRange(long long datarange_start, long long datarange_end); @@ -749,7 +749,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { * will be managed (freed) by this class. If \a datastore_internal is \c false the class will use tha datastore provided * in \a datast as an external datastore. You can modify this later by using useInternalDatastore() and useExternalDatastore(). */ - JKQtBasePlotter(bool datastore_internal=true, QObject* parent=NULL, JKQTPdatastore* datast=NULL); + JKQtBasePlotter(bool datastore_internal=true, QObject* parent=nullptr, JKQTPdatastore* datast=nullptr); /** \brief class destructor */ virtual ~JKQtBasePlotter(); @@ -901,16 +901,16 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { void setAbsoluteXY(double xminn, double xmaxx, double yminn, double ymaxx); /** \brief returns the absolute x-axis min */ - inline double getAbsoluteXMin() const {return xAxis->getAbsoluteMin(); }; + inline double getAbsoluteXMin() const {return xAxis->getAbsoluteMin(); } /** \brief returns the absolute x-axis max */ - inline double getAbsoluteXMax() const {return xAxis->getAbsoluteMax(); }; + inline double getAbsoluteXMax() const {return xAxis->getAbsoluteMax(); } /** \brief returns the absolute y-axis min */ - inline double getAbsoluteYMin() const {return yAxis->getAbsoluteMin(); }; + inline double getAbsoluteYMin() const {return yAxis->getAbsoluteMin(); } /** \brief returns the absolute y-axis max */ - inline double getAbsoluteYMax() const {return yAxis->getAbsoluteMax(); }; + inline double getAbsoluteYMax() const {return yAxis->getAbsoluteMax(); } /** \brief add a new plotter for grid printing mode */ @@ -920,32 +920,32 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { i.y=y; i.plotter=plotter; gridPrintingList.push_back(i); - }; + } /** \brief clear all additional plotters for grid printing mode */ inline void clearGridPrintingPlotters() { gridPrintingList.clear(); - }; + } /** \brief return x-pixel coordinate from time coordinate */ inline double x2p(double x) const { return xAxis->x2p(x); - }; + } /** \brief return y-pixel coordinate from y coordinate */ inline double y2p(double y) const { return yAxis->x2p(y); - }; + } /** \brief return time coordinate coordinate from x-pixel */ inline double p2x(long x) const { return xAxis->p2x(x); - }; + } /** \brief return y coordinate coordinate from y-pixel */ inline double p2y(long y) const { return yAxis->p2x(y); - }; + } /** \brief gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles */ int getNextStyle(); @@ -1066,11 +1066,11 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { JKQTPGET_MACRO(int, iplotBorderRight) JKQTPGET_MACRO(int, plotWidth) JKQTPGET_MACRO(int, plotHeight) - inline JKQTmathText* get_mathText() { return &mathText; }; - inline JKQTPhorizontalAxis* getXAxis() { return xAxis; }; - inline JKQTPverticalAxis* getYAxis() { return yAxis; }; - inline JKQTPhorizontalAxis* get_xAxis() { return xAxis; }; - inline JKQTPverticalAxis* get_yAxis() { return yAxis; }; + inline JKQTmathText* get_mathText() { return &mathText; } + inline JKQTPhorizontalAxis* getXAxis() { return xAxis; } + inline JKQTPverticalAxis* getYAxis() { return yAxis; } + inline JKQTPhorizontalAxis* get_xAxis() { return xAxis; } + inline JKQTPverticalAxis* get_yAxis() { return yAxis; } JKQTPGET_MACRO(QAction*, actSavePlot) @@ -1346,7 +1346,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject { /** \brief add a new overlay elements from a QList */ void addOverlayElements(const QList& gr); - QVector getBoundingLinesX1Y1(QRectF *rect=NULL) const; + QVector getBoundingLinesX1Y1(QRectF *rect=nullptr) const; signals: /** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse) */ diff --git a/jkqtpdatastorage.cpp b/jkqtpdatastorage.cpp index 745e7c692d..860253c96e 100644 --- a/jkqtpdatastorage.cpp +++ b/jkqtpdatastorage.cpp @@ -32,18 +32,44 @@ /************************************************************************************************************************** * JKQTPcolumn **************************************************************************************************************************/ -unsigned long long JKQTPcolumn::getRows() const { +//////////////////////////////////////////////////////////////////////////////////////////////// +JKQTPcolumn::JKQTPcolumn() +{ + datastore=nullptr; + name=""; + datastoreItem=0; + datastoreOffset=0; + valid=false; +} + +JKQTPcolumn::JKQTPcolumn(JKQTPdatastore *datastore, const QString &name, size_t datastoreItem, size_t datastoreOffset) +{ + this->datastore=datastore; + this->datastoreItem=datastoreItem; + this->datastoreOffset=datastoreOffset; + this->name=name; + valid=true; + +} + +JKQTPcolumn::~JKQTPcolumn() +{ + +} + +size_t JKQTPcolumn::getRows() const { if (!valid || !datastore) return 0; JKQTPdatastoreItem* i=datastore->getItem(datastoreItem); if (i) return i->get_rows(); else return 0; } +//////////////////////////////////////////////////////////////////////////////////////////////// void JKQTPcolumn::copyData(QVector ©To) const { double* d=getPointer(0); copyTo.clear(); - unsigned long long i, cnt=getRows(); + size_t i, cnt=getRows(); if (cnt>0) { copyTo.resize(cnt); for (i=0; i ©To) const } } +//////////////////////////////////////////////////////////////////////////////////////////////// QVector JKQTPcolumn::copyData() { QVector d; @@ -59,21 +86,24 @@ QVector JKQTPcolumn::copyData() return d; } -double JKQTPcolumn::getValue(unsigned long long n) const +//////////////////////////////////////////////////////////////////////////////////////////////// +double JKQTPcolumn::getValue(size_t n) const { if (!datastore) return 0; if (!datastore->getItem(datastoreItem)) return 0; return datastore->getItem(datastoreItem)->get(datastoreOffset, n); } -double *JKQTPcolumn::getPointer(unsigned long long n) const +//////////////////////////////////////////////////////////////////////////////////////////////// +double *JKQTPcolumn::getPointer(size_t n) const { if (!datastore) return 0; if (!datastore->getItem(datastoreItem)) return 0; return datastore->getItem(datastoreItem)->getPointer(datastoreOffset, n); } -void JKQTPcolumn::setValue(unsigned long long n, double val) +//////////////////////////////////////////////////////////////////////////////////////////////// +void JKQTPcolumn::setValue(size_t n, double val) { if (!datastore) return ; if (!datastore->getItem(datastoreItem)) return; @@ -83,44 +113,48 @@ void JKQTPcolumn::setValue(unsigned long long n, double val) -void JKQTPcolumn::copy(double* data, unsigned long long N, unsigned long long offset) { +//////////////////////////////////////////////////////////////////////////////////////////////// +void JKQTPcolumn::copy(double* data, size_t N, size_t offset) { if (!datastore) return ; JKQTPdatastoreItem* it=datastore->getItem(datastoreItem); if (!it) return; - for (unsigned long long i=0; iset(datastoreOffset, i+offset, data[i]); } } +//////////////////////////////////////////////////////////////////////////////////////////////// void JKQTPcolumn::exchange(double value, double replace) { if (!datastore) return ; - for (unsigned long long i=0; idataformat=JKQTPsingleColumn; this->allocated=false; - this->data=NULL; + this->data=nullptr; this->columns=0; this->rows=0; this->internal=true; } -JKQTPdatastoreItem::JKQTPdatastoreItem(size_t columns, unsigned long long rows){ +//////////////////////////////////////////////////////////////////////////////////////////////// +JKQTPdatastoreItem::JKQTPdatastoreItem(size_t columns, size_t rows){ this->internal=true; this->allocated=false; if (columns>1) { @@ -154,10 +190,11 @@ JKQTPdatastoreItem::JKQTPdatastoreItem(size_t columns, unsigned long long rows){ this->allocated=true; } -void JKQTPdatastoreItem::resizeColumns(unsigned long long new_rows) { - if (internal && allocated && data!=NULL) { +//////////////////////////////////////////////////////////////////////////////////////////////// +void JKQTPdatastoreItem::resizeColumns(size_t new_rows) { + if (internal && allocated && data!=nullptr) { free(data); - data=NULL; + data=nullptr; } data=(double*)calloc(columns*new_rows, sizeof(double)); rows=new_rows; @@ -165,7 +202,8 @@ void JKQTPdatastoreItem::resizeColumns(unsigned long long new_rows) { allocated=true; } -JKQTPdatastoreItem::JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, unsigned long long rows){ +//////////////////////////////////////////////////////////////////////////////////////////////// +JKQTPdatastoreItem::JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, size_t rows){ this->dataformat=dataformat; this->allocated=true; this->data=data; @@ -174,7 +212,8 @@ JKQTPdatastoreItem::JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, doub this->internal=false; } -JKQTPdatastoreItem::JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double *data, size_t columns, unsigned long long rows, bool internal) +//////////////////////////////////////////////////////////////////////////////////////////////// +JKQTPdatastoreItem::JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double *data, size_t columns, size_t rows, bool internal) { this->dataformat=dataformat; this->allocated=true; @@ -184,10 +223,11 @@ JKQTPdatastoreItem::JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, doub this->internal=internal; } +//////////////////////////////////////////////////////////////////////////////////////////////// JKQTPdatastoreItem::~JKQTPdatastoreItem(){ - if (internal && allocated && data!=NULL) { + if (internal && allocated && data!=nullptr) { free(data); - data=NULL; + data=nullptr; } } @@ -197,6 +237,7 @@ JKQTPdatastoreItem::~JKQTPdatastoreItem(){ * JKQTPdatastore **************************************************************************************************************************/ +//////////////////////////////////////////////////////////////////////////////////////////////// size_t JKQTPdatastore::addItem(JKQTPdatastoreItem* item) { /*items.push_back(item); return items.size()-1;*/ @@ -205,12 +246,14 @@ size_t JKQTPdatastore::addItem(JKQTPdatastoreItem* item) { return maxItemID-1; } +//////////////////////////////////////////////////////////////////////////////////////////////// size_t JKQTPdatastore::addColumn(JKQTPcolumn col) { columns.insert(maxColumnsID, col); maxColumnsID++; return maxColumnsID-1; } +//////////////////////////////////////////////////////////////////////////////////////////////// JKQTPdatastore::JKQTPdatastore() { maxItemID=0; @@ -235,7 +278,7 @@ void JKQTPdatastore::clear(){ columns.clear(); } -void JKQTPdatastore::deleteAllColumns(QString name, bool removeItems) { +void JKQTPdatastore::deleteAllColumns(const QString& name, bool removeItems) { QList ids; QMapIterator it(columns); while (it.hasNext()) { @@ -283,7 +326,7 @@ void JKQTPdatastore::deleteColumn(size_t column, bool removeItems) { columns.remove(column); } -int JKQTPdatastore::getColumnNum(QString name) { +int JKQTPdatastore::getColumnNum(const QString& name) { if (columns.size()<=0) return -1; QMapIterator it(columns); while (it.hasNext()) { @@ -293,7 +336,7 @@ int JKQTPdatastore::getColumnNum(QString name) { return -1; } -size_t JKQTPdatastore::ensureColumnNum(QString name) { +size_t JKQTPdatastore::ensureColumnNum(const QString& name) { if (columns.size()<=0) return -1; QMapIterator it(columns); while (it.hasNext()) { @@ -308,20 +351,20 @@ JKQTPcolumn JKQTPdatastore::getColumn(size_t i) const return columns.value(i); } -size_t JKQTPdatastore::addCopiedItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columnsnum, unsigned long long rows) { - JKQTPdatastoreItem* it=NULL; +size_t JKQTPdatastore::addCopiedItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columnsnum, size_t rows) { + JKQTPdatastoreItem* it=nullptr; if ((dataformat==JKQTPsingleColumn)||(columnsnum==1)) { return addCopiedItem(data, rows); } else if (dataformat==JKQTPmatrixColumn) { it=new JKQTPdatastoreItem(columnsnum, rows); for (size_t c=0; cset(c, r, data[c*rows+r]); } } } else if (dataformat==JKQTPmatrixColumn) { it=new JKQTPdatastoreItem(columnsnum, rows); - for (unsigned long long r=0; rset(c, r, data[r*columnsnum+c]); } @@ -335,44 +378,44 @@ size_t JKQTPdatastore::addCopiedItem(JKQTPdatastoreItemFormat dataformat, double /** \brief add a new columns/item with \a rows rows to the datastore and return its ID. The item uses internal memory management. */ -size_t JKQTPdatastore::addItem(unsigned long long rows) { +size_t JKQTPdatastore::addItem(size_t rows) { /*items.push_back(new JKQTPdatastoreItem(1, rows)); return items.size()-1;*/ return addItem(new JKQTPdatastoreItem(1, rows)); }; /** \brief add a new item with \a rows rows and \a columns columns to the datastore and return its ID. The item uses internal memory management. */ -size_t JKQTPdatastore::addItem(size_t columnsnum, unsigned long long rows) { +size_t JKQTPdatastore::addItem(size_t columnsnum, size_t rows) { /*items.push_back(new JKQTPdatastoreItem(columnsnum, rows)); return items.size()-1;*/ return addItem(new JKQTPdatastoreItem(columnsnum, rows)); }; /** \brief add one external column to the datastore. It contains \a rows rows.*/ -size_t JKQTPdatastore::addItem(double* data, unsigned long long rows) { +size_t JKQTPdatastore::addItem(double* data, size_t rows) { /*items.push_back(new JKQTPdatastoreItem(JKQTPsingleColumn, data, 1, rows)); return items.size()-1;*/ return addItem(new JKQTPdatastoreItem(JKQTPsingleColumn, data, 1, rows)); } -size_t JKQTPdatastore::addInternalItem(double *data, unsigned long long rows) +size_t JKQTPdatastore::addInternalItem(double *data, size_t rows) { JKQTPdatastoreItem* dsi=new JKQTPdatastoreItem(JKQTPsingleColumn, data, 1, rows, true); return addItem(dsi); }; /** \brief add an external memory block to the datastore. It contains \a rows rows and \a columns columns. \a dataformat determined the memory layout*/ -size_t JKQTPdatastore::addItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columnsnum, unsigned long long rows) { +size_t JKQTPdatastore::addItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columnsnum, size_t rows) { /*items.push_back(new JKQTPdatastoreItem(dataformat, data, columnsnum, rows)); return items.size()-1;*/ return addItem(new JKQTPdatastoreItem(dataformat, data, columnsnum, rows)); }; /** \brief add one external array to the datastore. It contains \a rows rows. The data is copied and the copy managed internally */ -size_t JKQTPdatastore::addCopiedItem(const double* data, unsigned long long rows) { +size_t JKQTPdatastore::addCopiedItem(const double* data, size_t rows) { JKQTPdatastoreItem* it=new JKQTPdatastoreItem(1, rows); if (data) { - for (unsigned long long i=0; iset(0, i, data[i]); //std::cout<<"copy@"< &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name, unsigned long long stride) -{ - return addCopiedColumn(data.data(), data.size(), stride, name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &data, QString name) -{ - return addCopiedColumn(data.data(), data.size(), name); -} - -size_t JKQTPdatastore::addCopiedColumn(const QVector &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, size_t start, size_t stride, const QString& name) { JKQTPcolumn old=columns[old_column]; - unsigned long long rows=old.getRows(); + size_t rows=old.getRows(); double* d=(double*)malloc(rows*sizeof(double)); double* dd=old.getPointer(0); int j=0; - for (unsigned long long i=start; iset(0, i, start+(double)i * delta); //std::cout<<"copy@"<=0) return getNextLowerIndex(column, row, 0, end); @@ -1073,12 +538,12 @@ long long JKQTPdatastore::getNextLowerIndex(size_t column, unsigned long long ro } } -long long JKQTPdatastore::getNextLowerIndex(size_t column, unsigned long long row) const +long long JKQTPdatastore::getNextLowerIndex(size_t column, size_t row) const { return getNextLowerIndex(column, row, 0, columns[column].getRows()-1); } -long long JKQTPdatastore::getNextHigherIndex(size_t column, unsigned long long row, long long start, long long end) const +long long JKQTPdatastore::getNextHigherIndex(size_t column, size_t row, long long start, long long end) const { const JKQTPcolumn& col=columns[column]; if (start<0 && end>=0) return getNextHigherIndex(column, row, 0, end); @@ -1102,28 +567,28 @@ long long JKQTPdatastore::getNextHigherIndex(size_t column, unsigned long long r } } -long long JKQTPdatastore::getNextHigherIndex(size_t column, unsigned long long row) const +long long JKQTPdatastore::getNextHigherIndex(size_t column, size_t row) const { return getNextHigherIndex(column, row, 0, columns[column].getRows()-1); } -void JKQTPdatastore::set(size_t column, unsigned long long row, double value) +void JKQTPdatastore::set(size_t column, size_t row, double value) { columns[column].setValue(row, value); } -unsigned long long JKQTPdatastore::getMaxRows() { - unsigned long long res=0; +size_t JKQTPdatastore::getMaxRows() { + size_t res=0; /*for (size_t i=0; ires) res=r; }*/ QMapIterator it(columns); while (it.hasNext()) { it.next(); - unsigned long long r=it.value().getRows(); + size_t r=it.value().getRows(); if (r>res) res=r; } @@ -1214,7 +679,7 @@ void JKQTPdatastore::saveMatlab(QTextStream &txt, QSet userColumns) { varnames.insert(newvar); txt< userColumns, QString se } txt<<"\n"; } - unsigned long long rows=getMaxRows(); - for (unsigned long long i=0; i it(columns); int j=0; @@ -1306,8 +771,8 @@ void JKQTPdatastore::saveSYLK(QString filename, QSet userColumns, QString f - unsigned long long rows=getMaxRows(); - for (unsigned long long i=0; i it(columns); c=1; while (it.hasNext()) { @@ -1341,7 +806,7 @@ QList > JKQTPdatastore::getData(QStringList *columnNames, QSet dat; - for (unsigned long long i=0; i userColumns, QString fl if (!f.open(QIODevice::WriteOnly|QIODevice::Text)) return; QTextStream txt(&f); txt.setLocale(loc); - unsigned long long rows=getMaxRows(); + size_t rows=getMaxRows(); // write DIF header txt< userColumns, QString fl - for (unsigned long long i=0; i it(columns); c=1; @@ -1484,4 +949,3 @@ void JKQTPdatastoreModel::reloadModel() reset(); #endif } - diff --git a/jkqtpdatastorage.h b/jkqtpdatastorage.h index c52aa2dd1d..1d801297e8 100644 --- a/jkqtpdatastorage.h +++ b/jkqtpdatastorage.h @@ -165,7 +165,7 @@ class LIB_EXPORT JKQTPdatastore{ /** \brief returns the JKQTPdatastoreItem object for the \a i -th item in the store */ inline JKQTPdatastoreItem* getItem(size_t i) const { - return items.value(i, NULL); + return items.value(i, nullptr); } /** \brief add a new item to the datastore and return its ID */ @@ -173,617 +173,309 @@ class LIB_EXPORT JKQTPdatastore{ /** \brief add a new columns/item with \a rows rows to the datastore and return its ID. The item uses internal memory management. */ - size_t addItem(unsigned long long rows); + size_t addItem(size_t rows); /** \brief delete the given column, if no other columns points to the datastore item of the column and \a removeItems is \c true, the item will be removed */ void deleteColumn(size_t column, bool removeItems=true); /** \brief delete all columns with the given name, if no other columns points to the datastore item of the column and \a removeItems is \c true, the item will be removed */ - void deleteAllColumns(QString name, bool removeItems=true); + void deleteAllColumns(const QString& name, bool removeItems=true); /** \brief delete all columns where the name starts with a given prefix, if no other columns points to the datastore item of the column and \a removeItems is \c true, the item will be removed */ void deleteAllPrefixedColumns(QString prefix, bool removeItems=true); /** \brief add a new item with \a rows rows and \a columns columns to the datastore and return its ID. The item uses internal memory management. */ - size_t addItem(size_t columns, unsigned long long rows); + size_t addItem(size_t columns, size_t rows); /** \brief add one external column to the datastore. It contains \a rows rows.*/ - size_t addItem(double* data, unsigned long long rows); + size_t addItem(double* data, size_t rows); /** \brief add one internal column to the datastore. It contains \a rows rows.*/ - size_t addInternalItem(double* data, unsigned long long rows); + size_t addInternalItem(double* data, size_t rows); /** \brief add an external memory block to the datastore. It contains \a rows rows and \a columns columns. \a dataformat determined the memory layout*/ - size_t addItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, unsigned long long rows); + size_t addItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, size_t rows); /** \brief add one external column to the datastore. It contains \a rows rows. The data is copied and the copy managed internally */ - size_t addCopiedItem(const double *data, unsigned long long rows); + size_t addCopiedItem(const double *data, size_t rows); /** \brief add one external data block to the datastore. It contains \a rows rows and \a columns columns. The data is copied and the copy managed internally */ - size_t addCopiedItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, unsigned long long rows); + size_t addCopiedItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, size_t rows); /** \brief returns the value at position (\c column, \c row). \c column is the logical column and will be mapped to the according memory block internally!) */ - double get(size_t column, unsigned long long row) const; - /** \brief gets the of the datapoint with the nearest, but lower value in the column (in a given inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)*/ - long long getNextLowerIndex(size_t column, unsigned long long row, long long start, long long end) const; - /** \brief gets the of the datapoint with the nearest, but lower value in the column */ - long long getNextLowerIndex(size_t column, unsigned long long row) const; + double get(size_t column, size_t row) const; + /** \brief gets the index of the datapoint with the nearest, but lower value in the column (in a given inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)*/ + long long getNextLowerIndex(size_t column, size_t row, long long start, long long end) const; + /** \brief gets the index of the datapoint with the nearest, but lower value in the column */ + long long getNextLowerIndex(size_t column, size_t row) const; /** \brief gets the index of the datapoint with the nearest, but higher value in the column (in a given inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column) */ - long long getNextHigherIndex(size_t column, unsigned long long row, long long start, long long end) const; + long long getNextHigherIndex(size_t column, size_t row, long long start, long long end) const; /** \brief gets the index of the datapoint with the nearest, but higher value in the column */ - long long getNextHigherIndex(size_t column, unsigned long long row) const; + long long getNextHigherIndex(size_t column, size_t row) const; /** \brief sets the value at position (\c column, \c row). \c column is the logical column and will be mapped to the according memory block internally!) */ - void set(size_t column, unsigned long long row, double value); + void set(size_t column, size_t row, double value); /** \brief add a new columns which references a specified item and a specified column therein. */ - size_t addColumnForItem(size_t itemID, size_t columnInItem, QString name=QString("")); + size_t addColumnForItem(size_t itemID, size_t columnInItem, const QString& name=QString("")); /** \brief add a new columns with \a rows rows to the datastore and return its column ID. The new item uses internal memory management. */ - size_t addColumn(unsigned long long rows, QString name=QString("")); + size_t addColumn(size_t rows, const QString& name=QString("")); /** \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, size_t rows, const 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("")); + size_t copyColumn(size_t old_column, size_t start, size_t stride, const 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 - * 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("")); - - /** \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 double* data, unsigned long long rows, unsigned long long stride, QString name=QString("")); + size_t copyColumn(size_t old_column, const 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& 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& data, QString name, unsigned long long stride); - - - /** \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& 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& 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& 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& 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& 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& 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& 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& 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& 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& 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. + /** \brief add one external column to the datastore. It will be filled with the contents of vector \a data. * - * \note This function converts the input array \a data into an array of double! + * \tparam TContainer datatype of the container, which need to support standard C++ iterators and the function \c size(). The contents needs to be convertible to double. + * \param data data vector to be copied + * \param name name for the column + * \return the ID of the newly created column */ - size_t addCopiedColumn(const bool* 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 - * 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 addCopiedColumn(const uint8_t* 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 - * 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 addCopiedColumn(const uint16_t* 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 - * 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 addCopiedColumn(const uint32_t* 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 - * 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 addCopiedColumn(const int8_t* 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 - * 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 addCopiedColumn(const int16_t* 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 - * 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 addCopiedColumn(const int32_t* 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 - * 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 addCopiedColumn(const int64_t* 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 - * 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 addCopiedColumn(const uint64_t* 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 - * 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 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 - * 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 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& data, const QVector& mask, QString name=QString(""), bool useIfMaskEquals=false) { - return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals); + template + size_t addCopiedColumn(const TContainer& data, const QString& name=QString("")) { + const size_t N=data.size(); + double* d=static_cast(malloc(static_cast(N)*sizeof(double))); + if (N>0) { + size_t r=0; + for (auto it=data.begin(); it!=data.end(); ++it) { + d[r]=jkqtp_todouble(*it); + r++; + } + } + size_t itemid=addInternalItem(d, N); + return addColumnForItem(itemid, 0, name); } - /** \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. + /** \brief add one external column to the datastore. It will be filled with the contents of vector \a data. * - * \note This function converts the input array \a data into an array of double! + * \tparam TContainer datatype of the container, which need to support standard C++ iterators and the function \c size(). The contents needs to be convertible to double. + * \param data data vector to be copied + * \param name name for the column + * \param stride strides through the container \a data with the given stride + * \param start starts copying from \a data with the element \a start + * \return the ID of the newly created column */ - 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& data, const QVector& mask, QString name=QString(""), bool useIfMaskEquals=false) { - return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals); + template + size_t addCopiedColumn(const TContainer& data, const QString& name, size_t stride, size_t start=0) { + const size_t N=(data.size()-start)/stride; + double* d=static_cast(malloc(static_cast(N)*sizeof(double))); + if (N>0) { + size_t r=0; + auto it=data.begin(); + if (start>0) it+=start; + for (; it!=data.end(); it+=stride) { + d[r]=jkqtp_todouble(*it); + r++; + } + } + size_t itemid=addInternalItem(d, N); + return addColumnForItem(itemid, 0, name); } - /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so + /** \brief copy an 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. * + * \tparam T datatype of the element in the vector, this has to be convertible to double! + * \param data pointer to the data to be copied + * \param name name for the column + * \return the ID of the newly created column + * * \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& data, const QVector& mask, QString name=QString(""), bool useIfMaskEquals=false) { - return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals); + template + size_t addCopiedColumn(const T* data, size_t rows, const QString& name=QString("")){ + double* d=static_cast(malloc(static_cast(rows)*sizeof(double))); + if (data) { + for (size_t r=0; r[start, start+stride, start+2*stride, ... start+(rows-1)*stride] are copied! + * \param start first element to copy + * \param name name for the column + * \return the ID of the newly created column + * * \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& data, const QVector& mask, QString name=QString(""), bool useIfMaskEquals=false) { - return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals); + template + size_t addCopiedColumn(const T* data, size_t rows, size_t stride, int start, const QString& name) { + double* d=static_cast(malloc(static_cast(rows)*sizeof(double))); + if (data) { + for (size_t r=0; r(start+static_cast(r*stride))]); + } + } + size_t itemid=addInternalItem(d, rows); + return addColumnForItem(itemid, 0, name); } - - /** \brief add one external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so + /** \brief copy an 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. * + * \tparam T datatype of the element in the vector, this has to be convertible to double! + * \param data pointer to the data to be copied + * \param name name for the column + * \param stride when copying, this function steps throught the data with the given stride, so only eleemnts [0, stride, 2*stride, ... (rows-1)*stride] are copied! + * \return the ID of the newly created column + * * \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& data, const QVector& mask, QString name=QString(""), bool useIfMaskEquals=false) { - return addCopiedColumnMasked(data.data(), mask.data(), qMin(data.size(), mask.size()), name, useIfMaskEquals); + template + size_t addCopiedColumn(const T* data, size_t rows, size_t stride, const QString& name) { + return addCopiedColumn(data, rows, stride, 0, name); } - /** \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& data, const QVector& 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& data, const QVector& 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& data, const QVector& 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& data, const QVector& 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& data, const QVector& 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& data, const QVector& 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 * afterwards you can delete the external arrayThis returns its logical column ID.*/ - inline size_t addCopiedImageAsColumn(const double* data, unsigned long long width, unsigned long long height, QString name=QString("")){ - return addCopiedColumn(data, width*height, name); + template + inline size_t addCopiedImageAsColumn(const T* data, size_t width, size_t height, const QString& name=QString(""), size_t stride=0, size_t start=0){ + return addCopiedColumn(data, width*height, stride, start, 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 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& 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& 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); + template + inline size_t addCopiedImageAsColumn(const TContainer& data, size_t /*width*/, const QString& name=QString("")){ + return addCopiedColumn(data, 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& data, unsigned long long width, QString name=QString("")) { - return addCopiedImageAsColumn(data.data(), width, data.size()/width, name); + template + size_t addCopiedImageAsColumnTranspose(const T* data, size_t width, size_t height, const QString& name=QString(""), size_t stride=0, size_t start=0){ + double* temp=static_cast(malloc(width*height*sizeof(T))); + + for (size_t x=0; x& data, unsigned long long width, QString name=QString("")) { - return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name); + template + inline size_t addCopiedImageAsColumnTranspose(const QVector& data, size_t width, const 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& 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& 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 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! + */ + template + size_t addCopiedColumnMasked(const T* data, const bool* mask, size_t rows, const QString& name=QString(""), bool useIfMaskEquals=false) { + double* d=static_cast(calloc(rows, sizeof(double))); + size_t rrs=0; + if (data) { + for (size_t r=0; r& 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& data, unsigned long long width, QString name=QString("")) { - return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name); + size_t col= addCopiedColumn(d, rrs, name); + free(d); + return col; } + /** \brief add one external column to the datastore. It will be filled with the contents of vector \a data. + * + * \tparam TContainer datatype of the container, which need to support standard C++ iterators and the function \c size(). The contents needs to be convertible to double. + * \param data data vector to be copied + * \param name name for the column + * \param stride strides through the container \a data with the given stride + * \param start starts copying from \a data with the element \a start + * \return the ID of the newly created column + */ + template + size_t addCopiedColumnMasked(const TContainer& data, const TContainerMask& mask, const QString& name=QString(""), bool useIfMaskEquals=false) { + const size_t N=data.size(); + double* d=static_cast(malloc(static_cast(N)*sizeof(double))); + size_t rrs=0; + if (data) { + auto itmask=mask.begin(); + auto itdata=data.begin(); + for (size_t r=0; r& 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& data, unsigned long long width, QString name=QString("")) { - return addCopiedImageAsColumnTranspose(data.data(), width, data.size()/width, name); + size_t col= addCopiedColumn(d, rrs, name); + free(d); + return col; + } - /** \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& 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& 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& 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& 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& 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& 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& 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& 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& 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& 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& 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& 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. * 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(size_t rows, double start, double end, const QString& name=QString("")); /** \brief returns the number of (logical) columns currently managed by the datastore */ - inline size_t getColumnCount() { return columns.size(); } + inline size_t getColumnCount() { return static_cast(columns.size()); } inline QList getColumnIDs() { return columns.keys(); } /** \brief return the num of the first column with the given name, or -1 if none was found */ - int getColumnNum(QString name); + int getColumnNum(const QString& name); /** \brief return the num of the first column with the given name, if none was found this creates a new column with no rows and returns its num */ - size_t ensureColumnNum(QString name); + size_t ensureColumnNum(const QString& name); /** \brief returns the JKQTPcolumn object for the \a i -th column in the store */ JKQTPcolumn getColumn(size_t i) const; /** \brief returns the maximum number of rows in all columns */ - unsigned long long getMaxRows(); + size_t getMaxRows(); /** \brief save contents of datastore as Comma Separated Values (CSV) file * @@ -832,10 +524,10 @@ class LIB_EXPORT JKQTPdatastore{ /** \brief return contents of datastore as QList >, i.e. a list of column-vectors * - * \param columnNames if \c !=NULL this will afterwards conatin the column titles + * \param columnNames if \c !=nullptr this will afterwards conatin the column titles * \param userColumns a list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames() */ - QList > getData(QStringList* columnNames=NULL, QSet userColumns=QSet()); + QList > getData(QStringList* columnNames=nullptr, QSet userColumns=QSet()); /** \brief save contents of datastore as DIF file (data interchange format) * @@ -860,10 +552,12 @@ class LIB_EXPORT JKQTPdatastore{ /** \brief return a list with all columns available in the datastore */ QStringList getColumnNames() const; - size_t addInternalColumn(double *data, unsigned long long rows, QString name); + size_t addInternalColumn(double *data, size_t rows, const QString& name); }; + + /** \brief stores information about one data column. See JKQTPdatastore for more information. * \ingroup jkqtpdatastorage * @@ -874,7 +568,7 @@ class LIB_EXPORT JKQTPcolumn { /** \brief index of the item in the datastore that contains the data for this column */ size_t datastoreItem; /** \brief offset, if the datastore item contains more than one column */ - unsigned long long datastoreOffset; + size_t datastoreOffset; /** \brief a name describing the column */ QString name; /** \brief pointer to the datastore object used to manage the data of the plot */ @@ -885,37 +579,27 @@ class LIB_EXPORT JKQTPcolumn { protected: JKQTPGET_MACRO(JKQTPdatastore*, datastore) public: - JKQTPcolumn() { - datastore=NULL; - name=""; - datastoreItem=0; - datastoreOffset=0; - valid=false; - }; + JKQTPcolumn(); /** \brief class constructor that binds the column to a specific datastore object. * * The use of this constructor is mandatory. The default constructor (no arguments) is hidden. Also note * that you cannot change the binding of a column to a datastore object after creation of the column. */ - JKQTPcolumn(JKQTPdatastore* datastore, QString name=QString(""), size_t datastoreItem=0, unsigned long long datastoreOffset=0) { - this->datastore=datastore; - this->datastoreItem=datastoreItem; - this->datastoreOffset=datastoreOffset; - this->name=name; - valid=true; - } + JKQTPcolumn(JKQTPdatastore* datastore, const QString& name=QString(""), size_t datastoreItem=0, size_t datastoreOffset=0); inline bool isValid() const { return valid; } /** \brief class destructor */ - virtual ~JKQTPcolumn() {} + virtual ~JKQTPcolumn() ; JKQTPGET_SET_MACRO(QString, name) /** \brief returns the number of rows in this column (accesses the datastore) */ - unsigned long long getRows() const; + size_t getRows() const; + /** \brief copies the contained data into a QVector */ void copyData(QVector& copyTo) const; + /** \brief returns a QVector with the contained data (as a copy) */ QVector copyData(); /** \brief reads the \a n'th value from the column @@ -923,17 +607,17 @@ class LIB_EXPORT JKQTPcolumn { * This method accesses the datastore and returns the double value stored in the \a n'th row of the according * column. */ - double getValue(unsigned long long n) const; + double getValue(size_t n) const; /** \brief gets a pointer to the n-th value in the column */ - double* getPointer(unsigned long long n=0) const ; + double* getPointer(size_t n=0) const ; /** \brief sets the \a n'th value from the column * * This method accesses the datastore and returns the double value stored in the \a n'th row of the according * column. */ - void setValue(unsigned long long n, double val) ; + void setValue(size_t n, double val) ; /** \brief returns a pointer to the datastore item representing this column */ inline JKQTPdatastoreItem* getDatastoreItem() const { return datastore->getItem(datastoreItem); } @@ -943,7 +627,7 @@ class LIB_EXPORT JKQTPcolumn { * This copies \a N elements from \a data into the column where the first overwritten column * line is \a offset, so you can shift the location where the copy process starts. */ - void copy(double* data, unsigned long long N, unsigned long long offset=0); + void copy(double* data, size_t N, size_t offset=0); /** \brief exchange everz occurence of a given \a value by a \a replace value */ void exchange(double value, double replace); @@ -954,7 +638,7 @@ class LIB_EXPORT JKQTPcolumn { void scale(double factor); JKQTPGET_MACRO(size_t, datastoreItem) - JKQTPGET_MACRO(unsigned long long, datastoreOffset) + JKQTPGET_MACRO(size_t, datastoreOffset) }; @@ -990,7 +674,7 @@ class LIB_EXPORT JKQTPdatastoreItem { /** \brief as data may also point to a matrix, this specifies the number of columns in this element (default: 1) */ size_t columns; /** \brief number of rows in this item */ - unsigned long long rows; + size_t rows; /** \brief memory format of the data in this item */ JKQTPdatastoreItemFormat dataformat; protected: @@ -998,24 +682,24 @@ class LIB_EXPORT JKQTPdatastoreItem { JKQTPdatastoreItem(); public: /** \brief class constructor: initializes the object for internal data storage */ - JKQTPdatastoreItem(size_t columns, unsigned long long rows); + JKQTPdatastoreItem(size_t columns, size_t rows); /** \brief class constructor: initializes the object for external data storage */ - JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, unsigned long long rows); + JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, size_t rows); /** \brief class constructor: initializes the object for external data storage */ - JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, unsigned long long rows, bool internal); + JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, size_t rows, bool internal); /** \brief class destructor: frees unfreed internal memory */ virtual ~JKQTPdatastoreItem(); /** \brief change the size of all columns to the givne number of rows. The data will be lost */ - void resizeColumns(unsigned long long rows); + void resizeColumns(size_t rows); - JKQTPGET_MACRO(unsigned long long, rows) + JKQTPGET_MACRO(size_t, rows) JKQTPGET_MACRO(size_t, columns) /** \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. */ - inline double get(size_t column, unsigned long long row) { - if (data!=NULL) switch(dataformat) { + inline double get(size_t column, size_t row) { + if (data!=nullptr) switch(dataformat) { case JKQTPsingleColumn: return data[row]; case JKQTPmatrixColumn: @@ -1028,8 +712,8 @@ class LIB_EXPORT JKQTPdatastoreItem { /** \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. */ - inline double* getPointer(size_t column, unsigned long long row) { - if (data!=NULL) switch(dataformat) { + inline double* getPointer(size_t column, size_t row) { + if (data!=nullptr) switch(dataformat) { case JKQTPsingleColumn: return &(data[row]); case JKQTPmatrixColumn: @@ -1037,11 +721,11 @@ class LIB_EXPORT JKQTPdatastoreItem { case JKQTPmatrixRow: return &(data[row*columns+column]); } - return NULL; + return nullptr; } /** \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) { - if (data!=NULL) switch(dataformat) { + inline void set(size_t column, size_t row, double value) { + if (data!=nullptr) switch(dataformat) { case JKQTPsingleColumn: data[row]=value; return; @@ -1064,7 +748,7 @@ class LIB_EXPORT JKQTPdatastoreItem { class LIB_EXPORT JKQTPdatastoreModel: public QAbstractTableModel { Q_OBJECT public: - JKQTPdatastoreModel(JKQTPdatastore* datastore, QObject* parent=NULL); + JKQTPdatastoreModel(JKQTPdatastore* datastore, QObject* parent=nullptr); ~JKQTPdatastoreModel(); diff --git a/jkqtpelements.cpp b/jkqtpelements.cpp index dd0ab7c068..7b062428f0 100644 --- a/jkqtpelements.cpp +++ b/jkqtpelements.cpp @@ -80,8 +80,8 @@ void JKQTPgraph::setParent(JKQtBasePlotter* parent) { this->xAxis=parent->getXAxis(); this->yAxis=parent->getYAxis(); } else { - xAxis=NULL; - yAxis=NULL; + xAxis=nullptr; + yAxis=nullptr; } QObject::setParent(parent); } @@ -117,17 +117,17 @@ bool JKQTPgraph::getDataMinMax(int column, double &minx, double &maxx, double &s maxx=0; smallestGreaterZero=0; - if (parent==NULL) return false; + if (parent==nullptr) return false; JKQTPdatastore* datastore=parent->getDatastore(); int imin=0; int imax=datastore->getColumn(column).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); if (JKQTPIsOKFloat(xv)) { if (start || xv>maxx) maxx=xv; if (start || xvgetDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(yColumn,i); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); if (JKQTPIsOKFloat(yv)) { if (start || yv>maxy) maxy=yv; if (start || yvgetDatastore(); int imin=0; int imax=datastore->getColumn(dataColumn).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -586,10 +586,10 @@ void JKQTPPeakStreamGraph::draw(JKQTPEnhancedPainter &painter) int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imax* dataorder) { //std::cout<<"JKQTPgraphErrors::intPlotXYErrorIndicators(p, "<getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; if ((yErrorStyle==JKQTPnoError) && (xErrorStyle==JKQTPnoError)) return; bool visX=(xErrorStyle!=JKQTPnoError)&&(xErrorColumn>=0||xErrorColumnLower>=0)&&(xColumn>=0)&&(yColumn>=0); @@ -710,16 +710,16 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J painter.setPen(p); unsigned long long imaxx=0, imaxy=0; - if (xColumn>=0) imaxx=datastore->getColumn(xColumn).getRows(); - if (yColumn>=0) imaxy=datastore->getColumn(yColumn).getRows(); + if (xColumn>=0) imaxx=datastore->getColumn(static_cast(xColumn)).getRows(); + if (yColumn>=0) imaxy=datastore->getColumn(static_cast(yColumn)).getRows(); int imax=qMin(imaxx, imaxy); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); if (imin==imax) { // only one x-value deltam=0.5; deltap=0.5; @@ -767,8 +767,8 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J for (int iii=imin; iiivalue(iii, iii); - double xv=datastore->get(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); double deltax=1; double deltapx=0; @@ -1259,9 +1259,9 @@ void JKQTPxyLineGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPxyLineGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; //qDebug()<<"JKQTPxyLineGraph::draw();"; @@ -1287,14 +1287,14 @@ void JKQTPxyLineGraph::draw(JKQTPEnhancedPainter& painter) { penSelection.setWidthF(penSelection.widthF()*3.0); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); double x=xAxis->x2p(xv); double y=yAxis->x2p(yv); //qDebug()<<"JKQTPxyLineGraph::draw(): (xv, yv) = ( "<getDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i)+getXErrorU(i, datastore); + double xv=datastore->get(static_cast(xColumn),static_cast(i))+getXErrorU(i, datastore); if (JKQTPIsOKFloat(xv)) { if (start || xv>maxx) maxx=xv; if (start || xvget(xColumn,i)-getXErrorL(i, datastore); + xv=datastore->get(static_cast(xColumn),static_cast(i))-getXErrorL(i, datastore); if (start || xv>maxx) maxx=xv; if (start || xvgetDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(yColumn,i)+getYErrorU(i, datastore); + double yv=datastore->get(static_cast(yColumn),static_cast(i))+getYErrorU(i, datastore); if (JKQTPIsOKFloat(yv)) { if (start || yv>maxy) maxy=yv; if (start || yvget(yColumn,i)-getYErrorL(i, datastore); + yv=datastore->get(static_cast(yColumn),static_cast(i))-getYErrorL(i, datastore); if (start || yv>maxy) maxy=yv; if (start || yvgetDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -1543,14 +1543,14 @@ void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { p.setStyle(Qt::SolidLine); p.setCapStyle(Qt::FlatCap); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) { double x=xAxis->x2p(xv); double y=yAxis->x2p(yv); @@ -1643,9 +1643,9 @@ void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesVerticalGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -1657,14 +1657,14 @@ void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) { p.setStyle(Qt::SolidLine); p.setCapStyle(Qt::FlatCap); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) ) { double x=xAxis->x2p(xv); double y=yAxis->x2p(yv); @@ -1781,9 +1781,9 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveXGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -1801,14 +1801,14 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) { b.setColor(fillColor); b.setStyle(fillStyle); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); //std::cout<<"(xv, yv) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); @@ -1956,9 +1956,9 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveYGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -1977,14 +1977,14 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) { b.setColor(fillColor); b.setStyle(fillStyle); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); //std::cout<<"(xv, yv) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); @@ -2156,9 +2156,9 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPboxplotVerticalGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -2181,10 +2181,10 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) { int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); int imin=0; int imax=datastore->getColumn(posColumn).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); int imin=0; int imax=datastore->getColumn(medianColumn).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); int imin=0; int imax=datastore->getColumn(medianColumn).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); int imin=0; int imax=datastore->getColumn(posColumn).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -2637,10 +2637,10 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxnext; delete d; } - data=NULL; + data=nullptr; } @@ -3388,8 +3388,8 @@ void JKQTPxFunctionLineGraph::createPlotData(bool collectParams) { clearData(); if (collectParams) collectParameters(); - if (parent==NULL) return; - if (plotFunction==NULL) return; + if (parent==nullptr) return; + if (plotFunction==nullptr) return; double xmin=parent->getXMin(); double xmax=parent->getXMax(); @@ -3402,14 +3402,14 @@ void JKQTPxFunctionLineGraph::createPlotData(bool collectParams) { doublePair* d=new doublePair; d->x=xmin; d->f=plotFunction(xmin, params); - d->next=NULL; + d->next=nullptr; data=d; /*if (parent && parent->getXAxis()->isLogAxis()) { for (double x=log(xmin)+logdelta0; xnext = new doublePair; d->next->x=exp(x+((double)rand()/(double)RAND_MAX-0.5)*delta0/2.0); d->next->f=plotFunction(d->next->x, params); - d->next->next=NULL; + d->next->next=nullptr; doublePair* dd=d; d=d->next; refine(dd, d); @@ -3423,7 +3423,7 @@ void JKQTPxFunctionLineGraph::createPlotData(bool collectParams) { d->next = new doublePair; d->next->x=parent->p2x(x+((double)rand()/(double)RAND_MAX-0.5)*delta0/2.0); d->next->f=plotFunction(d->next->x, params); - d->next->next=NULL; + d->next->next=nullptr; doublePair* dd=d; d=d->next; refine(dd, d); @@ -3433,7 +3433,7 @@ void JKQTPxFunctionLineGraph::createPlotData(bool collectParams) { d->next = new doublePair; d->next->x=xmax; d->next->f=plotFunction(xmax, params); - d->next->next=NULL; + d->next->next=nullptr; refine(d, d->next); } @@ -3523,9 +3523,9 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPxFunctionLineGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; //qDebug()<<"start plot\n"; createPlotData(); @@ -3579,7 +3579,7 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { double dypix=fabs(yama-yami); yami=yami-2*dypix; yama=yama+2*dypix; - while (d!=NULL) { + while (d!=nullptr) { double xv=d->x; double yv=d->f; @@ -3588,7 +3588,7 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { double x=xAxis->x2p(xv); double y=yAxis->x2p(yv); double ype=0, yme=0; - if ((drawErrorLines || drawErrorPolygons) && (errorPlotFunction!=NULL)) { + if ((drawErrorLines || drawErrorPolygons) && (errorPlotFunction!=nullptr)) { double e=errorPlotFunction(xv, errorParams); ype=yAxis->x2p(yv+e); yme=yAxis->x2p(yv-e); @@ -3604,7 +3604,7 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { if (!d->next) filledPolygon<x; double yv=d->f; //std::cout<<"(xv, yv) = ( "<getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; //std::cout<<"start plot\n"; createPlotData(); @@ -3754,7 +3754,7 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { bool first=false; doublePair* d=data; - while (d!=NULL) { + while (d!=nullptr) { double yv=d->x; double xv=d->f; //std::cout<<"(xv, yv) = ( "<x2p(xv); double y=yAxis->x2p(yv); double xpe=0, xme=0; - if ((drawErrorLines || drawErrorPolygons) && (errorPlotFunction!=NULL)) { + if ((drawErrorLines || drawErrorPolygons) && (errorPlotFunction!=nullptr)) { double e=errorPlotFunction(xv, errorParams); xpe=xAxis->x2p(xv+e); xme=xAxis->x2p(xv-e); @@ -3783,12 +3783,12 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { painter.drawConvexPolygon(poly); painter.restore(); /*pfill.lineTo(x, y); - if (d->next==NULL) { // last datapoint + if (d->next==nullptr) { // last datapoint pfill.lineTo(x, y0); }*/ } - if (drawErrorPolygons && (errorPlotFunction!=NULL)) { + if (drawErrorPolygons && (errorPlotFunction!=nullptr)) { painter.save(); painter.setBrush(eb); painter.setPen(np); @@ -3804,7 +3804,7 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { painter.drawLine(QLineF(xl1, yl1, xl2, yl2)); } - if (drawErrorLines && (errorPlotFunction!=NULL)) { + if (drawErrorLines && (errorPlotFunction!=nullptr)) { painter.setPen(ep); painter.drawLine(QLineF(xpeold, yold, xpe, y)); painter.drawLine(QLineF(xmeold, yold, xme, y)); @@ -3846,7 +3846,7 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) { QColor c=color; c.setHsv(fmod(color.hue()+90, 360), color.saturation(), color.value()); d=data; - if (displaySamplePoints) while (d!=NULL) { + if (displaySamplePoints) while (d!=nullptr) { double yv=d->x; double xv=d->f; //std::cout<<"(xv, yv) = ( "<getYMin(); double ymax=parent->getYMax(); @@ -3877,13 +3877,13 @@ void JKQTPyFunctionLineGraph::createPlotData(bool /*collectParams*/) { doublePair* d=new doublePair; d->x=ymin; d->f=plotFunction(ymin, params); - d->next=NULL; + d->next=nullptr; data=d; for (double y=ymin+delta0; ynext = new doublePair; d->next->x=y+((double)rand()/(double)RAND_MAX-0.5)*delta0/2.0; d->next->f=plotFunction(d->next->x, params); - d->next->next=NULL; + d->next->next=nullptr; doublePair* dd=d; d=d->next; refine(dd, d); @@ -3891,7 +3891,7 @@ void JKQTPyFunctionLineGraph::createPlotData(bool /*collectParams*/) { d->next = new doublePair; d->next->x=ymax; d->next->f=plotFunction(ymax, params); - d->next->next=NULL; + d->next->next=nullptr; refine(d, d->next); } @@ -3975,9 +3975,9 @@ void JKQTPstepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPstepHorizontalGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -3995,14 +3995,14 @@ void JKQTPstepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { b.setColor(fillColor); b.setStyle(fillStyle); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); //std::cout<<"(xv, yv) = ( "<x2p(xv); @@ -4104,9 +4104,9 @@ void JKQTPstepVerticalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPstepVerticalGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -4122,14 +4122,14 @@ void JKQTPstepVerticalGraph::draw(JKQTPEnhancedPainter& painter) { b.setColor(fillColor); b.setStyle(fillStyle); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); //std::cout<<"(xv, yv) = ( "<x2p(xv); @@ -4285,9 +4285,9 @@ void JKQTPbarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPbarHorizontalGraph::draw"); #endif - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -4301,14 +4301,14 @@ void JKQTPbarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { b.setColor(fillColor); b.setStyle(fillStyle); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end+1, (long long)imax); + imax=qMin(datarange_end+1, static_cast(imax)); } if (imaxget(xColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); long long sr=datastore->getNextLowerIndex(xColumn, i, datarange_start, datarange_end); long long lr=datastore->getNextHigherIndex(xColumn, i, datarange_start, datarange_end); - double yv=datastore->get(yColumn,i); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); // if (imin==imax) { // only one x-value // deltam=0.5; // deltap=0.5; @@ -4386,17 +4386,17 @@ bool JKQTPbarHorizontalGraph::getXMinMax(double& minx, double& maxx, double& sma maxx=0; smallestGreaterZero=0; - if (parent==NULL) return false; + if (parent==nullptr) return false; JKQTPdatastore* datastore=parent->getDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); long long sr=datastore->getNextLowerIndex(xColumn, i, datarange_start, datarange_end); long long lr=datastore->getNextHigherIndex(xColumn, i, datarange_start, datarange_end); double delta, deltap, deltam; @@ -4461,17 +4461,17 @@ bool JKQTPbarHorizontalGraph::getYMinMax(double& miny, double& maxy, double& sma smallestGreaterZero=0; if (baseline>0) smallestGreaterZero=baseline; - if (parent==NULL) return false; + if (parent==nullptr) return false; JKQTPdatastore* datastore=parent->getDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(yColumn,i)+getYErrorU(i, datastore); - double yvv=datastore->get(yColumn,i)-getYErrorL(i, datastore); + double yv=datastore->get(static_cast(yColumn),static_cast(i))+getYErrorU(i, datastore); + double yvv=datastore->get(static_cast(yColumn),static_cast(i))-getYErrorL(i, datastore); if (JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(yvv) ) { if (start || yv>maxy) maxy=yv; if (start || yvgetDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; drawErrorsBefore(painter); @@ -4563,14 +4563,14 @@ void JKQTPbarVerticalGraph::draw(JKQTPEnhancedPainter& painter) { b.setColor(fillColor); b.setStyle(fillStyle); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end+1, (long long)imax); + imax=qMin(datarange_end+1, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); long long sr=datastore->getNextLowerIndex(yColumn, i, datarange_start, datarange_end); long long lr=datastore->getNextHigherIndex(yColumn, i, datarange_start, datarange_end); // if (imin==imax) { // only one x-value @@ -4652,17 +4652,17 @@ bool JKQTPbarVerticalGraph::getXMinMax(double& minx, double& maxx, double& small maxx=0; smallestGreaterZero=0; - if (parent==NULL) return false; + if (parent==nullptr) return false; JKQTPdatastore* datastore=parent->getDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i)+getXErrorU(i, datastore); - double xvv=datastore->get(xColumn,i)-getXErrorL(i, datastore); + double xv=datastore->get(static_cast(xColumn),static_cast(i))+getXErrorU(i, datastore); + double xvv=datastore->get(static_cast(xColumn),static_cast(i))-getXErrorL(i, datastore); if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xvv) ) { if (start || xv>maxx) maxx=xv; if (start || xvgetDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(yColumn,i); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); double delta, deltap, deltam; long long sr=datastore->getNextLowerIndex(yColumn, i, datarange_start, datarange_end); long long lr=datastore->getNextHigherIndex(yColumn, i, datarange_start, datarange_end); @@ -5094,17 +5094,17 @@ void JKQTPxyGraph::intSortData() - if (parent==NULL) return ; + if (parent==nullptr) return ; JKQTPdatastore* datastore=parent->getDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); sortedIndices<get(yColumn,i); + double xv=datastore->get(static_cast(yColumn),static_cast(i)); sortedIndices<getDatastore(); int imin=0; int imax=datastore->getColumn(posColumn).getRows(); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; cbGetDataMinMax(intColMin, intColMax); @@ -5486,14 +5486,14 @@ void JKQTPxyParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter) penSelection.setWidthF(penSelection.widthF()*3.0); - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i); - double yv=datastore->get(yColumn,i); + double xv=datastore->get(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); double x=xAxis->x2p(xv); double y=yAxis->x2p(yv); if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) { @@ -5626,18 +5626,18 @@ void JKQTPxyParametrizedScatterGraph::cbGetDataMinMax(double &dmin, double &dmax { if (autoImageRange) { dmin=dmax=0; - if (parent==NULL) return; + if (parent==nullptr) return; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return; + if (datastore==nullptr) return; if (colorColumn<0) return; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); int imin=0; // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxgetDatastore(); - if (datastore==NULL) return symbolSize; + if (datastore==nullptr) return symbolSize; if (sizeColumn<0) return symbolSize; if (i>=(int64_t)datastore->getColumn(sizeColumn).getRows()) return symbolSize; return datastore->get(sizeColumn,i); @@ -5693,9 +5693,9 @@ double JKQTPxyParametrizedScatterGraph::getLocalSymbolSize(int i) QColor JKQTPxyParametrizedScatterGraph::getLocalColor(int i) { - if (parent==NULL) return color; + if (parent==nullptr) return color; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return color; + if (datastore==nullptr) return color; if (colorColumn<0) return color; if (colorColumnContainsRGB) { if (i<0 || i>=(int64_t)datastore->getColumn(colorColumn).getRows()) return color; @@ -5722,9 +5722,9 @@ QColor JKQTPxyParametrizedScatterGraph::getLocalColor(int i) JKQTPgraphSymbols JKQTPxyParametrizedScatterGraph::getLocalSymbolType(int i) { - if (parent==NULL) return symbol; + if (parent==nullptr) return symbol; JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==NULL) return symbol; + if (datastore==nullptr) return symbol; if (symbolColumn<0) return symbol; if (i>=(int64_t)datastore->getColumn(symbolColumn).getRows()) return symbol; int id=floor(datastore->get(symbolColumn,i)); @@ -5744,17 +5744,17 @@ bool JKQTPxyParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx maxx=0; smallestGreaterZero=0; - if (parent==NULL) return false; + if (parent==nullptr) return false; JKQTPdatastore* datastore=parent->getDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(xColumn,i)+getXErrorU(i, datastore); - double xvv=datastore->get(xColumn,i)-getXErrorL(i, datastore); + double xv=datastore->get(static_cast(xColumn),static_cast(i))+getXErrorU(i, datastore); + double xvv=datastore->get(static_cast(xColumn),static_cast(i))-getXErrorL(i, datastore); if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xvv) ) { if (start || xv>maxx) maxx=xv; if (start || xvgetDatastore(); int imin=0; - int imax=qMin(datastore->getColumn(xColumn).getRows(), datastore->getColumn(yColumn).getRows()); + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); // interpret data ranges if (datarange_start>-1) { - imin=qMin(datarange_start, (long long)imax); + imin=qMin(datarange_start, static_cast(imax)); } if (datarange_end>-1) { - imax=qMin(datarange_end, (long long)imax); + imax=qMin(datarange_end, static_cast(imax)); } if (imaxget(yColumn,i)+getYErrorU(i, datastore); - double yvv=datastore->get(yColumn,i)-getYErrorL(i, datastore); + double yv=datastore->get(static_cast(yColumn),static_cast(i))+getYErrorU(i, datastore); + double yvv=datastore->get(static_cast(yColumn),static_cast(i))-getYErrorL(i, datastore); if (JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(yvv) ) { if (start || yv>maxy) maxy=yv; if (start || yv* dataorder=NULL)=0; + virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector* dataorder=nullptr)=0; /** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is * given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */ - void intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, long long datarange_start=-1, long long datarange_end=-1, int xErrorColumnLower=-1, int yErrorColumnLower=-1, bool xErrorSymmetric=true, bool yErrorSymmetric=true, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=NULL); + void intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, long long datarange_start=-1, long long datarange_end=-1, int xErrorColumnLower=-1, int yErrorColumnLower=-1, bool xErrorSymmetric=true, bool yErrorSymmetric=true, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=nullptr); /** \brief this function can be used to set the color of the error indicators automatically * @@ -493,7 +493,7 @@ class LIB_EXPORT JKQTPxGraphErrors: public JKQTPgraphErrors { /** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is * given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */ - virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=NULL); + virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=nullptr); virtual double getXErrorU(int i, JKQTPdatastore* ds) const; virtual double getXErrorL(int i, JKQTPdatastore* ds) const; @@ -542,7 +542,7 @@ class LIB_EXPORT JKQTPyGraphErrors: public JKQTPgraphErrors { /** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is * given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */ - virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=NULL); + virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=nullptr); virtual double getYErrorU(int i, JKQTPdatastore* ds) const; virtual double getYErrorL(int i, JKQTPdatastore* ds) const; @@ -614,7 +614,7 @@ class LIB_EXPORT JKQTPxyGraphErrors: public JKQTPgraphErrors { /** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is * given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */ - virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=NULL); + virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, long long datarange_start=-1, long long datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector *dataorder=nullptr); virtual double getXErrorU(int i, JKQTPdatastore* ds) const; virtual double getXErrorL(int i, JKQTPdatastore* ds) const; @@ -635,7 +635,7 @@ class LIB_EXPORT JKQTPxyLineGraph: public JKQTPxyGraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPxyLineGraph(JKQtBasePlotter* parent=NULL); + JKQTPxyLineGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPxyLineGraph(JKQtPlotter* parent); @@ -709,7 +709,7 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi Q_OBJECT public: /** \brief class constructor */ - JKQTPxyParametrizedScatterGraph(JKQtBasePlotter* parent=NULL); + JKQTPxyParametrizedScatterGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPxyParametrizedScatterGraph(JKQtPlotter* parent); @@ -800,7 +800,7 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG Q_OBJECT public: /** \brief class constructor */ - inline JKQTPxyLineErrorGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPxyLineErrorGraph(JKQtBasePlotter* parent=nullptr): JKQTPxyLineGraph(parent), JKQTPxyGraphErrors() { setErrorColorFromGraphColor(color); } /** \brief class constructor */ @@ -840,7 +840,7 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG class LIB_EXPORT JKQTPxyParametrizedErrorScatterGraph: public JKQTPxyParametrizedScatterGraph, public JKQTPxyGraphErrors { Q_OBJECT public: - inline JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter* parent=nullptr): JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors() { setErrorColorFromGraphColor(color); } inline JKQTPxyParametrizedErrorScatterGraph(JKQtPlotter* parent): @@ -886,7 +886,7 @@ class LIB_EXPORT JKQTPimpulsesHorizontalGraph: public JKQTPxyGraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent=NULL); + JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPimpulsesHorizontalGraph(JKQtPlotter* parent); @@ -927,7 +927,7 @@ class LIB_EXPORT JKQTPimpulsesHorizontalErrorGraph: public JKQTPimpulsesHorizont Q_OBJECT public: /** \brief class constructor */ - inline JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=nullptr): JKQTPimpulsesHorizontalGraph(parent), JKQTPxGraphErrors() { setErrorColorFromGraphColor(color); @@ -963,7 +963,7 @@ class LIB_EXPORT JKQTPimpulsesVerticalGraph: public JKQTPimpulsesHorizontalGraph Q_OBJECT public: /** \brief class constructor */ - JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent=NULL); + JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPimpulsesVerticalGraph(JKQtPlotter* parent); @@ -982,7 +982,7 @@ class LIB_EXPORT JKQTPimpulsesVerticalErrorGraph: public JKQTPimpulsesVerticalGr Q_OBJECT public: /** \brief class constructor */ - inline JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter* parent=nullptr): JKQTPimpulsesVerticalGraph(parent), JKQTPyGraphErrors() { setErrorColorFromGraphColor(color); @@ -1022,7 +1022,7 @@ class LIB_EXPORT JKQTPfilledCurveXGraph: public JKQTPxyGraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPfilledCurveXGraph(JKQtBasePlotter* parent=NULL); + JKQTPfilledCurveXGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPfilledCurveXGraph(JKQtPlotter* parent); @@ -1084,7 +1084,7 @@ class LIB_EXPORT JKQTPfilledCurveXErrorGraph: public JKQTPfilledCurveXGraph, pub Q_OBJECT public: /** \brief class constructor */ - inline JKQTPfilledCurveXErrorGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPfilledCurveXErrorGraph(JKQtBasePlotter* parent=nullptr): JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors() { setErrorColorFromGraphColor(color); @@ -1123,7 +1123,7 @@ class LIB_EXPORT JKQTPfilledCurveYGraph: public JKQTPfilledCurveXGraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPfilledCurveYGraph(JKQtBasePlotter* parent=NULL); + JKQTPfilledCurveYGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPfilledCurveYGraph(JKQtPlotter* parent); @@ -1142,7 +1142,7 @@ class LIB_EXPORT JKQTPfilledCurveYErrorGraph: public JKQTPfilledCurveYGraph, pub Q_OBJECT public: /** \brief class constructor */ - inline JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=nullptr): JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors() { setErrorColorFromGraphColor(color); @@ -1189,7 +1189,7 @@ class LIB_EXPORT JKQTPboxplotVerticalGraph: public JKQTPgraph { /** \brief class constructor */ - JKQTPboxplotVerticalGraph(JKQtBasePlotter* parent=NULL); + JKQTPboxplotVerticalGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPboxplotVerticalGraph(JKQtPlotter* parent); @@ -1304,7 +1304,7 @@ class LIB_EXPORT JKQTPboxplotHorizontalGraph: public JKQTPboxplotVerticalGraph { Q_OBJECT public: /** \brief class constructor */ - inline JKQTPboxplotHorizontalGraph(JKQtBasePlotter* parent=NULL): + inline JKQTPboxplotHorizontalGraph(JKQtBasePlotter* parent=nullptr): JKQTPboxplotVerticalGraph(parent) { } @@ -1351,7 +1351,7 @@ class LIB_EXPORT JKQTPboxplotVerticalElement: public JKQTPgraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPboxplotVerticalElement(JKQtBasePlotter* parent=NULL); + JKQTPboxplotVerticalElement(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPboxplotVerticalElement(JKQtPlotter* parent); @@ -1456,7 +1456,7 @@ class LIB_EXPORT JKQTPboxplotHorizontalElement: public JKQTPboxplotVerticalEleme Q_OBJECT public: /** \brief class constructor */ - inline JKQTPboxplotHorizontalElement(JKQtBasePlotter* parent=NULL): + inline JKQTPboxplotHorizontalElement(JKQtBasePlotter* parent=nullptr): JKQTPboxplotVerticalElement(parent) { } @@ -1526,7 +1526,7 @@ class LIB_EXPORT JKQTPxFunctionLineGraph: public JKQTPgraph { }; /** \brief class constructor */ - JKQTPxFunctionLineGraph(JKQtBasePlotter* parent=NULL); + JKQTPxFunctionLineGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPxFunctionLineGraph(JKQtPlotter* parent); @@ -1716,7 +1716,7 @@ class LIB_EXPORT JKQTPyFunctionLineGraph: public JKQTPxFunctionLineGraph { Q_OBJECT public: /** \brief class constructor */ - inline JKQTPyFunctionLineGraph(JKQtBasePlotter* parent=NULL):JKQTPxFunctionLineGraph(parent) {} + inline JKQTPyFunctionLineGraph(JKQtBasePlotter* parent=nullptr):JKQTPxFunctionLineGraph(parent) {} /** \brief class constructor */ inline JKQTPyFunctionLineGraph(JKQtPlotter* parent):JKQTPxFunctionLineGraph(parent) {} @@ -1758,7 +1758,7 @@ class LIB_EXPORT JKQTPstepHorizontalGraph: public JKQTPxyGraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPstepHorizontalGraph(JKQtBasePlotter* parent=NULL); + JKQTPstepHorizontalGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPstepHorizontalGraph(JKQtPlotter* parent); @@ -1827,7 +1827,7 @@ class LIB_EXPORT JKQTPstepVerticalGraph: public JKQTPstepHorizontalGraph { Q_OBJECT public: /** \brief class constructor */ - inline JKQTPstepVerticalGraph(JKQtBasePlotter* parent=NULL): JKQTPstepHorizontalGraph(parent) {} + inline JKQTPstepVerticalGraph(JKQtBasePlotter* parent=nullptr): JKQTPstepHorizontalGraph(parent) {} /** \brief class constructor */ inline JKQTPstepVerticalGraph(JKQtPlotter* parent): JKQTPstepHorizontalGraph(parent) {} @@ -1871,7 +1871,7 @@ class LIB_EXPORT JKQTPbarHorizontalGraph: public JKQTPxyGraph, public JKQTPxyGra Q_OBJECT public: /** \brief class constructor */ - JKQTPbarHorizontalGraph(JKQtBasePlotter* parent=NULL); + JKQTPbarHorizontalGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPbarHorizontalGraph(JKQtPlotter* parent); @@ -1975,7 +1975,7 @@ class LIB_EXPORT JKQTPbarVerticalGraph: public JKQTPbarHorizontalGraph { Q_OBJECT public: /** \brief class constructor */ - inline JKQTPbarVerticalGraph(JKQtBasePlotter* parent=NULL): JKQTPbarHorizontalGraph(parent) {} + inline JKQTPbarVerticalGraph(JKQtBasePlotter* parent=nullptr): JKQTPbarHorizontalGraph(parent) {} /** \brief class constructor */ inline JKQTPbarVerticalGraph(JKQtPlotter* parent): JKQTPbarHorizontalGraph(parent) {} @@ -2022,7 +2022,7 @@ class LIB_EXPORT JKQTPhorizontalRange: public JKQTPgraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPhorizontalRange(JKQtBasePlotter* parent=NULL); + JKQTPhorizontalRange(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPhorizontalRange(JKQtPlotter* parent); @@ -2133,7 +2133,7 @@ class LIB_EXPORT JKQTPverticalRange: public JKQTPhorizontalRange { Q_OBJECT public: /** \brief class constructor */ - JKQTPverticalRange(JKQtBasePlotter* parent=NULL); + JKQTPverticalRange(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPverticalRange(JKQtPlotter* parent); diff --git a/jkqtpgeoelements.h b/jkqtpgeoelements.h index 4663b792ab..24b4f9590b 100644 --- a/jkqtpgeoelements.h +++ b/jkqtpgeoelements.h @@ -56,7 +56,7 @@ class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPgraph { \param style line style of drawing \param lineWidth lineWidth of drawing */ - explicit 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=nullptr); /*! \brief class contructor \param color color of drawing @@ -104,7 +104,7 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine { \param fillStyle filling style of the graph \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=nullptr); /*! \brief class contructor \param color color of drawing diff --git a/jkqtpimageelements.cpp b/jkqtpimageelements.cpp index 522651dbd7..9e13d458b3 100644 --- a/jkqtpimageelements.cpp +++ b/jkqtpimageelements.cpp @@ -157,7 +157,7 @@ void JKQTPImageBase::plotImage(JKQTPEnhancedPainter& painter, QImage& image, dou JKQTPImage::JKQTPImage(JKQtBasePlotter *parent): JKQTPImageBase(parent) { - this->image=NULL; + this->image=nullptr; createImageActions(); } @@ -171,7 +171,7 @@ JKQTPImage::JKQTPImage(double x, double y, double width, double height, QImage* JKQTPImage::JKQTPImage(JKQtPlotter *parent): JKQTPImageBase(parent) { - this->image=NULL; + this->image=nullptr; createImageActions(); } @@ -240,7 +240,7 @@ void JKQTPImage::saveImagePlotAsImage(const QString &filename, const QByteArray QString selFormat; if (fn.isEmpty()) { selFormat=currentFileFormat; - fn = QFileDialog::getSaveFileName(NULL, tr("Save Image Plot As Image ..."), + fn = QFileDialog::getSaveFileName(nullptr, tr("Save Image Plot As Image ..."), currentSaveDirectory, filt.join(";;"), &selFormat); if (!fn.isEmpty()) currentSaveDirectory=QFileInfo(fn).absolutePath(); @@ -287,7 +287,7 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double this->datatype=datatype; this->Nx=Nx; this->Ny=Ny; - dataModifier=NULL; + dataModifier=nullptr; datatypeModifier=DoubleArray; modifierMode=ModifyNone; } @@ -300,7 +300,7 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double this->datatype=datatype; this->Nx=Nx; this->Ny=Ny; - dataModifier=NULL; + dataModifier=nullptr; datatypeModifier=DoubleArray; modifierMode=ModifyNone; } @@ -312,11 +312,11 @@ void JKQTPMathImageBase::drawKeyMarker(JKQTPEnhancedPainter &/*painter*/, QRectF JKQTPMathImageBase::JKQTPMathImageBase(JKQtBasePlotter *parent): JKQTPImageBase(parent) { - this->data=NULL; + this->data=nullptr; this->Nx=0; this->Ny=0; this->datatype=DoubleArray; - dataModifier=NULL; + dataModifier=nullptr; datatypeModifier=DoubleArray; modifierMode=ModifyNone; } @@ -324,11 +324,11 @@ JKQTPMathImageBase::JKQTPMathImageBase(JKQtBasePlotter *parent): JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQtBasePlotter *parent): JKQTPImageBase(x,y,width,height,parent) { - this->data=NULL; + this->data=nullptr; this->Nx=0; this->Ny=0; this->datatype=DoubleArray; - dataModifier=NULL; + dataModifier=nullptr; datatypeModifier=DoubleArray; modifierMode=ModifyNone; } @@ -336,11 +336,11 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double JKQTPMathImageBase::JKQTPMathImageBase(JKQtPlotter *parent): JKQTPImageBase(parent) { - this->data=NULL; + this->data=nullptr; this->Nx=0; this->Ny=0; this->datatype=DoubleArray; - dataModifier=NULL; + dataModifier=nullptr; datatypeModifier=DoubleArray; modifierMode=ModifyNone; } @@ -348,11 +348,11 @@ JKQTPMathImageBase::JKQTPMathImageBase(JKQtPlotter *parent): JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQtPlotter *parent): JKQTPImageBase(x,y,width,height,parent) { - this->data=NULL; + this->data=nullptr; this->Nx=0; this->Ny=0; this->datatype=DoubleArray; - dataModifier=NULL; + dataModifier=nullptr; datatypeModifier=DoubleArray; modifierMode=ModifyNone; } @@ -682,7 +682,7 @@ JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, } JKQTPMathImage::JKQTPMathImage(JKQtBasePlotter *parent): - JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, NULL, 0, 0, parent) + JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, nullptr, 0, 0, parent) { initJKQTPMathImage(); } @@ -697,7 +697,7 @@ JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, } JKQTPMathImage::JKQTPMathImage(JKQtPlotter *parent): - JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, NULL, 0, 0, parent) + JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageBase::UInt8Array, nullptr, 0, 0, parent) { initJKQTPMathImage(); } @@ -750,7 +750,7 @@ void JKQTPMathImage::saveImagePlotAsImage(const QString &filename, const QByteAr QString selFormat; if (fn.isEmpty()) { selFormat=currentFileFormat; - fn = QFileDialog::getSaveFileName(NULL, tr("Save Image Plot As Image ..."), + fn = QFileDialog::getSaveFileName(nullptr, tr("Save Image Plot As Image ..."), currentSaveDirectory, filt.join(";;"), &selFormat); if (!fn.isEmpty()) currentSaveDirectory=QFileInfo(fn).absolutePath(); @@ -800,7 +800,7 @@ void JKQTPMathImage::saveColorbarPlotAsImage(const QString &filename, const QByt QString selFormat; if (fn.isEmpty()) { selFormat=currentFileFormat; - fn = QFileDialog::getSaveFileName(NULL, tr("Save Image Plot As Image ..."), + fn = QFileDialog::getSaveFileName(nullptr, tr("Save Image Plot As Image ..."), currentSaveDirectory, filt.join(";;"), &selFormat); if (!fn.isEmpty()) currentSaveDirectory=QFileInfo(fn).absolutePath(); @@ -1242,7 +1242,7 @@ JKQTPOverlayImage::JKQTPOverlayImage(JKQtBasePlotter *parent): connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage())); this->Nx=0; this->Ny=0; - this->data=NULL; + this->data=nullptr; this->trueColor=QColor("red"); } @@ -1269,7 +1269,7 @@ JKQTPOverlayImage::JKQTPOverlayImage(JKQtPlotter *parent): connect(actCopyImage, SIGNAL(triggered()), this, SLOT(copyImagePlotAsImage())); this->Nx=0; this->Ny=0; - this->data=NULL; + this->data=nullptr; this->trueColor=QColor("red"); } @@ -1341,7 +1341,7 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double } JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQtBasePlotter *parent): - JKQTPOverlayImage(0,0,1,1,NULL,0,0, QColor("red"), parent) + JKQTPOverlayImage(0,0,1,1,nullptr,0,0, QColor("red"), parent) { symbol=JKQTPtarget; symbolWidth=1; @@ -1361,7 +1361,7 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double } JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQtPlotter *parent): - JKQTPOverlayImage(0,0,1,1,NULL,0,0, QColor("red"), parent) + JKQTPOverlayImage(0,0,1,1,nullptr,0,0, QColor("red"), parent) { symbol=JKQTPtarget; symbolWidth=1; @@ -1541,14 +1541,14 @@ JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double he } JKQTPRGBMathImage::JKQTPRGBMathImage(JKQtBasePlotter *parent): - JKQTPMathImageBase(0,0,0,0, DoubleArray, NULL, 0, 0, parent) + JKQTPMathImageBase(0,0,0,0, DoubleArray, nullptr, 0, 0, parent) { initObject(); } JKQTPRGBMathImage::JKQTPRGBMathImage(JKQtPlotter *parent): - JKQTPMathImageBase(0,0,0,0, DoubleArray, NULL, 0, 0, parent) + JKQTPMathImageBase(0,0,0,0, DoubleArray, nullptr, 0, 0, parent) { initObject(); } @@ -2089,7 +2089,7 @@ void JKQTPRGBMathImage::saveImagePlotAsImage(const QString &filename, const QByt QString selFormat; if (fn.isEmpty()) { selFormat=currentFileFormat; - fn = QFileDialog::getSaveFileName(NULL, tr("Save Image Plot As Image ..."), + fn = QFileDialog::getSaveFileName(nullptr, tr("Save Image Plot As Image ..."), currentSaveDirectory, filt.join(";;"), &selFormat); if (!fn.isEmpty()) currentSaveDirectory=QFileInfo(fn).absolutePath(); @@ -2199,8 +2199,8 @@ QImage JKQTPRGBMathImage::drawImage() { void JKQTPRGBMathImage::set_data(void* data, uint32_t Nx, uint32_t Ny, DataType datatype) { this->data=data; this->datatype=datatype; - this->dataG=NULL; - this->dataB=NULL; + this->dataG=nullptr; + this->dataB=nullptr; this->Nx=Nx; this->Ny=Ny; } @@ -2209,8 +2209,8 @@ void JKQTPRGBMathImage::set_data(void* data, uint32_t Nx, uint32_t Ny) { this->data=data; this->Nx=Nx; this->Ny=Ny; - this->dataG=NULL; - this->dataB=NULL; + this->dataG=nullptr; + this->dataB=nullptr; } @@ -2244,7 +2244,7 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(JKQtBasePlotter *parent): } JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent): - JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,NULL,Nx,Ny,JKQTPMathImageGRAY,parent) + JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,nullptr,Nx,Ny,JKQTPMathImageGRAY,parent) { this->modifierColumn=-1; this->imageColumn=-1; @@ -2252,7 +2252,7 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, dou } JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, JKQtBasePlotter *parent): - JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,NULL,Nx,Ny,palette,parent) + JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,nullptr,Nx,Ny,palette,parent) { this->modifierColumn=-1; this->imageColumn=imageColumn; @@ -2268,7 +2268,7 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(JKQtPlotter *parent): } 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) + JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,nullptr,Nx,Ny,JKQTPMathImageGRAY,parent) { this->modifierColumn=-1; this->imageColumn=-1; @@ -2276,14 +2276,14 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, dou } 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) + JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,nullptr,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) + JKQTPMathImage(x,y,width,height,JKQTPMathImageBase::DoubleArray,nullptr,Nx,Ny,JKQTPMathImageGRAY,parent) { this->modifierColumn=-1; this->imageColumn=imageColumn; @@ -2300,7 +2300,7 @@ void JKQTPColumnMathImage::ensureImageData() if (this->Nx==0 || imageColumn<0 || !parent->getDatastore()->getColumn(imageColumn).getPointer(0)) { this->Ny=0; - this->data=NULL; + this->data=nullptr; this->datatype=JKQTPMathImageBase::DoubleArray; } else { this->datatype=JKQTPMathImageBase::DoubleArray; @@ -2308,7 +2308,7 @@ void JKQTPColumnMathImage::ensureImageData() this->Ny=parent->getDatastore()->getColumn(imageColumn).getRows()/this->Nx; } if (this->Nx==0 || modifierColumn<0 || !parent->getDatastore()->getColumn(modifierColumn).getPointer(0)) { - this->dataModifier=NULL; + this->dataModifier=nullptr; } else { this->datatypeModifier=JKQTPMathImageBase::DoubleArray; this->dataModifier=parent->getDatastore()->getColumn(modifierColumn).getPointer(0); @@ -2336,7 +2336,7 @@ void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) { } JKQTPOverlayImageEnhanced::draw(painter); free(data); - data=NULL; + data=nullptr; } bool JKQTPColumnOverlayImageEnhanced::usesColumn(int c) @@ -2345,7 +2345,7 @@ bool JKQTPColumnOverlayImageEnhanced::usesColumn(int c) } JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(JKQtBasePlotter *parent): - JKQTPRGBMathImage(0,0,0,0,DoubleArray,NULL,0,0,parent) + JKQTPRGBMathImage(0,0,0,0,DoubleArray,nullptr,0,0,parent) { this->modifierColumn=-1; this->imageRColumn=-1; @@ -2355,7 +2355,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(JKQtBasePlotter *parent): } JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent): - JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=-1; @@ -2365,7 +2365,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent): - JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=imageRColumn; @@ -2375,7 +2375,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent): - JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=imageRColumn; @@ -2385,7 +2385,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter *parent): - JKQTPRGBMathImage(x,y,width,height,DoubleArray,NULL,Nx,Ny,parent) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=imageRColumn; @@ -2395,7 +2395,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(JKQtPlotter *parent): - JKQTPRGBMathImage(0,0,0,0,DoubleArray,NULL,0,0,parent) + JKQTPRGBMathImage(0,0,0,0,DoubleArray,nullptr,0,0,parent) { this->modifierColumn=-1; this->imageRColumn=-1; @@ -2405,7 +2405,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(JKQtPlotter *parent): } 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) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=-1; @@ -2415,7 +2415,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } 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) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=imageRColumn; @@ -2425,7 +2425,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } 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) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=imageRColumn; @@ -2435,7 +2435,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt } 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) + JKQTPRGBMathImage(x,y,width,height,DoubleArray,nullptr,Nx,Ny,parent) { this->modifierColumn=-1; this->imageRColumn=imageRColumn; @@ -2619,7 +2619,7 @@ void JKQTPOverlayImage::saveImagePlotAsImage(const QString &filename, const QByt QString selFormat; if (fn.isEmpty()) { selFormat=currentFileFormat; - fn = QFileDialog::getSaveFileName(NULL, tr("Save Image Plot As Image ..."), + fn = QFileDialog::getSaveFileName(nullptr, tr("Save Image Plot As Image ..."), currentSaveDirectory, filt.join(";;"), &selFormat); if (!fn.isEmpty()) currentSaveDirectory=QFileInfo(fn).absolutePath(); diff --git a/jkqtpimageelements.h b/jkqtpimageelements.h index 75f5b87743..2a0d458da4 100644 --- a/jkqtpimageelements.h +++ b/jkqtpimageelements.h @@ -54,9 +54,9 @@ class LIB_EXPORT JKQTPImageBase: public JKQTPgraph { Q_OBJECT public: /** \brief class constructor */ - JKQTPImageBase(JKQtBasePlotter* parent=NULL); + JKQTPImageBase(JKQtBasePlotter* parent=nullptr); /** \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=nullptr); /** \brief class constructor */ JKQTPImageBase(JKQtPlotter* parent); /** \brief class constructor */ @@ -151,14 +151,14 @@ class LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase { /** \brief class constructor */ - JKQTPMathImageBase(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(JKQtBasePlotter* parent=nullptr); + JKQTPMathImageBase(double x, double y, double width, double height, JKQtBasePlotter* parent=nullptr); + JKQTPMathImageBase(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=nullptr); /** \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, JKQtPlotter* parent=nullptr); 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 */ @@ -220,7 +220,7 @@ class LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase { class LIB_EXPORT JKQTPImageModifierModeComboBox: public QComboBox { Q_OBJECT public: - JKQTPImageModifierModeComboBox(QWidget* parent=NULL); + JKQTPImageModifierModeComboBox(QWidget* parent=nullptr); JKQTPMathImageBase::ModifierMode getModifierMode() const; void setModifierMode(JKQTPMathImageBase::ModifierMode mode); @@ -237,11 +237,11 @@ class LIB_EXPORT JKQTPImage: public JKQTPImageBase { public: /** \brief class constructor */ - JKQTPImage(JKQtBasePlotter* parent=NULL); + JKQTPImage(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPImage(JKQtPlotter* parent); /** \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=nullptr); /** \brief class constructor */ JKQTPImage(double x, double y, double width, double height, QImage* image, JKQtPlotter* parent); @@ -284,8 +284,8 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase { public: /** \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(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=nullptr); + JKQTPMathImage(JKQtBasePlotter* parent=nullptr); 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); @@ -470,13 +470,13 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase { /** \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=nullptr); /** \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); + JKQTPRGBMathImage(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPRGBMathImage(JKQtPlotter* parent); @@ -655,9 +655,9 @@ class LIB_EXPORT JKQTPColumnMathImage: public JKQTPMathImage { public: /** \brief class constructor */ - 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, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQtBasePlotter* parent=NULL); + JKQTPColumnMathImage(JKQtBasePlotter* parent=nullptr); + JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=nullptr); + JKQTPColumnMathImage(double x, double y, double width, double height, int imageColumn, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPColumnMathImage(JKQtPlotter* parent); JKQTPColumnMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent); @@ -691,11 +691,11 @@ class LIB_EXPORT JKQTPColumnRGBMathImage: public JKQTPRGBMathImage { public: /** \brief class constructor */ - JKQTPColumnRGBMathImage(JKQtBasePlotter* parent=NULL); - JKQTPColumnRGBMathImage(double x, double y, double width, double height, 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, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=NULL); + JKQTPColumnRGBMathImage(JKQtBasePlotter* parent=nullptr); + JKQTPColumnRGBMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=nullptr); + JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=nullptr); + JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=nullptr); + JKQTPColumnRGBMathImage(double x, double y, double width, double height, int imageRColumn, int imageGColumn, int imageBColumn, uint32_t Nx, uint32_t Ny, JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPColumnRGBMathImage(JKQtPlotter* parent); JKQTPColumnRGBMathImage(double x, double y, double width, double height, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent); @@ -733,8 +733,8 @@ class LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase { public: /** \brief class constructor */ - 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(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtBasePlotter* parent=nullptr); + JKQTPOverlayImage(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPOverlayImage(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtPlotter* parent); @@ -799,8 +799,8 @@ class LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage { Q_OBJECT public: /** \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(JKQtBasePlotter* parent=NULL); + JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, uint32_t Nx, uint32_t Ny, QColor colTrue, JKQtBasePlotter* parent=nullptr); + JKQTPOverlayImageEnhanced(JKQtBasePlotter* parent=nullptr); /** \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); @@ -846,7 +846,7 @@ class LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage { class LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImageEnhanced { Q_OBJECT public: - JKQTPColumnOverlayImageEnhanced(JKQtBasePlotter* parent=NULL); + JKQTPColumnOverlayImageEnhanced(JKQtBasePlotter* parent=nullptr); JKQTPColumnOverlayImageEnhanced(JKQtPlotter* parent); JKQTPGET_SET_MACRO(int, imageColumn) @@ -884,9 +884,9 @@ class LIB_EXPORT JKQTPContour: public JKQTPMathImage { Q_OBJECT public: /** \brief class constructor */ - JKQTPContour(JKQtBasePlotter* parent=NULL); + JKQTPContour(JKQtBasePlotter* parent=nullptr); /** \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=nullptr); /** \brief class constructor */ JKQTPContour(JKQtPlotter* parent); /** \brief class constructor */ diff --git a/jkqtpimagetools.cpp b/jkqtpimagetools.cpp index 2a270f7b6a..d6b9ce33e2 100644 --- a/jkqtpimagetools.cpp +++ b/jkqtpimagetools.cpp @@ -371,15 +371,15 @@ void JKQTPimagePlot_freeLUTs(QList &lutstore) { } int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalette palette) { - int* lut_used=NULL; + int* lut_used=nullptr; if (palette == JKQTPMathImageRED) { //int*& plut=lutstore[palette]; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(static_cast(255.0*v), 0, 0); @@ -393,10 +393,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageGREEN) { //int*& plut=&lut_green; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(0, static_cast(255.0*v), 0); @@ -410,10 +410,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageBLUE) { //int*& plut=&lut_blue; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(0, 0, static_cast(255.0*v)); @@ -427,10 +427,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageGRAY) { //int*& plut=&lut_gray; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(static_cast(255.0*v), @@ -445,10 +445,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageALPHA) { //int*& plut=&lut_gray; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgba(255,255,255, @@ -462,10 +462,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_ALPHA) { //int*& plut=&lut_gray; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgba(255,255,255, @@ -479,10 +479,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTEDRED) { //int*& plut=&lut_invred; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(static_cast(255.0*(1.0-v)), 0, 0); @@ -496,10 +496,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTEDGREEN) { //int*& plut=&lut_invgreen; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(0, static_cast(255.0*(1.0-v)), 0); @@ -512,10 +512,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTEDBLUE) { //int*& plut=&lut_invblue; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=qRgb(0, 0, static_cast(255.0*(1.0-v))); @@ -528,10 +528,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTEDGRAY) { //int*& plut=&lut_invgray; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=1.0-(l/(double)(JKQTPimagePlot_LUTSIZE)); plut[l]=qRgb(static_cast(255.0*v), @@ -547,10 +547,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageMATLAB) { //int*& plut=&lut_matlab; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = 382.5 - 1020.0 * std::abs(v - 0.75); @@ -581,10 +581,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_MATLAB) { //int*& plut=&lut_matlab_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=JKQTPimagePlot_LUTSIZE; l>=0; l--) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 382.5 - 1020.0 * std::abs(v - 0.75); @@ -615,10 +615,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageRYGB) //gnuplot: 30,-13,-23 { //int*& plut=&lut_rygb; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = 796.875*v - 199.21875; @@ -642,10 +642,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_RYGB) //gnuplot: 30,-13,-23 { //int*& plut=&lut_rygb_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=JKQTPimagePlot_LUTSIZE; l>=0; l--) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 796.875*v - 199.21875; @@ -669,10 +669,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageHSV) { //int*& plut=&lut_hsv; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); int h = static_cast(floor(6*v)); @@ -696,10 +696,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_HSV) { //int*& plut=&lut_invhsv; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); int h = static_cast(floor(6.0-6.0*v)); @@ -723,11 +723,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageRAINBOW) //gnuplot: 33,13,10 { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = 255.0*std::abs(2.0*v-0.5); @@ -745,11 +745,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageINVERTED_RAINBOW) //gnuplot: 33,13,10 { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=JKQTPimagePlot_LUTSIZE; l>=0; l--) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 255.0*std::abs(2.0*v-0.5); @@ -769,10 +769,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageHOT) //gnuplot: 21,22,23 { //int*& plut=&lut_hot; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = 765.0*v; @@ -797,10 +797,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_HOT) //gnuplot: 21,22,23 { //int*& plut=&lut_hot_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=JKQTPimagePlot_LUTSIZE; l>=0; l--) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 765.0*v; @@ -825,10 +825,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageOCEAN) //gnuplot: 23,28,3 { //int*& plut=&lut_ocean; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = 765.0*v-510.0; @@ -847,10 +847,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_OCEAN) //gnuplot: 23,28,3 { //int*& plut=&lut_ocean_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=JKQTPimagePlot_LUTSIZE; l>=0; l--) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 765.0*v-510.0; @@ -868,10 +868,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageBLUEMAGENTAYELLOW) //gnuplot: 30,31,32 { //int*& plut=&lut_bluemagentayellow; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = (v/0.32-0.78125); @@ -898,10 +898,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW) //gnuplot: 30,31,32 { //int*& plut=&lut_bluemagentayellow_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = (v/0.32-0.78125); @@ -928,10 +928,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageBLUEYELLOW) //gnuplot: 8,9,10 { //int*& plut=&lut_blueyellow; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = sqrt(sqrt(v)); @@ -955,10 +955,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageINVERTED_BLUEYELLOW) //gnuplot: 8,9,10 { //int*& plut=&lut_blueyellow_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = sqrt(sqrt(v)); @@ -982,10 +982,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageCYAN) { //int*& plut=&lut_cyan; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = v*0.5; @@ -1009,10 +1009,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_CYAN) { //int*& plut=&lut_cyan_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = v*0.5; @@ -1036,10 +1036,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageTRAFFICLIGHT) { //int*& plut=&lut_trafficlight; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=l/(double)(JKQTPimagePlot_LUTSIZE); double r = (v < 0.5) ? 128.0*sin(M_PI*(2.0*v-0.5))+128.0 : 255.0; @@ -1059,10 +1059,10 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet else if (palette == JKQTPMathImageINVERTED_TRAFFICLIGHT) { //int*& plut=&lut_trafficlight_inverted; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = (v < 0.5) ? 128.0*sin(M_PI*(2.0*v-0.5))+128.0 : 255.0; @@ -1081,11 +1081,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageBLUEWHITERED) //gnuplot: 34,13,-34 { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(8.0, 0xFFB2182B); lst<(7.0, 0xFFD6604D); @@ -1103,11 +1103,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageREDWHITEBLUE) //gnuplot: https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/RdBu.plt { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFB2182B); lst<(1.0, 0xFFD6604D); @@ -1128,11 +1128,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageBLACKBLUEREDYELLOW) //gnuplot: 7,5,15 { // int*& plut=&lut_BLACKBLUEREDYELLOW; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 255.0*qBound(0.0,sqrt(v),1.0); @@ -1147,11 +1147,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageGREENREDVIOLET) //gnuplot: 3,11,6 { //int*& plut=&lut_GREENREDVIOLET; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 255.0*qBound(0.0,v,1.0); @@ -1166,11 +1166,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageBLACKBLUEVIOLETYELLOWWHITE) //gnuplot: 30,31,32 { //int*& plut=&lut_BLACKBLUEVIOLETYELLOWWHITE; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); @@ -1185,11 +1185,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageWHITEYELLOWVIOLETBLUEBLACK) //gnuplot: 30,31,32 { //int*& plut=&lut_WHITEYELLOWVIOLETBLUEBLACK; - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); @@ -1203,11 +1203,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageBR_GR) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/BrBG.plt { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); @@ -1224,11 +1224,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageBR_GR_STEP) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/BrBG.plt { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); @@ -1245,11 +1245,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImagePU_OR) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/PuOr.plt { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFB35806); lst<(1.0, 0xFFE08214); @@ -1267,11 +1267,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImagePU_OR_STEP) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/PuOr.plt { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFB35806); lst<(1.0, 0xFFE08214); @@ -1289,11 +1289,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageYL_GN_BU) //http://colorbrewer2.org/ { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFFFFFD9); lst<(1.0, 0xFFEDF8B1); @@ -1311,11 +1311,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageYL_GN_BU_STEP) //http://colorbrewer2.org/ { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFFFFFD9); lst<(1.0, 0xFFEDF8B1); @@ -1334,11 +1334,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageGN_BU) //http://colorbrewer2.org/ { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFF7FCF0); lst<(1.0, 0xFFE0F3DB); @@ -1356,11 +1356,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageGN_BU_STEP) //http://colorbrewer2.org/ { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFFF7FCF0); lst<(1.0, 0xFFE0F3DB); @@ -1378,11 +1378,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageBU_GN) //http://colorbrewer2.org/ { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(8.0, 0xFFF7FCF0); lst<(7.0, 0xFFE0F3DB); @@ -1400,11 +1400,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageBU_GN_STEP) //http://colorbrewer2.org/ { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(8.0, 0xFFF7FCF0); lst<(7.0, 0xFFE0F3DB); @@ -1422,11 +1422,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageINVERTED_MAGENTA) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); @@ -1437,11 +1437,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageMAGENTA) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); @@ -1452,11 +1452,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageINVERTED_YELLOW) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); @@ -1467,11 +1467,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageYELLOW) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); @@ -1483,11 +1483,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageINVERTED_MAGENTAWHITE) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); @@ -1498,11 +1498,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageMAGENTAWHITE) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); @@ -1513,11 +1513,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageINVERTED_YELLOWWHITE) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); @@ -1528,11 +1528,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageYELLOWWHITE) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); @@ -1544,11 +1544,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageINVERTED_CYANWHITE) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); @@ -1559,11 +1559,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageCYANWHITE) // from CMYK model { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { for (int l=0; l<=JKQTPimagePlot_LUTSIZE; l++) { double v=(JKQTPimagePlot_LUTSIZE-l)/(double)(JKQTPimagePlot_LUTSIZE); plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); @@ -1574,11 +1574,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet lut_used=lutstore[palette]; } else if (palette == JKQTPMathImageBlueGreenRed) { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(1.0, QColor("blue").rgb()); lst<(2.0, QColor("green").rgb()); @@ -1591,11 +1591,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImageRedGreenBlue) { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(1.0, QColor("red").rgb()); lst<(2.0, QColor("green").rgb()); @@ -1609,11 +1609,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT) { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(1.0, QColor("magenta").rgb()); lst<(2.0, QColor("yellow").rgb()); @@ -1625,11 +1625,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT+1) { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(1.0, QColor("yellow").rgb()); lst<(2.0, QColor("magenta").rgb()); @@ -1641,11 +1641,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT+2) { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(1.0, QColor("red").rgb()); lst<(2.0, QColor("blue").rgb()); @@ -1657,11 +1657,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT+3) { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(1.0, QColor("blue").rgb()); lst<(2.0, QColor("red").rgb()); @@ -1675,11 +1675,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet /* } else if (palette == JKQTPMathImagePU_OR) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/PuOr.plt { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { QList > lst; lst<(0.0, 0xFF); lst<(1.0, 0xFF); @@ -1700,11 +1700,11 @@ int* JKQTPimagePlot_getCreateLUT(QList& lutstore, JKQTPMathImageColorPalet } else if (JKQTPimagePlot_lutsFromFiles.contains(palette)) // LUTs read from files in JKQTPimagePlot_lutsFromFiles { - if (lutstore[palette]==NULL) { + if (lutstore[palette]==nullptr) { lutstore[palette]=(int*)malloc((JKQTPimagePlot_LUTSIZE+2)*sizeof(int)); int* plut=lutstore[palette]; //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=NULL) { + if (plut!=nullptr) { if (JKQTPimagePlot_lutsFromFiles[palette].size()>220) JKQTPimagePlot_buildDefinedPalette(plut, JKQTPimagePlot_lutsFromFiles[palette]); else JKQTPimagePlot_buildDefinedPaletteLinInterpolate(plut, JKQTPimagePlot_lutsFromFiles[palette]); } diff --git a/jkqtpimagetools.h b/jkqtpimagetools.h index 5a79dbccf0..ccd0f43651 100644 --- a/jkqtpimagetools.h +++ b/jkqtpimagetools.h @@ -131,7 +131,7 @@ enum JKQTPMathImageColorPalette { class LIB_EXPORT JKQTPMathImageColorPaletteComboBox: public QComboBox { Q_OBJECT public: - JKQTPMathImageColorPaletteComboBox(QWidget* parent=NULL); + JKQTPMathImageColorPaletteComboBox(QWidget* parent=nullptr); JKQTPMathImageColorPalette colorPalette() const; JKQTPMathImageColorPalette currentColorPalette() const; JKQTPMathImageColorPalette getColorPalette() const; @@ -617,9 +617,9 @@ inline void JKQTPimagePlot_array2image(T* dbl_in, int width, int height, QImage double delta=max-min; - int* lut_used=NULL; + int* lut_used=nullptr; int lutSize=JKQTPimagePlot_LUTSIZE; - if (global_jkqtpimagetools_lutstore.size()<=0) global_jkqtpimagetools_lutstore=JKQTPimagePlot_makeQList(NULL, JKQTPimagePlot_getPredefinedPalettes().size()+2); + if (global_jkqtpimagetools_lutstore.size()<=0) global_jkqtpimagetools_lutstore=JKQTPimagePlot_makeQList(nullptr, JKQTPimagePlot_getPredefinedPalettes().size()+2); img = QImage(width, height, QImage::Format_ARGB32); @@ -637,7 +637,7 @@ inline void JKQTPimagePlot_array2image(T* dbl_in, int width, int height, QImage } - if (lut_used!=NULL && lutSize>0) { + if (lut_used!=nullptr && lutSize>0) { // LUT found: collor the image accordingly for (register int j=0; jsaveData(filename, format); } - /** \brief print the current plot, if printer is \c NULL a printer selection dialog is displayed */ - inline void print(QPrinter* printer=NULL) { + /** \brief print the current plot, if printer is \c nullptr a printer selection dialog is displayed */ + inline void print(QPrinter* printer=nullptr) { plotter->print(printer); } diff --git a/jkqtpmathparser.cpp b/jkqtpmathparser.cpp index 3df694af4b..f540a0f02a 100644 --- a/jkqtpmathparser.cpp +++ b/jkqtpmathparser.cpp @@ -661,10 +661,10 @@ std::string JKQTPMathParser::currenttokentostring() { // class constructor JKQTPMathParser::JKQTPMathParser() { - jkmathparser_exception_function=NULL; - data=NULL; + jkmathparser_exception_function=nullptr; + data=nullptr; argc=0; - argv=NULL; + argv=nullptr; addStandardFunctions(); addStandardVariables(); } @@ -966,7 +966,7 @@ JKQTPMathParser::jkmpEvaluateFunc JKQTPMathParser::getFunctionDef(std::string na //std::cout <0) { p=(JKQTPMathParser::jkmpNode**)malloc(sizeof(JKQTPMathParser::jkmpNode*) * num); for (int i=0; i0)) { + if ((child!=nullptr) && (n>0)) { for (int i=0; inext; } diff --git a/jkqtpparsedfunctionelements.h b/jkqtpparsedfunctionelements.h index d25ea63bf1..05c69b9a3a 100644 --- a/jkqtpparsedfunctionelements.h +++ b/jkqtpparsedfunctionelements.h @@ -53,7 +53,7 @@ class LIB_EXPORT JKQTPxParsedFunctionLineGraph: public JKQTPxFunctionLineGraph { /** \brief class constructor */ - JKQTPxParsedFunctionLineGraph(JKQtBasePlotter* parent=NULL); + JKQTPxParsedFunctionLineGraph(JKQtBasePlotter* parent=nullptr); /** \brief class constructor */ JKQTPxParsedFunctionLineGraph(JKQtPlotter* parent); diff --git a/jkqtpplotsmodel.cpp b/jkqtpplotsmodel.cpp index 1f159b75d5..1596961192 100644 --- a/jkqtpplotsmodel.cpp +++ b/jkqtpplotsmodel.cpp @@ -49,12 +49,12 @@ int JKQTPPlotsModel::columnCount(const QModelIndex &/*parent*/) const QVariant JKQTPPlotsModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { - if (index.row()getGraphCount()) return m_plotter->getGraph(index.row())->get_title(); + if (index.row()(m_plotter->getGraphCount())) return m_plotter->getGraph(static_cast(index.row()))->get_title(); } else if (role == Qt::CheckStateRole) { - if (index.row()getGraphCount()) return m_plotter->getGraph(index.row())->get_visible()?Qt::Checked:Qt::Unchecked; + if (index.row()(m_plotter->getGraphCount())) return m_plotter->getGraph(static_cast(index.row()))->get_visible()?Qt::Checked:Qt::Unchecked; } else if (role == Qt::DecorationRole) { - if (index.row()getGraphCount()) { - return m_plotter->getGraph(index.row())->generateKeyMarker(QSize(16,16)); + if (index.row()(m_plotter->getGraphCount())) { + return m_plotter->getGraph(static_cast(index.row()))->generateKeyMarker(QSize(16,16)); } } return QVariant(); @@ -63,7 +63,7 @@ QVariant JKQTPPlotsModel::data(const QModelIndex &index, int role) const bool JKQTPPlotsModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (role == Qt::CheckStateRole) { - if (index.row()getGraphCount()) { + if (index.row()(m_plotter->getGraphCount())) { m_plotter->setGraphVisible(index.row(), value.toBool()); return true; } diff --git a/jkqtptools.cpp b/jkqtptools.cpp index 2c85a96bd2..ae3dde2fa4 100644 --- a/jkqtptools.cpp +++ b/jkqtptools.cpp @@ -1465,7 +1465,7 @@ void JKQTPEnhancedTableView::keyPressEvent(QKeyEvent *event) void JKQTPEnhancedTableView::print() { - QPrinter* tablePrinter=getPrinter(NULL); + QPrinter* tablePrinter=getPrinter(nullptr); if (tablePrinter) { QDialog* dlg=new QDialog(this); @@ -1737,12 +1737,12 @@ void JKQTPEnhancedTableView::paint(QPainter &painter, double scale, int page, do QPrinter *JKQTPEnhancedTableView::getPrinter(QPrinter *printerIn, bool *localPrinter) { QPrinter* p=printerIn; - if (p==NULL) { + if (p==nullptr) { p=new QPrinter(); if (localPrinter) *localPrinter=true; } - QPrintDialog *dialog = new QPrintDialog(p, NULL); + QPrintDialog *dialog = new QPrintDialog(p, nullptr); dialog->setWindowTitle(tr("Print Table")); if (dialog->exec() != QDialog::Accepted) { if (localPrinter && *localPrinter) delete p; diff --git a/jkqtptools.h b/jkqtptools.h index 9eadeb6158..0eff3f4d21 100644 --- a/jkqtptools.h +++ b/jkqtptools.h @@ -435,7 +435,7 @@ class JKQTPEnhancedPainter; // forward * * This returns a QString which contains the name of named colors and the RGBA values in a QT readable form othertwise. */ -#define QColor2String(color) QString(jkqtp_rgbtostring((color).red(), (color).green(), (color).blue(), (color).alpha()).c_str()) +#define QColor2String(color) QString(jkqtp_rgbtostring(static_cast((color).red()), static_cast((color).green()), static_cast((color).blue()), static_cast((color).alpha())).c_str()) /** \brief converts a QT::PenStyle into a string * \ingroup jkqtptools @@ -476,7 +476,7 @@ enum JKQTPCAdrawMode { class LIB_EXPORT JKQTPCAdrawModeComboBox: public QComboBox { Q_OBJECT public: - JKQTPCAdrawModeComboBox(QWidget* parent=NULL); + JKQTPCAdrawModeComboBox(QWidget* parent=nullptr); JKQTPCAdrawMode getDrawMode() const; void setDrawMode(JKQTPCAdrawMode position); @@ -533,7 +533,7 @@ LIB_EXPORT JKQTPLabelTickMode String2JKQTPLabelTickMode(QString pos); class LIB_EXPORT JKQTPCAlabelTypeComboBox: public QComboBox { Q_OBJECT public: - JKQTPCAlabelTypeComboBox(QWidget* parent=NULL); + JKQTPCAlabelTypeComboBox(QWidget* parent=nullptr); JKQTPCAlabelType getLabelType() const; void setLabelType(JKQTPCAlabelType position); @@ -567,7 +567,7 @@ enum JKQTPlabelPosition { class LIB_EXPORT JKQTPlabelPositionComboBox: public QComboBox { Q_OBJECT public: - JKQTPlabelPositionComboBox(QWidget* parent=NULL); + JKQTPlabelPositionComboBox(QWidget* parent=nullptr); JKQTPlabelPosition getPosition() const; void setPosition(JKQTPlabelPosition position); @@ -609,7 +609,7 @@ enum JKQTPkeyPosition { class LIB_EXPORT JKQTPkeyPositionComboBox: public QComboBox { Q_OBJECT public: - JKQTPkeyPositionComboBox(QWidget* parent=NULL); + JKQTPkeyPositionComboBox(QWidget* parent=nullptr); JKQTPkeyPosition getPosition() const; void setPosition(JKQTPkeyPosition position); @@ -647,7 +647,7 @@ enum JKQTPkeyLayout { class LIB_EXPORT JKQTPkeyLayoutComboBox: public QComboBox { Q_OBJECT public: - JKQTPkeyLayoutComboBox(QWidget* parent=NULL); + JKQTPkeyLayoutComboBox(QWidget* parent=nullptr); JKQTPkeyLayout getKeyLayout() const; void setKeyLayout(JKQTPkeyLayout layout); @@ -751,7 +751,7 @@ enum JKQTPerrorPlotstyle { class LIB_EXPORT JKQTPerrorPlotstyleComboBox: public QComboBox { Q_OBJECT public: - JKQTPerrorPlotstyleComboBox(QWidget* parent=NULL); + JKQTPerrorPlotstyleComboBox(QWidget* parent=nullptr); JKQTPerrorPlotstyle getErrorStyle() const; void setSymbol(JKQTPerrorPlotstyle symbol); @@ -836,7 +836,7 @@ LIB_EXPORT JKQTPgraphSymbols String2JKQTPgraphSymbols(QString pos); class LIB_EXPORT JKQTPSymbolComboBox: public QComboBox { Q_OBJECT public: - JKQTPSymbolComboBox(QWidget* parent=NULL); + JKQTPSymbolComboBox(QWidget* parent=nullptr); JKQTPgraphSymbols getSymbol() const; void setSymbol(JKQTPgraphSymbols symbol); @@ -852,7 +852,7 @@ class LIB_EXPORT JKQTPSymbolComboBox: public QComboBox { class LIB_EXPORT JKQTPLinePlotStyleComboBox: public QComboBox { Q_OBJECT public: - JKQTPLinePlotStyleComboBox(QWidget* parent=NULL); + JKQTPLinePlotStyleComboBox(QWidget* parent=nullptr); void setDefaultSymbol(JKQTPgraphSymbols symbol); void addUsedSymbol(JKQTPgraphSymbols symbol); @@ -873,7 +873,7 @@ class LIB_EXPORT JKQTPLinePlotStyleComboBox: public QComboBox { class LIB_EXPORT JKQTPLinePlotStyleWithSymbolSizeComboBox: public QComboBox { Q_OBJECT public: - JKQTPLinePlotStyleWithSymbolSizeComboBox(QWidget* parent=NULL); + JKQTPLinePlotStyleWithSymbolSizeComboBox(QWidget* parent=nullptr); void setDefaultSymbol(JKQTPgraphSymbols symbol, double size); void addUsedSymbol(JKQTPgraphSymbols symbol, double symbolSize, bool line); @@ -959,7 +959,7 @@ LIB_EXPORT void plotSymbol(QPaintDevice& paintDevice, double x, double y, JKQTPg \note all angles are given in degrees [0..360] */ -LIB_EXPORT QVector draw_ellipse(double x, double y, double a, double b, double angle_start=0, double angle_end=360, double alpha=0, int controlPoints=180, QPointF* x_start=NULL, QPointF* x_end=NULL); +LIB_EXPORT QVector draw_ellipse(double x, double y, double a, double b, double angle_start=0, double angle_end=360, double alpha=0, int controlPoints=180, QPointF* x_start=nullptr, QPointF* x_end=nullptr); #include @@ -970,7 +970,7 @@ LIB_EXPORT QVector draw_ellipse(double x, double y, double a, double b, class LIB_EXPORT JKQTPEnhancedDoubleSpinBox : public QDoubleSpinBox { Q_OBJECT public: - JKQTPEnhancedDoubleSpinBox(QWidget* parent=NULL); + JKQTPEnhancedDoubleSpinBox(QWidget* parent=nullptr); ~JKQTPEnhancedDoubleSpinBox(); signals: void editingFinished(double value); @@ -988,7 +988,7 @@ class LIB_EXPORT JKQTPEnhancedDoubleSpinBox : public QDoubleSpinBox { class LIB_EXPORT JKQTPEnhancedSpinBox : public QSpinBox { Q_OBJECT public: - JKQTPEnhancedSpinBox(QWidget* parent=NULL); + JKQTPEnhancedSpinBox(QWidget* parent=nullptr); ~JKQTPEnhancedSpinBox(); signals: void editingFinished(int value); @@ -1026,7 +1026,7 @@ inline QString JKQTPDoubleToQString(double value, int prec = 10, char f = 'g', Q class LIB_EXPORT JKQTPEnhancedTableView : public QTableView { Q_OBJECT public: - JKQTPEnhancedTableView(QWidget* parent=NULL); + JKQTPEnhancedTableView(QWidget* parent=nullptr); virtual ~JKQTPEnhancedTableView(); /** \brief return the contents of the table view as HTML fragment */ @@ -1048,9 +1048,9 @@ class LIB_EXPORT JKQTPEnhancedTableView : public QTableView { protected: virtual void keyPressEvent(QKeyEvent* event); - void paint(QPainter &painter, double scale, int page, double hhh, double vhw, const QList& pageCols, const QList& pageRows, QPrinter* p=NULL); + void paint(QPainter &painter, double scale, int page, double hhh, double vhw, const QList& pageCols, const QList& pageRows, QPrinter* p=nullptr); - QPrinter* getPrinter(QPrinter* printerIn=NULL, bool *localPrinter=NULL); + QPrinter* getPrinter(QPrinter* printerIn=nullptr, bool *localPrinter=nullptr); QAction* printAction; private: }; @@ -1252,23 +1252,23 @@ inline void jkqtpQuicksort(T* a, T2* a2, long long l, long long r){ \param input array to be sorted \param input2 array to be sorted \param N size of the array input - \param output if \c !=NULL data is written here (the memory location pointed at by \a output has to have at least the length \a N !!!), + \param output if \c !=nullptr data is written here (the memory location pointed at by \a output has to have at least the length \a N !!!), otherwise the array input is sorted inplace. - \param output2 if \c !=NULL data is written here (the memory location pointed at by \a output has to have at least the length \a N !!!), + \param output2 if \c !=nullptr data is written here (the memory location pointed at by \a output has to have at least the length \a N !!!), otherwise the array input is sorted inplace. */ template -inline void jkqtpSort(T* input, T2* input2, long long N, T* output=NULL, T2* output2=NULL) { +inline void jkqtpSort(T* input, T2* input2, long long N, T* output=nullptr, T2* output2=nullptr) { if ((!input)) return ; if (N<=0) return; T* data=input; - if (output!=NULL) { + if (output!=nullptr) { data=output; memcpy(output, input, N*sizeof(T)); } T2* data2=input2; - if (output2!=NULL && input2!=NULL) { + if (output2!=nullptr && input2!=nullptr) { data2=output2; memcpy(output2, input2, N*sizeof(T2)); } @@ -1290,23 +1290,23 @@ class LIB_EXPORT JKQTPAutoOutputTimer : public QElapsedTimer LIB_EXPORT std::string jkqtp_tolower(const std::string& s); - LIB_EXPORT bool jkqtp_strtobool(std::string data); - LIB_EXPORT std::string jkqtp_toupper(const std::string& s); +LIB_EXPORT bool jkqtp_strtobool(std::string data); +LIB_EXPORT std::string jkqtp_toupper(const std::string& s); - LIB_EXPORT std::string jkqtp_format(const std::string& templ, ...); +LIB_EXPORT std::string jkqtp_format(const std::string& templ, ...); - LIB_EXPORT long jkqtp_get_filesize(char *FileName); - LIB_EXPORT std::string jkqtp_bytestostr(double bytes); +LIB_EXPORT long jkqtp_get_filesize(char *FileName); +LIB_EXPORT std::string jkqtp_bytestostr(double bytes); - LIB_EXPORT std::string jkqtp_inttostr(long data); +LIB_EXPORT std::string jkqtp_inttostr(long data); - LIB_EXPORT std::string jkqtp_inttohex(long data); +LIB_EXPORT std::string jkqtp_inttohex(long data); - LIB_EXPORT std::string jkqtp_uinttostr(unsigned long data); +LIB_EXPORT std::string jkqtp_uinttostr(unsigned long data); - LIB_EXPORT std::string jkqtp_floattostr(double data, int past_comma=-1, bool remove_trail0=false, double belowIsZero=1e-16); +LIB_EXPORT std::string jkqtp_floattostr(double data, int past_comma=-1, bool remove_trail0=false, double belowIsZero=1e-16); - LIB_EXPORT std::string jkqtp_floattounitstr(double dataa, std::string unitname); +LIB_EXPORT std::string jkqtp_floattounitstr(double dataa, std::string unitname); LIB_EXPORT std::string jkqtp_booltostr(bool data); LIB_EXPORT std::string jkqtp_rgbtostring(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255); LIB_EXPORT std::string jkqtp_to_valid_variable_name(std::string input); @@ -1315,4 +1315,21 @@ LIB_EXPORT std::string jkqtp_floattounitstr(double data, int past_comma=5, bool LIB_EXPORT std::string jkqtp_floattolatexstr(double data, int past_comma=5, bool remove_trail0=false, double belowIsZero=1e-16, double minNoExponent=1e-3, double maxNoExponent=1e4); LIB_EXPORT std::string jkqtp_floattohtmlstr(double data, int past_comma=5, bool remove_trail0=false, double belowIsZero=1e-16, double minNoExponent=1e-3, double maxNoExponent=1e4); LIB_EXPORT std::string jkqtp_chartostr(char data); + +/** \brief wandelt einen Datentyp in einen double um, wird von JKQTPDatastore zur Wandlung benutzt + * + * Diese Funktion nutzt per default static_cast(), kann aber für spezielle Datentypen überschrieben werden, etwa für bool +*/ +template +inline constexpr double jkqtp_todouble(const T& d) { + return static_cast(d); +} + + +/** \brief wandelt einen boolean in einen double um, wird von JKQTPDatastore zur Wandlung benutzt, + * Spezialisierung für bool (true -> 1.0, false -> 0.0) */ +template<> +inline constexpr double jkqtp_todouble(const bool& d) { + return static_cast((d)?1.0:0.0); +} #endif // JKQTPTOOLS_H_INCLUDED diff --git a/test/jkqtplot_test/EmfEngine/src/EmfEngine.cpp b/test/jkqtplot_test/EmfEngine/src/EmfEngine.cpp index aa2c13d5d2..754b4332de 100644 --- a/test/jkqtplot_test/EmfEngine/src/EmfEngine.cpp +++ b/test/jkqtplot_test/EmfEngine/src/EmfEngine.cpp @@ -343,7 +343,7 @@ void EmfPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF int height = qRound(r.height()); #ifdef Q_WS_WIN - HBITMAP hbtmp = NULL; + HBITMAP hbtmp = nullptr; DWORD op = SRCCOPY; if (pm.hasAlpha()){ QImage image = pm.scaled(width, height).toImage(); @@ -457,13 +457,13 @@ void EmfPaintEngine::resetClipping() { #ifdef Q_WS_WIN if (painter()->hasClipping()) - SelectClipRgn(metaDC, NULL); + SelectClipRgn(metaDC, nullptr); #endif } HPEN EmfPaintEngine::convertPen(const QPen& pen) { - INT style = PS_NULL; + INT style = PS_nullptr; switch (pen.style()){ case Qt::SolidLine: style = PS_SOLID; @@ -528,12 +528,12 @@ HPEN EmfPaintEngine::convertPen(const QPen& pen) } LOGBRUSH lbrush = {BS_SOLID, RGB(pen.color().red(),pen.color().green(),pen.color().blue()), 0}; - return ExtCreatePen(PS_GEOMETRIC | style | capStyle | joinStyle, pen.width(), &lbrush, 0, NULL); + return ExtCreatePen(PS_GEOMETRIC | style | capStyle | joinStyle, pen.width(), &lbrush, 0, nullptr); } HBRUSH EmfPaintEngine::convertBrush(const QBrush& brush) { - LOGBRUSH lbrush = {BS_NULL, 0, 0}; + LOGBRUSH lbrush = {BS_nullptr, 0, 0}; if (!brush.color().alpha()) return CreateBrushIndirect( &lbrush ); @@ -562,7 +562,7 @@ HBRUSH EmfPaintEngine::convertBrush(const QBrush& brush) UINT lbStyle = BS_HATCHED; switch(brush.style()){ case Qt::NoBrush: - lbStyle = BS_NULL; + lbStyle = BS_nullptr; break; case Qt::SolidPattern: diff --git a/test/jkqtplot_test/EmfEngine/src/EmfEngine.h b/test/jkqtplot_test/EmfEngine/src/EmfEngine.h index cde7127943..1191e5176c 100644 --- a/test/jkqtplot_test/EmfEngine/src/EmfEngine.h +++ b/test/jkqtplot_test/EmfEngine/src/EmfEngine.h @@ -99,7 +99,7 @@ private: //! Converts a QPen to a GDI+ Pen structure Pen *convertPen(const QPen& pen); //! Converts a QBrush to a GDI+ Brush structure - Brush *convertBrush(const QBrush& brush, GraphicsPath *origPath = NULL); + Brush *convertBrush(const QBrush& brush, GraphicsPath *origPath = nullptr); //! Draws pixmap pix in a given rectangle void drawPixmap(const QPixmap &pix, const RectF &p); //! Constructs a texture brush based on pixmap pix diff --git a/test/jkqtplot_test/testmain.cpp b/test/jkqtplot_test/testmain.cpp index 09ad272335..f1089b23fd 100644 --- a/test/jkqtplot_test/testmain.cpp +++ b/test/jkqtplot_test/testmain.cpp @@ -431,7 +431,7 @@ TestMain::TestMain(QWidget *parent) : for (int y=0; y<100; y++) { img2[y*100+x]=sin(2*M_PI*sqrt(1.0+x*x+y*y)/20); img2M[y*100+x]=abs(y-x); - bimg2[y*100+x]=(double)rand()/(double)RAND_MAX>0.9; + bimg2[y*100+x]=static_cast(rand())/static_cast(RAND_MAX)>0.9; } } pimg2=new JKQTPMathImage(10,0,10,10, JKQTPMathImageBase::DoubleArray, img2, 100, 100, JKQTPMathImageGRAY, plotImg->get_plotter()); @@ -664,7 +664,7 @@ TestMain::TestMain(QWidget *parent) : // plotter for images QWidget* winrgb=new QWidget(this); QVBoxLayout* layoutrgb=new QVBoxLayout(this); - QFormLayout* frm=new QFormLayout(NULL); + QFormLayout* frm=new QFormLayout(nullptr); winrgb->setLayout(layoutrgb); winrgb->resize(1000, 800); plotImgRGB=new JKQtPlotter(true, winrgb); @@ -828,8 +828,8 @@ TestMain::TestMain(QWidget *parent) : for (int i=0; i<1000; i++) { double x=double(i)/1000.0; const double p=0.33*fabs(sin(x*4.0*M_PI))*fabs(sin(x*4.0*M_PI)); - if ((double)rand()/(double)RAND_MAX<=p) photons1<(rand())/static_cast(RAND_MAX)<=p) photons1<(rand())/static_cast(RAND_MAX)<=p) photons2<getDatastore()->addCopiedColumn(photons1.data(), photons1.size(), "photons 1"); int phot2=plotPeaks->getDatastore()->addCopiedColumn(photons2.data(), photons2.size(), "photons 2"); @@ -1263,21 +1263,21 @@ void TestMain::updateRGBChannels() rgbimg->set_data(rgb_rimg2, 100, 100); rgbimg2->set_imageRColumn(rgb_colr); } else { - rgbimg->set_data(NULL, 100, 100); + rgbimg->set_data(nullptr, 100, 100); rgbimg2->set_imageRColumn(-1); } if (chkRGBUseG->isChecked()) { rgbimg->set_dataG(rgb_gimg2); rgbimg2->set_imageGColumn(rgb_colg); } else { - rgbimg->set_dataG(NULL); + rgbimg->set_dataG(nullptr); rgbimg2->set_imageGColumn(-1); } if (chkRGBUseB->isChecked()) { rgbimg->set_dataB(rgb_bimg2); rgbimg2->set_imageBColumn(rgb_colb); } else { - rgbimg->set_dataB(NULL); + rgbimg->set_dataB(nullptr); rgbimg2->set_imageBColumn(-1); } plotImgRGB->update_plot();