PARP Research Group University of Murcia, Spain


src/qvgui/qvimagecanvas.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #ifndef QVIMAGECANVAS_H
00026 #define QVIMAGECANVAS_H
00027 
00028 #include <QPointF>
00029 #include <QVWorker>
00030 #include <QVPolyline>
00031 #include <QVPolylineF>
00032 #include <qvgui/qvcanvas.h>
00033 #include <qvgui/qvplot.h>
00034 
00047 class QVImageCanvas: public QVCanvas, public QVPropertyContainer
00048         {
00049                 Q_OBJECT
00050         public:
00051                 QVImageCanvas(const QString name = QString(), QWidget *parent=0);
00052 
00053                 /*bool linkProperty(QString sourcePropertyName, QVPropertyContainer *destinyContainer, QString destinyPropertyName, LinkType linkType = AsynchronousLink);
00054                 bool linkProperty(QString sourcePropertyName, QVPropertyContainer &destinyContainer, QString destinyPropertyName, LinkType linkType = AsynchronousLink);
00055                 bool linkProperty(QVPropertyContainer *destinyContainer, QString destinyPropertyName, LinkType linkType = AsynchronousLink);
00056                 bool linkProperty(QVPropertyContainer &destinyContainer, QString destinyPropertyName, LinkType linkType = AsynchronousLink);
00057                 bool linkProperty(QString sourcePropertyName, QVPropertyContainer *destinyContainer, LinkType linkType = AsynchronousLink);
00058                 bool linkProperty(QString sourcePropertyName, QVPropertyContainer &destinyContainer, LinkType linkType = AsynchronousLink);
00059                 void linkProperty(QVPropertyContainer *container, LinkType linkType = AsynchronousLink);
00060                 void linkProperty(QVPropertyContainer &container, LinkType linkType = AsynchronousLink);
00061                 bool unlinkProperty(QString origName, QVPropertyContainer *destCont, QString destName);
00062                 bool unlinkProperty(QString origName, QVPropertyContainer &destCont, QString destName);*/
00063                 void unlink();
00064 
00065                 void setLowHigh(float low,float high);
00066                 #ifndef DOXYGEN_IGNORE_THIS
00067                 void viewer();
00068                 #endif
00069                 virtual void custom_viewer() { };
00070 
00071                 bool setDisplayColor(const QString &name, const QColor &color)  { return setPropertyValue<QColor>("Color for " + name, color); }
00072                 bool setPrintTags(const QString &name, const bool &printTags)   { return setPropertyValue<bool>("Print tags for object" + name, printTags); }
00073                 bool setRadiusSize(const QString &name, const int &radius)      { return setPropertyValue<int>("Radius for points in " + name, radius); }
00074 
00075         public slots:
00076                 void rectSelectedSlot(QRect rect);
00077                 void polySelectedSlot(QPoint point, bool reset, TPolyMode mode);
00078                 void circleSelectedSlot(QPoint center, float radius);
00079 
00080         protected:
00081                 bool linkUnspecifiedInputProperty(QVPropertyContainer *sourceContainer, QString sourcePropName, LinkType linkType = AsynchronousLink);
00082                 bool linkUnspecifiedOutputProperty(QVPropertyContainer *destContainer, QString destPropName, LinkType linkType = AsynchronousLink);
00083                 bool treatUnlinkInputProperty(QString destPropName, QVPropertyContainer *sourceCont, QString sourcePropName);
00084 
00085                 void draw(const QList<QPoint> &pointList, QColor color = Qt::red, bool printTags = false, int radius = 3);
00086                 void draw(const QList<QPointF> &pointList, QColor color = Qt::red, bool printTags = false, int radius = 3);
00087                 void draw(const QVPolyline &polyline, QColor color = Qt::red, bool printTags = false);
00088                 void draw(const QVPolylineF &polylinef, QColor color = Qt::red, bool printTags = false);
00089                 void draw(const QRect &rectangle, QColor color = Qt::red, bool printTags = false);
00090 
00091         private:
00092 
00093                 const QColor    getNextColor()
00094                         {
00095                         QColor color = qvColors[colorCursor++];
00096                         colorCursor %= 10;
00097 
00098                         return color;
00099                         }
00100 
00101                 float _low,_high;
00102                 int colorCursor, contentLinkedWorkers;
00103         };
00104 
00105 Q_DECLARE_METATYPE(TPolyMode);
00106 
00107 #endif



QVision framework. PARP research group, copyright 2007, 2008.