Board 0.9.6
Dot.h
Go to the documentation of this file.
1/* -*- mode: c++ -*- */
26#ifndef BOARD_DOT_H
27#define BOARD_DOT_H
28
30
31namespace LibBoard
32{
33
42struct Dot : public ShapeWithStyle {
43
44 inline Dot(double x, double y, Color color = Style::defaultPenColor(), double lineWidth = Style::defaultLineWidth());
45
46 inline Dot(const Point & p, Color color = Style::defaultPenColor(), double lineWidth = Style::defaultLineWidth());
47
53 const std::string & name() const override;
54
55 Point center(LineWidthFlag flage = IgnoreLineWidth) const override;
56
65 Dot & rotate(double angle, const Point & center) override;
66
75 Dot rotated(double angle, const Point & center) const;
76
84 Dot & rotate(double angle) override;
85
93 Dot rotated(double angle) const;
94
103 Dot & translate(double dx, double dy) override;
104
113 Dot translated(double dx, double dy) const;
114
123 Dot & scale(double sx, double sy) override;
124
132 Dot & scale(double s) override;
133
144 Dot scaled(double sx, double sy) const;
145
155 Dot scaled(double s) const;
156
163 void scaleAll(double s) override;
164
165 void flushPostscript(std::ostream & stream, const TransformEPS & transform) const override;
166
167 void flushFIG(std::ostream & stream, const TransformFIG & transform, std::map<Color, int> & colormap) const override;
168
169 void flushSVG(std::ostream & stream, const TransformSVG & transform) const override;
170
171 void flushTikZ(std::ostream & stream, const TransformTikZ & transform) const override;
172
178 virtual void accept(ShapeVisitor & visitor) override;
179
185 virtual void accept(const ShapeVisitor & visitor) override;
186
192 virtual void accept(ConstShapeVisitor & visitor) const override;
193
199 virtual void accept(const ConstShapeVisitor & visitor) const override;
200
206 virtual Shape * accept(CompositeShapeTransform & transform) const override;
207
213 virtual Shape * accept(const CompositeShapeTransform & transform) const override;
214
220 Rect boundingBox(LineWidthFlag) const override;
221
222 Dot * clone() const override;
223
224 Dot(const Dot &) = default;
225 Dot(Dot &&) = default;
226 Dot & operator=(Dot &&) = default;
227 Dot & operator=(const Dot &) = default;
228 ~Dot() override = default;
229
230private:
231 static const std::string _name;
233protected:
234 double _x;
235 double _y;
236};
237} // namespace LibBoard
238
239/*
240 * Inline methods
241 */
242
243namespace LibBoard
244{
245Dot::Dot(double x, double y, Color color, double lineWidth) //
246 : ShapeWithStyle(color, Color::Null, lineWidth, SolidStyle, RoundCap, MiterJoin), _x(x), _y(y)
247{
248}
249
250Dot::Dot(const Point & p, Color color, double lineWidth) //
251 : ShapeWithStyle(color, Color::Null, lineWidth, SolidStyle, RoundCap, MiterJoin), _x(p.x), _y(p.y)
252{
253}
254} // namespace LibBoard
255
256#endif /* BOARD_DOT_H */
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Structure representing an RGB triple.
Definition Color.h:43
Definition Board.h:55
@ SolidStyle
Definition Style.h:48
@ RoundCap
Definition Style.h:37
LineWidthFlag
Definition Style.h:57
@ IgnoreLineWidth
Definition Style.h:58
@ MiterJoin
Definition Style.h:42
A CompositeShapeTransform may be used to duplicate/transform a composite shape tree.
Definition ShapeVisitor.h:104
A ConstShapeVisitor may visit const shapes of a composite shape tree in back-to-front order.
Definition ShapeVisitor.h:79
A line between two points.
Definition Dot.h:42
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override
Definition Dot.cpp:128
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const override
Definition Dot.cpp:158
Dot & translate(double dx, double dy) override
Definition Dot.cpp:81
Dot scaled(double sx, double sy) const
Definition Dot.cpp:103
Dot * clone() const override
Definition Dot.cpp:206
Dot & rotate(double angle, const Point &center) override
Definition Dot.cpp:60
Dot(const Dot &)=default
Dot & operator=(const Dot &)=default
Rect boundingBox(LineWidthFlag) const override
Definition Dot.cpp:195
void scaleAll(double s) override
Definition Dot.cpp:113
double _y
Definition Dot.h:235
Dot & scale(double sx, double sy) override
Definition Dot.cpp:93
Point center(LineWidthFlag flage=IgnoreLineWidth) const override
Definition Dot.cpp:55
Dot translated(double dx, double dy) const
Definition Dot.cpp:88
~Dot() override=default
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const override
Definition Dot.cpp:119
double _x
Definition Dot.h:234
const std::string & name() const override
Definition Dot.cpp:50
Dot rotated(double angle, const Point &center) const
Definition Dot.cpp:66
Dot(double x, double y, Color color=Style::defaultPenColor(), double lineWidth=Style::defaultLineWidth())
Definition Dot.h:245
Dot & operator=(Dot &&)=default
void flushSVG(std::ostream &stream, const TransformSVG &transform) const override
Definition Dot.cpp:150
Dot(Dot &&)=default
virtual void accept(ShapeVisitor &visitor) override
Accepts a visitor object.
Definition Dot.cpp:165
Struct representing a 2D point.
Definition Point.h:42
Struct representing a rectangle on the plane.
Definition Rect.h:40
A ShapeVisitor visits all shapes in a composite shape tree in back-to-front order.
Definition ShapeVisitor.h:54
Abstract structure for a 2D shape.
Definition ShapeWithStyle.h:38
double lineWidth() const
Definition ShapeWithStyle.h:165
Abstract structure for a 2D shape.
Definition Shape.h:64
static const Color & defaultPenColor()
defaultPenColor
Definition Style.h:279
static const double & defaultLineWidth()
defaultLineWidth
Definition Style.h:274
Structure representing a scaling and translation suitable for an EPS output.
Definition Transforms.h:71
Structure representing a scaling and translation suitable for an XFig output.
Definition Transforms.h:87
Structure representing a scaling and translation suitable for an SVG output.
Definition Transforms.h:109
Structure representing a scaling and translation suitable for an TikZ output.
Definition Transforms.h:126