libs/flake

KoPathPoint Class Reference

A KoPathPoint represents a point in a path. More...

#include <KoPathPoint.h>

List of all members.

Public Types

enum  KoPointProperty {
  Normal = 0, StartSubpath = 1, StopSubpath = 2, CloseSubpath = 8,
  IsSmooth = 16, IsSymmetric = 32
}
enum  KoPointType { Node = 1, ControlPoint1 = 2, ControlPoint2 = 4, All = 7 }

Public Member Functions

 KoPathPoint (const KoPathPoint &pathPoint)
 KoPathPoint (KoPathShape *path, const QPointF &point, KoPointProperties properties=Normal)
 KoPathPoint ()
 ~KoPathPoint ()
bool activeControlPoint1 () const
bool activeControlPoint2 () const
QRectF boundingRect (bool active=true) const
QPointF controlPoint1 () const
QPointF controlPoint2 () const
bool isSmooth (KoPathPoint *prev, KoPathPoint *next) const
void map (const QMatrix &matrix, bool mapGroup=false)
KoPathPointoperator= (const KoPathPoint &rhs)
bool operator== (const KoPathPoint &rhs) const
void paint (QPainter &painter, int handleRadius, KoPointTypes types, bool active=true)
KoPathShapeparent () const
QPointF point () const
KoPointProperties properties () const
void removeControlPoint1 ()
void removeControlPoint2 ()
void reverse ()
void setControlPoint1 (const QPointF &point)
void setControlPoint2 (const QPointF &point)
void setParent (KoPathShape *parent)
void setPoint (const QPointF &point)
void setProperties (KoPointProperties properties)
void setProperty (KoPointProperty property)
void unsetProperty (KoPointProperty property)

Protected Member Functions

void addToGroup (KoPointGroup *pointGroup)
KoPointGroupgroup ()
void removeFromGroup ()

Detailed Description

A KoPathPoint represents a point in a path.

A KoPathPoint stores a point in a path. Additional to this point 2 control points are stored. controlPoint1 is used to describe the second point of a cubic bezier ending at the point. controlPoint2 is used to describe the first point of a cubic bezier curve starting at the point.

Definition at line 43 of file KoPathPoint.h.


Member Enumeration Documentation

property enum

Enumerator:
Normal 

it has no control points

StartSubpath 

it starts a new subpath by a moveTo command

StopSubpath 

it stops a subpath (last point of subpath)

CloseSubpath 

it closes a subpath (only applicable on StartSubpath and StopSubpath)

IsSmooth 

it is smooth, both control points on a line through the point

IsSymmetric 

it is symmetric, like smooth but control points have same distance to point

Definition at line 47 of file KoPathPoint.h.

the type for identifying part of a KoPathPoint

Enumerator:
Node 

the node point

ControlPoint1 

the first control point

ControlPoint2 

the second control point

All 

Definition at line 58 of file KoPathPoint.h.


Constructor & Destructor Documentation

KoPathPoint::KoPathPoint (  ) 

Default constructor.

Definition at line 60 of file KoPathPoint.cpp.

KoPathPoint::KoPathPoint ( KoPathShape path,
const QPointF point,
KoPointProperties  properties = Normal 
)

Constructor.

Parameters:
path is a pointer to the path shape this point is used in
point the position relative to the shape origin
properties describing the point

Definition at line 65 of file KoPathPoint.cpp.

KoPathPoint::KoPathPoint ( const KoPathPoint pathPoint  ) 

Copy Constructor.

Definition at line 48 of file KoPathPoint.cpp.

KoPathPoint::~KoPathPoint (  ) 

Destructor.

Definition at line 73 of file KoPathPoint.cpp.


Member Function Documentation

bool KoPathPoint::activeControlPoint1 (  )  const

Checks if there is a controlPoint1.

The control point is active if a control point was set by calling setControlPoint1. However a start point of a subpath (StartSubpath) can only have an active control 1 if the subpath is closed (CloseSubpath on first and last point).

Returns:
true if control point is active, false otherwise

Definition at line 222 of file KoPathPoint.cpp.

bool KoPathPoint::activeControlPoint2 (  )  const

Checks if there is a controlPoint2.

The control point is active if a control point was set by calling setControlPoint2. However a end point of a subpath (StopSubpath) can only have an active control point 2 if there subpath is closed (CloseSubpath on first and last point).

Returns:
true if control point is active, false otherwise

Definition at line 231 of file KoPathPoint.cpp.

void KoPathPoint::addToGroup ( KoPointGroup pointGroup  )  [protected]

Definition at line 386 of file KoPathPoint.cpp.

QRectF KoPathPoint::boundingRect ( bool  active = true  )  const

Get the bounding rect of the point.

This takes into account if there are controlpoints

Parameters:
active If true only the active points are used in calculation of the bounding rectangle. If false all points are used.
Returns:
bounding rect in document coordinates

Definition at line 305 of file KoPathPoint.cpp.

QPointF KoPathPoint::controlPoint1 (  )  const

get the control point 1

This points is used for controlling a curve ending at this point

Returns:
control point 1 of this point

Definition at line 405 of file KoPathPoint.cpp.

QPointF KoPathPoint::controlPoint2 (  )  const

get the second control point

This points is used for controlling a curve starting at this point

Returns:
control point 2 of this point

Definition at line 410 of file KoPathPoint.cpp.

KoPointGroup * KoPathPoint::group (  )  [protected]

Definition at line 420 of file KoPathPoint.cpp.

bool KoPathPoint::isSmooth ( KoPathPoint prev,
KoPathPoint next 
) const

Returns if this point is a smooth join of adjacent path segments.

The smoothess is defined by the parallelness of the tangents emanating from the knot point, i.e. the normalized vectors from the knot to the first and second control point. The previous and next path points are used to determine the smoothness in case this path point has not two control points.

Parameters:
prev the previous path point
next the next path point

Definition at line 337 of file KoPathPoint.cpp.

void KoPathPoint::map ( const QMatrix matrix,
bool  mapGroup = false 
)

apply matrix on the point

This does a matrix multiplication on all points of the point

Parameters:
matrix which will be applied to all points
mapGroup true when the matrix should be also applied to all points of the group the point belongs to

Definition at line 240 of file KoPathPoint.cpp.

KoPathPoint & KoPathPoint::operator= ( const KoPathPoint rhs  ) 

Assignment operator.

Definition at line 78 of file KoPathPoint.cpp.

bool KoPathPoint::operator== ( const KoPathPoint rhs  )  const

Compare operator.

Definition at line 95 of file KoPathPoint.cpp.

void KoPathPoint::paint ( QPainter painter,
int  handleRadius,
KoPointTypes  types,
bool  active = true 
)

Paints the path point with the actual brush and pen.

Parameters:
painter used for painting the shape point
handleRadius size of point handles in pixel
types the points which should be painted
active If true only the given active points are painted If false all given points are used.

Definition at line 253 of file KoPathPoint.cpp.

KoPathShape * KoPathPoint::parent (  )  const

Get the path shape the point belongs to.

Returns:
the path shape the point belongs to

Definition at line 415 of file KoPathPoint.cpp.

QPointF KoPathPoint::point (  )  const

return the position relative to the shape origin

Returns:
point

Definition at line 400 of file KoPathPoint.cpp.

KoPathPoint::KoPointProperties KoPathPoint::properties (  )  const

Get the properties of a point.

Returns:
properties of the point

Definition at line 395 of file KoPathPoint.cpp.

void KoPathPoint::removeControlPoint1 (  ) 

Removes the first control point.

Definition at line 135 of file KoPathPoint.cpp.

void KoPathPoint::removeControlPoint2 (  ) 

Removes the second control point.

Definition at line 144 of file KoPathPoint.cpp.

void KoPathPoint::removeFromGroup (  )  [protected]

Definition at line 379 of file KoPathPoint.cpp.

void KoPathPoint::reverse (  ) 

Reverses the path point.

The control points are swapped and the point properties are adjusted. The position dependent properties like StartSubpath and CloseSubpath are not changed.

Definition at line 324 of file KoPathPoint.cpp.

void KoPathPoint::setControlPoint1 ( const QPointF point  ) 

Set the control point 1.

Parameters:
point to set

Definition at line 119 of file KoPathPoint.cpp.

void KoPathPoint::setControlPoint2 ( const QPointF point  ) 

Set the control point 2.

Parameters:
point to set

Definition at line 127 of file KoPathPoint.cpp.

void KoPathPoint::setParent ( KoPathShape parent  ) 

Sets the parent path shape.

Parameters:
parent the new parent path shape

Definition at line 298 of file KoPathPoint.cpp.

void KoPathPoint::setPoint ( const QPointF point  ) 

alter the point

Parameters:
point to set

Definition at line 112 of file KoPathPoint.cpp.

void KoPathPoint::setProperties ( KoPointProperties  properties  ) 

Set the properties of a point.

Parameters:
properties the new properties

Definition at line 153 of file KoPathPoint.cpp.

void KoPathPoint::setProperty ( KoPointProperty  property  ) 

Sets a single property of a point.

Parameters:
property the property to set

Definition at line 170 of file KoPathPoint.cpp.

void KoPathPoint::unsetProperty ( KoPointProperty  property  ) 

Removes a property from the point.

Parameters:
property the property to remove

Definition at line 196 of file KoPathPoint.cpp.


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