libcrn
3.9.5
A document image processing library
|
A list of points. More...
#include <CRNStroke.h>
Public Types | |
using | datatype = std::vector< Point2DInt > |
using | iterator = datatype::iterator |
using | const_iterator = datatype::const_iterator |
Public Member Functions | |
Stroke () | |
Default constructor. More... | |
virtual | ~Stroke () override |
Destructor. More... | |
Stroke (const Stroke &other) | |
Stroke & | operator= (const Stroke &other) |
Stroke (Stroke &&)=default | |
Stroke & | operator= (Stroke &&)=default |
void | AddPoint (const Point2DInt &p) |
Adds a point to the stroke. More... | |
void | MergeAtEnd (const Stroke &str) |
Adds a batch of points directly at the end of the stroke. More... | |
void | MergeWithXInterpolation (const Stroke &str, unsigned int step=1) |
Adds a batch of points at their original position and adds points to interpolate. More... | |
size_t | GetNbPoints () const noexcept |
Returns the number of points in the stroke. More... | |
Point2DInt & | GetPoint (size_t index) |
Returns a reference to a point. More... | |
const Point2DInt & | GetPoint (size_t index) const |
Returns a reference to a point. More... | |
Point2DInt & | operator[] (size_t index) |
Returns a reference to a point (fast and unsafe). More... | |
const Point2DInt & | operator[] (size_t index) const |
Returns a reference to a point (fast and unsafe). More... | |
double | GetFirstYAtX (double x) const |
Returns the ordinate of the first point with abscissa = x. More... | |
Rect | GetBBox () const |
Returns the bounding box using integer values. More... | |
Stroke | MakeIntersection (const Rect &rect) const |
Creates a new stroke that is the intersection of the stroke with a rectangle. More... | |
Stroke | MakeFirstIntersection (const Rect &rect) const |
Creates a new stroke that is the first intersection of the stroke with a rectangle. More... | |
iterator | begin () |
Returns a new iterator on the first point of the stroke. More... | |
iterator | end () |
Returns a new iterator after the last point of the stroke. More... | |
const_iterator | begin () const |
Returns a new const_iterator on the first point of the stroke. More... | |
const_iterator | end () const |
Returns a new const_iterator after the last point of the stroke. More... | |
const_iterator | cbegin () const |
Returns a new const_iterator on the first point of the stroke. More... | |
const_iterator | cend () const |
Returns a new const_iterator after the last point of the stroke. More... | |
void | Deserialize (xml::Element &el) |
Initializes the object from an XML element. More... | |
xml::Element | Serialize (xml::Element &parent) const |
Dumps the object to an XML element. More... | |
![]() | |
virtual | ~Object ()=default |
A list of points.
A stroke that is an ordered set of Point2DInt.
Definition at line 47 of file CRNStroke.h.
using crn::Stroke::const_iterator = datatype::const_iterator |
Definition at line 97 of file CRNStroke.h.
using crn::Stroke::datatype = std::vector<Point2DInt> |
Definition at line 50 of file CRNStroke.h.
using crn::Stroke::iterator = datatype::iterator |
Definition at line 92 of file CRNStroke.h.
|
default |
Default constructor.
Default constructor
|
overridevirtualdefault |
Destructor.
Destructor
Stroke::Stroke | ( | const Stroke & | other | ) |
Definition at line 40 of file CRNStroke.cpp.
|
default |
void Stroke::AddPoint | ( | const Point2DInt & | p | ) |
Adds a point to the stroke.
Adds a point to the stroke
[in] | p | the point to add |
Definition at line 107 of file CRNStroke.cpp.
|
inline |
Returns a new iterator on the first point of the stroke.
Definition at line 94 of file CRNStroke.h.
|
inline |
Returns a new const_iterator on the first point of the stroke.
Definition at line 99 of file CRNStroke.h.
|
inline |
Returns a new const_iterator on the first point of the stroke.
Definition at line 103 of file CRNStroke.h.
|
inline |
Returns a new const_iterator after the last point of the stroke.
Definition at line 105 of file CRNStroke.h.
void Stroke::Deserialize | ( | xml::Element & | el | ) |
Initializes the object from an XML element.
Initializes the object from an XML element. Unsafe.
ExceptionInvalidArgument | not a Stroke |
ExceptionDomain | CDATA not found |
[in] | el | the XML element to read |
Definition at line 63 of file CRNStroke.cpp.
|
inline |
Returns a new iterator after the last point of the stroke.
Definition at line 96 of file CRNStroke.h.
|
inline |
Returns a new const_iterator after the last point of the stroke.
Definition at line 101 of file CRNStroke.h.
Rect Stroke::GetBBox | ( | ) | const |
Returns the bounding box using integer values.
Returns the bounding box using integer values
Definition at line 257 of file CRNStroke.cpp.
double Stroke::GetFirstYAtX | ( | double | x | ) | const |
Returns the ordinate of the first point with abscissa = x.
Returns the ordinate of the first point with abscissa = x
ExceptionDomain | cannot reach abscissa |
[in] | x | the abscissa |
Definition at line 242 of file CRNStroke.cpp.
|
inlinenoexcept |
Returns the number of points in the stroke.
Definition at line 71 of file CRNStroke.h.
Point2DInt & Stroke::GetPoint | ( | size_t | index | ) |
Returns a reference to a point.
Returns a reference to a point
ExceptionDomain | index out of range |
[in] | index | the index of the point |
Definition at line 208 of file CRNStroke.cpp.
const Point2DInt & Stroke::GetPoint | ( | size_t | index | ) | const |
Returns a reference to a point.
Returns a reference to a point
ExceptionDomain | index out of range |
[in] | index | the index of the point |
Definition at line 225 of file CRNStroke.cpp.
Creates a new stroke that is the first intersection of the stroke with a rectangle.
Creates a new stroke that is the first intersection of the stroke with a rectangle
[in] | rect | the bounding box of the resulting stroke |
Definition at line 306 of file CRNStroke.cpp.
Creates a new stroke that is the intersection of the stroke with a rectangle.
Creates a new stroke that is the intersection of the stroke with a rectangle
[in] | rect | the bounding box of the resulting stroke |
Definition at line 286 of file CRNStroke.cpp.
void Stroke::MergeAtEnd | ( | const Stroke & | str | ) |
Adds a batch of points directly at the end of the stroke.
Adds a batch of points directly at the end of the stroke. The first point of the merged stroke is propped on the last point of the current stroke.
ExceptionInvalidArgument | invalid stroke |
[in] | str | the stoke to append |
Definition at line 121 of file CRNStroke.cpp.
void Stroke::MergeWithXInterpolation | ( | const Stroke & | str, |
unsigned int | step = 1 |
||
) |
Adds a batch of points at their original position and adds points to interpolate.
Adds a batch of points at their original position and adds points to interpolate
ExceptionInvalidArgument | null or invalid stroke |
ExceptionDomain | null step |
[in] | str | the stoke to append |
[in] | step | the step of the interpolation |
Definition at line 152 of file CRNStroke.cpp.
Definition at line 47 of file CRNStroke.cpp.
|
inline |
Returns a reference to a point (fast and unsafe).
Definition at line 77 of file CRNStroke.h.
|
inline |
Returns a reference to a point (fast and unsafe).
Definition at line 79 of file CRNStroke.h.
xml::Element Stroke::Serialize | ( | xml::Element & | parent | ) | const |
Dumps the object to an XML element.
Dumps the object to an XML element. Unsafe.
[in] | parent | the element in which the new element will be stored |
Definition at line 87 of file CRNStroke.cpp.