The Rubberband class. More...
#include <rubberband.h>
Public Member Functions | |
void | Drag (QPoint cursor) |
Set the current rubberband endpoint. | |
void | GetPoints (Point3f &startpoint, Point3f &endpoint) |
Get the rubberband start and end points. | |
bool | IsReady () |
Return true if the rubberband has been drawn. | |
void | Pin (QPoint cursor) |
Ask for picking. | |
void | Render (QGLWidget *glw) |
Render the rubberband and do the picking. | |
void | RenderLabel (QString text, QGLWidget *glw) |
Render a text label near the endpoint (if it exists). | |
void | Reset () |
Reset the rubberband. | |
Rubberband (Color4b) | |
The constructor. | |
virtual | ~Rubberband () |
Public Attributes | |
Color4b | color |
The color of the rubberband. | |
Private Types | |
enum | RubberPhase { RUBBER_BEGIN = 0, RUBBER_DRAGGING = 1, RUBBER_DRAGGED = 2 } |
Private Member Functions | |
Point3f | PixelConvert (const Point3f) |
Private Attributes | |
RubberPhase | currentphase |
Point3f | end |
QFont | font |
bool | have_to_pick |
QPoint | qt_cursor |
Point3f | start |
The Rubberband class.
This class is useful for interactively draw a straight line between 2 pickable points in a GL widget.
Definition at line 44 of file rubberband.h.
enum vcg::Rubberband::RubberPhase [private] |
Definition at line 130 of file rubberband.h.
Rubberband::Rubberband | ( | Color4b | c | ) |
virtual vcg::Rubberband::~Rubberband | ( | ) | [inline, virtual] |
The destructor.
Definition at line 66 of file rubberband.h.
void Rubberband::Drag | ( | QPoint | cursor | ) |
Set the current rubberband endpoint.
This function should be called after MouseMove events.
cursor | the cursor position. |
Definition at line 135 of file rubberband.cpp.
Get the rubberband start and end points.
startpoint | is set to the rubberband start point. | |
endpoint | is set to the rubberband end point. |
Definition at line 163 of file rubberband.cpp.
bool Rubberband::IsReady | ( | ) |
Return true if the rubberband has been drawn.
Definition at line 158 of file rubberband.cpp.
void Rubberband::Pin | ( | QPoint | cursor | ) |
Ask for picking.
This function should be called after MouseRelease events.
The first time is called, if the picking is successful, sets the startpoint. The second time sets, if the picking is successful, the endpoint. After the second time this has no effect.
cursor | the cursor position. |
Definition at line 141 of file rubberband.cpp.
Definition at line 229 of file rubberband.cpp.
void Rubberband::Render | ( | QGLWidget * | glw | ) |
Render the rubberband and do the picking.
Is important that this function is called in order to apply the Drag and Pin commands.
glw | the GL widget. |
Definition at line 45 of file rubberband.cpp.
void Rubberband::RenderLabel | ( | QString | text, | |
QGLWidget * | glw | |||
) |
Render a text label near the endpoint (if it exists).
text | the text to render. | |
glw | the GL widget. |
Definition at line 170 of file rubberband.cpp.
void Rubberband::Reset | ( | ) |
Reset the rubberband.
Definition at line 149 of file rubberband.cpp.
The color of the rubberband.
Definition at line 50 of file rubberband.h.
RubberPhase vcg::Rubberband::currentphase [private] |
Definition at line 135 of file rubberband.h.
Point3f vcg::Rubberband::end [private] |
Definition at line 137 of file rubberband.h.
QFont vcg::Rubberband::font [private] |
Definition at line 139 of file rubberband.h.
bool vcg::Rubberband::have_to_pick [private] |
Definition at line 138 of file rubberband.h.
QPoint vcg::Rubberband::qt_cursor [private] |
Definition at line 136 of file rubberband.h.
Point3f vcg::Rubberband::start [private] |
Definition at line 137 of file rubberband.h.