12#include <klocalizedstring.h>
33 if (insertPosition < 0)
35 if (insertPosition > 1)
41 for (; it != pointDataList.end(); ++it) {
52 QPair<KoPathSegment, KoPathSegment> splitSegments = segment.
splitAt(insertPosition);
54 KoPathPoint * split1 = splitSegments.first.second();
55 KoPathPoint * split2 = splitSegments.second.first();
63 QPointF cp1 = splitSegments.first.first()->controlPoint2();
64 QPointF cp2 = splitSegments.second.second()->controlPoint1();
141 segmentPoints << nextPoint;
QPair< int, int > KoPathPointIndex
void setText(const KUndo2MagicString &text)
Describe a KoPathPoint by a KoPathShape and its indices.
KoPathPointIndex pointIndex
position of the point in the path shape
KoPathShape * pathShape
path shape the path point belongs too
KoPathPointInsertCommandPrivate()
QList< KoPathPoint * > points
QList< KoPathPointData > pointDataList
QList< QPair< QPointF, QPointF > > controlPoints
~KoPathPointInsertCommandPrivate()
KoPathPointInsertCommandPrivate *const d
KoPathPointInsertCommand(const QList< KoPathPointData > &pointDataList, qreal insertPosition, KUndo2Command *parent=0)
void redo() override
redo the command
void undo() override
revert the actions done in redo
~KoPathPointInsertCommand() override
QList< KoPathPoint * > insertedPoints() const
Returns list of inserted points.
A KoPathPoint represents a point in a path.
void setControlPoint1(const QPointF &point)
Set the control point 1.
void setControlPoint2(const QPointF &point)
Set the control point 2.
@ CloseSubpath
it closes a subpath (only applicable on StartSubpath and StopSubpath)
A KoPathSegment consist of two neighboring KoPathPoints.
QPair< KoPathSegment, KoPathSegment > splitAt(qreal t) const
Splits segment at given position returning the two resulting segments.
bool isValid() const
Returns if segment is valid, e.g. has two valid points.
The position of a path point within a path shape.
void recommendPointSelectionChange(const QList< KoPathPointIndex > &newSelection)
KoPathPoint * removePoint(const KoPathPointIndex &pointIndex)
Removes a point from the path.
KoPathSegment segmentByIndex(const KoPathPointIndex &pointIndex) const
Returns the segment specified by a path point index.
KoPathPoint * pointByIndex(const KoPathPointIndex &pointIndex) const
Returns the path point specified by a path point index.
bool insertPoint(KoPathPoint *point, const KoPathPointIndex &pointIndex)
Inserts a new point into the given subpath at the specified position.
void update() const override
reimplemented
KUndo2MagicString kundo2_i18n(const char *text)