![]() |
University of Murcia, Spain ![]() |
QVImageCanvas Class ReferenceDisplayer widget for QVImage objects and other data types.
More...
|
Public Slots | |
void | rectSelectedSlot (QRect rect) |
void | polySelectedSlot (QPoint point, bool reset, TPolyMode mode) |
void | circleSelectedSlot (QPoint center, float radius) |
Public Member Functions | |
QVImageCanvas (const QString name=QString(), QWidget *parent=0) | |
Image canvas constructor. | |
bool | setColor (const QString &name, const QColor &color) |
Sets the display color for a registered input property of the canvas. | |
bool | setPrintTags (const QString &name, const bool &printTags) |
bool | setRadius (const QString &name, const int &radius) |
Sets the display radius for a registered input property of the canvas. | |
void | setSaturationRange (const float low, const float high) |
Sets the saturation range to display floating point images. | |
virtual void | custom_viewer () |
Display user defined data types method. | |
void | setLowHigh (float low, float high) |
void | unlink () |
Completely unlinks a property holder. | |
Protected Member Functions | |
bool | linkUnspecifiedInputProperty (QVPropertyContainer *sourceContainer, QString sourcePropName, LinkType linkType=AsynchronousLink) |
bool | linkUnspecifiedOutputProperty (QVPropertyContainer *destContainer, QString destPropName, LinkType linkType=AsynchronousLink) |
bool | treatUnlinkInputProperty (QString destPropName, QVPropertyContainer *sourceCont, QString sourcePropName) |
void | draw (const QList< QPoint > &pointList, QColor color=Qt::red, bool printTags=false, int radius=3) |
void | draw (const QList< QPointF > &pointList, QColor color=Qt::red, bool printTags=false, double radius=3) |
void | draw (const QVPolyline &polyline, QColor color=Qt::red, bool printTags=false) |
void | draw (const QVPolylineF &polylinef, QColor color=Qt::red, bool printTags=false) |
void | draw (const QRect &rectangle, QColor color=Qt::red, bool printTags=false) |
void | closeEvent (QCloseEvent *event) |
Displays images from an image source:
For further information about its usage, see section The image canvas widget.
Definition at line 46 of file qvimagecanvas.h.
QVImageCanvas::QVImageCanvas | ( | const QString | name = QString() , |
|
QWidget * | parent = 0 | |||
) |
Image canvas constructor.
name | Name of the image canvas | |
parent | parent QObject of the canvas |
Definition at line 28 of file qvimagecanvas.cpp.
bool QVImageCanvas::setColor | ( | const QString & | name, | |
const QColor & | color | |||
) | [inline] |
Sets the display color for a registered input property of the canvas.
Registered properties of types QList<QPoint>, QList<QPointF>, QList<QVPolyline> and QList<QVPolylineF> are displayed in the canvas with a default color assigned by the link method. The user can specify a non-default color value using method setColor.
The following code registers an image property, and a QList<QPointF> property in an image canvas from a source worker, and sets the display color of the points received from the worker, through the Detected points property to be red.
QVImageCanvas imageCanvas("Harris corners"); harrisCornersDetector.linkProperty("Input image", imageCanvas); // Property "Detected points" is of type QList<QpointF> harrisCornersDetector.linkProperty("Detected points", imageCanvas); imageCanvas.setColor("Detected points", Qt::red);
name | Name of the source property to set the color. | |
QColor | Color to display the elements contained in the property. |
Definition at line 74 of file qvimagecanvas.h.
bool QVImageCanvas::setRadius | ( | const QString & | name, | |
const int & | radius | |||
) | [inline] |
Sets the display radius for a registered input property of the canvas.
Some registered properties, for example points, are displayed in the canvas with a default radius size of 3. As the setColor, this method can be used to specify a display radius size different than the default.
name | Name of the source property to set the radius. | |
radius | Radius size of the property. |
Definition at line 87 of file qvimagecanvas.h.
void QVImageCanvas::setSaturationRange | ( | const float | low, | |
const float | high | |||
) |
Sets the saturation range to display floating point images.
The default saturation range to display a floating point image (QVImage<sFloat, 1> or QVImage<sFloat, 3>) is [0, 255]. This means that pixel intensity values outside that range will be set to 0 or 255, wether the intensity is below or above that range.
This method can be used to specify a different saturation range.
low | Lower value for the saturation range. | |
high | Higher value for the saturation range. |
Definition at line 385 of file qvimagecanvas.cpp.
Referenced by setLowHigh().
virtual void QVImageCanvas::custom_viewer | ( | ) | [inline, virtual] |
Display user defined data types method.
By reimplementing this method on QVImageCanvas subclasses, the developer can modify the way the objects are displayed in the canvas, or specify the way new user data type objects must be displayed.
These subclasses can create image canvas objects which display registered objects the new way.
Method custom_viewer is called whenever the canvas must be repainted, for example due to changes in the input properties or a canvas resizement. The reimplemented code for this method must read the user defined properties, and use QVImageCanvas or QWidget functionallity to correctly display them.
An example custom_viewer function reimplementation follows:
void MyImageCanvas::custom_viewer() { foreach(QString propertyName, getPropertyListByType< QList< QVPolylineF > >()) { QList< QVPolylineF > polylineList = getPropertyValue< QList< QVPolylineF > >(propertyName); foreach(QVPolylineF polyline, polylineList) { // Set the color of the polyline const int pointHash = qHash(polyline.first()); draw(polyline, qvColors[pointHash % 10]); // Draw red dots on the end of the polyline getQVPainter()->setPen(Qt::red); getQVPainter()->setBrush(QBrush(Qt::red, Qt::SolidPattern)); getQVPainter()->drawEllipse(polyline.first().x()-1, polyline.first().y()-1, 3, 3); getQVPainter()->drawEllipse(polyline.last().x()-1, polyline.last().y()-1, 3, 3); } } }
Image canvas objects created from the class MyImageCanvas, which supossely inherits from QVImageCanvas will display polylines contained in input polyline lists with different colors, depending on the location of their first point, and red dots of radius 3 at the ends of each polyline.
Definition at line 139 of file qvimagecanvas.h.
void QVImageCanvas::unlink | ( | ) | [virtual] |
Completely unlinks a property holder.
Deletes all the input and output links associated to the holder. Of course, all the corresponding necessary unlinks in other property holders are also performed.
Reimplemented from QVPropertyContainer.
Definition at line 291 of file qvimagecanvas.cpp.
void QVImageCanvas::circleSelectedSlot | ( | QPoint | center, | |
float | radius | |||
) | [slot] |
¿Cuantos puntos debe contener la polilínea de la circunferencia, uno por pixel o menos? -> Hacer concilio
Definition at line 399 of file qvimagecanvas.cpp.
void QVImageCanvas::draw | ( | const QVPolyline & | polyline, | |
QColor | color = Qt::red , |
|||
bool | printTags = false | |||
) | [protected] |
Definition at line 246 of file qvimagecanvas.cpp.