libs/flake
KoParameterShape Class Reference
KoParameterShape is the base class for all parametric shapes in flake. More...
#include <KoParameterShape.h>

Public Member Functions | |
| KoParameterShape () | |
| ~KoParameterShape () | |
| virtual int | getHandleCount () |
| virtual int | handleIdAt (const QRectF &rect) const |
| virtual QPointF | handlePosition (int handleId) |
| bool | isParametricShape () const |
| virtual void | moveHandle (int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier) |
| virtual QPointF | normalize () |
| virtual void | paintHandle (QPainter &painter, const KoViewConverter &converter, int handleId, int handleRadius) |
| virtual void | paintHandles (QPainter &painter, const KoViewConverter &converter, int handleRadius) |
| void | setModified (bool modified) |
| virtual void | setSize (const QSizeF &size) |
Protected Member Functions | |
| virtual void | moveHandleAction (int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier)=0 |
| virtual void | updatePath (const QSizeF &size)=0 |
Protected Attributes | |
| QList< QPointF > | m_handles |
Detailed Description
KoParameterShape is the base class for all parametric shapes in flake.
Parametric shapes are those whose appearance can be completely defined by a few numerical parameters. Rectangle, ellipse and star are examples of parametric shapes. In flake, these shape parameters can be manipulated visually by means of control points. These control points can be moved with the mouse on the canvas which changes the shapes parameter values and hence the shapes appearance in realtime. KoParameterShape is derived from the KoPathShape class that means by changing the shape parameters, the underlying path is manipulated. A parametric shape can be converted into a path shape by simply calling the setModified method. This makes the path tool know that it can handle the shape like a path shape, so that modifying the single path points is possible.
Definition at line 46 of file KoParameterShape.h.
Constructor & Destructor Documentation
| KoParameterShape::KoParameterShape | ( | ) |
Definition at line 38 of file KoParameterShape.cpp.
| KoParameterShape::~KoParameterShape | ( | ) |
Definition at line 43 of file KoParameterShape.cpp.
Member Function Documentation
| int KoParameterShape::getHandleCount | ( | ) | [virtual] |
Return the number of handles.
- Returns:
- the number of handles
Definition at line 119 of file KoParameterShape.cpp.
| int KoParameterShape::handleIdAt | ( | const QRectF & | rect | ) | const [virtual] |
Get the id of the handle within the given rect.
- Parameters:
-
rect the rect in shape coordinates
- Returns:
- id of the found handle or -1 if none was found
Definition at line 65 of file KoParameterShape.cpp.
| QPointF KoParameterShape::handlePosition | ( | int | handleId | ) | [virtual] |
Get the handle position.
- Parameters:
-
handleId the id of the handle for which to get the position in shape coordinates
Definition at line 78 of file KoParameterShape.cpp.
| bool KoParameterShape::isParametricShape | ( | ) | const |
Check if object is a parametric shape.
It is no longer a parametric shape when the path was manipulated
- Returns:
- true if it is a parametic shape, false otherwise
Definition at line 148 of file KoParameterShape.cpp.
| void KoParameterShape::moveHandle | ( | int | handleId, | |
| const QPointF & | point, | |||
| Qt::KeyboardModifiers | modifiers = Qt::NoModifier | |||
| ) | [virtual] |
Move handle to point.
This method calls moveHandleAction. Overload moveHandleAction to get the behaviour you want. After that updatePath and a repaint is called.
- Parameters:
-
handleId the id of the handle to move point the point to move the handle to in document coordinates modifiers the keyboard modifiers used during moving the handle
Definition at line 47 of file KoParameterShape.cpp.
| virtual void KoParameterShape::moveHandleAction | ( | int | handleId, | |
| const QPointF & | point, | |||
| Qt::KeyboardModifiers | modifiers = Qt::NoModifier | |||
| ) | [protected, pure virtual] |
Updates the internal state of a KoParameterShape.
This method is called from moveHandle.
- Parameters:
-
handleId of the handle point to move the handle to in shape coordinates modifiers used during move to point
Implemented in KoConnectionShape.
| QPointF KoParameterShape::normalize | ( | ) | [virtual] |
Normalizes the path data.
The path points are transformed so that the top-left corner of the bounding rect is at (0,0). This should be called after adding points to the path or changing positions of path points.
- Returns:
- the offset by which the points are moved in shape coordinates.
Reimplemented from KoPathShape.
Definition at line 135 of file KoParameterShape.cpp.
| void KoParameterShape::paintHandle | ( | QPainter & | painter, | |
| const KoViewConverter & | converter, | |||
| int | handleId, | |||
| int | handleRadius | |||
| ) | [virtual] |
Paint the given handles.
- Parameters:
-
painter the painter to paint the handles on converter the view converter for applying the actual zoom handleId of the handle which should be repainted handleRadius the radius of the handle used for painting
Definition at line 104 of file KoParameterShape.cpp.
| void KoParameterShape::paintHandles | ( | QPainter & | painter, | |
| const KoViewConverter & | converter, | |||
| int | handleRadius | |||
| ) | [virtual] |
Paint the handles.
- Parameters:
-
painter the painter to paint the handles on converter the view converter for applying the actual zoom handleRadius the radius of the handles used for painting
Definition at line 83 of file KoParameterShape.cpp.
| void KoParameterShape::setModified | ( | bool | modified | ) |
Set the modified status.
After the state is set to modified it is no longer possible to work with parameters on this shape.
- Parameters:
-
modified the modification state
Definition at line 154 of file KoParameterShape.cpp.
| void KoParameterShape::setSize | ( | const QSizeF & | size | ) | [virtual] |
reimplemented from KoShape
Reimplemented from KoPathShape.
Definition at line 124 of file KoParameterShape.cpp.
| virtual void KoParameterShape::updatePath | ( | const QSizeF & | size | ) | [protected, pure virtual] |
Update the path of the parameter shape.
- Parameters:
-
size of the shape
Implemented in KoConnectionShape.
Member Data Documentation
QList<QPointF> KoParameterShape::m_handles [protected] |
the handles that the user can grab and change
Definition at line 149 of file KoParameterShape.h.
The documentation for this class was generated from the following files:
