File indexing completed on 2024-06-23 04:27:04
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2007 Rob Buis <buis@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KOSPIRALSHAPE_H 0008 #define KOSPIRALSHAPE_H 0009 0010 #include "KoParameterShape.h" 0011 0012 #define SpiralShapeId "SpiralShape" 0013 0014 /** 0015 * This class adds support for the spiral 0016 * shape. 0017 */ 0018 class SpiralShape : public KoParameterShape 0019 { 0020 public: 0021 /// the possible spiral types 0022 enum SpiralType { 0023 Curve = 0, ///< spiral uses curves 0024 Line = 1 ///< spiral uses lines 0025 }; 0026 0027 SpiralShape(); 0028 ~SpiralShape() override; 0029 0030 KoShape* cloneShape() const override; 0031 0032 void setSize(const QSizeF &newSize) override; 0033 QPointF normalize() override; 0034 0035 /** 0036 * Sets the type of the spiral. 0037 * @param type the new spiral type 0038 */ 0039 void setType(SpiralType type); 0040 0041 /// Returns the actual spiral type 0042 SpiralType type() const; 0043 0044 /** 0045 * Sets the fade parameter of the spiral. 0046 * @param angle the new start angle in degree 0047 */ 0048 void setFade(qreal fade); 0049 0050 /// Returns the actual fade parameter 0051 qreal fade() const; 0052 0053 bool clockWise() const; 0054 void setClockWise(bool clockwise); 0055 0056 /// reimplemented 0057 QString pathShapeId() const override; 0058 0059 protected: 0060 SpiralShape(const SpiralShape &rhs); 0061 0062 void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override; 0063 void updatePath(const QSizeF &size) override; 0064 void createPath(const QSizeF &size); 0065 0066 private: 0067 void updateKindHandle(); 0068 void updateAngleHandles(); 0069 0070 // fade parameter 0071 qreal m_fade; 0072 // angle for modifying the kind in radiant 0073 qreal m_kindAngle; 0074 // the center of the spiral 0075 QPointF m_center; 0076 // the radii of the spiral 0077 QPointF m_radii; 0078 // the actual spiral type 0079 SpiralType m_type; 0080 // 0081 bool m_clockwise; 0082 0083 KoSubpath m_points; 0084 }; 0085 0086 #endif /* KOSPIRALSHAPE_H */ 0087