Board  0.9.4
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
 
Pathoperator<< (const Point &p)
 
Pathoperator<< (const std::vector< Point > &v)
 
Pathpop_back ()
 
Pointoperator[] (const std::size_t n)
 
const Pointoperator[] (const std::size_t n) const
 
Pathrotate (double angle, const Point &center)
 
PathrotateDeg (double angle, const Point &center)
 
Path rotated (double angle, const Point &center) const
 
Path rotatedDeg (double angle, const Point &center) const
 
Pathrotate (double angle)
 
PathrotateDeg (double angle)
 
Path rotated (double angle) const
 
Path rotatedDeg (double angle) const
 
Pathtranslate (double dx, double dy)
 
Path translated (double dx, double dy) const
 
Pathscale (double sx, double sy)
 
Pathscale (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
 
const std::vector< Pointpoints () const
 
std::ostream & flush (std::ostream &) 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, and examples/stroke_path.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::Text::center(), rotate(), rotated(), rotatedDeg(), rotateDeg(), 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.
Path & LibBoard::Path::operator<< ( const std::vector< Point > &  v)

Add a vector of points at the end of the path.

Parameters
vA vector of points.
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(), LibBoard::Text::rotate(), rotated(), rotatedDeg(), and rotateDeg().

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.

Referenced by rotatedDeg().

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::rotatedDeg ( 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 degrees).
centerThe rotation center.
Returns
A rotated copy of the path.

References rotated().

Path LibBoard::Path::rotatedDeg ( double  angle) const

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

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

References center(), and rotate().

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

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

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

References rotate().

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

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

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

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(), LibBoard::Text::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)
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(), LibBoard::Polyline::translate(), and LibBoard::Text::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: