Warning, file /graphics/krita/plugins/flake/pathshapes/ellipse/EllipseShape.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2006-2007 Thorsten Zachmann <zachmann@kde.org> 0003 SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KOELLIPSESHAPE_H 0009 #define KOELLIPSESHAPE_H 0010 0011 #include "KoParameterShape.h" 0012 #include <SvgShape.h> 0013 0014 #define EllipseShapeId "EllipseShape" 0015 0016 /** 0017 * This class adds support for arc, pie, chord, circle and ellipse 0018 * shapes. The ellipse/circle radii are defined by the actual size 0019 * of the ellipse shape which can be changed with the setSize 0020 * method. 0021 */ 0022 class EllipseShape : public KoParameterShape, public SvgShape 0023 { 0024 public: 0025 /// the possible ellipse types 0026 enum EllipseType { 0027 Arc = 0, ///< an ellipse arc 0028 Pie = 1, ///< an ellipse pie 0029 Chord = 2 ///< an ellipse chord 0030 }; 0031 0032 EllipseShape(); 0033 ~EllipseShape() override; 0034 0035 KoShape* cloneShape() const override; 0036 0037 void setSize(const QSizeF &newSize) override; 0038 QPointF normalize() override; 0039 0040 /** 0041 * Sets the type of the ellipse. 0042 * @param type the new ellipse type 0043 */ 0044 void setType(EllipseType type); 0045 0046 /// Returns the actual ellipse type 0047 EllipseType type() const; 0048 0049 /** 0050 * Sets the start angle of the ellipse. 0051 * @param angle the new start angle in degree 0052 */ 0053 void setStartAngle(qreal angle); 0054 0055 /// Returns the actual ellipse start angle in degree 0056 qreal startAngle() const; 0057 0058 /** 0059 * Sets the end angle of the ellipse. 0060 * @param angle the new end angle in degree 0061 */ 0062 void setEndAngle(qreal angle); 0063 0064 /// Returns the actual ellipse end angle in degree 0065 qreal endAngle() const; 0066 0067 /// reimplemented 0068 QString pathShapeId() const override; 0069 0070 /// reimplemented from SvgShape 0071 bool saveSvg(SvgSavingContext &context) override; 0072 0073 /// reimplemented from SvgShape 0074 bool loadSvg(const QDomElement &element, SvgLoadingContext &context) override; 0075 0076 protected: 0077 0078 void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override; 0079 void updatePath(const QSizeF &size) override; 0080 void createPoints(int requiredPointCount); 0081 0082 private: 0083 qreal sweepAngle() const; 0084 0085 void updateKindHandle(); 0086 void updateAngleHandles(); 0087 0088 EllipseShape(const EllipseShape &rhs); 0089 0090 // start angle in degree 0091 qreal m_startAngle; 0092 // end angle in degree 0093 qreal m_endAngle; 0094 // angle for modifying the kind in radiant 0095 qreal m_kindAngle; 0096 // the center of the ellipse 0097 QPointF m_center; 0098 // the radii of the ellipse 0099 QPointF m_radii; 0100 // the actual ellipse type 0101 EllipseType m_type; 0102 }; 0103 0104 #endif /* KOELLIPSESHAPE_H */ 0105