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 
29 class Q_DECL_EXPORT Array3DItem : public ThreeDItem
30 {
31 public:
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);
128  Array3DItem(const Array3DItem& a);
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);
153  ~Array3DItem();
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; };
217  inline void setDecimalCharacter(ArrayItem::DecimalCharacter decimalCharacter)
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 
270 protected:
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
void setRowStart(int rowStart)
Sets start row index.
Definition: array3ditem.h:243
void writePlo(KConfigGroup *plo) const
Writes into plot file.
void setColX(int colX)
Sets x column index.
Definition: array3ditem.h:196
GridMode
Grid mode.
Definition: frameitem.h:37
int count() const
Returns number of data points.
Definition: array3ditem.h:165
void setDecimalCharacter(ArrayItem::DecimalCharacter decimalCharacter)
Sets decimal character.
Definition: array3ditem.h:217
ArrayItem::DecimalCharacter decimalCharacter() const
Returns decimal symbol of floating point numbers.
Definition: array3ditem.h:172
double smf() const
Returns smoothing factor.
Definition: array3ditem.h:255
void setErrorBars(bool errorBars)
Sets error bars mode.
Definition: array3ditem.h:223
Mode3D
3D mode.
Definition: threeditem.h:34
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: array3ditem.h:257
Specific QGraphicsItem type number of FrameItem for function type().
Definition: frameitem.h:46
void setInternal(bool internal)
Sets storage mode.
Definition: array3ditem.h:228
int rowStart() const
Returns start row index.
Definition: array3ditem.h:186
int colZ() const
Returns z column index.
Definition: array3ditem.h:163
DecimalCharacter
Decimal character.
Definition: arrayitem.h:43
int colErr() const
Returns y error column index.
Definition: array3ditem.h:157
void setNumRows(int nRows)
Sets number of rows.
Definition: array3ditem.h:238
int numRows() const
Returns number of rows.
Definition: array3ditem.h:181
bool errorBars() const
Returns true to use error bars.
Definition: array3ditem.h:175
int colY() const
Returns y column index.
Definition: array3ditem.h:161
void update()
Applies changes and forces redrawing.
void setSmf(double smooth)
Sets smoothing factor.
Definition: array3ditem.h:248
int colX() const
Returns x column index.
Definition: array3ditem.h:159
const QUrl & url() const
Returns URL of data file.
Definition: array3ditem.h:259
void setColErr(int colErr)
Sets error column index.
Definition: array3ditem.h:191
void setColZ(int colZ)
Sets z column index.
Definition: array3ditem.h:206
void setUrl(const QUrl &url)
Sets URL.
Definition: array3ditem.h:253
3D arrayitem class.
Definition: array3ditem.h:29
Decimal point.
Definition: arrayitem.h:44
void setNumCols(int nCols)
Sets number of columns.
Definition: array3ditem.h:233
void setCount(int n)
Sets number of data points.
Definition: array3ditem.h:211
3D item class.
Definition: threeditem.h:30
int numCols() const
Returns number of columns.
Definition: array3ditem.h:179
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Paints item.
double *** data()
Returns pointer to internal array.
Definition: array3ditem.h:170
void setColY(int colY)
Sets y column index.
Definition: array3ditem.h:201