![]() |
Mapper
0.9.0
API documentation
|
This class deals with anchor and control points for objects. More...
#include <point_handles.h>
Public Types | |
enum | PointHandleType { StartHandle = 0, EndHandle = 1, NormalHandle = 2, CurveHandle = 3, DashHandle = 4 } |
Types of point handle. More... | |
enum | PointHandleState { NormalHandleState = 0, ActiveHandleState = 1, SelectedHandleState = 2, DisabledHandleState = 3 } |
States of point handles. More... | |
Public Member Functions | |
PointHandles () noexcept | |
Default constructor. More... | |
PointHandles (unsigned int factor) | |
Constructs a point handles utility for the given scale factor. More... | |
unsigned int | scaleFactor () const |
The factor by which all drawing shall be scaled. More... | |
void | setScaleFactor (unsigned int factor) |
Sets the scale factor. More... | |
int | displayRadius () const |
The number of covered pixels around the center of a point handle. More... | |
const QImage | image () const |
The control point handles image. More... | |
void | draw (QPainter *painter, const QPointF &position, PointHandleType type, PointHandleState state) const |
Draws a single handle. More... | |
void | draw (QPainter *painter, const MapWidget *widget, const Object *object, MapCoordVector::size_type hover_point=std::numeric_limits< MapCoordVector::size_type >::max(), bool draw_curve_handles=true, PointHandleState base_state=NormalHandleState) const |
Draws all point handles for the given object. More... | |
void | drawCurveHandleLine (QPainter *painter, QPointF anchor_point, QPointF curve_handle, PointHandleType type, PointHandleState state) const |
Draws a point handle line. More... | |
Static Public Member Functions | |
static QRgb | stateColor (PointHandleState state) |
Returns the color in which point handles with the given state will be displayed. More... | |
This class deals with anchor and control points for objects.
|
noexcept |
Default constructor.
The resulting object is in a valid stable, but not really useful until calling setScaleFactor().
OpenOrienteering::PointHandles::PointHandles | ( | unsigned int | factor | ) |
Constructs a point handles utility for the given scale factor.
|
inline |
The number of covered pixels around the center of a point handle.
void OpenOrienteering::PointHandles::draw | ( | QPainter * | painter, |
const QPointF & | position, | ||
PointHandleType | type, | ||
PointHandleState | state | ||
) | const |
Draws a single handle.
void OpenOrienteering::PointHandles::draw | ( | QPainter * | painter, |
const MapWidget * | widget, | ||
const Object * | object, | ||
MapCoordVector::size_type | hover_point = std::numeric_limits<MapCoordVector::size_type>::max() , |
||
bool | draw_curve_handles = true , |
||
PointHandleState | base_state = NormalHandleState |
||
) | const |
Draws all point handles for the given object.
painter | QPainter object with correct transformation set. |
widget | Map widget which provides coordinate transformations. |
object | Object to draw point handles for. |
hover_point | Index of a point which should be drawn in 'active' state. Pass out-of-bounds value to disable. |
draw_curve_handles | If false, curve handles for path objects are not drawn. |
base_state | The state in which all points except hover_point should be drawn. |
void OpenOrienteering::PointHandles::drawCurveHandleLine | ( | QPainter * | painter, |
QPointF | anchor_point, | ||
QPointF | curve_handle, | ||
PointHandleType | type, | ||
PointHandleState | state | ||
) | const |
Draws a point handle line.
The curve handle line connects a curve anchor point and a controlling handle.
|
inline |
The control point handles image.
The image matches the current scale factor.
|
inline |
The factor by which all drawing shall be scaled.
The control point handles image matches this factor, too. Currently, this value is either 0, 1, 2, or 4. (0 represents a default constructed object.)
void OpenOrienteering::PointHandles::setScaleFactor | ( | unsigned int | factor | ) |
Sets the scale factor.
Currently, valid factors are 1, 2, or 4.
|
static |
Returns the color in which point handles with the given state will be displayed.