libkpl  6.0
A Library for Graphical Presentation of Data Sets and Functions
array3ditem.h
1/***************************************************************************
2 array3ditem.h - description
3 -------------------
4 begin : Tue Dec 25 2001
5 copyright : (C) 2024 by Werner Stille
6 email : kpl@werner-stille.de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef ARRAY3DITEM_H
19#define ARRAY3DITEM_H
20
21#include <QTransform>
22#include "arrayitem.h"
23#include "threeditem.h"
24
29class Q_DECL_EXPORT Array3DItem : public ThreeDItem
30{
31public:
33 enum {
34 Type = UserType + Array3D
38 };
104 Array3DItem(double x0 = 4, double y0 = 3, double width = 15,
105 double height = 10, unsigned colorFrame = 0,
106 unsigned colorGrid = 0, unsigned colorData = 0,
107 bool logX = false, bool logY = false, bool logZ = false,
108 GridMode gridMode = AxesWithLabels, Mode3D mode3D = Grid,
109 double xMax = 15, double yMax = 10, double zMax = 15,
110 const QString& textX = QString(),
111 const QString& textY = QString(),
112 const QString& textZ = QString(),
113 const QString& header = QString(),
114 double relSize = 1, int colX = 0, int colY = 1, int colZ = 2,
115 int colErr = 0, bool errorBars = false,
117 int numDigX = -1, int numDigY = -1, int numDigZ = -1,
118 int minTicX = 5, int minTicY = 2, int minTicZ = 5, int expX = 0,
119 int expY = 0, int expZ = 0, double xMin = 0, double yMin = 0,
120 double zMin = 0, double xTic = 5, double yTic = 2,
121 double zTic = 5, double deltaX = 0, double deltaZ = 0,
122 double phi = 20, double theta = -20, double boxX = 7.5,
123 double boxY = 7.5, double boxZ = 7.5, double xRef = 7.5,
124 double yRef = 4, double fx = 1, double fy = 1, double fz = 1,
125 int rowStart = 0, int n = 0, double smooth = 0,
126 const QUrl& url = QUrl(), bool showFrame = true,
127 bool internal = false, bool collapsed = false,
128 bool visible = true);
148 Array3DItem(const KConfigGroup* plo, const QUrl& urlPlo, double x0 = 4,
149 double y0 = 3, double width = 15, double height = 10,
150 unsigned colorFrame = 0, unsigned colorGrid = 0,
151 unsigned colorData = 0, GridMode gridMode = AxesWithLabels,
152 int colX = 0, int colY = 1, int colErr = 0,
153 bool errorBars = false);
157 void calcTable() const;
159 inline int colErr() const { return m_colErr; };
161 inline int colX() const { return m_colX; };
163 inline int colY() const { return m_colY; };
165 inline int colZ() const { return m_colZ; };
167 inline int count() const { return m_count; };
172 inline double*** data() { return &m_data; };
175 { return m_decimalCharacter; };
177 inline bool errorBars() const { return m_errorBars; };
179 inline bool internal() const { return m_internal; };
181 inline int numCols() const { return m_numCols; };
183 inline int numRows() const { return m_numRows; };
185 virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
186 QWidget* widget = nullptr) override;
188 inline int rowStart() const { return m_rowStart; };
193 inline void setColErr(int colErr) { m_colErr = colErr; };
198 inline void setColX(int colX) { m_colX = colX; };
203 inline void setColY(int colY) { m_colY = colY; };
208 inline void setColZ(int colZ) { m_colZ = colZ; };
213 inline void setCount(int n) { m_count = n; };
220 { m_decimalCharacter = decimalCharacter; };
225 inline void setErrorBars(bool errorBars) { m_errorBars = errorBars; };
230 inline void setInternal(bool internal) { m_internal = internal; };
235 inline void setNumCols(int nCols) { m_numCols = nCols; };
240 inline void setNumRows(int nRows) { m_numRows = nRows; };
245 inline void setRowStart(int rowStart) { m_rowStart = rowStart; };
250 inline void setSmf(double smooth) { m_smf = smooth; };
255 inline void setUrl(const QUrl& url) { m_url = url; };
257 inline double smf() const { return m_smf; };
259 virtual int type() const override { return Type; };
261 inline const QUrl& url() const { return m_url; };
263 void update();
270 void writePlo(KConfigGroup* plo, const QUrl& urlPlo, bool absolute) const;
271
272protected:
273 bool m_internal, m_errorBars;
274 mutable bool errorBarso;
275 int m_colX, m_colY, m_colZ, m_colErr, m_rowStart, m_count, m_numRows,
276 m_numCols;
277 ArrayItem::DecimalCharacter m_decimalCharacter;
278 mutable int colXo, colYo, colZo, colErro, rowStarto, counto;
279 double m_smf;
280 mutable double smfo;
281 double** m_data;
282 QUrl m_url;
283};
284
285#endif
3D arrayitem class.
Definition array3ditem.h:30
int rowStart() const
Returns start row index.
Definition array3ditem.h:188
int numRows() const
Returns number of rows.
Definition array3ditem.h:183
void update()
Applies changes and forces redrawing.
Array3DItem(const KConfigGroup *plo, const QUrl &urlPlo, double x0=4, double y0=3, double width=15, double height=10, unsigned colorFrame=0, unsigned colorGrid=0, unsigned colorData=0, GridMode gridMode=AxesWithLabels, int colX=0, int colY=1, int colErr=0, bool errorBars=false)
Constructor.
int colX() const
Returns x column index.
Definition array3ditem.h:161
void setUrl(const QUrl &url)
Sets URL.
Definition array3ditem.h:255
void setRowStart(int rowStart)
Sets start row index.
Definition array3ditem.h:245
int numCols() const
Returns number of columns.
Definition array3ditem.h:181
void setColX(int colX)
Sets x column index.
Definition array3ditem.h:198
void writePlo(KConfigGroup *plo, const QUrl &urlPlo, bool absolute) const
Writes into plot file.
ArrayItem::DecimalCharacter decimalCharacter() const
Returns decimal symbol of floating point numbers.
Definition array3ditem.h:174
const QUrl & url() const
Returns URL of data file.
Definition array3ditem.h:261
void calcTable() const
Calculates value table.
double smf() const
Returns smoothing factor.
Definition array3ditem.h:257
void setColY(int colY)
Sets y column index.
Definition array3ditem.h:203
void setNumRows(int nRows)
Sets number of rows.
Definition array3ditem.h:240
int colErr() const
Returns y error column index.
Definition array3ditem.h:159
virtual int type() const override
Returns specific QGraphicsItem type number.
Definition array3ditem.h:259
void setCount(int n)
Sets number of data points.
Definition array3ditem.h:213
void setErrorBars(bool errorBars)
Sets error bars mode.
Definition array3ditem.h:225
int colZ() const
Returns z column index.
Definition array3ditem.h:165
Array3DItem(const Array3DItem &a)
Copy constructor.
bool errorBars() const
Returns true to use error bars.
Definition array3ditem.h:177
double *** data()
Returns pointer to internal array.
Definition array3ditem.h:172
void setNumCols(int nCols)
Sets number of columns.
Definition array3ditem.h:235
void setDecimalCharacter(ArrayItem::DecimalCharacter decimalCharacter)
Sets decimal character.
Definition array3ditem.h:219
void setColZ(int colZ)
Sets z column index.
Definition array3ditem.h:208
int count() const
Returns number of data points.
Definition array3ditem.h:167
Array3DItem(double x0=4, double y0=3, double width=15, double height=10, unsigned colorFrame=0, unsigned colorGrid=0, unsigned colorData=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 colX=0, int colY=1, int colZ=2, int colErr=0, bool errorBars=false, ArrayItem::DecimalCharacter decimalChar=ArrayItem::Point, 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, int rowStart=0, int n=0, double smooth=0, const QUrl &url=QUrl(), bool showFrame=true, bool internal=false, bool collapsed=false, bool visible=true)
Constructor.
void setInternal(bool internal)
Sets storage mode.
Definition array3ditem.h:230
~Array3DItem()
Destructor.
int colY() const
Returns y column index.
Definition array3ditem.h:163
bool internal() const
Returns true for internal stored array data.
Definition array3ditem.h:179
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
Paints item.
void setSmf(double smooth)
Sets smoothing factor.
Definition array3ditem.h:250
void setColErr(int colErr)
Sets error column index.
Definition array3ditem.h:193
DecimalCharacter
Decimal character.
Definition arrayitem.h:43
@ Point
Decimal point.
Definition arrayitem.h:44
@ Type
Specific QGraphicsItem type number of FrameItem for function type().
Definition frameitem.h:46
GridMode
Grid mode.
Definition frameitem.h:37
3D item class.
Definition threeditem.h:31
Mode3D
3D mode.
Definition threeditem.h:34