Board  0.9.2
Public Member Functions | Protected Attributes | List of all members
LibBoard::Path Struct Reference

A path, according to Postscript and SVG definition. More...

#include <Path.h>

Public Member Functions

 Path (const std::vector< Point > &points, bool closed)
 
 Path (bool closed)
 
void clear ()
 
bool closed () const
 
bool empty () const
 
std::size_t size () const
 
void setClosed (bool closed)
 
Point center () const
 
Path & operator<< (const Point &p)
 
Path & pop_back ()
 
Point & operator[] (const std::size_t n)
 
const Point & operator[] (const std::size_t n) const
 
Path & rotate (double angle, const Point &center)
 
Path rotated (double angle, const Point &center) const
 
Path & rotate (double angle)
 
Path rotated (double angle) const
 
Path & translate (double dx, double dy)
 
Path translated (double dx, double dy) const
 
Path & scale (double sx, double sy)
 
Path & scale (double s)
 
Path scaled (double sx, double sy) const
 
Path scaled (double s) const
 
void scaleAll (double s)
 
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
 
void flushFIG (std::ostream &stream, const TransformFIG &transform) const
 
void flushSVGPoints (std::ostream &stream, const TransformSVG &transform) const
 
void flushSVGCommands (std::ostream &stream, const TransformSVG &transform) const
 
void flushTikZPoints (std::ostream &stream, const TransformTikZ &transform) const
 
Rect boundingBox () const
 

Protected Attributes

std::vector< Point > _points
 
bool _closed
 

Detailed Description

A path, according to Postscript and SVG definition.

The path structure.

Examples:
examples/clipping.cpp.

Member Function Documentation

Rect LibBoard::Path::boundingBox ( ) const
Point LibBoard::Path::center ( ) const

Center of the bounding box of the path.

Returns
The center of the bounding box of the path.

References boundingBox().

Referenced by LibBoard::Polyline::center(), LibBoard::GouraudTriangle::center(), rotate(), rotated(), LibBoard::Board::scale(), scale(), and LibBoard::Group::scale().

Path & LibBoard::Path::operator<< ( const Point &  p)

Add a point at the end of the path.

Parameters
pA point.
Returns
The path itself.
Point & LibBoard::Path::operator[] ( const std::size_t  n)
inline

Get the n-th point of the path.

Parameters
nIndex of a point in the path.
Returns
A reference to the n-th point.
const Point & LibBoard::Path::operator[] ( const std::size_t  n) const
inline

Get the n-th point of the path (const version).

Parameters
nIndex of a point in the path.
Returns
A (const) reference to the n-th point.
Path & LibBoard::Path::pop_back ( )

Remove the last point of the path.

Returns
The path itself.

Referenced by LibBoard::Group::setClippingPath(), and LibBoard::Board::setClippingPath().

Path & LibBoard::Path::rotate ( double  angle,
const Point &  center 
)

Rotate the path by a given angle and according to a rotation center.

Parameters
angleThe rotation angle (in radians).
centerThe rotation center.
Returns
The path itself.

Referenced by LibBoard::Board::rotate(), rotate(), LibBoard::Group::rotate(), LibBoard::Polyline::rotate(), LibBoard::GouraudTriangle::rotate(), and rotated().

Path & LibBoard::Path::rotate ( double  angle)

Rotate the path by a given angle around the center of its bounding box.

Parameters
angleThe rotation angle (in radians).
Returns
The path itself.

References center(), and rotate().

Path LibBoard::Path::rotated ( double  angle,
const Point &  center 
) const

Return a rotated copy of the path, thanks to an angle and a rotation center.

Parameters
angleThe rotation angle (in radians).
centerThe rotation center.
Returns
A rotated copy of the path.
Path LibBoard::Path::rotated ( double  angle) const

Return a rotated copy of the path, around the center of its bounding box.

Parameters
angleThe rotation angle (in radians).
Returns
A rotated copy of the point.

References center(), and rotate().

Path & LibBoard::Path::scale ( double  sx,
double  sy 
)

Apply a scaling factor to the path along each axis.

Parameters
sxThe scaling factor along the x axis.
syThe scaling factor along the y axis.
Returns
The path itself, once scaled.

References center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by LibBoard::Board::scale(), scale(), LibBoard::Group::scale(), LibBoard::Polyline::scale(), and scaled().

Path & LibBoard::Path::scale ( double  s)

Apply a scaling factor to the path.

Parameters
sThe scaling factor.
Returns
The path itself, once scaled.

References scale().

void LibBoard::Path::scaleAll ( double  s)

Scale all the points.

Parameters
sThe scaling factor.

Referenced by LibBoard::Polyline::scaleAll(), LibBoard::Rectangle::scaleAll(), and LibBoard::GouraudTriangle::scaleAll().

Path LibBoard::Path::scaled ( double  sx,
double  sy 
) const

Return a scaled copy of the path.

Parameters
sxThe scaling factor along the x axis.
syThe scaling factor along the y axis.
Returns
The scaled copy of the path.

References scale().

Path LibBoard::Path::scaled ( double  s) const

Return a scaled copy of the path.

Parameters
sThe scaling factor along both axis's.
Returns
The scaled copy of the path.

References scale().

Path & LibBoard::Path::translate ( double  dx,
double  dy 
)

Translate the path.

Parameters
dxThe shift along the x axis.
dyThe shift along the y axis.
Returns
The path itself.

Referenced by LibBoard::Board::scale(), scale(), LibBoard::Group::scale(), LibBoard::Board::translate(), LibBoard::Group::translate(), and LibBoard::Polyline::translate().

Path LibBoard::Path::translated ( double  dx,
double  dy 
) const

Return a translated copy of the path.

Parameters
dxThe shift along the x axis.
dyThe shift along the y axis.
Returns
A translated copy of the path.

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