libkpl  5.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) 2017 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 = "", const QString& textY = "",
111 const QString& textZ = "", const QString& header = "",
112 double relSize = 1, int colX = 0, int colY = 1, int colZ = 2,
113 int colErr = 0, bool errorBars = false,
115 int numDigX = -1, int numDigY = -1, int numDigZ = -1,
116 int minTicX = 5, int minTicY = 2, int minTicZ = 5, int expX = 0,
117 int expY = 0, int expZ = 0, double xMin = 0, double yMin = 0,
118 double zMin = 0, double xTic = 5, double yTic = 2,
119 double zTic = 5, double deltaX = 0, double deltaZ = 0,
120 double phi = 20, double theta = -20, double boxX = 7.5,
121 double boxY = 7.5, double boxZ = 7.5, double xRef = 7.5,
122 double yRef = 4, double fx = 1, double fy = 1, double fz = 1,
123 int rowStart = 0, int n = 0, double smooth = 0,
124 const QUrl& url = QUrl(), bool showFrame = true,
125 bool internal = false, bool collapsed = false,
126 bool visible = true);
146 Array3DItem(const KConfigGroup* plo, const QUrl& urlPlo, double x0 = 4,
147 double y0 = 3, double width = 15, double height = 10,
148 unsigned colorFrame = 0, unsigned colorGrid = 0,
149 unsigned colorData = 0, GridMode gridMode = AxesWithLabels,
150 int colX = 0, int colY = 1, int colErr = 0,
151 bool errorBars = false);
155 void calcTable() const;
157 inline int colErr() const { return m_colErr; };
159 inline int colX() const { return m_colX; };
161 inline int colY() const { return m_colY; };
163 inline int colZ() const { return m_colZ; };
165 inline int count() const { return m_count; };
170 inline double*** data() { return &m_data; };
173 { return m_decimalCharacter; };
175 inline bool errorBars() const { return m_errorBars; };
177 inline bool internal() const { return m_internal; };
179 inline int numCols() const { return m_numCols; };
181 inline int numRows() const { return m_numRows; };
183 virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
184 QWidget* widget = 0);
186 inline int rowStart() const { return m_rowStart; };
191 inline void setColErr(int colErr) { m_colErr = colErr; };
196 inline void setColX(int colX) { m_colX = colX; };
201 inline void setColY(int colY) { m_colY = colY; };
206 inline void setColZ(int colZ) { m_colZ = colZ; };
211 inline void setCount(int n) { m_count = n; };
218 { m_decimalCharacter = decimalCharacter; };
223 inline void setErrorBars(bool errorBars) { m_errorBars = errorBars; };
228 inline void setInternal(bool internal) { m_internal = internal; };
233 inline void setNumCols(int nCols) { m_numCols = nCols; };
238 inline void setNumRows(int nRows) { m_numRows = nRows; };
243 inline void setRowStart(int rowStart) { m_rowStart = rowStart; };
248 inline void setSmf(double smooth) { m_smf = smooth; };
253 inline void setUrl(const QUrl& url) { m_url = url; };
255 inline double smf() const { return m_smf; };
257 virtual int type() const { return Type; };
259 inline const QUrl& url() const { return m_url; };
261 void update();
268 void writePlo(KConfigGroup* plo, const QUrl& urlPlo, bool absolute) const;
269
270protected:
271 bool m_internal, m_errorBars;
272 mutable bool errorBarso;
273 int m_colX, m_colY, m_colZ, m_colErr, m_rowStart, m_count, m_numRows,
274 m_numCols;
275 ArrayItem::DecimalCharacter m_decimalCharacter;
276 mutable int colXo, colYo, colZo, colErro, rowStarto, counto;
277 double m_smf;
278 mutable double smfo;
279 double** m_data;
280 QUrl m_url;
281};
282
283#endif
3D arrayitem class.
Definition: array3ditem.h:30
int rowStart() const
Returns start row index.
Definition: array3ditem.h:186
int numRows() const
Returns number of rows.
Definition: array3ditem.h:181
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:159
void setUrl(const QUrl &url)
Sets URL.
Definition: array3ditem.h:253
void setRowStart(int rowStart)
Sets start row index.
Definition: array3ditem.h:243
int numCols() const
Returns number of columns.
Definition: array3ditem.h:179
void setColX(int colX)
Sets x column index.
Definition: array3ditem.h:196
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:172
const QUrl & url() const
Returns URL of data file.
Definition: array3ditem.h:259
void calcTable() const
Calculates value table.
double smf() const
Returns smoothing factor.
Definition: array3ditem.h:255
void setColY(int colY)
Sets y column index.
Definition: array3ditem.h:201
void setNumRows(int nRows)
Sets number of rows.
Definition: array3ditem.h:238
int colErr() const
Returns y error column index.
Definition: array3ditem.h:157
void setCount(int n)
Sets number of data points.
Definition: array3ditem.h:211
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Paints item.
void setErrorBars(bool errorBars)
Sets error bars mode.
Definition: array3ditem.h:223
int colZ() const
Returns z column index.
Definition: array3ditem.h:163
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="", const QString &textY="", const QString &textZ="", const QString &header="", 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.
Array3DItem(const Array3DItem &a)
Copy constructor.
bool errorBars() const
Returns true to use error bars.
Definition: array3ditem.h:175
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: array3ditem.h:257
double *** data()
Returns pointer to internal array.
Definition: array3ditem.h:170
void setNumCols(int nCols)
Sets number of columns.
Definition: array3ditem.h:233
void setDecimalCharacter(ArrayItem::DecimalCharacter decimalCharacter)
Sets decimal character.
Definition: array3ditem.h:217
void setColZ(int colZ)
Sets z column index.
Definition: array3ditem.h:206
int count() const
Returns number of data points.
Definition: array3ditem.h:165
void setInternal(bool internal)
Sets storage mode.
Definition: array3ditem.h:228
~Array3DItem()
Destructor.
int colY() const
Returns y column index.
Definition: array3ditem.h:161
bool internal() const
Returns true for internal stored array data.
Definition: array3ditem.h:177
void setSmf(double smooth)
Sets smoothing factor.
Definition: array3ditem.h:248
void setColErr(int colErr)
Sets error column index.
Definition: array3ditem.h:191
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