itom  4.1.0
AbstractDObjFigure.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, 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 #ifndef ABSTRACTDOBJFIGURE_H
29 #define ABSTRACTDOBJFIGURE_H
30 
31 #include "AbstractFigure.h"
32 #include "../DataObject/dataobj.h"
33 #include "../common/sharedStructuresQt.h"
34 #include "../common/addInInterface.h"
35 #include "../common/interval.h"
36 #include "../common/qtMetaTypeDeclarations.h"
37 
38 #include <qpointer.h>
39 #include <qpixmap.h>
40 
41 
42 #if !defined(Q_MOC_RUN) || defined(ITOMCOMMONPLOT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
43 
44 namespace ito {
45 
46 class ITOMCOMMONPLOT_EXPORT AbstractDObjFigure : public AbstractFigure
47 {
48  Q_OBJECT
49  Q_PROPERTY(QSharedPointer<ito::DataObject> source READ getSource WRITE setSource DESIGNABLE false USER false)
50  Q_PROPERTY(QSharedPointer<ito::DataObject> displayed READ getDisplayed DESIGNABLE false USER false)
51  Q_PROPERTY(QPointer<ito::AddInDataIO> camera READ getCamera WRITE setCamera DESIGNABLE false USER false)
52 
53  Q_PROPERTY(ito::AutoInterval xAxisInterval READ getXAxisInterval WRITE setXAxisInterval DESIGNABLE true USER true)
54  Q_PROPERTY(ito::AutoInterval yAxisInterval READ getYAxisInterval WRITE setYAxisInterval DESIGNABLE true USER true)
55  Q_PROPERTY(ito::AutoInterval zAxisInterval READ getZAxisInterval WRITE setZAxisInterval DESIGNABLE true USER true)
56  Q_PROPERTY(QString colorMap READ getColorMap WRITE setColorMap DESIGNABLE true USER true)
57 
58  Q_CLASSINFO("prop://source", "Sets the input data object for this plot.")
59  Q_CLASSINFO("prop://displayed", "This returns the currently displayed data object [read only].")
60  Q_CLASSINFO("prop://camera", "Use this property to set a camera/grabber to this plot (live image).")
61  Q_CLASSINFO("prop://xAxisInterval", "Sets the visible range of the displayed x-axis (in coordinates of the data object). Set it to 'auto' if range should be automatically set [default].")
62  Q_CLASSINFO("prop://yAxisInterval", "Sets the visible range of the displayed y-axis (in coordinates of the data object). Set it to 'auto' if range should be automatically set [default].")
63  Q_CLASSINFO("prop://zAxisInterval", "Sets the visible range of the displayed z-axis (in coordinates of the data object). Set it to 'auto' if range should be automatically set [default].")
64  Q_CLASSINFO("prop://colorMap", "Color map (string) that should be used to colorize a non-color data object.")
65 
66  Q_CLASSINFO("slot://setSource", "This slot can be implemented by any plot plugin to send a dataObject to the plot. Here it is not required and therefore not implemented.")
67  Q_CLASSINFO("slot://setLinePlot", "This slot can be implemented by any plot plugin to force the plot to open a line plot. Here it is not required and therefore not implemented.")
68 
69 public:
70  AbstractDObjFigure(const QString &itomSettingsFile, AbstractFigure::WindowMode windowMode = AbstractFigure::ModeStandaloneInUi, QWidget *parent = 0);
71 
72  virtual ~AbstractDObjFigure();
73 
75  ito::RetVal update(void);
76 
77  virtual QSharedPointer<ito::DataObject> getSource(void) const;
78  virtual ito::RetVal setSource(QSharedPointer<ito::DataObject> source);
79 
80  virtual ito::RetVal setAxisData(QSharedPointer<ito::DataObject> data, Qt::Axis axis);
81  virtual QSharedPointer<ito::DataObject> getAxisData(Qt::Axis axis) const;
82 
83  virtual QSharedPointer<ito::DataObject> getDisplayed(void); // { return QSharedPointer<ito::DataObject>(m_pOutput["displayed"]->getVal<ito::DataObject*>()); }
84 
85  virtual QPointer<ito::AddInDataIO> getCamera(void) const;
86  virtual ito::RetVal setCamera( QPointer<ito::AddInDataIO> camera );
87 
88  virtual ito::AutoInterval getXAxisInterval(void) const;
89  virtual void setXAxisInterval(ito::AutoInterval);
90 
91  virtual ito::AutoInterval getYAxisInterval(void) const;
92  virtual void setYAxisInterval(ito::AutoInterval);
93 
94  virtual ito::AutoInterval getZAxisInterval(void) const;
95  virtual void setZAxisInterval(ito::AutoInterval);
96 
97  virtual QString getColorMap(void) const;
98  virtual void setColorMap(QString);
99 
101  virtual QPixmap renderToPixMap(const int xsize, const int ysize, const int resolution);
102 
103 protected:
104  QHash<QString, QSharedPointer<ito::DataObject> > m_dataPointer;
105  bool m_cameraConnected;
106 
107  RetVal removeLiveSource();
108 
109 signals:
110 
111 public slots:
112  //this source is invoked by any connected camera
113  virtual ITOM_PYNOTACCESSIBLE void setSource(QSharedPointer<ito::DataObject> source, ItomSharedSemaphore *waitCond);
114 
115  //this can be invoked by python to trigger a lineplot
116  virtual ito::RetVal setLinePlot(const double x0, const double y0, const double x1, const double y1, const int destID = -1);
117 };
118 
119 } // namespace ito
120 
121 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
122 
123 #endif //ABSTRACTDOBJFIGURE_H
Definition: AbstractFigure.h:63
Class for managing status values (like errors or warning)
Definition: retVal.h:54
Definition: apiFunctionsGraph.cpp:39
semaphore which can be used for asychronous thread communication. By using this class it is possible ...
Definition: sharedStructuresQt.h:57
Definition: AbstractDObjFigure.h:46
class for a interval type containing a min-max-range and an auto-flag.
Definition: interval.h:49