Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Static Public Member Functions | List of all members
OpenOrienteering::PointHandles Class Reference

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...
 

Detailed Description

This class deals with anchor and control points for objects.

Member Enumeration Documentation

◆ PointHandleState

States of point handles.

The numbers correspond to the rows in point-handles.png

Enumerator
NormalHandleState 
ActiveHandleState 
SelectedHandleState 
DisabledHandleState 

◆ PointHandleType

Types of point handle.

The numbers correspond to the columns in point-handles.png

Enumerator
StartHandle 
EndHandle 
NormalHandle 
CurveHandle 
DashHandle 

Constructor & Destructor Documentation

◆ PointHandles() [1/2]

OpenOrienteering::PointHandles::PointHandles ( )
noexcept

Default constructor.

The resulting object is in a valid stable, but not really useful until calling setScaleFactor().

◆ PointHandles() [2/2]

OpenOrienteering::PointHandles::PointHandles ( unsigned int  factor)

Constructs a point handles utility for the given scale factor.

Member Function Documentation

◆ displayRadius()

int OpenOrienteering::PointHandles::displayRadius ( ) const
inline

The number of covered pixels around the center of a point handle.

◆ draw() [1/2]

void OpenOrienteering::PointHandles::draw ( QPainter painter,
const QPointF position,
PointHandleType  type,
PointHandleState  state 
) const

Draws a single handle.

◆ draw() [2/2]

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.

Parameters
painterQPainter object with correct transformation set.
widgetMap widget which provides coordinate transformations.
objectObject to draw point handles for.
hover_pointIndex of a point which should be drawn in 'active' state. Pass out-of-bounds value to disable.
draw_curve_handlesIf false, curve handles for path objects are not drawn.
base_stateThe state in which all points except hover_point should be drawn.

◆ drawCurveHandleLine()

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.

◆ image()

const QImage OpenOrienteering::PointHandles::image ( ) const
inline

The control point handles image.

The image matches the current scale factor.

◆ scaleFactor()

unsigned int OpenOrienteering::PointHandles::scaleFactor ( ) const
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.)

◆ setScaleFactor()

void OpenOrienteering::PointHandles::setScaleFactor ( unsigned int  factor)

Sets the scale factor.

Currently, valid factors are 1, 2, or 4.

◆ stateColor()

QRgb OpenOrienteering::PointHandles::stateColor ( PointHandleState  state)
static

Returns the color in which point handles with the given state will be displayed.


The documentation for this class was generated from the following files: