Board
0.9.5
|
A path, according to Postscript and SVG definition. More...
#include <Path.h>
Public Types | |
enum | OpenClosed { OpenPath, ClosedPath } |
typedef std::vector< Point >::size_type | size_type |
Public Member Functions | |
Path (const std::vector< Point > &points, OpenClosed openClosed) | |
Path (std::initializer_list< Point > points) | |
Path (OpenClosed openClosed) | |
void | clear () |
bool | isClosed () const |
bool | isOpen () const |
bool | empty () const |
std::size_t | size () const |
void | close () |
OpenClosed | openClosed () const |
void | open () |
void | setOpenClosed (OpenClosed openClosed) |
Point | center () const |
Path & | operator<< (const Point &p) |
Path & | operator<< (const std::vector< Point > &v) |
Path & | pop_back () |
Path & | push_back (const Point &p) |
const Point & | front () const |
const Point & | back () const |
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 & | moveCenter (double x, double y) |
Translate the center to a given position. More... | |
Path & | moveCenter (Point p) |
Translate the center to a given position. More... | |
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 |
Path | transformed (const Transform &transform) const |
bool | isClockwise () const |
Tell if the points of the path are ordered clockwise. More... | |
bool | isCounterclockwise () const |
Tell if the points of the path are ordered counterclockwise. More... | |
void | setClockwise () |
Make the path clockwise. | |
void | setCounterclockwise () |
Make the path counterclockwise. | |
Path | getClockwise () const |
Return a clockwise copy of the path. More... | |
Path | getCounterclockwise () const |
Return a counterclockwise copy of the path. More... | |
Rect | boundingBox () const |
const std::vector< Point > & | points () const |
std::ostream & | flush (std::ostream &) const |
std::vector< Point >::const_iterator | begin () const |
std::vector< Point >::const_iterator | cbegin () const |
std::vector< Point >::const_iterator | end () const |
std::vector< Point >::const_iterator | cend () const |
Protected Attributes | |
std::vector< Point > | _points |
OpenClosed | _openClosed |
A path, according to Postscript and SVG definition.
The path structure.
|
inline |
The last point of the path.
Referenced by LibBoard::bezierControls().
Rect LibBoard::Path::boundingBox | ( | ) | const |
Compute the bounding box of the path.
Referenced by LibBoard::Group::boundingBox(), LibBoard::Text::boundingBox(), and center().
Point LibBoard::Path::center | ( | ) | const |
Center of the bounding box of the path.
References boundingBox().
Referenced by LibBoard::Text::center(), moveCenter(), rotate(), rotated(), LibBoard::Group::scale(), LibBoard::Polyline::scale(), LibBoard::Board::scale(), and scale().
|
inline |
The first point of the path.
Path LibBoard::Path::getClockwise | ( | ) | const |
Return a clockwise copy of the path.
References setClockwise().
Referenced by LibBoard::Polyline::flushPostscript().
Path LibBoard::Path::getCounterclockwise | ( | ) | const |
Return a counterclockwise copy of the path.
References setCounterclockwise().
bool LibBoard::Path::isClockwise | ( | ) | const |
Tell if the points of the path are ordered clockwise.
References LibBoard::Point::x, and LibBoard::Point::y.
Referenced by isCounterclockwise(), and setCounterclockwise().
bool LibBoard::Path::isCounterclockwise | ( | ) | const |
Tell if the points of the path are ordered counterclockwise.
References isClockwise().
Referenced by setClockwise().
Path & LibBoard::Path::moveCenter | ( | double | x, |
double | y | ||
) |
Translate the center to a given position.
x | |
y |
References center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by LibBoard::Polyline::scale().
Translate the center to a given position.
p |
References center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
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().
Add a point to the path.
Path & LibBoard::Path::rotate | ( | double | angle | ) |
Rotate the path by a given angle and according to a rotation center.
angle | The rotation angle (in radians). |
center | The rotation center. |
References center().
Referenced by LibBoard::Group::rotate(), LibBoard::Polyline::rotate(), LibBoard::Text::rotate(), LibBoard::Bezier::rotate(), LibBoard::Board::rotate(), rotate(), rotated(), rotatedDeg(), and rotateDeg().
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 radians). |
center | The rotation center. |
References center().
Referenced by rotatedDeg().
Path LibBoard::Path::rotatedDeg | ( | double | angle | ) | const |
Return a rotated copy of the path, around the center of its bounding box.
angle | The rotation angle (in degrees). |
References rotate().
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::rotateDeg | ( | double | angle | ) |
Rotate the path by a given angle around the center of its bounding box.
angle | The rotation angle (in degrees). |
References rotate().
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::scale | ( | double | s | ) |
Apply a scaling factor to the path.
s | The scaling factor. |
References scale().
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::Group::scale(), LibBoard::Text::scale(), LibBoard::Polyline::scale(), LibBoard::Board::scale(), LibBoard::Bezier::scale(), scale(), and scaled().
void LibBoard::Path::scaleAll | ( | double | s | ) |
Scale all the points.
s | The scaling factor. |
Referenced by LibBoard::Text::scaleAll(), LibBoard::Polyline::scaleAll(), and LibBoard::Bezier::scaleAll().
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::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::translate | ( | double | dx, |
double | dy | ||
) |
Translate the path.
dx | The shift along the x axis. |
dy | The shift along the y axis. |
Referenced by moveCenter(), LibBoard::Group::scale(), LibBoard::Board::scale(), scale(), LibBoard::Group::translate(), LibBoard::Text::translate(), LibBoard::Polyline::translate(), LibBoard::Board::translate(), and LibBoard::Bezier::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. |