Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-ellipse.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
17#ifndef SEEN_SP_ELLIPSE_H
18#define SEEN_SP_ELLIPSE_H
19
20#include "svg/svg-length.h"
21#include "sp-shape.h"
22
29
35
36class SPGenericEllipse final : public SPShape {
37public:
40 int tag() const override { return tag_of<decltype(*this)>; }
41
42 // Regardless of type, the ellipse/circle/arc is stored
43 // internally with these variables. (Circle radius is rx).
48
49 // Return slice, chord, or arc.
52
53 double start, end;
56
57 void tag_name_changed(gchar const* oldname, gchar const* newname) override;
58
60
61 void set(SPAttr key, char const *value) override;
62 void update(SPCtx *ctx, unsigned int flags) override;
63
64 Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override;
65 const char *typeName() const override;
66 const char *displayName() const override;
67
68 void set_shape() override;
69 void update_patheffect(bool write) override;
70 Geom::Affine set_transform(Geom::Affine const &xform) override;
71
72 void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const override;
73
74 void modified(unsigned int flags) override;
75
79 void normalize();
80
81 Geom::Point getPointAtAngle(double arg) const;
82
84 void position_set(double x, double y, double rx, double ry);
85
86 double getVisibleRx() const;
87 void setVisibleRx(double rx);
88
89 double getVisibleRy() const;
90 void setVisibleRy(double ry);
91
92 bool is_whole() const { return !_isSlice(); }
93
94protected:
98 bool _isSlice() const;
99};
100
101#endif
102
103/*
104 Local Variables:
105 mode:c++
106 c-file-style:"stroustrup"
107 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
108 indent-tabs-mode:nil
109 fill-column:99
110 End:
111*/
112// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
SPAttr
Definition attributes.h:27
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
3x3 matrix representing an affine transformation.
Definition affine.h:70
Two-dimensional point that doubles as a vector.
Definition point.h:66
Storing of snapping preferences.
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:101
~SPGenericEllipse() override
const char * displayName() const override
The item's type name as a translated human string.
Geom::Point getPointAtAngle(double arg) const
int tag() const override
Definition sp-ellipse.h:40
GenericEllipseArcType arcType()
Definition sp-ellipse.h:50
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
void modified(unsigned int flags) override
bool is_whole() const
Definition sp-ellipse.h:92
double getVisibleRy() const
void setVisibleRy(double ry)
void update_patheffect(bool write) override
void tag_name_changed(gchar const *oldname, gchar const *newname) override
void normalize()
Makes sure that start and end lie between 0 and 2 * PI.
void setArcType(GenericEllipseArcType type)
Definition sp-ellipse.h:51
void set_shape() override
void position_set(double x, double y, double rx, double ry)
bool set_elliptical_path_attribute(Inkscape::XML::Node *repr)
Geom::Affine set_transform(Geom::Affine const &xform) override
bool _isSlice() const
Determines whether the shape is a part of an ellipse.
void update(SPCtx *ctx, unsigned int flags) override
void setVisibleRx(double rx)
void build(SPDocument *document, Inkscape::XML::Node *repr) override
const char * typeName() const override
The item's type name, not node tag name.
double getVisibleRx() const
GenericEllipseType type
Definition sp-ellipse.h:54
GenericEllipseArcType arc_type
Definition sp-ellipse.h:55
void snappoints(std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs) const override
Inkscape::XML::Node * repr
Definition sp-object.h:193
SPDocument * document
Definition sp-object.h:188
Base class for shapes, including <path> element.
Definition sp-shape.h:38
SVG length type.
Definition svg-length.h:22
static cairo_user_data_key_t key
GenericEllipseArcType
Definition sp-ellipse.h:30
@ SP_GENERIC_ELLIPSE_ARC_TYPE_CHORD
Definition sp-ellipse.h:33
@ SP_GENERIC_ELLIPSE_ARC_TYPE_SLICE
Definition sp-ellipse.h:31
@ SP_GENERIC_ELLIPSE_ARC_TYPE_ARC
Definition sp-ellipse.h:32
GenericEllipseType
Definition sp-ellipse.h:23
@ SP_GENERIC_ELLIPSE_CIRCLE
Definition sp-ellipse.h:26
@ SP_GENERIC_ELLIPSE_UNDEFINED
Definition sp-ellipse.h:24
@ SP_GENERIC_ELLIPSE_ARC
Definition sp-ellipse.h:25
@ SP_GENERIC_ELLIPSE_ELLIPSE
Definition sp-ellipse.h:27
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94