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
00047 class QVImageCanvas: public QVCanvas, public QVPropertyContainer
00048 {
00049 Q_OBJECT
00050 public:
00051 QVImageCanvas(const QString name = QString(), QWidget *parent=0);
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
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