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 =
"",
98 const QString& textY =
"",
const QString& textZ =
"",
99 const QString& header =
"",
double relSize = 1,
int numDigX = -1,
100 int numDigY = -1,
int numDigZ = -1,
int minTicX = 5,
101 int minTicY = 2,
int minTicZ = 5,
int expX = 0,
int expY = 0,
102 int expZ = 0,
double xMin = 0,
double yMin = 0,
double zMin = 0,
103 double xTic = 5,
double yTic = 2,
double zTic = 5,
104 double deltaX = 0,
double deltaZ = 0,
double phi = 20,
105 double theta = -20,
double boxX = 7.5,
double boxY = 7.5,
106 double boxZ = 7.5,
double xRef = 7.5,
double yRef = 4,
107 double fx = 1,
double fy = 1,
double fz = 1,
108 bool showFrame =
true,
bool collapsed =
false,
109 bool visible =
true);
127 ThreeDItem(
const KConfigGroup* plo,
double x0,
double y0,
double width,
128 double height,
unsigned colorFrame,
unsigned colorGrid,
129 unsigned colorData,
GridMode gridMode);
135 inline double boxX()
const {
return m_boxX; };
137 inline double boxY()
const {
return m_boxY; };
139 inline double boxZ()
const {
return m_boxZ; };
141 inline unsigned colorData()
const {
return m_colorData; };
143 inline double deltaX()
const {
return m_deltaX; };
145 inline double deltaZ()
const {
return m_deltaZ; };
153 void exportTable(QTextStream& stream,
char separator,
char format,
154 int precision)
const;
156 inline int expZ()
const {
return m_expZ; };
158 inline double fX()
const {
return m_fX; };
160 inline double fY()
const {
return m_fY; };
162 inline double fZ()
const {
return m_fZ; };
164 inline bool logZ()
const {
return m_logZ; };
166 inline int minTicZ()
const {
return m_minTicZ; };
173 inline int numDigZ()
const {
return m_numDigZ; };
175 virtual void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
176 QWidget* widget = 0);
184 inline double phi()
const {
return m_phi; };
224 inline void setFX(
double fx) { m_fX = fx; };
229 inline void setFY(
double fy) { m_fY = fy; };
234 inline void setFZ(
double fz) { m_fZ = fz; };
239 inline void setLogZ(
bool logZ) { m_logZ = logZ; };
244 inline void setMinTicZ(
int minTicZ) { m_minTicZ = minTicZ; };
254 inline void setNumDigZ(
int numDigZ) { m_numDigZ = numDigZ; };
259 inline void setPhi(
double phi) { m_phi = phi; };
274 inline void setTextZ(
const QString& text) { m_textZ = text; };
279 inline void setTheta(
double theta) { m_theta = theta; };
284 inline void setXRef(
double xRef) { m_xRef = xRef; };
289 inline void setYRef(
double yRef) { m_yRef = yRef; };
294 inline void setZMax(
double zMax) { m_zMax = zMax; };
299 inline void setZMin(
double zMin) { m_zMin = zMin; };
304 inline void setZTic(
double zTic) { m_zTic = zTic; };
308 inline QString
textZ()
const {
return m_textZ; };
310 inline double theta()
const {
return m_theta; };
319 inline double xRef()
const {
return m_xRef; };
321 inline double yRef()
const {
return m_yRef; };
323 double**
yValues()
const {
return m_yValues; };
325 inline double zMax()
const {
return m_zMax; };
327 inline double zMin()
const {
return m_zMin; };
329 inline double zTic()
const {
return m_zTic; };
355 void axis3D(QPainter* painter,
double vMin,
double vMax,
double tic,
357 double f,
double scale,
double xAxis,
double zAxis,
358 double ticLen,
int numDig,
Axis axis,
bool log,
370 void drawText(QPainter* painter,
const QString& text,
double x,
double y,
372 double dir = 0)
const;
391 void line3D(QPainter* painter,
double x1,
double y1,
double z1,
392 double x2,
double y2,
double z2,
PSGraph* ps = 0)
const;
418 void plot3D(QPainter* painter,
bool xArray,
bool yArray,
bool zArray,
419 const double* xData,
const double* yData,
420 const double* zData,
double xScale,
double yScale,
421 double zScale,
bool firstLine,
int n,
double xOffset,
422 double yOffset,
double* vertex,
PSGraph* ps = 0)
const;
432 void plotArray(QPainter* painter,
const double* x,
const double* y,
int n,
454 double yFrom3d(
double x,
double y,
double z)
const;
455 bool m_showFrame, m_logZ;
456 mutable bool logXo, logZo;
457 int m_numDigZ, m_minTicZ, m_expZ;
460 unsigned m_colorData;
461 double m_zMin, m_zMax, m_deltaX, m_deltaZ, m_zTic, m_phi, m_theta, m_boxX,
462 m_boxY, m_boxZ, m_xRef, m_yRef, m_fX, m_fY, m_fZ, zminl;
463 mutable double xStep, zStep, xMino, xMaxo, deltaXo, zMino, zMaxo, deltaZo,
464 scalx, scaly, scalz, scal3D, phio, thetao, xOff3D, yOff3D;
465 mutable double** m_yValues;
466 mutable double vertex[16];
467 mutable QTransform m3D;
468 mutable QVector<double> yMin3D, yMax3D;
Frame item class.
Definition: frameitem.h:34
double width() const
Returns width in cm.
Definition: frameitem.h:408
GridMode
Grid mode.
Definition: frameitem.h:37
PS graphics class.
Definition: psgraph.h:46
Alignment
Text alignment.
Definition: textitem.h:33
3D item class.
Definition: threeditem.h:31
void setShowFrame(bool showFrame)
Sets frame mode.
Definition: threeditem.h:269
void plotArray(QPainter *painter, const double *x, const double *y, int n, PSGraph *ps=0) const
Plots array.
void setBoxY(double width)
Sets y box width in cm.
Definition: threeditem.h:194
void setYRef(double yRef)
Sets y position of center of box bottom plane.
Definition: threeditem.h:289
void setTextZ(const QString &text)
Sets z axis text.
Definition: threeditem.h:274
void frame3D(QPainter *painter, int iBack, PSGraph *ps=0) const
Plots 3D frame.
Mode3D mode3D() const
Returns 0 for lines parallel to x, 1 for lines parallel to z, 2 for x,z grid.
Definition: threeditem.h:171
void setZMax(double zMax)
Sets upper z data limit.
Definition: threeditem.h:294
void plotArray3D(QPainter *painter, PSGraph *ps=0) const
Plots 3D data.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Paints item.
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:219
void setBoxZ(double width)
Sets z box width in cm.
Definition: threeditem.h:199
void setTheta(double theta)
Sets angle of rotation about y axis.
Definition: threeditem.h:279
double theta() const
Returns angle of rotation about y axis in deg.
Definition: threeditem.h:310
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:239
void paintCond(QPainter *painter, PSGraph *ps=0) const
Paints or calculates bounding area.
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=0) const
Plots curve in 3D space.
double ** yValues() const
Returns pointer to y value array.
Definition: threeditem.h:323
double boxZ() const
Returns z box width in cm.
Definition: threeditem.h:139
void setMinTicZ(int minTicZ)
Sets number of intervals between major tics of z axis.
Definition: threeditem.h:244
void setZTic(double zTic)
Sets z tic distance.
Definition: threeditem.h:304
void setNumDigZ(int numDigZ)
Sets number of digits for z axis.
Definition: threeditem.h:254
double yFrom3d(double x, double y, double z) const
Calculates 2D y value.
Axis
3D mode.
Definition: threeditem.h:333
@ Y
y axis.
Definition: threeditem.h:335
@ X
x axis.
Definition: threeditem.h:334
double fZ() const
Returns normalization factor for z values.
Definition: threeditem.h:162
void setMode3D(Mode3D mode3D)
Sets 3D mode.
Definition: threeditem.h:249
double zMin() const
Returns lower z data limit user units.
Definition: threeditem.h:327
unsigned colorData() const
Returns color for data.
Definition: threeditem.h:141
bool showFrame() const
Returns true for shown frame.
Definition: threeditem.h:306
double boxX() const
Returns x box width in cm.
Definition: threeditem.h:135
void setBoxX(double width)
Sets x box width in cm.
Definition: threeditem.h:189
double boxY() const
Returns y box width in cm.
Definition: threeditem.h:137
QString textZ() const
Returns z axis text.
Definition: threeditem.h:308
void update()
Applies changes and forces redrawing.
int minTicZ() const
Returns number of intervals between major tics of z axis.
Definition: threeditem.h:166
void setProperties()
Sets properties according to transformation matrix.
void setFX(double fx)
Sets x normalization factor.
Definition: threeditem.h:224
void line3D(QPainter *painter, double x1, double y1, double z1, double x2, double y2, double z2, PSGraph *ps=0) const
Draws line in 3D space.
double deltaX() const
Returns x step size of grid.
Definition: threeditem.h:143
void setProperties(const QTransform &m)
Sets properties according to transformation matrix.
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="", const QString &textY="", const QString &textZ="", const QString &header="", 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 setFZ(double fz)
Sets z normalization factor.
Definition: threeditem.h:234
void setDeltaZ(double dz)
Sets z step size of grid.
Definition: threeditem.h:214
bool logZ() const
Returns true for logarithmic z axis.
Definition: threeditem.h:164
void setZMin(double zMin)
Sets lower z data limit.
Definition: threeditem.h:299
double xRef() const
Returns x position of center of box bottom plane.
Definition: threeditem.h:319
int expZ() const
Returns logarithm of normalization factor for z axis.
Definition: threeditem.h:156
double zMax() const
Returns upper z data limit user units.
Definition: threeditem.h:325
double phi() const
Returns angle of rotation about y axis in deg.
Definition: threeditem.h:184
int numDigZ() const
Returns number of digits for z axis.
Definition: threeditem.h:173
double yRef() const
Returns y position of center of box bottom plane.
Definition: threeditem.h:321
void setXRef(double xRef)
Sets x position of center of box bottom plane.
Definition: threeditem.h:284
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=0) const
Plots 3D axis.
void raster3d(QPainter *painter, PSGraph *ps=0) const
Draws frame and axes of 3D plot.
void setPhi(double phi)
Sets angle of rotation about y axis.
Definition: threeditem.h:259
void setDeltaX(double dx)
Sets x step size of grid.
Definition: threeditem.h:209
double fX() const
Returns normalization factor for x values.
Definition: threeditem.h:158
void setColorData(unsigned color)
Sets color for data.
Definition: threeditem.h:204
double fY() const
Returns normalization factor for y values.
Definition: threeditem.h:160
ThreeDItem(const ThreeDItem &a)
Copy constructor.
double zTic() const
Returns distance between major tics of z axis.
Definition: threeditem.h:329
void setFY(double fy)
Sets y normalization factor.
Definition: threeditem.h:229
virtual QRectF boundingRect() const
Calculates bounding rectangle.
double deltaZ() const
Returns z step size of grid.
Definition: threeditem.h:145
void drawText(QPainter *painter, const QString &text, double x, double y, TextItem::Alignment alignment, PSGraph *ps, double dir=0) const
Plots text.
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