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 | RenderLine (QGLWidget *gla, Point3f AA, Point3f BB) |
RenderLine draws a line from two points. | |
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 } |
Render a text label near the endpoint (if it exists). More... | |
Private Member Functions | |
vcg::Point2f | DevicePixelConvert (const Point3f) |
Private Attributes | |
RubberPhase | currentphase |
Point3f | end |
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] |
Render a text label near the endpoint (if it exists).
text | the text to render. |
glw | the GL widget. |
Definition at line 138 of file rubberband.h.
virtual vcg::Rubberband::~Rubberband | ( | ) | [inline, virtual] |
The destructor.
Definition at line 66 of file rubberband.h.
Point2f Rubberband::DevicePixelConvert | ( | const Point3f | p | ) | [private] |
Definition at line 218 of file rubberband.cpp.
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 183 of file rubberband.cpp.
void Rubberband::GetPoints | ( | Point3f & | startpoint, |
Point3f & | endpoint | ||
) |
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 211 of file rubberband.cpp.
bool Rubberband::IsReady | ( | ) |
Return true if the rubberband has been drawn.
Definition at line 206 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 189 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 44 of file rubberband.cpp.
void Rubberband::RenderLine | ( | QGLWidget * | gla, |
Point3f | AA, | ||
Point3f | BB | ||
) |
RenderLine draws a line from two points.
glw | the GL widget. |
AA | the start point. |
BB | the end point. |
Definition at line 142 of file rubberband.cpp.
void Rubberband::Reset | ( | ) |
Reset the rubberband.
Definition at line 197 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 143 of file rubberband.h.
Point3f vcg::Rubberband::end [private] |
Definition at line 145 of file rubberband.h.
bool vcg::Rubberband::have_to_pick [private] |
Definition at line 146 of file rubberband.h.
QPoint vcg::Rubberband::qt_cursor [private] |
Definition at line 144 of file rubberband.h.
Point3f vcg::Rubberband::start [private] |
Definition at line 145 of file rubberband.h.