92 ThreeDItem(
double x0 = 4,
double y0 = 3,
double width = 15,
93 double height = 10,
unsigned colFrame = 0,
unsigned colGrid = 0,
94 unsigned colData = 0,
bool logX =
false,
bool logY =
false,
95 bool logZ =
false,
GridMode gridMode = AxesWithLabels,
96 Mode3D mode3D = Grid,
double xMax = 15,
double yMax = 10,
97 double zMax = 15,
const QString& textX = QString(),
98 const QString& textY = QString(),
99 const QString& textZ = QString(),
100 const QString& header = QString(),
double relSize = 1,
101 int numDigX = -1,
int numDigY = -1,
int numDigZ = -1,
102 int minTicX = 5,
int minTicY = 2,
int minTicZ = 5,
int expX = 0,
103 int expY = 0,
int expZ = 0,
double xMin = 0,
double yMin = 0,
104 double zMin = 0,
double xTic = 5,
double yTic = 2,
105 double zTic = 5,
double deltaX = 0,
double deltaZ = 0,
106 double phi = 20,
double theta = -20,
double boxX = 7.5,
107 double boxY = 7.5,
double boxZ = 7.5,
double xRef = 7.5,
108 double yRef = 4,
double fx = 1,
double fy = 1,
double fz = 1,
109 bool showFrame =
true,
bool collapsed =
false,
110 bool visible =
true);
128 ThreeDItem(
const KConfigGroup* plo,
double x0,
double y0,
double width,
129 double height,
unsigned colorFrame,
unsigned colorGrid,
130 unsigned colorData,
GridMode gridMode);
136 inline double boxX()
const {
return m_boxX; };
138 inline double boxY()
const {
return m_boxY; };
140 inline double boxZ()
const {
return m_boxZ; };
142 inline unsigned colorData()
const {
return m_colorData; };
144 inline double deltaX()
const {
return m_deltaX; };
146 inline double deltaZ()
const {
return m_deltaZ; };
154 void exportTable(QTextStream& stream,
char separator,
char format,
155 int precision)
const;
157 inline int expZ()
const {
return m_expZ; };
159 inline double fX()
const {
return m_fX; };
161 inline double fY()
const {
return m_fY; };
163 inline double fZ()
const {
return m_fZ; };
165 inline bool logZ()
const {
return m_logZ; };
167 inline int minTicZ()
const {
return m_minTicZ; };
174 inline int numDigZ()
const {
return m_numDigZ; };
176 virtual void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
177 QWidget* widget =
nullptr)
override;
185 inline double phi()
const {
return m_phi; };
225 inline void setFX(
double fx) { m_fX = fx; };
230 inline void setFY(
double fy) { m_fY = fy; };
235 inline void setFZ(
double fz) { m_fZ = fz; };
240 inline void setLogZ(
bool logZ) { m_logZ = logZ; };
245 inline void setMinTicZ(
int minTicZ) { m_minTicZ = minTicZ; };
255 inline void setNumDigZ(
int numDigZ) { m_numDigZ = numDigZ; };
260 inline void setPhi(
double phi) { m_phi = phi; };
275 inline void setTextZ(
const QString& text) { m_textZ = text; };
280 inline void setTheta(
double theta) { m_theta = theta; };
285 inline void setXRef(
double xRef) { m_xRef = xRef; };
290 inline void setYRef(
double yRef) { m_yRef = yRef; };
295 inline void setZMax(
double zMax) { m_zMax = zMax; };
300 inline void setZMin(
double zMin) { m_zMin = zMin; };
305 inline void setZTic(
double zTic) { m_zTic = zTic; };
309 inline QString
textZ()
const {
return m_textZ; };
311 inline double theta()
const {
return m_theta; };
320 inline double xRef()
const {
return m_xRef; };
322 inline double yRef()
const {
return m_yRef; };
324 double**
yValues()
const {
return m_yValues; };
326 inline double zMax()
const {
return m_zMax; };
328 inline double zMin()
const {
return m_zMin; };
330 inline double zTic()
const {
return m_zTic; };
356 void axis3D(QPainter* painter,
double vMin,
double vMax,
double tic,
358 double f,
double scale,
double xAxis,
double zAxis,
359 double ticLen,
int numDig,
Axis axis,
bool log,
371 void drawText(QPainter* painter,
const QString& text,
double x,
double y,
373 double dir = 0)
const;
392 void line3D(QPainter* painter,
double x1,
double y1,
double z1,
393 double x2,
double y2,
double z2,
PSGraph* ps =
nullptr)
const;
419 void plot3D(QPainter* painter,
bool xArray,
bool yArray,
bool zArray,
420 const double* xData,
const double* yData,
421 const double* zData,
double xScale,
double yScale,
422 double zScale,
bool firstLine,
int n,
double xOffset,
423 double yOffset,
double* vertex,
PSGraph* ps =
nullptr)
const;
433 void plotArray(QPainter* painter,
const double* x,
const double* y,
int n,
455 double yFrom3d(
double x,
double y,
double z)
const;
456 bool m_showFrame, m_logZ;
457 mutable bool logXo, logZo;
458 int m_numDigZ, m_minTicZ, m_expZ;
461 unsigned m_colorData;
462 double m_zMin, m_zMax, m_deltaX, m_deltaZ, m_zTic, m_phi, m_theta, m_boxX,
463 m_boxY, m_boxZ, m_xRef, m_yRef, m_fX, m_fY, m_fZ, zminl;
464 mutable double xStep, zStep, xMino, xMaxo, deltaXo, zMino, zMaxo, deltaZo,
465 scalx, scaly, scalz, scal3D, phio, thetao, xOff3D, yOff3D;
466 mutable double** m_yValues;
467 mutable double vertex[16];
468 mutable QTransform m3D;
469 mutable QVector<double> yMin3D, yMax3D;
Frame item class.
Definition frameitem.h:34
double width() const
Returns width in cm.
Definition frameitem.h:409
GridMode
Grid mode.
Definition frameitem.h:37
PS graphics class.
Definition psgraph.h:46
Alignment
Text alignment.
Definition textitem.h:35
3D item class.
Definition threeditem.h:31
void frame3D(QPainter *painter, int iBack, PSGraph *ps=nullptr) const
Plots 3D frame.
void setShowFrame(bool showFrame)
Sets frame mode.
Definition threeditem.h:270
void setBoxY(double width)
Sets y box width in cm.
Definition threeditem.h:195
void setYRef(double yRef)
Sets y position of center of box bottom plane.
Definition threeditem.h:290
void setTextZ(const QString &text)
Sets z axis text.
Definition threeditem.h:275
Mode3D mode3D() const
Returns 0 for lines parallel to x, 1 for lines parallel to z, 2 for x,z grid.
Definition threeditem.h:172
void raster3d(QPainter *painter, PSGraph *ps=nullptr) const
Draws frame and axes of 3D plot.
void setZMax(double zMax)
Sets upper z data limit.
Definition threeditem.h:295
void line3D(QPainter *painter, double x1, double y1, double z1, double x2, double y2, double z2, PSGraph *ps=nullptr) const
Draws line in 3D space.
void writePlo(KConfigGroup *plo) const
Writes into plot file.
void exportTable(QTextStream &stream, char separator, char format, int precision) const
Exports value table to file.
void setExpZ(int e)
Sets exponent of z normalization factor.
Definition threeditem.h:220
void setBoxZ(double width)
Sets z box width in cm.
Definition threeditem.h:200
void setTheta(double theta)
Sets angle of rotation about y axis.
Definition threeditem.h:280
double theta() const
Returns angle of rotation about y axis in deg.
Definition threeditem.h:311
double xFrom3d(double x, double z) const
Calculates 2D x value.
ThreeDItem(const KConfigGroup *plo, double x0, double y0, double width, double height, unsigned colorFrame, unsigned colorGrid, unsigned colorData, GridMode gridMode)
Constructor.
void setLogZ(bool logZ)
Sets logarithmic mode of z axis.
Definition threeditem.h:240
double ** yValues() const
Returns pointer to y value array.
Definition threeditem.h:324
double boxZ() const
Returns z box width in cm.
Definition threeditem.h:140
void setMinTicZ(int minTicZ)
Sets number of intervals between major tics of z axis.
Definition threeditem.h:245
void setZTic(double zTic)
Sets z tic distance.
Definition threeditem.h:305
void setNumDigZ(int numDigZ)
Sets number of digits for z axis.
Definition threeditem.h:255
double yFrom3d(double x, double y, double z) const
Calculates 2D y value.
Axis
3D mode.
Definition threeditem.h:334
@ Y
y axis.
Definition threeditem.h:336
@ X
x axis.
Definition threeditem.h:335
void axis3D(QPainter *painter, double vMin, double vMax, double tic, int minTic, double f, double scale, double xAxis, double zAxis, double ticLen, int numDig, Axis axis, bool log, PSGraph *ps=nullptr) const
Plots 3D axis.
double fZ() const
Returns normalization factor for z values.
Definition threeditem.h:163
ThreeDItem(double x0=4, double y0=3, double width=15, double height=10, unsigned colFrame=0, unsigned colGrid=0, unsigned colData=0, bool logX=false, bool logY=false, bool logZ=false, GridMode gridMode=AxesWithLabels, Mode3D mode3D=Grid, double xMax=15, double yMax=10, double zMax=15, const QString &textX=QString(), const QString &textY=QString(), const QString &textZ=QString(), const QString &header=QString(), double relSize=1, int numDigX=-1, int numDigY=-1, int numDigZ=-1, int minTicX=5, int minTicY=2, int minTicZ=5, int expX=0, int expY=0, int expZ=0, double xMin=0, double yMin=0, double zMin=0, double xTic=5, double yTic=2, double zTic=5, double deltaX=0, double deltaZ=0, double phi=20, double theta=-20, double boxX=7.5, double boxY=7.5, double boxZ=7.5, double xRef=7.5, double yRef=4, double fx=1, double fy=1, double fz=1, bool showFrame=true, bool collapsed=false, bool visible=true)
Constructor.
void setMode3D(Mode3D mode3D)
Sets 3D mode.
Definition threeditem.h:250
double zMin() const
Returns lower z data limit user units.
Definition threeditem.h:328
unsigned colorData() const
Returns color for data.
Definition threeditem.h:142
bool showFrame() const
Returns true for shown frame.
Definition threeditem.h:307
double boxX() const
Returns x box width in cm.
Definition threeditem.h:136
void setBoxX(double width)
Sets x box width in cm.
Definition threeditem.h:190
double boxY() const
Returns y box width in cm.
Definition threeditem.h:138
QString textZ() const
Returns z axis text.
Definition threeditem.h:309
void update()
Applies changes and forces redrawing.
int minTicZ() const
Returns number of intervals between major tics of z axis.
Definition threeditem.h:167
void setProperties()
Sets properties according to transformation matrix.
void setFX(double fx)
Sets x normalization factor.
Definition threeditem.h:225
double deltaX() const
Returns x step size of grid.
Definition threeditem.h:144
void setProperties(const QTransform &m)
Sets properties according to transformation matrix.
void setFZ(double fz)
Sets z normalization factor.
Definition threeditem.h:235
void setDeltaZ(double dz)
Sets z step size of grid.
Definition threeditem.h:215
bool logZ() const
Returns true for logarithmic z axis.
Definition threeditem.h:165
void setZMin(double zMin)
Sets lower z data limit.
Definition threeditem.h:300
double xRef() const
Returns x position of center of box bottom plane.
Definition threeditem.h:320
virtual QRectF boundingRect() const override
Calculates bounding rectangle.
int expZ() const
Returns logarithm of normalization factor for z axis.
Definition threeditem.h:157
double zMax() const
Returns upper z data limit user units.
Definition threeditem.h:326
double phi() const
Returns angle of rotation about y axis in deg.
Definition threeditem.h:185
int numDigZ() const
Returns number of digits for z axis.
Definition threeditem.h:174
double yRef() const
Returns y position of center of box bottom plane.
Definition threeditem.h:322
void setXRef(double xRef)
Sets x position of center of box bottom plane.
Definition threeditem.h:285
void plotArray(QPainter *painter, const double *x, const double *y, int n, PSGraph *ps=nullptr) const
Plots array.
void setPhi(double phi)
Sets angle of rotation about y axis.
Definition threeditem.h:260
void setDeltaX(double dx)
Sets x step size of grid.
Definition threeditem.h:210
double fX() const
Returns normalization factor for x values.
Definition threeditem.h:159
void setColorData(unsigned color)
Sets color for data.
Definition threeditem.h:205
double fY() const
Returns normalization factor for y values.
Definition threeditem.h:161
ThreeDItem(const ThreeDItem &a)
Copy constructor.
void plot3D(QPainter *painter, bool xArray, bool yArray, bool zArray, const double *xData, const double *yData, const double *zData, double xScale, double yScale, double zScale, bool firstLine, int n, double xOffset, double yOffset, double *vertex, PSGraph *ps=nullptr) const
Plots curve in 3D space.
double zTic() const
Returns distance between major tics of z axis.
Definition threeditem.h:330
void setFY(double fy)
Sets y normalization factor.
Definition threeditem.h:230
double deltaZ() const
Returns z step size of grid.
Definition threeditem.h:146
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
Paints item.
void drawText(QPainter *painter, const QString &text, double x, double y, TextItem::Alignment alignment, PSGraph *ps, double dir=0) const
Plots text.
void plotArray3D(QPainter *painter, PSGraph *ps=nullptr) const
Plots 3D data.
void paintCond(QPainter *painter, PSGraph *ps=nullptr) const
Paints or calculates bounding area.
Mode3D
3D mode.
Definition threeditem.h:34
@ AlongX
Lines along x direction.
Definition threeditem.h:35
@ AlongZ
Lines along z direction.
Definition threeditem.h:36