KoParameterShape Class Reference

KoParameterShape is the base class for all parametric shapes in flake. More...

#include <KoParameterShape.h>

Inheritance diagram for KoParameterShape:

KoPathShape KoShape List of all members.

Public Member Functions

virtual void moveHandle (int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
 Move handle to point.
virtual int handleIdAt (const QRectF &rect) const
 Get the handleId in the rect.
virtual QPointF handlePosition (int handleId)
 Get the handle position.
virtual void paintHandles (QPainter &painter, const KoViewConverter &converter, int handleRadius)
 Paint the handles.
virtual void paintHandle (QPainter &painter, const KoViewConverter &converter, int handleId, int handleRadius)
 Paint the given handles.
virtual void setSize (const QSizeF &size)
 reimplemented
bool isParametricShape () const
 Check if object is a parametric shape.
void setModified (bool modified)
 Set the modified status.
virtual QPointF normalize ()
 Normalizes the path data.

Protected Member Functions

virtual void moveHandleAction (int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier)=0
 Updates the internal state of a KoParameterShape.
virtual void updatePath (const QSizeF &size)=0
 Update the path of the parameter shape.

Protected Attributes

QList< QPointF > m_handles
 the handles that the user can grab and change

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


Member Function Documentation

int KoParameterShape::handleIdAt ( const QRectF &  rect  )  const [virtual]

Get the handleId in the rect.

Parameters:
rect in shape coordinates
Returns:
id of the found handle or -1 if one was found

QPointF KoParameterShape::handlePosition ( int  handleId  )  [virtual]

Get the handle position.

Parameters:
handleId for which ti get the position in shape coordinates

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

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 of the handle
point to move the handle to in document coordinates
modifiers used during move to point

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

QPointF KoParameterShape::normalize (  )  [virtual]

Normalizes the path data.

The path points are transformed so that the top-left corner of the bounding rect is (0,0). This should be called after adding points to the path.

Returns:
the offset by which the points are moved in shape coordinates.

Reimplemented from KoPathShape.

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

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

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

virtual void KoParameterShape::updatePath ( const QSizeF &  size  )  [protected, pure virtual]

Update the path of the parameter shape.

Parameters:
size of the shape


The documentation for this class was generated from the following files:
Generated on Sun Jul 20 22:37:15 2008 for libs/flake by  doxygen 1.4.7