itom 2.2.0
K:/git-itom/sources/itom/plot/AbstractDObjFigure.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom and its software development toolkit (SDK).
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013    
00014     In addition, as a special exception, the Institut fuer Technische
00015     Optik (ITO) gives you certain additional rights.
00016     These rights are described in the ITO LGPL Exception version 1.0,
00017     which can be found in the file LGPL_EXCEPTION.txt in this package.
00018 
00019     itom is distributed in the hope that it will be useful, but
00020     WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00022     General Public Licence for more details.
00023 
00024     You should have received a copy of the GNU Library General Public License
00025     along with itom. If not, see <http://www.gnu.org/licenses/>.
00026 *********************************************************************** */
00027 
00028 #ifndef ABSTRACTDOBJFIGURE_H
00029 #define ABSTRACTDOBJFIGURE_H
00030 
00031 #include "AbstractFigure.h"
00032 #include "../DataObject/dataobj.h"
00033 #include "../common/sharedStructuresQt.h"
00034 #include "../common/addInInterface.h"
00035 #include "../common/interval.h"
00036 #include "../common/qtMetaTypeDeclarations.h"
00037 
00038 #include <qpointer.h>
00039 #include <qpixmap.h>
00040 
00041 
00042 #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
00043 
00044 namespace ito {
00045 
00046 class ITOMCOMMONPLOT_EXPORT AbstractDObjFigure : public AbstractFigure
00047 {
00048     Q_OBJECT
00049     Q_PROPERTY(QSharedPointer<ito::DataObject> source READ getSource WRITE setSource DESIGNABLE false USER false)
00050     Q_PROPERTY(QSharedPointer<ito::DataObject> displayed READ getDisplayed DESIGNABLE false USER false)
00051     Q_PROPERTY(QPointer<ito::AddInDataIO> camera READ getCamera WRITE setCamera DESIGNABLE false USER false)
00052 
00053     Q_PROPERTY(ito::AutoInterval xAxisInterval READ getXAxisInterval WRITE setXAxisInterval DESIGNABLE true USER true)
00054     Q_PROPERTY(ito::AutoInterval yAxisInterval READ getYAxisInterval WRITE setYAxisInterval DESIGNABLE true USER true)
00055     Q_PROPERTY(ito::AutoInterval zAxisInterval READ getZAxisInterval WRITE setZAxisInterval DESIGNABLE true USER true)
00056     Q_PROPERTY(QString colorMap READ getColorMap WRITE setColorMap DESIGNABLE true USER true)
00057 
00058     Q_CLASSINFO("prop://source", "Sets the input data object for this plot.")
00059     Q_CLASSINFO("prop://displayed", "This returns the currently displayed data object [read only].")
00060     Q_CLASSINFO("prop://camera", "Use this property to set a camera/grabber to this plot (live image).")
00061     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].")
00062     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].")
00063     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].")
00064     Q_CLASSINFO("prop://colorMap", "Color map (string) that should be used to colorize a non-color data object.")
00065     
00066     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.")
00067     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.")
00068 
00069 public:
00070     AbstractDObjFigure(const QString &itomSettingsFile, AbstractFigure::WindowMode windowMode = AbstractFigure::ModeStandaloneInUi, QWidget *parent = 0);
00071 
00072     virtual ~AbstractDObjFigure();
00073 
00074     ito::RetVal update(void);
00075 
00076     virtual QSharedPointer<ito::DataObject> getSource(void) const;
00077     virtual void setSource(QSharedPointer<ito::DataObject> source);
00078 
00079     virtual QSharedPointer<ito::DataObject> getDisplayed(void); // { return QSharedPointer<ito::DataObject>(m_pOutput["displayed"]->getVal<ito::DataObject*>()); }
00080 
00081     virtual QPointer<ito::AddInDataIO> getCamera(void) const;
00082     virtual void setCamera( QPointer<ito::AddInDataIO> camera );
00083 
00084     virtual ito::AutoInterval getXAxisInterval(void) const;
00085     virtual void setXAxisInterval(ito::AutoInterval);
00086         
00087     virtual ito::AutoInterval getYAxisInterval(void) const;
00088     virtual void setYAxisInterval(ito::AutoInterval);
00089         
00090     virtual ito::AutoInterval getZAxisInterval(void) const;
00091     virtual void setZAxisInterval(ito::AutoInterval);
00092         
00093     virtual QString getColorMap(void) const;
00094     virtual void setColorMap(QString);
00095 
00097     virtual QPixmap renderToPixMap(const int xsize, const int ysize, const int resolution);
00098 
00099 protected:
00100     QHash<QString, QSharedPointer<ito::DataObject> > m_dataPointer;
00101     bool m_cameraConnected;
00102 
00103     RetVal removeLiveSource();
00104 
00105 signals:
00106 
00107 public slots:
00108     //this source is invoked by any connected camera
00109     virtual ITOM_PYNOTACCESSIBLE void setSource(QSharedPointer<ito::DataObject> source, ItomSharedSemaphore *waitCond);
00110 
00111     //this can be invoked by python to trigger a lineplot
00112     virtual ito::RetVal setLinePlot(const double x0, const double y0, const double x1, const double y1, const int destID = -1);
00113 };
00114 
00115 } // namespace ito
00116 
00117 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
00118 
00119 #endif //ABSTRACTDOBJFIGURE_H
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends