DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Path.h
1
/* -*- mode: c++ -*- */
9
/*
10
* \@copyright This File is part of the Board library which is
11
* licensed under the terms of the GNU Lesser General Public Licence.
12
* See the LICENCE file for further details.
13
*/
14
#ifndef _BOARD_PATH_H_
15
#define _BOARD_PATH_H_
16
17
#include "Board/Point.h"
18
#include "Board/Rect.h"
19
#include "Board/Transforms.h"
20
#include <vector>
21
#include <iostream>
22
23
#ifdef DGTAL_WITH_CAIRO
24
// cairo
25
#if defined(__clang__)
26
#pragma clang diagnostic push
27
#pragma clang diagnostic ignored "-Wdocumentation"
28
#endif
29
#include <cairo.h>
30
#if defined(__clang__)
31
#pragma clang diagnostic pop
32
#endif
33
#endif
34
35
namespace
LibBoard
{
36
37
38
43
struct
Path
{
44
45
Path
() :
_closed
( false ) { }
46
47
Path
(
const
std::vector<Point> & points,
bool
closedPath )
48
:
_points
( points ),
_closed
( closedPath ) { }
49
50
Path
(
bool
closedPath ) :
_closed
( closedPath ) { }
51
52
inline
void
clear();
53
54
inline
bool
closed
()
const
;
55
56
inline
bool
empty
()
const
;
57
58
inline
unsigned
int
size
()
const
;
59
60
inline
void
setClosed
(
bool
closed
);
61
66
Point
center
()
const
;
67
75
Path
& operator<<(
const
Point
& p );
76
83
Path
&
pop_back
();
84
92
Point
&
operator[]
(
const
unsigned
int
n ) {
93
return
_points
[ n ];
94
}
95
103
const
Point
&
operator[]
(
const
unsigned
int
n )
const
{
104
return
_points
[ n ];
105
}
106
115
Path
& rotate(
double
angle
,
const
Point
&
center
);
116
125
Path
rotated
(
double
angle
,
const
Point
&
center
)
const
;
126
134
Path
& rotate(
double
angle
);
135
143
Path
rotated
(
double
angle
)
const
;
144
153
Path
&
translate
(
double
dx,
double
dy );
154
163
Path
translated
(
double
dx,
double
dy )
const
;
164
173
Path
&
scale
(
double
sx,
double
sy );
174
182
Path
&
scale
(
double
s );
183
192
Path
scaled
(
double
sx,
double
sy )
const
;
193
194
Path
scaled
(
double
s )
const
;
195
201
void
scaleAll
(
double
s );
202
203
void
flushPostscript
( std::ostream & stream,
204
const
TransformEPS
& transform )
const
;
205
206
void
flushFIG
( std::ostream & stream,
207
const
TransformFIG
& transform )
const
;
208
209
void
flushSVGPoints
( std::ostream & stream,
210
const
TransformSVG
& transform )
const
;
211
212
void
flushSVGCommands
( std::ostream & stream,
213
const
TransformSVG
& transform )
const
;
214
215
#ifdef DGTAL_WITH_CAIRO
216
void
flushCairoPoints
( cairo_t *cr,
217
const
TransformCairo
& transform )
const
;
218
#endif
219
220
void
flushTikZPoints
( std::ostream & stream,
221
const
TransformTikZ
& transform )
const
;
222
223
Rect
boundingBox
()
const
;
224
225
protected
:
226
std::vector<Point>
_points
;
227
bool
_closed
;
228
};
229
230
void
231
Path::clear
()
232
{
233
_points
.clear();
234
}
235
236
bool
237
Path::closed
()
const
238
{
239
return
_closed
;
240
}
241
242
bool
243
Path::empty
()
const
244
{
245
return
_points
.empty();
246
}
247
248
unsigned
int
249
Path::size
()
const
250
{
251
return
(
unsigned
int
)
_points
.size();
252
}
253
254
void
255
Path::setClosed
(
bool
closedPath )
256
{
257
_closed
= closedPath;
258
}
259
260
}
// namespace LibBoard
261
262
#endif
/* _PATH_H_ */
scale
float scale
Definition
dgtalCalculus-bunny.cpp:59
LibBoard
Definition
Board.cpp:86
LibBoard::Path
A path, according to Postscript and SVG definition.
Definition
Path.h:43
LibBoard::Path::size
unsigned int size() const
Definition
Path.h:249
LibBoard::Path::translated
Path translated(double dx, double dy) const
Definition
Path.cpp:94
LibBoard::Path::operator[]
Point & operator[](const unsigned int n)
Definition
Path.h:92
LibBoard::Path::flushCairoPoints
void flushCairoPoints(cairo_t *cr, const TransformCairo &transform) const
Definition
Path.cpp:235
LibBoard::Path::clear
void clear()
Definition
Path.h:231
LibBoard::Path::Path
Path(const std::vector< Point > &points, bool closedPath)
Definition
Path.h:47
LibBoard::Path::pop_back
Path & pop_back()
Definition
Path.cpp:22
LibBoard::Path::operator[]
const Point & operator[](const unsigned int n) const
Definition
Path.h:103
LibBoard::Path::_closed
bool _closed
Definition
Path.h:227
LibBoard::Path::_points
std::vector< Point > _points
Definition
Path.h:226
LibBoard::Path::flushFIG
void flushFIG(std::ostream &stream, const TransformFIG &transform) const
Definition
Path.cpp:173
LibBoard::Path::center
Point center() const
Definition
Path.cpp:36
LibBoard::Path::setClosed
void setClosed(bool closed)
Definition
Path.h:255
LibBoard::Path::closed
bool closed() const
Definition
Path.h:237
LibBoard::Path::flushSVGPoints
void flushSVGPoints(std::ostream &stream, const TransformSVG &transform) const
Definition
Path.cpp:215
LibBoard::Path::empty
bool empty() const
Definition
Path.h:243
LibBoard::Path::scaleAll
void scaleAll(double s)
Definition
Path.cpp:143
LibBoard::Path::scaled
Path scaled(double sx, double sy) const
Definition
Path.cpp:131
LibBoard::Path::Path
Path()
Definition
Path.h:45
LibBoard::Path::rotated
Path rotated(double angle, const Point ¢er) const
Definition
Path.cpp:55
LibBoard::Path::Path
Path(bool closedPath)
Definition
Path.h:50
LibBoard::Path::translate
Path & translate(double dx, double dy)
Definition
Path.cpp:81
LibBoard::Path::flushPostscript
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition
Path.cpp:154
LibBoard::Path::flushSVGCommands
void flushSVGCommands(std::ostream &stream, const TransformSVG &transform) const
Definition
Path.cpp:193
LibBoard::Path::flushTikZPoints
void flushTikZPoints(std::ostream &stream, const TransformTikZ &transform) const
Definition
Path.cpp:255
LibBoard::Point
Struct representing a 2D point.
Definition
Point.h:27
LibBoard::Rect
Struct representing a rectangle on the plane.
Definition
Rect.h:26
LibBoard::TransformCairo
Structure representing a scaling and translation suitable for an Cairo output.
Definition
Transforms.h:112
LibBoard::TransformEPS
Structure representing a scaling and translation suitable for an EPS output.
Definition
Transforms.h:59
LibBoard::TransformFIG
Structure representing a scaling and translation suitable for an XFig output.
Definition
Transforms.h:73
LibBoard::TransformSVG
Structure representing a scaling and translation suitable for an SVG output.
Definition
Transforms.h:95
LibBoard::TransformTikZ
Structure representing a scaling and translation suitable for an TikZ output.
Definition
Transforms.h:129
boundingBox
std::pair< TPoint, TPoint > boundingBox(const std::vector< TPoint > &v)
Definition
testAffineBasis.cpp:98
angle
double angle(const DGtal::Z2i::RealPoint &point)
Definition
testProjection.cpp:56
src
Board
Path.h
Generated on
for DGtal by
1.18.0