PARP Research Group University of Murcia, Spain


src/qvgui/qvimagecanvas.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008, 2009. 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 
00046 class QVImageCanvas: public QVCanvas, public QVPropertyContainer
00047         {
00048                 Q_OBJECT
00049         public:
00054                 QVImageCanvas(const QString name = QString(), QWidget *parent=0);
00055 
00074                 bool setColor(const QString &name, const QColor &color)
00075                         { return setPropertyValue<QColor>("Color for " + name, color); }
00076 
00077                 bool setPrintTags(const QString &name, const bool &printTags)
00078                         { return setPropertyValue<bool>("Print tags for " + name, printTags); }
00079 
00087                 bool setRadius(const QString &name, const int &radius)
00088                         { return setPropertyValue<int>("Radius for " + name, radius); }
00089 
00099                 void setSaturationRange(const float low, const float high);
00100 
00139                 virtual void custom_viewer() { };
00140 
00141                 void setLowHigh(float low,float high)
00142                         {
00143                         std::cout << "DEPRECATED, use setSaturationRange instead" << std::endl;
00144                         setSaturationRange(low, high);
00145                         }
00146 
00147                 void unlink();
00148 
00149                 #ifndef DOXYGEN_IGNORE_THIS
00150                 void viewer();
00151                 #endif
00152 
00153         public slots:
00154                 void rectSelectedSlot(QRect rect);
00155                 void polySelectedSlot(QPoint point, bool reset, TPolyMode mode);
00156                 void circleSelectedSlot(QPoint center, float radius);
00157 
00158         protected:
00159                 bool linkUnspecifiedInputProperty(QVPropertyContainer *sourceContainer, QString sourcePropName, LinkType linkType = AsynchronousLink);
00160                 bool linkUnspecifiedOutputProperty(QVPropertyContainer *destContainer, QString destPropName, LinkType linkType = AsynchronousLink);
00161                 bool treatUnlinkInputProperty(QString destPropName, QVPropertyContainer *sourceCont, QString sourcePropName);
00162 
00163                 void draw(const QList<QPoint> &pointList, QColor color = Qt::red, bool printTags = false, int radius = 3);
00164                 void draw(const QList<QPointF> &pointList, QColor color = Qt::red, bool printTags = false, double radius = 3);
00165                 void draw(const QVPolyline &polyline, QColor color = Qt::red, bool printTags = false);
00166                 void draw(const QVPolylineF &polylinef, QColor color = Qt::red, bool printTags = false);
00167                 void draw(const QRect &rectangle, QColor color = Qt::red, bool printTags = false);
00168 
00169                 void closeEvent(QCloseEvent *event) { Q_UNUSED(event); emit closed(); }
00170         private:
00171 
00172                 const QColor    getNextColor()
00173                         {
00174                         QColor color = qvColors[colorCursor++];
00175                         colorCursor %= 10;
00176 
00177                         return color;
00178                         }
00179 
00180                 float _low,_high;
00181                 int colorCursor, contentLinkedWorkers;
00182 
00183         signals:
00184                 void closed();
00185 
00186         };
00187 
00188 Q_DECLARE_METATYPE(TPolyMode);
00189 
00190 #endif



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