Board
0.9.4
|
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 & | operator<< (const std::vector< Point > &v) |
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 ¢er) |
Path & | rotateDeg (double angle, const Point ¢er) |
Path | rotated (double angle, const Point ¢er) const |
Path | rotatedDeg (double angle, const Point ¢er) const |
Path & | rotate (double angle) |
Path & | rotateDeg (double angle) |
Path | rotated (double angle) const |
Path | rotatedDeg (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 |
const std::vector< Point > | points () const |
std::ostream & | flush (std::ostream &) const |
Protected Attributes | |
std::vector< Point > | _points |
bool | _closed |
A path, according to Postscript and SVG definition.
The path structure.
Rect LibBoard::Path::boundingBox | ( | ) | const |
Compute the bounding box of the path.
Referenced by LibBoard::Group::boundingBox(), LibBoard::Line::boundingBox(), LibBoard::Arrow::boundingBox(), LibBoard::Polyline::boundingBox(), LibBoard::Text::boundingBox(), center(), LibBoard::Board::saveEPS(), LibBoard::Board::saveSVG(), and LibBoard::Board::saveTikZ().
Point LibBoard::Path::center | ( | ) | const |
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().
Add a point at the end of the path.
p | A point. |
Add a vector of points at the end of the path.
v | A vector of points. |
|
inline |
Get the n-th point of the path.
n | Index of a point in the path. |
|
inline |
Get the n-th point of the path (const version).
n | Index of a point in the path. |
Path & LibBoard::Path::pop_back | ( | ) |
Remove the last point of the path.
Referenced by LibBoard::Group::setClippingPath(), and LibBoard::Board::setClippingPath().
Rotate the path by a given angle and according to a rotation center.
angle | The rotation angle (in radians). |
center | The rotation center. |
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 | ) |
Return a rotated copy of the path, thanks to an angle and a rotation center.
angle | The rotation angle (in radians). |
center | The rotation center. |
Referenced by rotatedDeg().
Path LibBoard::Path::rotated | ( | double | angle | ) | const |
Return a rotated copy of the path, thanks to an angle and a rotation center.
angle | The rotation angle (in degrees). |
center | The rotation center. |
References rotated().
Path LibBoard::Path::rotatedDeg | ( | double | angle | ) | const |
Rotate the path by a given angle, in degrees, and according to a rotation center.
angle | The rotation angle (in degrees). |
center | The rotation center. |
References rotate().
Path & LibBoard::Path::rotateDeg | ( | double | angle | ) |
Path & LibBoard::Path::scale | ( | double | sx, |
double | sy | ||
) |
Apply a scaling factor to the path along each axis.
sx | The scaling factor along the x axis. |
sy | The scaling factor along the y axis. |
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.
s | The scaling factor. |
References scale().
void LibBoard::Path::scaleAll | ( | double | s | ) |
Scale all the points.
s | The scaling factor. |
Referenced by LibBoard::Polyline::scaleAll(), LibBoard::Rectangle::scaleAll(), LibBoard::GouraudTriangle::scaleAll(), and LibBoard::Text::scaleAll().
Path LibBoard::Path::scaled | ( | double | sx, |
double | sy | ||
) | const |
Return a scaled copy of the path.
sx | The scaling factor along the x axis. |
sy | The scaling factor along the y axis. |
References scale().
Path LibBoard::Path::scaled | ( | double | s | ) | const |
Return a scaled copy of the path.
s | The scaling factor along both axis's. |
References scale().
Path & LibBoard::Path::translate | ( | double | dx, |
double | dy | ||
) |
Translate the path.
dx | The shift along the x axis. |
dy | The shift along the y axis. |
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.
dx | The shift along the x axis. |
dy | The shift along the y axis. |