libkpl  5.0
A Library for Graphical Presentation of Data Sets and Functions
fun3ditem.h
1 /***************************************************************************
2  fun3ditem.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 FUN3DITEM_H
19 #define FUN3DITEM_H
20 
21 #include "funitem.h"
22 #include "threeditem.h"
23 
28 class Q_DECL_EXPORT Fun3DItem : public ThreeDItem
29 {
30 public:
32  enum {
33  Type = UserType + Function3D
37  };
93  Fun3DItem(double x0 = 4, double y0 = 3, double width = 15,
94  double height = 10, unsigned colorFrame = 0,
95  unsigned colorGrid = 0, unsigned colorData = 0, bool logX = false,
96  bool logY = false, bool logZ = false,
97  GridMode gridMode = AxesWithLabels, Mode3D mode3D = Grid,
98  double xMax = 15, double yMax = 10, double zMax = 15,
99  const QString& textX = "", const QString& textY = "",
100  const QString& textZ = "", const QString& header = "",
101  double relSize = 1, int numDigX = -1, int numDigY = -1,
102  int numDigZ = -1, int minTicX = 5, int minTicY = 2,
103  int minTicZ = 5, int expX = 0, int expY = 0, int expZ = 0,
104  double xMin = 0, double yMin = 0, double zMin = 0, double xTic = 5,
105  double yTic = 2, double zTic = 5, double deltaX = 0,
106  double deltaZ = 0,
107  double phi = 20, double theta = -20, double bx = 7.5,
108  double by = 7.5, double bz = 7.5, double xr = 7.5, double yr = 4,
109  double fx = 1, double fy = 1, double fz = 1,
110  const QString& name = "", const QUrl& url = QUrl(),
111  bool showFrame = true, bool collapsed = false,
112  bool visible = true);
114  Fun3DItem(const Fun3DItem& f);
128  Fun3DItem(const KConfigGroup* plo, const QUrl& urlPlo, double x0 = 4,
129  double y0 = 3, double width = 15, double height = 10,
130  unsigned colorFrame = 0, unsigned colorGrid = 0,
131  unsigned colorData = 0, GridMode gridMode = AxesWithLabels);
133  ~Fun3DItem();
138  int calcTable() const;
146  void exportTable(QTextStream& stream, char separator, char format,
147  int precision) const;
148  double (*funcY)(double, double, const double*);
150  inline const QLibrary* libY() const { return m_libY; };
152  inline QString nameY() const { return m_nameY; };
154  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
155  QWidget* widget = 0);
157  inline double* parY() { return m_parY; };
164  bool setFuncY(const QUrl& url, const QString& name);
170  inline void setPar(int i, double value) { m_parY[i] = value; };
172  virtual int type() const { return Type; };
174  void update();
176  inline const QUrl& urlY() const { return m_urlY; };
185  void writePlo(KConfigGroup* plo, const QUrl& urlPlo, bool absolute,
186  char format, int precision) const;
187 
188 protected:
190  void unload();
191  mutable double (*funcYo)(double, double, const double*);
192  double m_parY[FunItem::NumParMax];
193  mutable double parYo[FunItem::NumParMax];
194  QString m_nameY;
195  QUrl m_urlY;
196  QLibrary* m_libY;
197 };
198 
199 #endif
void writePlo(KConfigGroup *plo) const
Writes into plot file.
GridMode
Grid mode.
Definition: frameitem.h:37
Mode3D
3D mode.
Definition: threeditem.h:34
Specific QGraphicsItem type number of FrameItem for function type().
Definition: frameitem.h:46
const QUrl & urlY() const
Returns URL of y function library.
Definition: fun3ditem.h:176
void exportTable(QTextStream &stream, char separator, char format, int precision) const
Exports value table to file.
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: fun3ditem.h:172
QString nameY() const
Returns y function name.
Definition: fun3ditem.h:152
const QLibrary * libY() const
Returns pointer to library for y function.
Definition: fun3ditem.h:150
void update()
Applies changes and forces redrawing.
double * parY()
Returns y function parameter array pointer.
Definition: fun3ditem.h:157
void setPar(int i, double value)
Sets parameter.
Definition: fun3ditem.h:170
3D function item class.
Definition: fun3ditem.h:28
3D item class.
Definition: threeditem.h:30
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Paints item.
static const int NumParMax
Dimension of parameter arrays.
Definition: funitem.h:43