Krita Source Code Documentation
Loading...
Searching...
No Matches
EllipseShape.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2006-2007 Thorsten Zachmann <zachmann@kde.org>
3 SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KOELLIPSESHAPE_H
9#define KOELLIPSESHAPE_H
10
11#include "KoParameterShape.h"
12#include <SvgShape.h>
13
14#define EllipseShapeId "EllipseShape"
15
23{
24public:
27 Arc = 0,
28 Pie = 1,
29 Chord = 2
30 };
31
33 ~EllipseShape() override;
34
35 KoShape* cloneShape() const override;
36
37 void setSize(const QSizeF &newSize) override;
38 QPointF normalize() override;
39
45
47 EllipseType type() const;
48
53 void setStartAngle(qreal angle);
54
56 qreal startAngle() const;
57
62 void setEndAngle(qreal angle);
63
65 qreal endAngle() const;
66
68 QString pathShapeId() const override;
69
71 bool saveSvg(SvgSavingContext &context) override;
72
74 bool loadSvg(const QDomElement &element, SvgLoadingContext &context) override;
75
76protected:
77
78 void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
79 void updatePath(const QSizeF &size) override;
80 void createPoints(int requiredPointCount);
81
82private:
83 qreal sweepAngle() const;
84
85 void updateKindHandle();
86 void updateAngleHandles();
87
88 EllipseShape(const EllipseShape &rhs);
89
90 // start angle in degree
92 // end angle in degree
94 // angle for modifying the kind in radiant
96 // the center of the ellipse
97 QPointF m_center;
98 // the radii of the ellipse
99 QPointF m_radii;
100 // the actual ellipse type
102};
103
104#endif /* KOELLIPSESHAPE_H */
105
void setType(EllipseType type)
void updatePath(const QSizeF &size) override
Update the path of the parameter shape.
qreal startAngle() const
Returns the actual ellipse start angle in degree.
QPointF normalize() override
Normalizes the path data.
void updateAngleHandles()
qreal m_startAngle
void setStartAngle(qreal angle)
~EllipseShape() override
void updateKindHandle()
qreal endAngle() const
Returns the actual ellipse end angle in degree.
QPointF m_radii
void setEndAngle(qreal angle)
EllipseType m_type
QString pathShapeId() const override
reimplemented
void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier) override
Updates the internal state of a KoParameterShape.
EllipseType type() const
Returns the actual ellipse type.
bool loadSvg(const QDomElement &element, SvgLoadingContext &context) override
reimplemented from SvgShape
void setSize(const QSizeF &newSize) override
Resize the shape.
void createPoints(int requiredPointCount)
KoShape * cloneShape() const override
creates a deep copy of the shape or shape's subtree
qreal sweepAngle() const
bool saveSvg(SvgSavingContext &context) override
reimplemented from SvgShape
QPointF m_center
qreal m_kindAngle
EllipseType
the possible ellipse types
@ Pie
an ellipse pie
@ Chord
an ellipse chord
@ Arc
an ellipse arc
QSizeF size() const override
reimplemented
Contains data used for loading svg.
Context for saving svg files.
An interface providing svg loading and saving routines.
Definition SvgShape.h:18