mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
fixed several static code analysis warnings and security vulnerabilities
This commit is contained in:
parent
7cf2990f08
commit
f096aa9602
@ -2168,7 +2168,7 @@ QImage JKQTPImageTools::GetPaletteImage(int i, int width)
|
||||
QImage JKQTPImageTools::GetPaletteImage(int i, int width, int height)
|
||||
{
|
||||
QImage img;
|
||||
const long NPixels=static_cast<int>(jkqtp_bounded<long>(0, width*height, std::numeric_limits<int>::max()));
|
||||
const int NPixels=jkqtp_bounded<int>(width*height);
|
||||
|
||||
QVector<double> pic(NPixels,0);
|
||||
for (int j=0; j<NPixels; j++) {
|
||||
|
@ -483,7 +483,7 @@ struct JKQTPImageTools {
|
||||
if (!dbl_in || width<=0 || height<=0)
|
||||
return;
|
||||
|
||||
const long NPixels= width*height;
|
||||
const int NPixels= jkqtp_bounded<int>(width*height);
|
||||
double min = *dbl_in;
|
||||
double max = *dbl_in;
|
||||
if (jkqtp_approximatelyEqual(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) {
|
||||
|
@ -90,7 +90,7 @@ QString JKQTPGraphSymbols2String(JKQTPGraphSymbols pos) {
|
||||
case JKQTPFemale: return "symbol_female";
|
||||
case JKQTPMale: return "symbol_male";
|
||||
case JKQTPCirclePeace: return "symbol_circle_peace";
|
||||
case JKQTPSymbolCount: JKQTPGraphSymbols2String(JKQTPMaxSymbolID);
|
||||
case JKQTPSymbolCount: return JKQTPGraphSymbols2String(JKQTPMaxSymbolID);
|
||||
case JKQTPCharacterSymbol:
|
||||
case JKQTPFilledCharacterSymbol:
|
||||
case JKQTPFirstCustomSymbol:
|
||||
@ -179,7 +179,7 @@ QString JKQTPGraphSymbols2NameString(JKQTPGraphSymbols pos) {
|
||||
case JKQTPFemale: return QObject::tr("female");
|
||||
case JKQTPMale: return QObject::tr("male");
|
||||
case JKQTPCirclePeace: return QObject::tr("circled peace");
|
||||
case JKQTPSymbolCount: JKQTPGraphSymbols2NameString(JKQTPMaxSymbolID);
|
||||
case JKQTPSymbolCount: return JKQTPGraphSymbols2NameString(JKQTPMaxSymbolID);
|
||||
case JKQTPCharacterSymbol:
|
||||
case JKQTPFilledCharacterSymbol:
|
||||
case JKQTPFirstCustomSymbol:
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <iostream>
|
||||
#include <float.h>
|
||||
#include <ctime>
|
||||
#include <array>
|
||||
#include "jkqtcommon/jkqtpstringtools.h"
|
||||
|
||||
|
||||
@ -1784,14 +1785,14 @@ JKQTPMathParser::jkmpFunctionNode::jkmpFunctionNode(const std::string& name, JKQ
|
||||
}
|
||||
|
||||
JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpFunctionNode::evaluate() {
|
||||
JKQTPMathParser::jkmpResult data[257];
|
||||
std::array<JKQTPMathParser::jkmpResult,257> data;
|
||||
if (n>0) {
|
||||
for (int i=0; i<n; i++) {
|
||||
data[i]=child[i]->evaluate();
|
||||
}
|
||||
}
|
||||
// JKQTPMathParser::jkmpResult r= getParser()->evaluateFunction(fun, data,n);
|
||||
return function(data,n, parser);
|
||||
return function(data.data(),n, parser);
|
||||
}
|
||||
|
||||
|
||||
@ -1885,6 +1886,12 @@ const char *JKQTPMathParser::jkmpException::what() const noexcept {
|
||||
return errormessage.c_str();
|
||||
}
|
||||
|
||||
JKQTPMathParser::jkmpNode::jkmpNode(JKQTPMathParser *parser_, jkmpNode *parent_):
|
||||
parser(parser_), parent(parent_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPMathParser *JKQTPMathParser::jkmpNode::getParser(){ return parser; }
|
||||
|
||||
void JKQTPMathParser::jkmpNode::setParser(JKQTPMathParser *mp){ parser=mp; }
|
||||
@ -1892,3 +1899,20 @@ void JKQTPMathParser::jkmpNode::setParser(JKQTPMathParser *mp){ parser=mp; }
|
||||
JKQTPMathParser::jkmpNode *JKQTPMathParser::jkmpNode::getParent(){ return parent; }
|
||||
|
||||
void JKQTPMathParser::jkmpNode::setParent(JKQTPMathParser::jkmpNode *par) { parent=par; }
|
||||
|
||||
JKQTPMathParser::jkmpFunctionDescriptor::jkmpFunctionDescriptor(jkmpEvaluateFunc function_):
|
||||
function(function_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPMathParser::jkmpTempVariable::jkmpTempVariable()
|
||||
{
|
||||
type=jkmpDouble;
|
||||
name="";
|
||||
internal=false;
|
||||
str=nullptr;
|
||||
num=nullptr;
|
||||
boolean=nullptr;
|
||||
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ class jkqtmath_LIB_EXPORT JKQTPMathParser
|
||||
|
||||
/** \brief This struct is for managing temporary variables. It is generally like jkmpVariable. */
|
||||
struct jkqtmath_LIB_EXPORT jkmpTempVariable {
|
||||
jkmpTempVariable();
|
||||
std::string name; /*!< \brief name of the variable */
|
||||
jkmpResultType type; /*!< \brief type of the variable */
|
||||
bool internal; /*!< \brief this is an internal variable */
|
||||
@ -298,8 +299,9 @@ class jkqtmath_LIB_EXPORT JKQTPMathParser
|
||||
|
||||
/** \brief description of a user registered function */
|
||||
struct jkqtmath_LIB_EXPORT jkmpFunctionDescriptor {
|
||||
jkmpEvaluateFunc function; /*!< \brief a pointer to the function implementation */
|
||||
std::string name; /*!< \brief name of the function */
|
||||
jkmpFunctionDescriptor(jkmpEvaluateFunc function_=nullptr);
|
||||
jkmpEvaluateFunc function; /*!< \brief a pointer to the function implementation */
|
||||
std::string name; /*!< \brief name of the function */
|
||||
};
|
||||
|
||||
|
||||
@ -316,6 +318,7 @@ class jkqtmath_LIB_EXPORT JKQTPMathParser
|
||||
JKQTPMathParser* parser; /*!< \brief points to the parser object that is used to evaluate this node */
|
||||
jkmpNode* parent; /*!< \brief points to the parent node */
|
||||
public:
|
||||
jkmpNode(JKQTPMathParser* parser_=nullptr, jkmpNode* parent_=nullptr);
|
||||
/** \brief virtual class destructor */
|
||||
virtual ~jkmpNode();
|
||||
|
||||
|
@ -308,7 +308,7 @@ void JKQTMathTextMatrixNode::parseColumnSpec(const QString &columnSpec)
|
||||
|
||||
|
||||
JKQTMathTextMatrixNode::LayoutInfo::LayoutInfo():
|
||||
JKQTMathTextNodeSize(), colwidth(), rowheight()
|
||||
JKQTMathTextNodeSize(), colwidth(), rowheight(), leftPadding(0), rightPadding(0), topPadding(0), bottomPadding(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -35,11 +35,12 @@
|
||||
# include <QVector3D>
|
||||
|
||||
JKQTPContourPlot::JKQTPContourPlot(JKQTBasePlotter *parent) :
|
||||
JKQTPMathImage(parent)
|
||||
JKQTPMathImage(parent),
|
||||
ignoreOnPlane(false),
|
||||
contourColoringMode(ColorContoursFromPaletteByValue),
|
||||
relativeLevels(false),
|
||||
contourLinesCachedForChecksum(0)
|
||||
{
|
||||
ignoreOnPlane=false;
|
||||
contourColoringMode=ColorContoursFromPaletteByValue;
|
||||
relativeLevels=false;
|
||||
|
||||
initLineStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Default);
|
||||
}
|
||||
@ -428,7 +429,8 @@ void JKQTPContourPlot::calcContourLines(QList<QVector<QLineF> > &ContourLines)
|
||||
|
||||
|
||||
JKQTPColumnContourPlot::JKQTPColumnContourPlot(JKQTBasePlotter *parent):
|
||||
JKQTPContourPlot(parent)
|
||||
JKQTPContourPlot(parent),
|
||||
imageColumn(-1)
|
||||
{
|
||||
this->datatype=JKQTPMathImageDataType::DoubleArray;
|
||||
}
|
||||
|
@ -382,8 +382,42 @@ void JKQTPImage::copyImagePlotAsImage()
|
||||
|
||||
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(JKQTBasePlotter *parent):
|
||||
JKQTPImageBase(parent),
|
||||
data(nullptr),
|
||||
datatype(JKQTPMathImageDataType::DoubleArray),
|
||||
Nx(0), Ny(0),
|
||||
dataModifier(nullptr), datatypeModifier(JKQTPMathImageDataType::DoubleArray),
|
||||
internalDataMin(0.0), internalDataMax(0.0),
|
||||
internalModifierMin(0.0), internalModifierMax(0.0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTBasePlotter *parent):
|
||||
JKQTPImageBase(x,y,width,height,parent),
|
||||
data(nullptr),
|
||||
datatype(JKQTPMathImageDataType::DoubleArray),
|
||||
Nx(0), Ny(0),
|
||||
dataModifier(nullptr), datatypeModifier(JKQTPMathImageDataType::DoubleArray),
|
||||
internalDataMin(0.0), internalDataMax(0.0),
|
||||
internalModifierMin(0.0), internalModifierMax(0.0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(JKQTPlotter *parent):
|
||||
JKQTPMathImageBase(parent->getPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTPlotter *parent):
|
||||
JKQTPMathImageBase(x,y,width,height,parent->getPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
JKQTPMathImageBase(x, y, width, height, parent)
|
||||
{
|
||||
this->data=data;
|
||||
this->datatype=datatype;
|
||||
@ -395,14 +429,9 @@ JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double
|
||||
|
||||
|
||||
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)
|
||||
JKQTPMathImageBase(x, y, width, height, datatype, data, Nx, Ny, parent->getPlotter())
|
||||
{
|
||||
this->data=data;
|
||||
this->datatype=datatype;
|
||||
this->Nx=Nx;
|
||||
this->Ny=Ny;
|
||||
dataModifier=nullptr;
|
||||
datatypeModifier=JKQTPMathImageDataType::DoubleArray;
|
||||
|
||||
}
|
||||
void JKQTPMathImageBase::drawKeyMarker(JKQTPEnhancedPainter &/*painter*/, const QRectF &/*rect*/)
|
||||
{
|
||||
@ -411,138 +440,94 @@ void JKQTPMathImageBase::drawKeyMarker(JKQTPEnhancedPainter &/*painter*/, const
|
||||
|
||||
void JKQTPMathImageBase::setNx(int __value)
|
||||
{
|
||||
this->Nx = __value;
|
||||
Nx = __value;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setNx(size_t __value)
|
||||
{
|
||||
this->Nx = static_cast<int>(__value);
|
||||
Nx = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
int JKQTPMathImageBase::getNx() const
|
||||
{
|
||||
return this->Nx;
|
||||
return Nx;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setNy(int __value)
|
||||
{
|
||||
this->Ny = __value;
|
||||
Ny = __value;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setNy(size_t __value)
|
||||
{
|
||||
this->Ny = static_cast<int>(__value);
|
||||
Ny = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
int JKQTPMathImageBase::getNy() const
|
||||
{
|
||||
return this->Ny;
|
||||
return Ny;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setData(const void *__value)
|
||||
{
|
||||
this->data = __value;
|
||||
data = __value;
|
||||
}
|
||||
|
||||
const void *JKQTPMathImageBase::getData() const
|
||||
{
|
||||
return this->data;
|
||||
return data;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDatatype(JKQTPMathImageDataType __value)
|
||||
{
|
||||
this->datatype = __value;
|
||||
datatype = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageDataType JKQTPMathImageBase::getDatatype() const
|
||||
{
|
||||
return this->datatype;
|
||||
return datatype;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDataModifier(const void *__value)
|
||||
{
|
||||
this->dataModifier = __value;
|
||||
dataModifier = __value;
|
||||
}
|
||||
|
||||
const void *JKQTPMathImageBase::getDataModifier() const
|
||||
{
|
||||
return this->dataModifier;
|
||||
return dataModifier;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDatatypeModifier(JKQTPMathImageDataType __value)
|
||||
{
|
||||
this->datatypeModifier = __value;
|
||||
datatypeModifier = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageDataType JKQTPMathImageBase::getDatatypeModifier() const
|
||||
{
|
||||
return this->datatypeModifier;
|
||||
return datatypeModifier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(JKQTBasePlotter *parent):
|
||||
JKQTPImageBase(parent)
|
||||
{
|
||||
this->data=nullptr;
|
||||
this->Nx=0;
|
||||
this->Ny=0;
|
||||
this->datatype=JKQTPMathImageDataType::DoubleArray;
|
||||
dataModifier=nullptr;
|
||||
datatypeModifier=JKQTPMathImageDataType::DoubleArray;
|
||||
void JKQTPMathImageBase::setData(const void *data_, int Nx_, int Ny_, JKQTPMathImageDataType datatype_) {
|
||||
data=data_;
|
||||
datatype=datatype_;
|
||||
Nx=Nx_;
|
||||
Ny=Ny_;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTBasePlotter *parent):
|
||||
JKQTPImageBase(x,y,width,height,parent)
|
||||
{
|
||||
this->data=nullptr;
|
||||
this->Nx=0;
|
||||
this->Ny=0;
|
||||
this->datatype=JKQTPMathImageDataType::DoubleArray;
|
||||
dataModifier=nullptr;
|
||||
datatypeModifier=JKQTPMathImageDataType::DoubleArray;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(JKQTPlotter *parent):
|
||||
JKQTPImageBase(parent)
|
||||
{
|
||||
this->data=nullptr;
|
||||
this->Nx=0;
|
||||
this->Ny=0;
|
||||
this->datatype=JKQTPMathImageDataType::DoubleArray;
|
||||
dataModifier=nullptr;
|
||||
datatypeModifier=JKQTPMathImageDataType::DoubleArray;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::JKQTPMathImageBase(double x, double y, double width, double height, JKQTPlotter *parent):
|
||||
JKQTPImageBase(x,y,width,height,parent)
|
||||
{
|
||||
this->data=nullptr;
|
||||
this->Nx=0;
|
||||
this->Ny=0;
|
||||
this->datatype=JKQTPMathImageDataType::DoubleArray;
|
||||
dataModifier=nullptr;
|
||||
datatypeModifier=JKQTPMathImageDataType::DoubleArray;
|
||||
}
|
||||
|
||||
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(const void* data, int Nx, int Ny) {
|
||||
this->data=data;
|
||||
this->Nx=Nx;
|
||||
this->Ny=Ny;
|
||||
void JKQTPMathImageBase::setData(const void *data_, int Nx_, int Ny_) {
|
||||
data=data_;
|
||||
Nx=Nx_;
|
||||
Ny=Ny_;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDataModifier(const void *data, JKQTPMathImageDataType datatype)
|
||||
{
|
||||
this->dataModifier=data;
|
||||
this->datatypeModifier=datatype;
|
||||
dataModifier=data;
|
||||
datatypeModifier=datatype;
|
||||
}
|
||||
|
||||
|
||||
@ -731,23 +716,25 @@ void JKQTPMathImage::initJKQTPMathImage() {
|
||||
|
||||
|
||||
|
||||
this->palette=JKQTPMathImageGRAY;
|
||||
this->autoModifierRange=true;
|
||||
palette=JKQTPMathImageGRAY;
|
||||
autoModifierRange=true;
|
||||
}
|
||||
|
||||
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)
|
||||
JKQTPColorPaletteWithModifierStyleAndToolsMixin(parent),
|
||||
actCopyImage(nullptr),
|
||||
actSaveImage(nullptr),
|
||||
actCopyPalette(nullptr),
|
||||
actSavePalette(nullptr)
|
||||
{
|
||||
initJKQTPMathImage();
|
||||
this->palette=palette;
|
||||
}
|
||||
|
||||
JKQTPMathImage::JKQTPMathImage(JKQTBasePlotter *parent):
|
||||
JKQTPMathImageBase(0, 0, 1, 1, JKQTPMathImageDataType::UInt8Array, nullptr, 0, 0, parent),
|
||||
JKQTPColorPaletteWithModifierStyleAndToolsMixin(parent)
|
||||
JKQTPMathImage(0, 0, 1, 1, JKQTPMathImageDataType::UInt8Array, nullptr, 0, 0, JKQTPMathImageGRAY, parent)
|
||||
{
|
||||
initJKQTPMathImage();
|
||||
if (parent) this->palette=parent->getCurrentPlotterStyle().graphsStyle.defaultPalette;
|
||||
}
|
||||
|
||||
|
@ -218,6 +218,16 @@ void JKQTPRGBMathImage::getOutsideSize(JKQTPEnhancedPainter& painter, int& leftS
|
||||
}
|
||||
|
||||
struct RGBOutsizeData {
|
||||
RGBOutsizeData():
|
||||
internalDataMin(0),
|
||||
internalDataMax(0),
|
||||
data(nullptr),
|
||||
colorBarRightAxis(nullptr),
|
||||
colorBarTopAxis(nullptr),
|
||||
name(),
|
||||
palette(JKQTPMathImageMATLAB),
|
||||
paletteImage()
|
||||
{}
|
||||
double internalDataMin;
|
||||
double internalDataMax;
|
||||
const void* data;
|
||||
|
@ -78,6 +78,7 @@ protected:
|
||||
/** \brief INTERNAL data structure combining a JKQTPMathParser and a JKQTPMathParser::jkmpNode
|
||||
*/
|
||||
struct ParsedFunctionLineGraphFunctionData {
|
||||
inline ParsedFunctionLineGraphFunctionData(): varcount(0) {};
|
||||
std::shared_ptr<JKQTPMathParser> parser;
|
||||
std::shared_ptr<JKQTPMathParser::jkmpNode> node;
|
||||
int varcount;
|
||||
|
@ -36,12 +36,11 @@
|
||||
|
||||
|
||||
JKQTPSingleColumnSymbolsGraph::JKQTPSingleColumnSymbolsGraph(JKQTBasePlotter *parent):
|
||||
JKQTPSingleColumnGraph(parent), seedValue(123456)
|
||||
JKQTPSingleColumnGraph(parent), seedValue(123456), positionScatterStyle(NoScatter), position(0), width(1)
|
||||
|
||||
{
|
||||
parentPlotStyle=-1;
|
||||
dataDirection=DataDirection::Y;
|
||||
position=0;
|
||||
width=1;
|
||||
|
||||
initSymbolStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Default);
|
||||
}
|
||||
|
@ -36,17 +36,19 @@
|
||||
|
||||
|
||||
JKQTPViolinplotElementBase::JKQTPViolinplotElementBase(JKQTBasePlotter* parent):
|
||||
JKQTPPlotElement(parent)
|
||||
JKQTPPlotElement(parent),
|
||||
pos(JKQTP_NAN),
|
||||
median(JKQTP_NAN),
|
||||
mean(JKQTP_NAN),
|
||||
min(JKQTP_NAN),
|
||||
max(JKQTP_NAN),
|
||||
drawMean(false),
|
||||
drawMinMax(false),
|
||||
drawMedian(false),
|
||||
violinPositionColumn(-1),
|
||||
violinFrequencyColumn(-1)
|
||||
{
|
||||
pos=JKQTP_NAN;
|
||||
median=JKQTP_NAN;
|
||||
mean=JKQTP_NAN;
|
||||
min=JKQTP_NAN;
|
||||
max=JKQTP_NAN;
|
||||
drawMean=false;
|
||||
drawMinMax=false;
|
||||
violinPositionColumn=-1;
|
||||
violinFrequencyColumn=-1;
|
||||
|
||||
|
||||
initViolinplotStyle(parent, parentPlotStyle);
|
||||
setMeanSymbolType(JKQTPPlus);
|
||||
|
@ -1520,6 +1520,10 @@ void JKQTBasePlotter::print(QPrinter* printer, bool displayPreview) {
|
||||
|
||||
|
||||
bool JKQTBasePlotter::printpreviewNew(QPaintDevice* paintDevice, bool setAbsolutePaperSize, double printsizeX_inMM, double printsizeY_inMM, bool displayPreview) {
|
||||
|
||||
JKQTPASSERT_M(paintDevice, "INTERNAL ERROR: no QPaintDevice given to JKQTBasePlotter::printpreviewNew()!");
|
||||
|
||||
|
||||
#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
|
||||
QPrinter *printer=dynamic_cast<QPrinter*>(paintDevice);
|
||||
QSvgGenerator* svg=dynamic_cast<QSvgGenerator*>(paintDevice);
|
||||
@ -1939,6 +1943,8 @@ void JKQTBasePlotter::updatePreviewLabel() {
|
||||
|
||||
#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
|
||||
void JKQTBasePlotter::printpreviewPaintRequested(QPrinter* printer) {
|
||||
JKQTPASSERT_M(printer, "INTERNAL ERROR: no QPrinter given to JKQTBasePlotter::printpreviewPaintRequested()!");
|
||||
|
||||
double lw=lineWidthMultiplier;
|
||||
double fs=fontSizeMultiplier;
|
||||
QBrush bc=plotterStyle.widgetBackgroundBrush;
|
||||
@ -2016,6 +2022,7 @@ void JKQTBasePlotter::printpreviewPaintRequested(QPrinter* printer) {
|
||||
|
||||
|
||||
void JKQTBasePlotter::printpreviewPaintRequestedNewPrinter(QPrinter* printer) {
|
||||
JKQTPASSERT_M(printer, "INTERNAL ERROR: no QPrinter given to JKQTBasePlotter::printpreviewPaintRequestedNewPrinter()!");
|
||||
QPaintDevice* paintDevice=dynamic_cast<QPaintDevice*>(printer);
|
||||
printpreviewPaintRequestedNewPaintDevice(paintDevice);
|
||||
|
||||
@ -2024,6 +2031,8 @@ void JKQTBasePlotter::printpreviewPaintRequestedNewPrinter(QPrinter* printer) {
|
||||
|
||||
void JKQTBasePlotter::printpreviewPaintRequestedNewPaintDevice(QPaintDevice *paintDevice)
|
||||
{
|
||||
JKQTPASSERT_M(paintDevice, "INTERNAL ERROR: no QPaintDevice given to JKQTBasePlotter::printpreviewPaintRequestedNewPaintDevice()!");
|
||||
|
||||
//QPaintDevice* paintDevice=dynamic_cast<QPaintDevice*>(printer);
|
||||
#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
|
||||
QPrinter* printer=dynamic_cast<QPrinter*>(paintDevice);
|
||||
|
@ -947,13 +947,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPDatastore{
|
||||
template<typename T>
|
||||
size_t addCopiedColumn(const T* data, size_t rows, const QString& name=QString("")){
|
||||
double* d=static_cast<double*>(malloc(static_cast<size_t>(rows)*sizeof(double)));
|
||||
if (data) {
|
||||
for (size_t r=0; r<rows; r++) {
|
||||
d[r]=jkqtp_todouble(data[r]);
|
||||
if (d) {
|
||||
if (data) {
|
||||
for (size_t r=0; r<rows; r++) {
|
||||
d[r]=jkqtp_todouble(data[r]);
|
||||
}
|
||||
}
|
||||
const size_t itemid=addInternalItem(d, rows);
|
||||
return addColumnForItem(itemid, 0, name);
|
||||
} else {
|
||||
throw std::runtime_error("could not allocate memory in JKQTPDataStore::addCopiedColumn()");
|
||||
}
|
||||
size_t itemid=addInternalItem(d, rows);
|
||||
return addColumnForItem(itemid, 0, name);
|
||||
}
|
||||
|
||||
/** \brief copy an external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
|
||||
@ -980,13 +984,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPDatastore{
|
||||
template<typename T>
|
||||
size_t addCopiedColumn(const T* data, size_t rows, size_t stride, int start, const QString& name) {
|
||||
double* d=static_cast<double*>(malloc(static_cast<size_t>(rows)*sizeof(double)));
|
||||
if (data) {
|
||||
for (size_t r=0; r<rows; r++) {
|
||||
d[r]=jkqtp_todouble(data[static_cast<size_t>(start+static_cast<int64_t>(r*stride))]);
|
||||
if (d) {
|
||||
if (data) {
|
||||
for (size_t r=0; r<rows; r++) {
|
||||
d[r]=jkqtp_todouble(data[static_cast<size_t>(start+static_cast<int64_t>(r*stride))]);
|
||||
}
|
||||
}
|
||||
size_t itemid=addInternalItem(d, rows);
|
||||
return addColumnForItem(itemid, 0, name);
|
||||
} else {
|
||||
throw std::runtime_error("could not allocate memory in JKQTPDataStore::addCopiedColumn()");
|
||||
}
|
||||
size_t itemid=addInternalItem(d, rows);
|
||||
return addColumnForItem(itemid, 0, name);
|
||||
}
|
||||
|
||||
/** \brief copy an external column to the datastore. It contains \a rows rows. The external data is copied to an internal array, so
|
||||
@ -1761,7 +1769,7 @@ class JKQTPColumnIterator {
|
||||
|
||||
/** \brief dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the value does not exist in the column */
|
||||
inline reference operator*() const {
|
||||
JKQTPASSERT(col_!=nullptr && pos_>=0 && pos_<static_cast<int>(col_->getRows()));
|
||||
JKQTPASSERT((col_!=nullptr) && (pos_>=0) && (pos_<static_cast<int>(col_->getRows())));
|
||||
return col_->at(pos_);
|
||||
}
|
||||
inline reference operator[](difference_type off) const
|
||||
@ -1769,7 +1777,7 @@ class JKQTPColumnIterator {
|
||||
if (!isValid() && off<0) {
|
||||
return col_->at(static_cast<int>(col_->getRows())+off);
|
||||
}
|
||||
JKQTPASSERT(col_!=nullptr && pos_+off>=0 && pos_+off<static_cast<int>(col_->getRows()));
|
||||
JKQTPASSERT((col_!=nullptr) && (pos_+off>=0) && (pos_+off<static_cast<int>(col_->getRows())));
|
||||
return col_->at(pos_+off);
|
||||
}
|
||||
/** \brief comparison operator (less than)
|
||||
@ -2092,6 +2100,7 @@ class JKQTPColumnConstIterator {
|
||||
inline reference operator[](difference_type off) const
|
||||
{
|
||||
if (!isValid() && off<0) {
|
||||
JKQTPASSERT(col_!=nullptr);
|
||||
return col_->at(static_cast<int>(col_->getRows())+off);
|
||||
}
|
||||
JKQTPASSERT(col_!=nullptr && pos_+off>=0 && pos_+off<static_cast<int>(col_->getRows()));
|
||||
|
@ -43,27 +43,27 @@ JKQTPColorPaletteStyleAndToolsMixin::JKQTPColorPaletteStyleAndToolsMixin(JKQTBas
|
||||
colorBarTopAxis->setAxisLabel("");
|
||||
|
||||
|
||||
this->palette=JKQTPMathImageMATLAB;
|
||||
this->imageNameFontName=parent->getDefaultTextFontName();
|
||||
this->imageNameFontSize=parent->getDefaultTextSize();
|
||||
this->imageName="";
|
||||
this->showColorBar=true;
|
||||
this->colorBarWidth=14;
|
||||
this->colorBarRelativeHeight=0.75;
|
||||
this->autoImageRange=true;
|
||||
this->imageMin=0;
|
||||
this->imageMax=1;
|
||||
this->colorBarOffset=4;
|
||||
this->rangeMinFailAction=JKQTPMathImageLastPaletteColor;
|
||||
this->rangeMaxFailAction=JKQTPMathImageLastPaletteColor;
|
||||
this->rangeMinFailColor=QColor("black");
|
||||
this->rangeMaxFailColor=QColor("black");
|
||||
this->nanColor=QColor("black");
|
||||
this->infColor=QColor("black");
|
||||
this->colorBarTopVisible=false;
|
||||
this->colorBarRightVisible=true;
|
||||
palette=JKQTPMathImageMATLAB;
|
||||
imageNameFontName=parent->getDefaultTextFontName();
|
||||
imageNameFontSize=parent->getDefaultTextSize();
|
||||
imageName="";
|
||||
showColorBar=true;
|
||||
colorBarWidth=14;
|
||||
colorBarRelativeHeight=0.75;
|
||||
autoImageRange=true;
|
||||
imageMin=0;
|
||||
imageMax=1;
|
||||
colorBarOffset=4;
|
||||
rangeMinFailAction=JKQTPMathImageLastPaletteColor;
|
||||
rangeMaxFailAction=JKQTPMathImageLastPaletteColor;
|
||||
rangeMinFailColor=QColor("black");
|
||||
rangeMaxFailColor=QColor("black");
|
||||
nanColor=QColor("black");
|
||||
infColor=QColor("black");
|
||||
colorBarTopVisible=false;
|
||||
colorBarRightVisible=true;
|
||||
|
||||
if (parent) this->palette=parent->getCurrentPlotterStyle().graphsStyle.defaultPalette;
|
||||
if (parent) palette=parent->getCurrentPlotterStyle().graphsStyle.defaultPalette;
|
||||
|
||||
}
|
||||
|
||||
@ -328,208 +328,208 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbSetParent(JKQTBasePlotter* parent) {
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setColorPalette(const JKQTPMathImageColorPalette &__value)
|
||||
{
|
||||
this->palette = __value;
|
||||
palette = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageColorPalette JKQTPColorPaletteStyleAndToolsMixin::getColorPalette() const
|
||||
{
|
||||
return this->palette;
|
||||
return palette;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction &__value)
|
||||
{
|
||||
this->rangeMinFailAction = __value;
|
||||
rangeMinFailAction = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageColorRangeFailAction JKQTPColorPaletteStyleAndToolsMixin::getActionRangeMinFail() const
|
||||
{
|
||||
return this->rangeMinFailAction;
|
||||
return rangeMinFailAction;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction &__value)
|
||||
{
|
||||
this->rangeMaxFailAction = __value;
|
||||
rangeMaxFailAction = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageColorRangeFailAction JKQTPColorPaletteStyleAndToolsMixin::getActionRangeMaxFail() const
|
||||
{
|
||||
return this->rangeMaxFailAction;
|
||||
return rangeMaxFailAction;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setRangeMinFailColor(const QColor &__value)
|
||||
{
|
||||
this->rangeMinFailColor = __value;
|
||||
rangeMinFailColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPColorPaletteStyleAndToolsMixin::getRangeMinFailColor() const
|
||||
{
|
||||
return this->rangeMinFailColor;
|
||||
return rangeMinFailColor;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setRangeMaxFailColor(const QColor &__value)
|
||||
{
|
||||
this->rangeMaxFailColor = __value;
|
||||
rangeMaxFailColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPColorPaletteStyleAndToolsMixin::getRangeMaxFailColor() const
|
||||
{
|
||||
return this->rangeMaxFailColor;
|
||||
return rangeMaxFailColor;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setNanColor(const QColor &__value)
|
||||
{
|
||||
this->nanColor = __value;
|
||||
nanColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPColorPaletteStyleAndToolsMixin::getNanColor() const
|
||||
{
|
||||
return this->nanColor;
|
||||
return nanColor;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setInfColor(const QColor &__value)
|
||||
{
|
||||
this->infColor = __value;
|
||||
infColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPColorPaletteStyleAndToolsMixin::getInfColor() const
|
||||
{
|
||||
return this->infColor;
|
||||
return infColor;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setShowColorBar(bool __value)
|
||||
{
|
||||
this->showColorBar = __value;
|
||||
showColorBar = __value;
|
||||
}
|
||||
|
||||
bool JKQTPColorPaletteStyleAndToolsMixin::getShowColorBar() const
|
||||
{
|
||||
return this->showColorBar;
|
||||
return showColorBar;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setColorBarWidth(int __value)
|
||||
{
|
||||
this->colorBarWidth = __value;
|
||||
colorBarWidth = __value;
|
||||
}
|
||||
|
||||
int JKQTPColorPaletteStyleAndToolsMixin::getColorBarWidth() const
|
||||
{
|
||||
return this->colorBarWidth;
|
||||
return colorBarWidth;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setColorBarOffset(int __value)
|
||||
{
|
||||
this->colorBarOffset = __value;
|
||||
colorBarOffset = __value;
|
||||
}
|
||||
|
||||
int JKQTPColorPaletteStyleAndToolsMixin::getColorBarOffset() const
|
||||
{
|
||||
return this->colorBarOffset;
|
||||
return colorBarOffset;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setColorBarRelativeHeight(double __value)
|
||||
{
|
||||
this->colorBarRelativeHeight = __value;
|
||||
colorBarRelativeHeight = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteStyleAndToolsMixin::getColorBarRelativeHeight() const
|
||||
{
|
||||
return this->colorBarRelativeHeight;
|
||||
return colorBarRelativeHeight;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setImageMin(double __value)
|
||||
{
|
||||
this->imageMin = __value;
|
||||
imageMin = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteStyleAndToolsMixin::getImageMin() const
|
||||
{
|
||||
return this->imageMin;
|
||||
return imageMin;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setImageMax(double __value)
|
||||
{
|
||||
this->imageMax = __value;
|
||||
imageMax = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteStyleAndToolsMixin::getImageMax() const
|
||||
{
|
||||
return this->imageMax;
|
||||
return imageMax;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setAutoImageRange(bool __value)
|
||||
{
|
||||
this->autoImageRange = __value;
|
||||
autoImageRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPColorPaletteStyleAndToolsMixin::getAutoImageRange() const
|
||||
{
|
||||
return this->autoImageRange;
|
||||
return autoImageRange;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setImageName(const QString &__value)
|
||||
{
|
||||
this->imageName = __value;
|
||||
imageName = __value;
|
||||
}
|
||||
|
||||
QString JKQTPColorPaletteStyleAndToolsMixin::getImageName() const
|
||||
{
|
||||
return this->imageName;
|
||||
return imageName;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setImageNameFontName(const QString &__value)
|
||||
{
|
||||
this->imageNameFontName = __value;
|
||||
imageNameFontName = __value;
|
||||
}
|
||||
|
||||
QString JKQTPColorPaletteStyleAndToolsMixin::getImageNameFontName() const
|
||||
{
|
||||
return this->imageNameFontName;
|
||||
return imageNameFontName;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setImageNameFontSize(double __value)
|
||||
{
|
||||
this->imageNameFontSize = __value;
|
||||
imageNameFontSize = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteStyleAndToolsMixin::getImageNameFontSize() const
|
||||
{
|
||||
return this->imageNameFontSize;
|
||||
return imageNameFontSize;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPColorPaletteStyleAndToolsMixin::getColorBarRightAxis() {
|
||||
return this->colorBarRightAxis;
|
||||
return colorBarRightAxis;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPColorPaletteStyleAndToolsMixin::getColorBarTopAxis() {
|
||||
return this->colorBarTopAxis;
|
||||
return colorBarTopAxis;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPColorPaletteStyleAndToolsMixin::getColorBarRightAxis() const {
|
||||
return this->colorBarRightAxis;
|
||||
return colorBarRightAxis;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPColorPaletteStyleAndToolsMixin::getColorBarTopAxis() const {
|
||||
return this->colorBarTopAxis;
|
||||
return colorBarTopAxis;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setColorBarTopVisible(bool __value)
|
||||
{
|
||||
this->colorBarTopVisible = __value;
|
||||
colorBarTopVisible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPColorPaletteStyleAndToolsMixin::getColorBarTopVisible() const
|
||||
{
|
||||
return this->colorBarTopVisible;
|
||||
return colorBarTopVisible;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteStyleAndToolsMixin::setColorBarRightVisible(bool __value)
|
||||
{
|
||||
this->colorBarRightVisible = __value;
|
||||
colorBarRightVisible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPColorPaletteStyleAndToolsMixin::getColorBarRightVisible() const
|
||||
{
|
||||
return this->colorBarRightVisible;
|
||||
return colorBarRightVisible;
|
||||
}
|
||||
|
||||
|
||||
@ -540,8 +540,11 @@ JKQTPColorPaletteWithModifierStyleAndToolsMixin::JKQTPColorPaletteWithModifierSt
|
||||
modifierColorBarTopAxis->setAxisLabel("");
|
||||
modifierColorBarRightAxis=new JKQTPHorizontalIndependentAxis (0, 100, 0, 100, parent);
|
||||
modifierColorBarRightAxis->setAxisLabel("");
|
||||
this->colorBarModifiedWidth=80;
|
||||
colorBarModifiedWidth=80;
|
||||
modifierMode=JKQTPMathImageModifierMode::ModifyNone;
|
||||
modifierMin=0;
|
||||
modifierMax=0;
|
||||
autoModifierRange=true;
|
||||
}
|
||||
|
||||
|
||||
@ -735,12 +738,12 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbSetParent(JKQTBasePlotte
|
||||
|
||||
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::setModifierMode(const JKQTPMathImageModifierMode &__value)
|
||||
{
|
||||
this->modifierMode = __value;
|
||||
modifierMode = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageModifierMode JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierMode() const
|
||||
{
|
||||
return this->modifierMode;
|
||||
return modifierMode;
|
||||
}
|
||||
|
||||
|
||||
@ -752,59 +755,59 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::modifyImage(QImage &img, c
|
||||
|
||||
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::setColorBarModifiedWidth(double __value)
|
||||
{
|
||||
this->colorBarModifiedWidth = __value;
|
||||
colorBarModifiedWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteWithModifierStyleAndToolsMixin::getColorBarModifiedWidth() const
|
||||
{
|
||||
return this->colorBarModifiedWidth;
|
||||
return colorBarModifiedWidth;
|
||||
}
|
||||
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierColorBarTopAxis() {
|
||||
return this->modifierColorBarTopAxis;
|
||||
return modifierColorBarTopAxis;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierColorBarRightAxis() {
|
||||
return this->modifierColorBarRightAxis ;
|
||||
return modifierColorBarRightAxis ;
|
||||
}
|
||||
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierColorBarTopAxis() const {
|
||||
return this->modifierColorBarTopAxis;
|
||||
return modifierColorBarTopAxis;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierColorBarRightAxis() const {
|
||||
return this->modifierColorBarRightAxis ;
|
||||
return modifierColorBarRightAxis ;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::setAutoModifierRange(bool __value)
|
||||
{
|
||||
this->autoModifierRange = __value;
|
||||
autoModifierRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPColorPaletteWithModifierStyleAndToolsMixin::getAutoModifierRange() const
|
||||
{
|
||||
return this->autoModifierRange;
|
||||
return autoModifierRange;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::setModifierMin(double __value)
|
||||
{
|
||||
this->modifierMin = __value;
|
||||
modifierMin = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierMin() const
|
||||
{
|
||||
return this->modifierMin;
|
||||
return modifierMin;
|
||||
}
|
||||
|
||||
void JKQTPColorPaletteWithModifierStyleAndToolsMixin::setModifierMax(double __value)
|
||||
{
|
||||
this->modifierMax = __value;
|
||||
modifierMax = __value;
|
||||
}
|
||||
|
||||
double JKQTPColorPaletteWithModifierStyleAndToolsMixin::getModifierMax() const
|
||||
{
|
||||
return this->modifierMax;
|
||||
return modifierMax;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user