improved/breaking change: image plots now manage CONST-data, not plain pointer arrays... This is OK, since the raw data is never owned nor modified by the plot, only referenced!

This commit is contained in:
jkriege2 2020-09-28 19:24:17 +02:00
parent 48ec6060ab
commit 58403f8905
12 changed files with 370 additions and 351 deletions

View File

@ -38,6 +38,7 @@ Changes, compared to \ref page_whatsnew_V2019_11 "v2019.11" include:
<li>improved/breaking change: extended styling system for graphs.</li>
<li>improved/breaking change: reworked graph Base-Classes (promoted several setters to slots, added Q_PROPERTY- and Q_ENUM-declarations...)</li>
<li>improved/breaking change: made more functions and function parameters const</li>
<li>improved/breaking change: image plots now manage CONST-data, not plain pointer arrays... This is OK, since the raw data is never owned nor modified by the plot, only referenced!.</li>
<li>bugfixed/improved: aspect ratio handling in JKQTPlotter.</li>
<li>new: added geometric plot objects JKQTPGeoArrow to draw arrows (aka lines with added line-end decorators, also extended JKQTPGeoLine, JKQTPGeoInfiniteLine, JKQTPGeoPolyLines to draw line-end decorator (aka arrows)</li>
<li>new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves</li>

View File

@ -2986,7 +2986,7 @@ QString ModifierModeToString(const JKQTPMathImageModifierMode &mode) {
return "none";
}
void JKQTPModifyImage(QImage &img, JKQTPMathImageModifierMode modifierMode, void *dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax)
void JKQTPModifyImage(QImage &img, JKQTPMathImageModifierMode modifierMode, const void *dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax)
{
if (!dataModifier) return;
//getModifierMinMax(internalModifierMin, internalModifierMax);
@ -3011,16 +3011,16 @@ void JKQTPModifyImage(QImage &img, JKQTPMathImageModifierMode modifierMode, void
}
//qDebug()<<"mod: "<<modifierMode<<" ch:"<<modChannel<<" rgb:"<<rgbModMode;
switch(datatypeModifier) {
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<double*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<float*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<uint8_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<uint16_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<uint32_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<uint64_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<int8_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<int16_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<int32_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<int64_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<const double*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<const float*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<const uint8_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<const uint16_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<const uint32_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<const uint64_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<const int8_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<const int16_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<const int32_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<const int64_t*>(dataModifier), Nx, Ny, img, modChannel, internalModifierMin, internalModifierMax, rgbModMode); break;
}
}

View File

@ -549,7 +549,7 @@ inline QVector<double> JKQTPImagePlot_BarrayToDVector(const bool* input, int N)
*/
template <class T>
inline double JKQTPImagePlot_getImageMin(T* dbl, int width, int height)
inline double JKQTPImagePlot_getImageMin(const T* dbl, int width, int height)
{
if (!dbl || width<=0 || height<=0)
return 0;
@ -580,7 +580,7 @@ inline double JKQTPImagePlot_getImageMin(T* dbl, int width, int height)
*/
template <class T>
inline double JKQTPImagePlot_getImageMax(T* dbl, int width, int height)
inline double JKQTPImagePlot_getImageMax(const T* dbl, int width, int height)
{
if (!dbl || width<=0 || height<=0)
return 0;
@ -623,7 +623,7 @@ inline double JKQTPImagePlot_getImageMax(T* dbl, int width, int height)
leave alpha as it is.
*/
template <class T>
inline void JKQTPImagePlot_array2RGBimage(T* dbl_in, int width, int height, QImage &img, int channel, double minColor, double maxColor, JKQTPRGBMathImageRGBMode rgbMode=JKQTPRGBMathImageModeRGBMode, bool logScale=false, double logBase=10.0)
inline void JKQTPImagePlot_array2RGBimage(const T* dbl_in, int width, int height, QImage &img, int channel, double minColor, double maxColor, JKQTPRGBMathImageRGBMode rgbMode=JKQTPRGBMathImageModeRGBMode, bool logScale=false, double logBase=10.0)
{
if (!dbl_in || width<=0 || height<=0)
return;
@ -653,16 +653,18 @@ inline void JKQTPImagePlot_array2RGBimage(T* dbl_in, int width, int height, QIma
}
T* dbl=dbl_in;
const T* dbl=dbl_in;
T* dbllog=nullptr;
if (logScale) {
double logB=log10(logBase);
dbl=static_cast<T*>(malloc(width*height*sizeof(T)));
dbllog=static_cast<T*>(malloc(width*height*sizeof(T)));
//memcpy(dbl, dbl_in, width*height*sizeof(T));
for (int i=0; i<width*height; i++) {
dbl[i]=log10(dbl_in[i])/logB;
dbllog[i]=log10(dbl_in[i])/logB;
}
min=log10(min)/logB;
max=log10(max)/logB;
dbl=dbllog;
}
double delta=max-min;
@ -864,7 +866,7 @@ inline void JKQTPImagePlot_array2RGBimage(T* dbl_in, int width, int height, QIma
}
}
if (logScale) free(dbl);
if (logScale) free(dbllog);
}
@ -1069,7 +1071,7 @@ QString JKQTCOMMON_LIB_EXPORT ModifierModeToString(const JKQTPMathImageModifierM
/** \brief modify the given image \a img, using modifier image \a dataModifier (of type \a datatypeModifier and size \a Nx * \a Ny), using values in the range \a internalModifierMin ... \a internalModifierMax )
\ingroup jkqtplotter_imagelots_tools
*/
void JKQTCOMMON_LIB_EXPORT JKQTPModifyImage(QImage& img, JKQTPMathImageModifierMode modifierMode, void* dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax);
void JKQTCOMMON_LIB_EXPORT JKQTPModifyImage(QImage& img, JKQTPMathImageModifierMode modifierMode, const void* dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax);

View File

@ -63,7 +63,7 @@ void JKQTPContourPlot::draw(JKQTPEnhancedPainter &painter)
int64_t colChecksum=-1;
if (data && Nx*Ny>0) {
colChecksum=static_cast<int64_t>(qChecksum(reinterpret_cast<char*>(data), Nx*Ny* getSampleSize()));
colChecksum=static_cast<int64_t>(qChecksum(reinterpret_cast<const char*>(data), Nx*Ny* getSampleSize()/sizeof(char)));
}
/*if (parent && parent->getDatastore() && imageColumn>=0) {
colChecksum=static_cast<int64_t>(parent->getDatastore()->getColumnChecksum(imageColumn));

View File

@ -132,62 +132,68 @@ void JKQTPImageBase::plotImage(JKQTPEnhancedPainter& painter, QImage& image, dou
}
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
double xmin=parent->getXMin();
double xmax=parent->getXMax();
double ymin=parent->getYMin();
double ymax=parent->getYMax();
QPointF pp1=transform(xmin,ymax);
QPointF pp2=transform(xmax,ymin);
QRectF pr(pp1, pp2);
// determine full shown plot rectangle in pixel coordinates
const double xmin=parent->getXMin();
const double xmax=parent->getXMax();
const double ymin=parent->getYMin();
const double ymax=parent->getYMax();
QPointF pix_plot_topleft=transform(xmin,ymax);
QPointF pix_plot_bottomright=transform(xmax,ymin);
QRectF pix_plotrectangle(pix_plot_topleft, pix_plot_bottomright);
// these flags say, whether to mirror the image in one or the other direction, before plotting
bool mirrx=false;
bool mirry=false;
QPointF p1=transform(x,y+height);
QPointF p2=transform(x+width,y);
if (p1.x()>p2.x()) {
double tmp=p1.x();
p1.setX(p2.x());
p2.setX(tmp);
tmp=pp1.x();
pp1.setX(pp2.x());
pp2.setX(tmp);
// determine pixel coordinates of image (x..x+width / y..y+width)
QPointF pix_topelft=transform(x,y+height);
QPointF pix_bottomright=transform(x+width,y);
if (pix_topelft.x()>pix_bottomright.x()) {
double tmp=pix_topelft.x();
pix_topelft.setX(pix_bottomright.x());
pix_bottomright.setX(tmp);
tmp=pix_plot_topleft.x();
pix_plot_topleft.setX(pix_plot_bottomright.x());
pix_plot_bottomright.setX(tmp);
mirrx=true;
}
if (p1.y()>p2.y()) {
double tmp=p1.y();
p1.setY(p2.y());
p2.setY(tmp);
tmp=pp1.y();
pp1.setY(pp2.y());
pp2.setY(tmp);
if (pix_topelft.y()>pix_bottomright.y()) {
double tmp=pix_topelft.y();
pix_topelft.setY(pix_bottomright.y());
pix_bottomright.setY(tmp);
tmp=pix_plot_topleft.y();
pix_plot_topleft.setY(pix_plot_bottomright.y());
pix_plot_bottomright.setY(tmp);
mirry=true;
}
QRectF r(p1, p2);
const QRectF pix_imagerect(pix_topelft, pix_bottomright);
if (image.width()>0 && image.height()>0 && !image.isNull()) {
if (r.width()<2*pr.width() && r.height()<2*pr.height()) {
// now we determine, whether to directly draw the image (if its size is smaller than twice the plot rectangle,
// or not ...
if (pix_imagerect.width()<2.0*pix_plotrectangle.width() && pix_imagerect.height()<2.0*pix_plotrectangle.height()) {
//painter.drawImage(QRectF(p1.x(), p2.y(), fabs(p2.x()-p1.x()), fabs(p2.y()-p1.y())), image);
painter.drawImage(QPointF(p1.x(), p1.y()), image.mirrored(mirrx, mirry).scaled(QSize(fabs(p2.x()-p1.x()), fabs(p2.y()-p1.y())), Qt::IgnoreAspectRatio, Qt::FastTransformation));
painter.drawImage(QPointF(pix_topelft.x(), pix_topelft.y()), image.mirrored(mirrx, mirry).scaled(QSize(fabs(pix_bottomright.x()-pix_topelft.x()), fabs(pix_bottomright.y()-pix_topelft.y())), Qt::IgnoreAspectRatio, Qt::FastTransformation));
//qDebug()<<"\nimage.size = "<<image.size() <<" SIMPLE!";
} else {
double pixwidth=fabs(p2.x()-p1.x())/static_cast<double>(image.width());
double pixheight=fabs(p2.y()-p1.y())/static_cast<double>(image.height());
// ... if the image is much larger than the plot rectangle, we cut a potion from the image, before plotting
const double pixwidth=fabs(pix_bottomright.x()-pix_topelft.x())/static_cast<double>(image.width());
const double pixheight=fabs(pix_bottomright.y()-pix_topelft.y())/static_cast<double>(image.height());
//qDebug()<<"\nimage.size = "<<image.size();
//qDebug()<<"size = "<<QSizeF(width, height);
//qDebug()<<"pixsize = "<<QSizeF(pixwidth, pixheight);
//qDebug()<<"p1 = "<<p1<< " p2 = "<<p2;
//qDebug()<<"pp1 = "<<pp1<<" pp2 = "<<pp2;
QPointF ps1(floor((pp1.x()-p1.x())/pixwidth), floor((pp1.y()-p1.y())/pixheight));
QPointF ps2=ps1+QPointF(ceil(fabs(pp2.x()-pp1.x())/pixwidth), ceil(fabs(pp2.y()-pp1.y())/pixheight));
QPointF ps1(floor((pix_plot_topleft.x()-pix_topelft.x())/pixwidth), floor((pix_plot_topleft.y()-pix_topelft.y())/pixheight));
QPointF ps2=ps1+QPointF(ceil(fabs(pix_plot_bottomright.x()-pix_plot_topleft.x())/pixwidth), ceil(fabs(pix_plot_bottomright.y()-pix_plot_topleft.y())/pixheight));
if (ps1.x()<0) ps1.setX(0);
if (ps1.y()<0) ps1.setY(0);
if (ps2.x()>image.width()) ps2.setX(image.width());
if (ps2.y()>image.height()) ps2.setY(image.height());
QRectF source(ps1, ps2);
QRectF target(p1.x()+ps1.x()*pixwidth, p1.y()+ps1.y()*pixheight, source.width()*pixwidth, source.height()*pixheight);
const QRectF source(ps1, ps2);
const QRectF target(pix_topelft.x()+ps1.x()*pixwidth, pix_topelft.y()+ps1.y()*pixheight, source.width()*pixwidth, source.height()*pixheight);
//qDebug()<<"source = "<<source;
//qDebug()<<"target = "<<target;
painter.drawImage(target, image.mirrored(mirrx, mirry), source);
@ -376,7 +382,7 @@ void JKQTPImage::copyImagePlotAsImage()
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTBasePlotter* parent):
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTBasePlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
this->data=data;
@ -388,7 +394,7 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double
}
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPlotter* parent):
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
this->data=data;
@ -433,12 +439,12 @@ int JKQTPMathImageBase::getNy() const
return this->Ny;
}
void JKQTPMathImageBase::setData(void *__value)
void JKQTPMathImageBase::setData(const void *__value)
{
this->data = __value;
}
void *JKQTPMathImageBase::getData() const
const void *JKQTPMathImageBase::getData() const
{
return this->data;
}
@ -453,12 +459,12 @@ JKQTPMathImageDataType JKQTPMathImageBase::getDatatype() const
return this->datatype;
}
void JKQTPMathImageBase::setDataModifier(void *__value)
void JKQTPMathImageBase::setDataModifier(const void *__value)
{
this->dataModifier = __value;
}
void *JKQTPMathImageBase::getDataModifier() const
const void *JKQTPMathImageBase::getDataModifier() const
{
return this->dataModifier;
}
@ -520,20 +526,20 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double
datatypeModifier=JKQTPMathImageDataType::DoubleArray;
}
void JKQTPMathImageBase::setData(void* data, int Nx, int Ny, JKQTPMathImageDataType datatype) {
void JKQTPMathImageBase::setData(const void *data, int Nx, int Ny, JKQTPMathImageDataType datatype) {
this->data=data;
this->datatype=datatype;
this->Nx=Nx;
this->Ny=Ny;
}
void JKQTPMathImageBase::setData(void* data, int Nx, int Ny) {
void JKQTPMathImageBase::setData(const void* data, int Nx, int Ny) {
this->data=data;
this->Nx=Nx;
this->Ny=Ny;
}
void JKQTPMathImageBase::setDataModifier(void *data, JKQTPMathImageDataType datatype)
void JKQTPMathImageBase::setDataModifier(const void *data, JKQTPMathImageDataType datatype)
{
this->dataModifier=data;
this->datatypeModifier=datatype;
@ -546,44 +552,44 @@ void JKQTPMathImageBase::getDataMinMax(double& imin, double& imax) {
if (!data) return;
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
imin= JKQTPImagePlot_getImageMin<double>(static_cast<double*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<double*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<double>(static_cast<const double*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<const double*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::FloatArray:
imin= JKQTPImagePlot_getImageMin<float>(static_cast<float*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<float*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<float>(static_cast<const float*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<const float*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt8Array:
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<uint8_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<uint8_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<const uint8_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<const uint8_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt16Array:
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<uint16_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<uint16_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<const uint16_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<const uint16_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt32Array:
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<uint32_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<uint32_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<const uint32_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<const uint32_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt64Array:
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<uint64_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<uint64_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<const uint64_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<const uint64_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::Int8Array:
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<int8_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<int8_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<const int8_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<const int8_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::Int16Array:
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<int16_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<int16_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<const int16_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<const int16_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::Int32Array:
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<int32_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<int32_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<const int32_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<const int32_t*>(data), Nx, Ny);
break;
case JKQTPMathImageDataType::Int64Array:
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<int64_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<int64_t*>(data), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<const int64_t*>(data), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<const int64_t*>(data), Nx, Ny);
break;
}
}
@ -595,44 +601,44 @@ void JKQTPMathImageBase::getModifierMinMax(double &imin, double &imax)
if (!dataModifier) return;
switch(datatypeModifier) {
case JKQTPMathImageDataType::DoubleArray:
imin= JKQTPImagePlot_getImageMin<double>(static_cast<double*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<double*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<double>(static_cast<const double*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<const double*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::FloatArray:
imin= JKQTPImagePlot_getImageMin<float>(static_cast<float*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<float*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<float>(static_cast<const float*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<const float*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt8Array:
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<uint8_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<uint8_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<const uint8_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<const uint8_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt16Array:
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<uint16_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<uint16_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<const uint16_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<const uint16_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt32Array:
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<uint32_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<uint32_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<const uint32_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<const uint32_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt64Array:
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<uint64_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<uint64_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<const uint64_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<const uint64_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::Int8Array:
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<int8_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<int8_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<const int8_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<const int8_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::Int16Array:
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<int16_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<int16_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<const int16_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<const int16_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::Int32Array:
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<int32_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<int32_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<const int32_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<const int32_t*>(dataModifier), Nx, Ny);
break;
case JKQTPMathImageDataType::Int64Array:
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<int64_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<int64_t*>(dataModifier), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<const int64_t*>(dataModifier), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<const int64_t*>(dataModifier), Nx, Ny);
break;
}
}
@ -641,34 +647,34 @@ QVector<double> JKQTPMathImageBase::getDataAsDoubleVector() const
{
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
return JKQTPImagePlot_arrayToDVector(static_cast<double*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const double*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::FloatArray:
return JKQTPImagePlot_arrayToDVector(static_cast<float*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const float*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::UInt8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint8_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint8_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::UInt16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint16_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint16_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::UInt32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint32_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint32_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::UInt64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint64_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint64_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::Int8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int8_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int8_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::Int16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int16_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int16_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::Int32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int32_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int32_t*>(data), Nx*Ny);
break;
case JKQTPMathImageDataType::Int64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int64_t*>(data), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int64_t*>(data), Nx*Ny);
break;
}
QVector<double> res;
@ -679,25 +685,25 @@ QVector<double> JKQTPMathImageBase::getDataModifierAsDoubleVector() const
{
switch(datatypeModifier) {
case JKQTPMathImageDataType::DoubleArray:
return JKQTPImagePlot_arrayToDVector(static_cast<double*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const double*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::FloatArray:
return JKQTPImagePlot_arrayToDVector(static_cast<float*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const float*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::UInt8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint8_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint8_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::UInt16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint16_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint16_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::UInt32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint32_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint32_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::UInt64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint64_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint64_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::Int8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int8_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int8_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::Int16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int16_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int16_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::Int32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int32_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int32_t*>(dataModifier), Nx*Ny);
case JKQTPMathImageDataType::Int64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int64_t*>(dataModifier), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int64_t*>(dataModifier), Nx*Ny);
}
QVector<double> res;
return res;
@ -729,7 +735,7 @@ void JKQTPMathImage::initJKQTPMathImage() {
this->autoModifierRange=true;
}
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, JKQTBasePlotter* parent):
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, JKQTBasePlotter* parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent),
JKQTPColorPaletteWithModifierStyleAndToolsMixin(parent)
{
@ -747,7 +753,7 @@ JKQTPMathImage::JKQTPMathImage(JKQTBasePlotter *parent):
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, JKQTPlotter* parent):
JKQTPMathImage::JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void *data, int Nx, int Ny, JKQTPMathImageColorPalette palette, JKQTPlotter* parent):
JKQTPMathImage(x, y, width, height, datatype, data, Nx, Ny, palette, parent->getPlotter())
{
}
@ -983,16 +989,16 @@ QImage JKQTPMathImage::drawImage() {
getDataMinMax(internalDataMin, internalDataMax);
getModifierMinMax(internalModifierMin, internalModifierMax);
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray: JKQTPImageTools::array2image<double>(static_cast<double*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImageTools::array2image<float>(static_cast<float*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImageTools::array2image<uint8_t>(static_cast<uint8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImageTools::array2image<uint16_t>(static_cast<uint16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImageTools::array2image<uint32_t>(static_cast<uint32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImageTools::array2image<uint64_t>(static_cast<uint64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImageTools::array2image<int8_t>(static_cast<int8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImageTools::array2image<int16_t>(static_cast<int16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImageTools::array2image<int32_t>(static_cast<int32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImageTools::array2image<int64_t>(static_cast<int64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::DoubleArray: JKQTPImageTools::array2image<double>(static_cast<const double*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImageTools::array2image<float>(static_cast<const float*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImageTools::array2image<uint8_t>(static_cast<const uint8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImageTools::array2image<uint16_t>(static_cast<const uint16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImageTools::array2image<uint32_t>(static_cast<const uint32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImageTools::array2image<uint64_t>(static_cast<const uint64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImageTools::array2image<int8_t>(static_cast<const int8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImageTools::array2image<int16_t>(static_cast<const int16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImageTools::array2image<int32_t>(static_cast<const int32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImageTools::array2image<int64_t>(static_cast<const int64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break;
}
modifyImage(img, dataModifier, datatypeModifier, Nx, Ny, internalModifierMin, internalModifierMax);
return img;

View File

@ -86,23 +86,24 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImageBase: public JKQTPGraph {
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override;
/** \copydoc x */
void setX(double __value);
/** \copydoc x */
double getX() const;
/** \copydoc y */
void setY(double __value);
/** \copydoc y */
double getY() const;
/** \copydoc width */
void setWidth(double __value);
/** \copydoc width */
double getWidth() const;
/** \copydoc height */
void setHeight(double __value);
/** \copydoc height */
double getHeight() const;
public slots:
/** \copydoc x */
void setX(double __value);
/** \copydoc y */
void setY(double __value);
/** \copydoc width */
void setWidth(double __value);
/** \copydoc height */
void setHeight(double __value);
protected:
/** \brief x coordinate of lower left corner */
@ -114,12 +115,18 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImageBase: public JKQTPGraph {
/** \brief height of image */
double height;
/*! \brief plot the given QImage onto the widget where the QImage fills the area defined by x, y (lower left corner) and width, height
in the simplest case your implementation of draw() will call
<code>plotImage(painter, image, this->x, this->y, this->width, this->height);</code>
/** \brief plot the given QImage onto the widget where the QImage fills the area defined by x, y (lower left corner) and width, height
* in the simplest case your implementation of draw() will call
* <code>plotImage(painter, image, this->x, this->y, this->width, this->height);</code>
*
* \param painter the Painter to use for drawing
* \param image the image to draw
* \param x x-coordinate of lower-left corner in coordinate space
* \param y y-coordinate of lower-left corner in coordinate space
* \param width width of image in coordinate space
* \param height height of image in coordinate space
*/
virtual void plotImage(JKQTPEnhancedPainter& painter, QImage& image, double x, double y, double width, double height);
void plotImage(JKQTPEnhancedPainter& painter, QImage& image, double x, double y, double width, double height);
};
@ -162,7 +169,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
* \param parent parent plotter object
*
*/
JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTBasePlotter* parent=nullptr);
JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTBasePlotter* parent=nullptr);
/** \brief class constructor
@ -193,7 +200,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
* \param parent parent plotter object
*
*/
JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPlotter* parent);
JKQTPMathImageBase(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPlotter* parent);
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
@ -206,22 +213,22 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
int getNx() const;
/** \copydoc Ny */
void setNy(int __value);
/** \copydoc Ny */
/** \copydoc Ny */
void setNy(size_t __value);
/** \copydoc Ny */
/** \copydoc Ny */
int getNy() const;
/** \copydoc data */
virtual void setData(void* __value);
virtual void setData(const void* __value);
/** \copydoc data */
virtual void *getData() const;
virtual const void *getData() const;
/** \copydoc datatype */
virtual void setDatatype(JKQTPMathImageDataType __value);
/** \copydoc datatype */
virtual JKQTPMathImageDataType getDatatype() const;
/** \copydoc dataModifier */
virtual void setDataModifier(void* __value);
virtual void setDataModifier(const void* __value);
/** \copydoc dataModifier */
virtual void *getDataModifier() const;
virtual const void *getDataModifier() const;
/** \copydoc datatypeModifier */
virtual void setDatatypeModifier(JKQTPMathImageDataType __value);
/** \copydoc datatypeModifier */
@ -229,11 +236,11 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
/** \copydoc modifierMode */
/** \brief sets dataModifier (\copybrief dataModifier ) and datatypeModifier (\copybrief datatypeModifier ) */
virtual void setDataModifier(void* data, JKQTPMathImageDataType datatype);
virtual void setDataModifier(const void *data, JKQTPMathImageDataType datatype);
/** \brief sets data (\copybrief data ) and datatype (\copybrief datatype ), as well as the size of data (Nx: \copybrief Nx and Ny: \copybrief Ny ) */
virtual void setData(void* data, int Nx, int Ny, JKQTPMathImageDataType datatype);
virtual void setData(const void* data, int Nx, int Ny, JKQTPMathImageDataType datatype);
/** \brief sets data (\copybrief data ), as well as the size of data (Nx: \copybrief Nx and Ny: \copybrief Ny ) */
virtual void setData(void* data, int Nx, int Ny);
virtual void setData(const void* data, int Nx, int Ny);
/** \brief determine min/max data value of the image */
virtual void getDataMinMax(double& imin, double& imax);
/** \brief determine min/max data value of the image */
@ -245,7 +252,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
QVector<double> getDataModifierAsDoubleVector() const;
protected:
/** \brief points to the data array, holding the image */
void* data;
const void* data;
/** \brief datatype of the data array data */
JKQTPMathImageDataType datatype;
/** \brief width of the data array data in pt */
@ -254,7 +261,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
int Ny;
/** \brief points to the data array, holding the modifier image */
void* dataModifier;
const void* dataModifier;
/** \brief datatype of the data array data */
JKQTPMathImageDataType datatypeModifier;
@ -371,7 +378,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImage: public JKQTPImageBase {
void clear_image();
/** \copydoc image */
inline QImage* getImage() const { return this->image; }
inline QImage* getImage() { return this->image; }
/** \copydoc image */
inline const QImage* getImage() const { return this->image; }
protected:
/** \brief the image to be plotted. This is freed by the destructor, iff \a image_owned is set to \c true (.e.g by QImage-copy-constructors) */
QImage* image;
@ -452,7 +461,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase, public J
* \param parent parent plotter object
*
*/
JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQTBasePlotter* parent=nullptr);
JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette=JKQTPMathImageGRAY, JKQTBasePlotter* parent=nullptr);
/** \brief class constructor
*
* \param x origin of the image (x-direction) in system coordinates
@ -467,7 +476,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase, public J
* \param parent parent plotter object
*
*/
JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, JKQTPlotter* parent);
JKQTPMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, JKQTPlotter* parent);
/** \brief class constructor
*
* \param parent parent plotter object
@ -591,20 +600,20 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase, public J
double JKQTPMathImage::getValueAt(double x, double y)
{
ensureImageData();
int xx=jkqtp_truncTo<int>((x-this->x)/width*double(Nx));
int yy=jkqtp_truncTo<int>((y-this->y)/height*double(Ny));
const int xx=jkqtp_truncTo<int>((x-this->x)/width*double(Nx));
const int yy=jkqtp_truncTo<int>((y-this->y)/height*double(Ny));
if (xx>=0 && xx<static_cast<int64_t>(Nx) && yy>=0 && yy<static_cast<int64_t>(Ny)) {
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray: return static_cast<double>((static_cast<double*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::FloatArray: return static_cast<double>((static_cast<float*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt8Array: return static_cast<double>((static_cast<uint8_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt16Array: return static_cast<double>((static_cast<uint16_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt32Array: return static_cast<double>((static_cast<uint32_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt64Array: return static_cast<double>((static_cast<uint64_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int8Array: return static_cast<double>((static_cast<int8_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int16Array: return static_cast<double>((static_cast<int16_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int32Array: return static_cast<double>((static_cast<int32_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int64Array: return static_cast<double>((static_cast<int64_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::DoubleArray: return static_cast<double>((static_cast<const double*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::FloatArray: return static_cast<double>((static_cast<const float*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt8Array: return static_cast<double>((static_cast<const uint8_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt16Array: return static_cast<double>((static_cast<const uint16_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt32Array: return static_cast<double>((static_cast<const uint32_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt64Array: return static_cast<double>((static_cast<const uint64_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int8Array: return static_cast<double>((static_cast<const int8_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int16Array: return static_cast<double>((static_cast<const int16_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int32Array: return static_cast<double>((static_cast<const int32_t*>(data))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int64Array: return static_cast<double>((static_cast<const int64_t*>(data))[yy*Nx+xx]);
} }
return 0.0;
}
@ -617,25 +626,25 @@ double JKQTPMathImage::getPixelValue(int xIdx, int yIdx) const {
if (!data) return 0;
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
return (static_cast<double*>(data))[yIdx*getNx()+xIdx];
return (static_cast<const double*>(data))[yIdx*getNx()+xIdx];
case JKQTPMathImageDataType::FloatArray:
return static_cast<double>((static_cast<float*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const float*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt8Array:
return static_cast<double>((static_cast<uint8_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint8_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt16Array:
return static_cast<double>((static_cast<uint16_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint16_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt32Array:
return static_cast<double>((static_cast<uint32_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint32_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt64Array:
return static_cast<double>((static_cast<uint64_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint64_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int8Array:
return static_cast<double>((static_cast<int8_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int8_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int16Array:
return static_cast<double>((static_cast<int16_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int16_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int32Array:
return static_cast<double>((static_cast<int32_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int32_t*>(data))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int64Array:
return static_cast<double>((static_cast<int64_t*>(data))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int64_t*>(data))[yIdx*getNx()+xIdx]);
default:
return 0;
}
@ -676,20 +685,20 @@ int JKQTPMathImage::getSampleSize() const {
double JKQTPMathImage::getModifierValueAt(double x, double y)
{
ensureImageData();
int xx=jkqtp_truncTo<int>((x-this->x)/width*double(Nx));
int yy=jkqtp_truncTo<int>((y-this->y)/height*double(Ny));
const int xx=jkqtp_truncTo<int>((x-this->x)/width*double(Nx));
const int yy=jkqtp_truncTo<int>((y-this->y)/height*double(Ny));
if (xx>=0 && xx<(int64_t)Nx && yy>=0 && yy<(int64_t)Ny) {
switch(datatypeModifier) {
case JKQTPMathImageDataType::DoubleArray: return (static_cast<double*>(dataModifier))[yy*Nx+xx];
case JKQTPMathImageDataType::FloatArray: return static_cast<double>((static_cast<float*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt8Array: return static_cast<double>((static_cast<uint8_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt16Array: return static_cast<double>((static_cast<uint16_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt32Array: return static_cast<double>((static_cast<uint32_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt64Array: return static_cast<double>((static_cast<uint64_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int8Array: return static_cast<double>((static_cast<int8_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int16Array: return static_cast<double>((static_cast<int16_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int32Array: return static_cast<double>((static_cast<int32_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int64Array: return static_cast<double>((static_cast<int64_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::DoubleArray: return (static_cast<const double*>(dataModifier))[yy*Nx+xx];
case JKQTPMathImageDataType::FloatArray: return static_cast<double>((static_cast<const float*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt8Array: return static_cast<double>((static_cast<const uint8_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt16Array: return static_cast<double>((static_cast<const uint16_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt32Array: return static_cast<double>((static_cast<const uint32_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::UInt64Array: return static_cast<double>((static_cast<const uint64_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int8Array: return static_cast<double>((static_cast<const int8_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int16Array: return static_cast<double>((static_cast<const int16_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int32Array: return static_cast<double>((static_cast<const int32_t*>(dataModifier))[yy*Nx+xx]);
case JKQTPMathImageDataType::Int64Array: return static_cast<double>((static_cast<const int64_t*>(dataModifier))[yy*Nx+xx]);
} }
return 0.0;
}
@ -702,25 +711,25 @@ double JKQTPMathImage::getModifierPixelValue(int xIdx, int yIdx) const {
if (!dataModifier) return 0;
switch(datatypeModifier) {
case JKQTPMathImageDataType::DoubleArray:
return (static_cast<double*>(dataModifier))[yIdx*getNx()+xIdx];
return (static_cast<const double*>(dataModifier))[yIdx*getNx()+xIdx];
case JKQTPMathImageDataType::FloatArray:
return static_cast<double>((static_cast<float*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const float*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt8Array:
return static_cast<double>((static_cast<uint8_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint8_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt16Array:
return static_cast<double>((static_cast<uint16_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint16_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt32Array:
return static_cast<double>((static_cast<uint32_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint32_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::UInt64Array:
return static_cast<double>((static_cast<uint64_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const uint64_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int8Array:
return static_cast<double>((static_cast<int8_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int8_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int16Array:
return static_cast<double>((static_cast<int16_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int16_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int32Array:
return static_cast<double>((static_cast<int32_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int32_t*>(dataModifier))[yIdx*getNx()+xIdx]);
case JKQTPMathImageDataType::Int64Array:
return static_cast<double>((static_cast<int64_t*>(dataModifier))[yIdx*getNx()+xIdx]);
return static_cast<double>((static_cast<const int64_t*>(dataModifier))[yIdx*getNx()+xIdx]);
default:
return 0;
}

View File

@ -32,7 +32,7 @@
#include <QClipboard>
JKQTPOverlayImage::JKQTPOverlayImage(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTBasePlotter* parent):
JKQTPOverlayImage::JKQTPOverlayImage(double x, double y, double width, double height, const bool *data, int Nx, int Ny, QColor colTrue, JKQTBasePlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
actSaveImage=new QAction(tr("Save JKQTPOverlayImage ..."), this);
@ -59,7 +59,7 @@ JKQTPOverlayImage::JKQTPOverlayImage(JKQTBasePlotter *parent):
this->trueColor=QColor("red");
}
JKQTPOverlayImage::JKQTPOverlayImage(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTPlotter* parent):
JKQTPOverlayImage::JKQTPOverlayImage(double x, double y, double width, double height, const bool* data, int Nx, int Ny, QColor colTrue, JKQTPlotter* parent):
JKQTPImageBase(x, y, width, height, parent)
{
actSaveImage=new QAction(tr("Save JKQTPOverlayImage ..."), this);
@ -185,17 +185,17 @@ int JKQTPOverlayImage::getNy() const
return this->Ny;
}
void JKQTPOverlayImage::setData(bool *__value)
void JKQTPOverlayImage::setData(const bool *__value)
{
this->data = __value;
}
bool *JKQTPOverlayImage::getData() const
const bool *JKQTPOverlayImage::getData() const
{
return this->data;
}
void JKQTPOverlayImage::setData(bool* data, int Nx, int Ny) {
void JKQTPOverlayImage::setData(const bool *data, int Nx, int Ny) {
this->data=data;
this->Nx=Nx;
this->Ny=Ny;
@ -365,15 +365,16 @@ int JKQTPColumnOverlayImageEnhanced::getImageColumn() const
return this->imageColumn;
}
void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) {
double* d=parent->getDatastore()->getColumnPointer(imageColumn,0);
const double* d=parent->getDatastore()->getColumnPointer(imageColumn,0);
size_t imgSize=parent->getDatastore()->getRows(imageColumn);
this->data=(bool*)malloc(imgSize*sizeof(bool));
bool* locData=static_cast<bool*>(malloc(imgSize*sizeof(bool)));
this->data=locData;
this->Ny= static_cast<int>(imgSize/this->Nx);
for (size_t i=0; i<imgSize; i++) {
data[i]=(d[i]!=0.0);
locData[i]=(d[i]!=0.0);
}
JKQTPOverlayImageEnhanced::draw(painter);
free(data);
free(locData);
data=nullptr;
}

View File

@ -46,11 +46,11 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
public:
/** \brief class constructor */
JKQTPOverlayImage(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTBasePlotter* parent=nullptr);
JKQTPOverlayImage(double x, double y, double width, double height, const bool* data, int Nx, int Ny, QColor colTrue, JKQTBasePlotter* parent=nullptr);
JKQTPOverlayImage(JKQTBasePlotter* parent=nullptr);
/** \brief class constructor */
JKQTPOverlayImage(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTPlotter* parent);
JKQTPOverlayImage(double x, double y, double width, double height, const bool* data, int Nx, int Ny, QColor colTrue, JKQTPlotter* parent);
JKQTPOverlayImage(JKQTPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
@ -85,19 +85,19 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
/** \copydoc Ny */
int getNy() const;
/** \copydoc data */
virtual void setData(bool* __value);
virtual void setData(const bool* __value);
/** \copydoc data */
bool *getData() const;
const bool *getData() const;
/** \brief set the plot-data to a given array \a data with size \a Nx * \a Ny in row-major ordering */
virtual void setData(bool* data, int Nx, int Ny);
virtual void setData(const bool* data, int Nx, int Ny);
/** \brief return the data used for plotting as a QVector<double> in row-major data-ordering */
QVector<double> getDataAsDoubleVector() const;
protected:
/** \brief points to the data array, holding the image */
bool* data;
const bool* data;
/** \brief width of the data array data in pt */
int Nx;
/** \brief height of the data array data in pt */

View File

@ -121,14 +121,14 @@ void JKQTPRGBMathImage::initObject()
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTBasePlotter *parent):
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTBasePlotter *parent):
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent)
{
initObject();
}
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPlotter *parent):
JKQTPRGBMathImage::JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPlotter *parent):
JKQTPRGBMathImage(x, y, width, height, datatype, data, Nx, Ny, parent->getPlotter())
{
}
@ -261,7 +261,7 @@ void JKQTPRGBMathImage::getOutsideSize(JKQTPEnhancedPainter& painter, int& leftS
struct RGBOutsizeData {
double internalDataMin;
double internalDataMax;
void* data;
const void* data;
JKQTPVerticalIndependentAxis* colorBarRightAxis;
JKQTPHorizontalIndependentAxis* colorBarTopAxis;
QString name;
@ -490,12 +490,12 @@ void JKQTPRGBMathImage::getDataMinMax(double& imin, double& imax) {
}
}
void JKQTPRGBMathImage::setDataR(void *__value)
void JKQTPRGBMathImage::setDataR(const void *__value)
{
setData(__value);
}
void *JKQTPRGBMathImage::getDataR() const
const void *JKQTPRGBMathImage::getDataR() const
{
return getData();
}
@ -510,12 +510,12 @@ JKQTPMathImageDataType JKQTPRGBMathImage::getDatatypeR() const
return getDatatype();
}
void JKQTPRGBMathImage::setDataG(void *__value)
void JKQTPRGBMathImage::setDataG(const void *__value)
{
this->dataG = __value;
}
void *JKQTPRGBMathImage::getDataG() const
const void *JKQTPRGBMathImage::getDataG() const
{
return this->dataG;
}
@ -530,12 +530,12 @@ JKQTPMathImageDataType JKQTPRGBMathImage::getDatatypeG() const
return this->datatypeG;
}
void JKQTPRGBMathImage::setDataB(void *__value)
void JKQTPRGBMathImage::setDataB(const void *__value)
{
this->dataB = __value;
}
void *JKQTPRGBMathImage::getDataB() const
const void *JKQTPRGBMathImage::getDataB() const
{
return this->dataB;
}
@ -909,44 +909,44 @@ void JKQTPRGBMathImage::getDataMinMaxG(double& imin, double& imax) {
if (!dataG) return;
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
imin= JKQTPImagePlot_getImageMin<double>(static_cast<double*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<double*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<double>(static_cast<const double*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<const double*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::FloatArray:
imin= JKQTPImagePlot_getImageMin<float>(static_cast<float*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<float*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<float>(static_cast<const float*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<const float*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt8Array:
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<uint8_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<uint8_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<const uint8_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<const uint8_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt16Array:
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<uint16_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<uint16_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<const uint16_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<const uint16_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt32Array:
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<uint32_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<uint32_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<const uint32_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<const uint32_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt64Array:
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<uint64_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<uint64_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<const uint64_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<const uint64_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::Int8Array:
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<int8_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<int8_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<const int8_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<const int8_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::Int16Array:
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<int16_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<int16_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<const int16_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<const int16_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::Int32Array:
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<int32_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<int32_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<const int32_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<const int32_t*>(dataG), Nx, Ny);
break;
case JKQTPMathImageDataType::Int64Array:
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<int64_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<int64_t*>(dataG), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<const int64_t*>(dataG), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<const int64_t*>(dataG), Nx, Ny);
break;
}
} else {
@ -962,44 +962,44 @@ void JKQTPRGBMathImage::getDataMinMaxB(double& imin, double& imax) {
if (!dataG) return;
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
imin= JKQTPImagePlot_getImageMin<double>(static_cast<double*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<double*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<double>(static_cast<const double*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<double>(static_cast<const double*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::FloatArray:
imin= JKQTPImagePlot_getImageMin<float>(static_cast<float*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<float*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<float>(static_cast<const float*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<float>(static_cast<const float*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt8Array:
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<uint8_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<uint8_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint8_t>(static_cast<const uint8_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint8_t>(static_cast<const uint8_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt16Array:
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<uint16_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<uint16_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint16_t>(static_cast<const uint16_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint16_t>(static_cast<const uint16_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt32Array:
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<uint32_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<uint32_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint32_t>(static_cast<const uint32_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint32_t>(static_cast<const uint32_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::UInt64Array:
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<uint64_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<uint64_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<uint64_t>(static_cast<const uint64_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<uint64_t>(static_cast<const uint64_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::Int8Array:
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<int8_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<int8_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int8_t>(static_cast<const int8_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int8_t>(static_cast<const int8_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::Int16Array:
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<int16_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<int16_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int16_t>(static_cast<const int16_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int16_t>(static_cast<const int16_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::Int32Array:
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<int32_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<int32_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int32_t>(static_cast<const int32_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int32_t>(static_cast<const int32_t*>(dataB), Nx, Ny);
break;
case JKQTPMathImageDataType::Int64Array:
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<int64_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<int64_t*>(dataB), Nx, Ny);
imin= JKQTPImagePlot_getImageMin<int64_t>(static_cast<const int64_t*>(dataB), Nx, Ny);
imax= JKQTPImagePlot_getImageMax<int64_t>(static_cast<const int64_t*>(dataB), Nx, Ny);
break;
}
} else {
@ -1011,7 +1011,7 @@ void JKQTPRGBMathImage::getDataMinMaxB(double& imin, double& imax) {
double JKQTPRGBMathImage::getValueAt(double x, double y, int channel)
{
ensureImageData();
void* dd=data;
const void* dd=data;
if (channel==0) dd=data;
if (channel==1) dd=dataG;
if (channel==2) dd=dataB;
@ -1019,16 +1019,16 @@ double JKQTPRGBMathImage::getValueAt(double x, double y, int channel)
int yy=static_cast<int>(trunc((y-this->y)/height*Ny));
if (xx>=0 && xx<Nx && yy>=0 && yy<Ny) {
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray: return static_cast<double>((static_cast<double*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::FloatArray: return static_cast<double>((static_cast<float*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt8Array: return static_cast<double>((static_cast<uint8_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt16Array: return static_cast<double>((static_cast<uint16_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt32Array: return static_cast<double>((static_cast<uint32_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt64Array: return static_cast<double>((static_cast<uint64_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int8Array: return static_cast<double>((static_cast<int8_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int16Array: return static_cast<double>((static_cast<int16_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int32Array: return static_cast<double>((static_cast<int32_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int64Array: return static_cast<double>((static_cast<int64_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::DoubleArray: return static_cast<double>((static_cast<const double*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::FloatArray: return static_cast<double>((static_cast<const float*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt8Array: return static_cast<double>((static_cast<const uint8_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt16Array: return static_cast<double>((static_cast<const uint16_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt32Array: return static_cast<double>((static_cast<const uint32_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::UInt64Array: return static_cast<double>((static_cast<const uint64_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int8Array: return static_cast<double>((static_cast<const int8_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int16Array: return static_cast<double>((static_cast<const int16_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int32Array: return static_cast<double>((static_cast<const int32_t*>(dd))[yy*Nx+xx]); break;
case JKQTPMathImageDataType::Int64Array: return static_cast<double>((static_cast<const int64_t*>(dd))[yy*Nx+xx]); break;
} }
return 0.0;
}
@ -1122,46 +1122,46 @@ QImage JKQTPRGBMathImage::drawImage() {
int palette = 0;
if (data) {
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<double*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<float*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<uint8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<uint16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<uint32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<uint64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<int8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<int16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<int32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<int64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<const double*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<const float*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<const uint8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<const uint16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<const uint32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<const uint64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<const int8_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<const int16_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<const int32_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<const int64_t*>(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rgbMode); break;
}
}
palette = 1;
if (dataG) {
switch(datatypeG) {
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<double*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<float*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<uint8_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<uint16_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<uint32_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<uint64_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<int8_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<int16_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<int32_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<int64_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<const double*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<const float*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<const uint8_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<const uint16_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<const uint32_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<const uint64_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<const int8_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<const int16_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<const int32_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<const int64_t*>(dataG), Nx, Ny, img, palette, internalDataMinG, internalDataMaxG, rgbMode); break;
}
}
palette = 2;
if (dataB) {
switch(datatypeB) {
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<double*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<float*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<uint8_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<uint16_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<uint32_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<uint64_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<int8_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<int16_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<int32_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<int64_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::DoubleArray: JKQTPImagePlot_array2RGBimage<double>(static_cast<const double*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::FloatArray: JKQTPImagePlot_array2RGBimage<float>(static_cast<const float*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt8Array: JKQTPImagePlot_array2RGBimage<uint8_t>(static_cast<const uint8_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt16Array: JKQTPImagePlot_array2RGBimage<uint16_t>(static_cast<const uint16_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt32Array: JKQTPImagePlot_array2RGBimage<uint32_t>(static_cast<const uint32_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::UInt64Array: JKQTPImagePlot_array2RGBimage<uint64_t>(static_cast<const uint64_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int8Array: JKQTPImagePlot_array2RGBimage<int8_t>(static_cast<const int8_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int16Array: JKQTPImagePlot_array2RGBimage<int16_t>(static_cast<const int16_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int32Array: JKQTPImagePlot_array2RGBimage<int32_t>(static_cast<const int32_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
case JKQTPMathImageDataType::Int64Array: JKQTPImagePlot_array2RGBimage<int64_t>(static_cast<const int64_t*>(dataB), Nx, Ny, img, palette, internalDataMinB, internalDataMaxB, rgbMode); break;
}
}
@ -1170,7 +1170,7 @@ QImage JKQTPRGBMathImage::drawImage() {
return img;
}
void JKQTPRGBMathImage::setData(void* data, int Nx, int Ny, JKQTPMathImageDataType datatype) {
void JKQTPRGBMathImage::setData(const void* data, int Nx, int Ny, JKQTPMathImageDataType datatype) {
this->data=data;
this->datatype=datatype;
this->dataG=nullptr;
@ -1179,7 +1179,7 @@ void JKQTPRGBMathImage::setData(void* data, int Nx, int Ny, JKQTPMathImageDataTy
this->Ny=Ny;
}
void JKQTPRGBMathImage::setData(void* data, int Nx, int Ny) {
void JKQTPRGBMathImage::setData(const void* data, int Nx, int Ny) {
this->data=data;
this->Nx=Nx;
this->Ny=Ny;
@ -1188,7 +1188,7 @@ void JKQTPRGBMathImage::setData(void* data, int Nx, int Ny) {
}
void JKQTPRGBMathImage::setData(void *data, void *dataG, void *dataB, int Nx, int Ny, JKQTPMathImageDataType datatype) {
void JKQTPRGBMathImage::setData(const void *data, const void *dataG, const void *dataB, int Nx, int Ny, JKQTPMathImageDataType datatype) {
this->data=data;
this->datatype=datatype;
this->datatypeG=datatype;
@ -1199,7 +1199,7 @@ void JKQTPRGBMathImage::setData(void *data, void *dataG, void *dataB, int Nx, in
this->Ny=Ny;
}
void JKQTPRGBMathImage::setData(void *data, void *dataG, void *dataB, int Nx, int Ny) {
void JKQTPRGBMathImage::setData(const void *data, const void *dataG, const void *dataB, int Nx, int Ny) {
this->data=data;
this->dataG=dataG;
this->dataB=dataB;
@ -1328,25 +1328,25 @@ QVector<double> JKQTPRGBMathImage::getDataGAsDoubleVector() const
{
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
return JKQTPImagePlot_arrayToDVector(static_cast<double*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const double*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::FloatArray:
return JKQTPImagePlot_arrayToDVector(static_cast<float*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const float*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::UInt8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint8_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint8_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::UInt16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint16_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint16_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::UInt32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint32_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint32_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::UInt64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint64_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint64_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::Int8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int8_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int8_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::Int16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int16_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int16_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::Int32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int32_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int32_t*>(dataG), Nx*Ny);
case JKQTPMathImageDataType::Int64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int64_t*>(dataG), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int64_t*>(dataG), Nx*Ny);
}
QVector<double> res;
return res;
@ -1356,25 +1356,25 @@ QVector<double> JKQTPRGBMathImage::getDataBAsDoubleVector() const
{
switch(datatype) {
case JKQTPMathImageDataType::DoubleArray:
return JKQTPImagePlot_arrayToDVector(static_cast<double*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const double*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::FloatArray:
return JKQTPImagePlot_arrayToDVector(static_cast<float*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const float*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::UInt8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint8_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint8_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::UInt16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint16_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint16_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::UInt32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint32_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint32_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::UInt64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<uint64_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const uint64_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::Int8Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int8_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int8_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::Int16Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int16_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int16_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::Int32Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int32_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int32_t*>(dataB), Nx*Ny);
case JKQTPMathImageDataType::Int64Array:
return JKQTPImagePlot_arrayToDVector(static_cast<int64_t*>(dataB), Nx*Ny);
return JKQTPImagePlot_arrayToDVector(static_cast<const int64_t*>(dataB), Nx*Ny);
}
QVector<double> res;
return res;

View File

@ -66,7 +66,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
* \param parent parent plotter object
*
*/
JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTBasePlotter* parent=nullptr);
JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTBasePlotter* parent=nullptr);
/** \brief class constructor
*
@ -81,7 +81,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
* \param parent parent plotter object
*
*/
JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, void* data, int Nx, int Ny, JKQTPlotter* parent);
JKQTPRGBMathImage(double x, double y, double width, double height, JKQTPMathImageDataType datatype, const void* data, int Nx, int Ny, JKQTPlotter* parent);
/** \brief class constructor
*
@ -104,14 +104,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
/** \brief set the plot-data to a given array \a data (red), \a dataG (green), \a dataB (blue) with size \a Nx * \a Ny in row-major ordering and with the given \a datatype */
virtual void setData(void* dataR, void* dataG, void* dataB, int Nx, int Ny, JKQTPMathImageDataType datatype);
virtual void setData(const void* dataR, const void* dataG, const void* dataB, int Nx, int Ny, JKQTPMathImageDataType datatype);
/** \brief set the plot-data to a given array \a data (red), \a dataG (green), \a dataB (blue) with size \a Nx * \a Ny in row-major ordering */
virtual void setData(void* dataR, void* dataG, void* dataB, int Nx, int Ny);
virtual void setData(const void* dataR, const void* dataG, const void* dataB, int Nx, int Ny);
/** \brief set the plot-data to a given array \a data (red) with size \a Nx * \a Ny in row-major ordering and with the given \a datatype */
virtual void setData(void* dataR, int Nx, int Ny, JKQTPMathImageDataType datatype) override;
virtual void setData(const void* dataR, int Nx, int Ny, JKQTPMathImageDataType datatype) override;
/** \brief set the plot-data to a given array \a data (red) with size \a Nx * \a Ny in row-major ordering */
virtual void setData(void* dataR, int Nx, int Ny) override ;
virtual void setData(const void* dataR, int Nx, int Ny) override ;
/** \brief determine min/max data value of the image */
@ -119,26 +119,26 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
/** \copydoc data */
virtual void setDataR(void* __value);
virtual void setDataR(const void* __value);
/** \copydoc data */
void* getDataR() const;
const void* getDataR() const;
/** \copydoc datatype */
void setDatatypeR(JKQTPMathImageDataType __value);
/** \copydoc datatype */
JKQTPMathImageDataType getDatatypeR() const;
/** \copydoc dataG */
virtual void setDataG(void* __value);
virtual void setDataG(const void* __value);
/** \copydoc dataG */
void* getDataG() const;
const void* getDataG() const;
/** \copydoc datatypeG */
void setDatatypeG(JKQTPMathImageDataType __value);
/** \copydoc datatypeG */
JKQTPMathImageDataType getDatatypeG() const;
/** \copydoc dataB */
virtual void setDataB(void* __value);
virtual void setDataB(const void* __value);
/** \copydoc dataB */
void* getDataB() const;
const void* getDataB() const;
/** \copydoc datatypeB */
void setDatatypeB(JKQTPMathImageDataType __value);
/** \copydoc datatypeB */
@ -330,11 +330,11 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
protected:
void initObject();
/** \brief points to the data array, holding the image */
void* dataG;
const void* dataG;
/** \brief datatype of the data array data */
JKQTPMathImageDataType datatypeG;
/** \brief points to the data array, holding the image */
void* dataB;
const void* dataB;
/** \brief datatype of the data array data */
JKQTPMathImageDataType datatypeB;

View File

@ -754,7 +754,7 @@ JKQTPMathImageModifierMode JKQTPColorPaletteWithModifierStyleAndToolsMixin::getM
}
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::modifyImage(QImage &img, void *dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax)
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::modifyImage(QImage &img, const void *dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax)
{
JKQTPModifyImage(img, modifierMode, dataModifier, datatypeModifier, Nx, Ny, internalModifierMin, internalModifierMax);
}

View File

@ -315,7 +315,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPColorPaletteWithModifierStyleAndToolsMixin : p
/** \brief modify the given image \a img, using modifier image \a dataModifier (of type \a datatypeModifier and size \a Nx * \a Ny), using values in the range \a internalModifierMin ... \a internalModifierMax
*/
void modifyImage(QImage& img, void* dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax);
void modifyImage(QImage& img, const void* dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax);
protected: