00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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