itom  3.0.0
itomParamManager.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2017, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut fuer Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 
29 #ifndef ITOMPARAMMANAGER_H
30 #define ITOMPARAMMANAGER_H
31 
32 #include "qtpropertybrowser.h"
33 #include "common/param.h"
34 #include "common/paramMeta.h"
35 
36 #include <qicon.h>
37 
38 namespace ito
39 {
40 
41 class AbstractParamPropertyManagerPrivate;
42 
43 /*
44 Abstract base class for all property managers that are responsible for ito::Param values.
45 */
47 {
48  Q_OBJECT
49 public:
50  AbstractParamPropertyManager(QObject *parent = 0);
52 
53  const ito::ParamBase &paramBase(const QtProperty *property) const;
54  const ito::Param &param(const QtProperty *property) const;
55 
56 public Q_SLOTS:
57  virtual void setParam(QtProperty *property, const ito::Param &param) = 0;
58 
59 protected:
60  virtual QString valueText(const QtProperty *property) const;
61  virtual QIcon valueIcon(const QtProperty *property) const;
62  virtual void initializeProperty(QtProperty *property) = 0;
63  virtual void uninitializeProperty(QtProperty *property);
64 
66 
67 private:
68  Q_DECLARE_PRIVATE(AbstractParamPropertyManager)
69  Q_DISABLE_COPY(AbstractParamPropertyManager)
70 };
71 
72 
73 /*
74 Property Manager for parameters of type ito::ParamBase::Int
75 */
76 class ITOMWIDGETS_EXPORT ParamIntPropertyManager : public AbstractParamPropertyManager
77 {
78  Q_OBJECT
79 public:
80  ParamIntPropertyManager(QObject *parent = 0);
82 
83 protected:
84  QString valueText(const QtProperty *property) const;
85  QIcon valueIcon(const QtProperty *property) const;
86  void initializeProperty(QtProperty *property);
87 
88 Q_SIGNALS:
89  void valueChanged(QtProperty *property, int val);
90  void metaChanged(QtProperty *property, ito::IntMeta meta);
91 
92 public Q_SLOTS:
93  void setParam(QtProperty *property, const ito::Param &param);
94  void setValue(QtProperty *property, int value);
95 
96 private:
97  Q_DISABLE_COPY(ParamIntPropertyManager)
98 };
99 
100 /*
101 Property Manager for parameters of type ito::ParamBase::Char
102 */
104 {
105  Q_OBJECT
106 public:
107  ParamCharPropertyManager(QObject *parent = 0);
109 
110 protected:
111  QString valueText(const QtProperty *property) const;
112  QIcon valueIcon(const QtProperty *property) const;
113  void initializeProperty(QtProperty *property);
114 
115 Q_SIGNALS:
116  void valueChanged(QtProperty *property, char val);
117  void metaChanged(QtProperty *property, ito::CharMeta meta);
118 
119 public Q_SLOTS:
120  void setParam(QtProperty *property, const ito::Param &param);
121  void setValue(QtProperty *property, char value);
122 
123 private:
124  Q_DISABLE_COPY(ParamCharPropertyManager)
125 };
126 
127 /*
128 Property Manager for parameters of type ito::ParamBase::Double
129 */
131 {
132  Q_OBJECT
133 public:
134  ParamDoublePropertyManager(QObject *parent = 0);
136 
137 protected:
138  QString valueText(const QtProperty *property) const;
139  QIcon valueIcon(const QtProperty *property) const;
140  void initializeProperty(QtProperty *property);
141 
142 Q_SIGNALS:
143  void valueChanged(QtProperty *property, double val);
144  void metaChanged(QtProperty *property, ito::DoubleMeta meta);
145 
146 public Q_SLOTS:
147  void setParam(QtProperty *property, const ito::Param &param);
148  void setValue(QtProperty *property, double value);
149 
150 private:
151  Q_DISABLE_COPY(ParamDoublePropertyManager)
152 };
153 
154 
155 /*
156 Property Manager for parameters of type ito::ParamBase::String
157 */
159 {
160  Q_OBJECT
161 public:
162  ParamStringPropertyManager(QObject *parent = 0);
164 
165 protected:
166  QString valueText(const QtProperty *property) const;
167  void initializeProperty(QtProperty *property);
168 
169 Q_SIGNALS:
170  void valueChanged(QtProperty *property, const QByteArray &value);
171  void metaChanged(QtProperty *property, ito::StringMeta meta);
172 
173 public Q_SLOTS:
174  void setParam(QtProperty *property, const ito::Param &param);
175  void setValue(QtProperty *property, const QByteArray &value);
176 
177 private:
178  Q_DISABLE_COPY(ParamStringPropertyManager)
179 };
180 
181 /*
182 Property Manager for parameters of type ito::ParamBase::Interval and ito::ParamBase::Range
183 */
185 {
186  Q_OBJECT
187 public:
188  ParamIntervalPropertyManager(QObject *parent = 0);
190 
191 protected:
192  QString valueText(const QtProperty *property) const;
193  void initializeProperty(QtProperty *property);
194 
195 Q_SIGNALS:
196  void valueChanged(QtProperty *property, int min, int max);
197  void metaChanged(QtProperty *property, ito::IntervalMeta meta);
198 
199 public Q_SLOTS:
200  void setParam(QtProperty *property, const ito::Param &param);
201  void setValue(QtProperty *property, int min, int max);
202 
203 private:
204  Q_DISABLE_COPY(ParamIntervalPropertyManager)
205 };
206 
207 
209 
210 /*
211 Property Manager for parameters of type ito::ParamBase::Rect
212 */
214 {
215  Q_OBJECT
216 public:
217  ParamRectPropertyManager(QObject *parent = 0);
219 
220 Q_SIGNALS:
221  void valueChanged(QtProperty *property, int left, int top, int width, int height);
222  void metaChanged(QtProperty *property, ito::RectMeta meta);
223 
224 public Q_SLOTS:
225  void setParam(QtProperty *property, const ito::Param &param);
226  void setValue(QtProperty *property, int left, int top, int width, int height);
227 
228  ParamIntervalPropertyManager *subIntervalPropertyManager() const;
229 
230 protected:
231  QString valueText(const QtProperty *property) const;
232  void initializeProperty(QtProperty *property);
233  virtual void uninitializeProperty(QtProperty *property);
235 
236 private:
237  Q_DECLARE_PRIVATE(ParamRectPropertyManager)
238  Q_DISABLE_COPY(ParamRectPropertyManager)
239 
240  Q_PRIVATE_SLOT(d_func(), void slotIntervalChanged(QtProperty *, int, int))
241  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
242 };
243 
244 
246 
247 /*
248 Property Manager for parameters of type ito::ParamBase::CharArray
249 */
251 {
252  Q_OBJECT
253 public:
254  ParamCharArrayPropertyManager(QObject *parent = 0);
256 
257  typedef char DataType;
258 
259 Q_SIGNALS:
260  void valueChanged(QtProperty *property, int num, const char* values);
261  void metaChanged(QtProperty *property, ito::CharArrayMeta meta);
262 
263 public Q_SLOTS:
264  void setParam(QtProperty *property, const ito::Param &param);
265  void setValue(QtProperty *property, int num, const char* values);
266 
267  ParamCharPropertyManager *subIntervalPropertyManager() const;
268 
269 protected:
270  QString valueText(const QtProperty *property) const;
271  void initializeProperty(QtProperty *property);
272  virtual void uninitializeProperty(QtProperty *property);
274 
275 private:
276  Q_DECLARE_PRIVATE(ParamCharArrayPropertyManager)
277  Q_DISABLE_COPY(ParamCharArrayPropertyManager)
278 
279  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, char))
280  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
281 };
282 
284 
285 /*
286 Property Manager for parameters of type ito::ParamBase::IntArray
287 */
289 {
290  Q_OBJECT
291 public:
292  ParamIntArrayPropertyManager(QObject *parent = 0);
294 
295  typedef int DataType;
296 
297 Q_SIGNALS:
298  void valueChanged(QtProperty *property, int num, const int* values);
299  void metaChanged(QtProperty *property, ito::IntArrayMeta meta);
300 
301 public Q_SLOTS:
302  void setParam(QtProperty *property, const ito::Param &param);
303  void setValue(QtProperty *property, int num, const int* values);
304 
305  ParamIntPropertyManager *subIntervalPropertyManager() const;
306 
307 protected:
308  QString valueText(const QtProperty *property) const;
309  void initializeProperty(QtProperty *property);
310  virtual void uninitializeProperty(QtProperty *property);
312 
313 private:
314  Q_DECLARE_PRIVATE(ParamIntArrayPropertyManager)
315  Q_DISABLE_COPY(ParamIntArrayPropertyManager)
316 
317  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int))
318  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
319 };
320 
322 
323 /*
324 Property Manager for parameters of type ito::ParamBase::DoubleArray
325 */
327 {
328  Q_OBJECT
329 public:
330  ParamDoubleArrayPropertyManager(QObject *parent = 0);
332 
333  typedef double DataType;
334 
335 Q_SIGNALS:
336  void valueChanged(QtProperty *property, int num, const double* values);
337  void metaChanged(QtProperty *property, ito::DoubleArrayMeta meta);
338 
339 public Q_SLOTS:
340  void setParam(QtProperty *property, const ito::Param &param);
341  void setValue(QtProperty *property, int num, const double* values);
342 
343  ParamDoublePropertyManager *subIntervalPropertyManager() const;
344 
345 protected:
346  QString valueText(const QtProperty *property) const;
347  void initializeProperty(QtProperty *property);
348  virtual void uninitializeProperty(QtProperty *property);
350 
351 private:
352  Q_DECLARE_PRIVATE(ParamDoubleArrayPropertyManager)
353  Q_DISABLE_COPY(ParamDoubleArrayPropertyManager)
354 
355  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, double))
356  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
357 };
358 
359 /*
360 Property Manager for parameters of type ito::ParamBase::HWRef, ito::ParamBase::DObjPtr,
361 ito::ParamBase::PolygonMeshPtr, ito::ParamBase::PointCloudPtr, ito::ParamBase::PointPtr
362 */
364 {
365  Q_OBJECT
366 public:
367  ParamOtherPropertyManager(QObject *parent = 0);
369 
370 protected:
371  QString valueText(const QtProperty *property) const;
372  void initializeProperty(QtProperty *property);
373 
374 public Q_SLOTS:
375  void setParam(QtProperty *property, const ito::Param &param);
376 
377 private:
378  Q_DISABLE_COPY(ParamOtherPropertyManager)
379 };
380 
381 
382 
383 } //end namespace ito
384 
385 #endif
PyObject * setParam(ito::AddInBase *addInObj, PyObject *args)
Definition: pythonPlugins.cpp:1048
Definition: itomParamManager.cpp:51
Definition: itomParamManager.cpp:1114
Definition: paramMeta.h:494
Definition: itomParamManager.cpp:1545
Definition: itomParamManager.h:288
Meta-information for Param of type Int.
Definition: paramMeta.h:183
class for parameter handling e.g. to pass paramters to plugins
Definition: param.h:251
Meta-information for Param of type CharArrayMeta.
Definition: paramMeta.h:448
Definition: apiFunctionsGraph.cpp:39
Definition: itomParamManager.h:103
Definition: itomParamManager.h:213
Definition: itomParamManager.h:130
Definition: itomParamManager.cpp:879
Definition: itomParamManager.h:184
Definition: itomParamManager.cpp:1331
Meta-information for ito::Param of type Double.
Definition: paramMeta.h:233
meta-information for Param of type Char.
Definition: paramMeta.h:132
Definition: itomParamManager.h:326
Definition: itomParamManager.h:363
Meta-information for Param of type IntArrayMeta that represent an interval [minimum, maximum).
Definition: paramMeta.h:638
Definition: itomParamManager.h:158
The QtAbstractPropertyManager provides an interface for property managers.
Definition: qtpropertybrowser.h:101
Meta-information for Param of type DoubleArrayMeta.
Definition: paramMeta.h:540
Definition: param.h:67
Meta-information for Param of type String.
Definition: paramMeta.h:354
Definition: itomParamManager.h:250
Meta-information for Param of type IntArrayMeta that represent a rectangle (left, top...
Definition: paramMeta.h:712
Definition: itomParamManager.h:76
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:60
Definition: itomParamManager.h:46