15#include "Board/Path.h"
16#include "Board/Transforms.h"
45 std::vector<Point>::iterator i =
_points.begin();
46 std::vector<Point>::iterator end =
_points.end();
48 i->rotate( angle, rotCenter );
58 std::vector<Point>::iterator i = res._points.begin();
59 std::vector<Point>::iterator end = res._points.end();
61 i->rotate( angle, rotCenter );
77 return static_cast<Path&
>( res.rotate( angle,
center() ) );
83 std::vector<Point>::iterator i =
_points.begin();
84 std::vector<Point>::iterator end =
_points.end();
85 Point delta( dx, dy );
97 std::vector<Point>::iterator i = res._points.begin();
98 std::vector<Point>::iterator end = res._points.end();
99 Point delta( dx, dy );
112 std::vector<Point>::iterator i =
_points.begin();
113 std::vector<Point>::iterator end =
_points.end();
133 return Path(*this).scale( sx, sy );
139 return Path(*this).scale( s, s );
145 std::vector<Point>::iterator it =
_points.begin();
146 std::vector<Point>::iterator end =
_points.end();
147 while ( it != end ) {
159 std::vector<Point>::const_iterator i =
_points.begin();
160 std::vector<Point>::const_iterator end =
_points.end();
162 stream << transform.mapX( i->x ) <<
" " << transform.mapY( i->y ) <<
" m";
165 stream <<
" " << transform.mapX( i->x ) <<
" " << transform.mapY( i->y ) <<
" l";
168 if (
_closed ) stream <<
" cp";
179 std::vector<Point>::const_iterator i =
_points.begin();
180 std::vector<Point>::const_iterator end =
_points.end();
182 stream <<
" " <<
static_cast<int>( transform.mapX( i->x ) )
183 <<
" " <<
static_cast<int>( transform.mapY( i->y ) );
187 stream <<
" " <<
static_cast<int>( transform.mapX(
_points.begin()->x ) )
188 <<
" " <<
static_cast<int>( transform.mapY(
_points.begin()->y ) );
198 std::vector<Point>::const_iterator i =
_points.begin();
199 std::vector<Point>::const_iterator end =
_points.end();
202 stream <<
"M " << transform.mapX( i->x ) <<
" " << transform.mapY( i->y );
205 stream <<
" L " << transform.mapX( i->x ) <<
" " << transform.mapY( i->y );
207 count = ( count + 1 ) % 6;
208 if ( !count ) stream <<
"\n ";
211 stream <<
" Z" << std::endl;
220 std::vector<Point>::const_iterator i =
_points.begin();
221 std::vector<Point>::const_iterator end =
_points.end();
223 stream << transform.mapX( i->x ) <<
"," << transform.mapY( i->y );
226 stream <<
" " << transform.mapX( i->x ) <<
"," << transform.mapY( i->y );
228 count = ( count + 1 ) % 6;
229 if ( !count ) stream <<
"\n ";
240 std::vector<Point>::const_iterator i =
_points.begin();
241 std::vector<Point>::const_iterator end =
_points.end();
243 cairo_move_to (cr, transform.mapX( i->x ), transform.mapY( i->y ));
246 cairo_line_to (cr, transform.mapX( i->x ), transform.mapY( i->y ));
248 count = ( count + 1 ) % 6;
260 std::vector<Point>::const_iterator i =
_points.begin();
261 std::vector<Point>::const_iterator end =
_points.end();
262 stream <<
'(' << transform.mapX( i->x ) <<
"," << transform.mapY( i->y ) <<
')';
266 <<
'(' << transform.mapX( i->x ) <<
"," << transform.mapY( i->y ) <<
')';
275 return Rect( 0, 0, 0, 0 );
277 std::vector< Point >::const_iterator i =
_points.begin();
278 std::vector< Point >::const_iterator end =
_points.end();
285 if ( i->x < rect.
left ) {
286 double dw = rect.
left - i->x;
289 }
else if ( i->x > rect.
left + rect.
width ) {
292 if ( i->y > rect.
top ) {
293 double dh = i->y - rect.
top;
296 }
else if ( i->y < rect.
top - rect.
height ) {
A path, according to Postscript and SVG definition.
Path translated(double dx, double dy) const
void flushCairoPoints(cairo_t *cr, const TransformCairo &transform) const
std::vector< Point > _points
Path & scale(double sx, double sy)
void flushFIG(std::ostream &stream, const TransformFIG &transform) const
Path & operator<<(const Point &p)
void flushSVGPoints(std::ostream &stream, const TransformSVG &transform) const
Path scaled(double sx, double sy) const
Path rotated(double angle, const Point ¢er) const
Path & translate(double dx, double dy)
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
void flushSVGCommands(std::ostream &stream, const TransformSVG &transform) const
void flushTikZPoints(std::ostream &stream, const TransformTikZ &transform) const
Path & rotate(double angle, const Point ¢er)
Struct representing a 2D point.
Struct representing a rectangle on the plane.