itom  4.1.0
AbstractDObjPCLFigure.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 ABSTRACTDOBJPCLFIGURE_H
29 #define ABSTRACTDOBJPCLFIGURE_H
30 
31 #include "AbstractFigure.h"
32 #include "../DataObject/dataobj.h"
33 #if defined USEPCL || ITOM_POINTCLOUDLIBRARY
34 #include "../PointCloud/pclStructures.h"
35 #endif
36 #include "../common/sharedStructuresQt.h"
37 #include "../common/addInInterface.h"
38 #include "../common/interval.h"
39 #include "../common/qtMetaTypeDeclarations.h"
40 
41 #include <qpointer.h>
42 #include <qpixmap.h>
43 
44 
45 #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
46 
47 namespace ito {
48 
49  class ITOMCOMMONPLOT_EXPORT AbstractDObjPclFigure : public AbstractFigure
50 {
51  Q_OBJECT
52  Q_PROPERTY(QSharedPointer<ito::DataObject> dataObject READ getDataObject WRITE setDataObject DESIGNABLE false USER false)
53 #ifdef USEPCL //this symbol is automatically defined if the itom SDK is compiled with PCL support (set in itom_sdk.cmake)
54  Q_PROPERTY(QSharedPointer<ito::PCLPointCloud> pointCloud READ getPointCloud WRITE setPointCloud DESIGNABLE false USER false)
55  Q_PROPERTY(QSharedPointer<ito::PCLPolygonMesh> polygonMesh READ getPolygonMesh WRITE setPolygonMesh DESIGNABLE false USER false)
56 #endif
57 
58  Q_PROPERTY(ito::AutoInterval xAxisInterval READ getXAxisInterval WRITE setXAxisInterval DESIGNABLE true USER true)
59  Q_PROPERTY(ito::AutoInterval yAxisInterval READ getYAxisInterval WRITE setYAxisInterval DESIGNABLE true USER true)
60  Q_PROPERTY(ito::AutoInterval zAxisInterval READ getZAxisInterval WRITE setZAxisInterval DESIGNABLE true USER true)
61  Q_PROPERTY(QString colorMap READ getColorMap WRITE setColorMap DESIGNABLE true USER true)
62 
63  Q_CLASSINFO("prop://dataObject", "Sets the input data object for this plot.")
64  Q_CLASSINFO("prop://polygonMesh", "Sets the input polygon mesh for this plot.")
65  Q_CLASSINFO("prop://pointCloud", "Sets the input point cloud for this plot.")
66 
67  Q_CLASSINFO("prop://xAxisInterval", "Sets the visible range of the displayed x-axis (in coordinates of the data object) or (0.0, 0.0) if range should be automatically set [default].")
68  Q_CLASSINFO("prop://yAxisInterval", "Sets the visible range of the displayed y-axis (in coordinates of the data object) or (0.0, 0.0) if range should be automatically set [default].")
69  Q_CLASSINFO("prop://zAxisInterval", "Sets the visible range of the displayed z-axis (in coordinates of the data object) or (0.0, 0.0) if range should be automatically set [default].")
70  Q_CLASSINFO("prop://colorMap", "Color map (string) that should be used to colorize a non-color data object.")
71 
72  Q_CLASSINFO("slot://setLinePlot", "This (virtual) slot can be invoked by python to trigger a lineplot.")
73 
74 public:
75  AbstractDObjPclFigure(const QString &itomSettingsFile, const ito::ParamBase::Type inpType, AbstractFigure::WindowMode windowMode = AbstractFigure::ModeStandaloneInUi, QWidget *parent = 0);
76 
77  AbstractDObjPclFigure(const QString &itomSettingsFile, AbstractFigure::WindowMode windowMode = AbstractFigure::ModeStandaloneInUi, QWidget *parent = 0);
78 
79  virtual ~AbstractDObjPclFigure();
80 
82  ito::RetVal update(void);
83 
84  virtual ito::RetVal setDataObject(QSharedPointer<ito::DataObject>);
85  virtual QSharedPointer<ito::DataObject> getDataObject(void) const;
86 
87  virtual ito::AutoInterval getXAxisInterval(void) const;
88  virtual void setXAxisInterval(ito::AutoInterval);
89 
90  virtual ito::AutoInterval getYAxisInterval(void) const;
91  virtual void setYAxisInterval(ito::AutoInterval);
92 
93  virtual ito::AutoInterval getZAxisInterval(void) const;
94  virtual void setZAxisInterval(ito::AutoInterval);
95 
96  virtual QString getColorMap(void) const;
97  virtual void setColorMap(QString);
98 
100  virtual QPixmap renderToPixMap(const int xsize, const int ysize, const int resolution);
101 
102 #ifdef USEPCL
103  virtual ito::RetVal setPointCloud(QSharedPointer<ito::PCLPointCloud>);
104  virtual QSharedPointer<ito::PCLPointCloud> getPointCloud(void) const;
105 
106  virtual ito::RetVal setPolygonMesh(QSharedPointer<ito::PCLPolygonMesh>);
107  virtual QSharedPointer<ito::PCLPolygonMesh> getPolygonMesh(void) const;
108 #endif
109 
110 protected:
111  QHash<QString, QSharedPointer<ito::DataObject> > m_dataPointerDObj;
112  int m_inpType;
113 #ifdef USEPCL
114  QHash<QString, QSharedPointer<ito::PCLPointCloud> > m_dataPointerPC;
115  QHash<QString, QSharedPointer<ito::PCLPolygonMesh> > m_dataPointerPM;
116 #endif
117 
118 signals:
119 
120 public slots:
121  //this can be invoked by python to trigger a lineplot
122  virtual ito::RetVal setLinePlot(const double x0, const double y0, const double x1, const double y1, const int destID = -1);
123 };
124 
125 } // namespace ito
126 
127 
128 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
129 
130 #endif //ABSTRACTDOBJPCLFIGURE_H
Definition: AbstractFigure.h:63
Class for managing status values (like errors or warning)
Definition: retVal.h:54
Definition: apiFunctionsGraph.cpp:39
Definition: AbstractDObjPCLFigure.h:49
class for a interval type containing a min-max-range and an auto-flag.
Definition: interval.h:49
Type
Definition: param.h:83