12#include <klocalizedstring.h>
40 std::sort(sortedPointData.begin(), sortedPointData.end());
45 sortedPointData.append(last);
53 last = sortedPointData.first();
56 for (; it != sortedPointData.constEnd(); ++it) {
62 subpathsOfPath.append(pointsOfSubpath.first());
65 pointsToDelete += pointsOfSubpath;
68 pointsOfSubpath.clear();
79 subpathToDelete += subpathsOfPath;
81 subpathsOfPath.clear();
88 pointsOfSubpath.append(*it);
93 if (pointsToDelete.size() > 0) {
99 if (shapesToDelete.size() > 0) {
112 for (; it != pointDataList.end(); ++it) {
113 KoPathPoint *point = it->pathShape->pointByIndex(it->pointIndex);
140 QPointF offset = lastPathShape->
normalize();
143 matrix.translate(-offset.x(), -offset.y());
144 for (
int j = i + 1; j < updateBefore; ++j) {
148 updateBefore = i + 1;
155 QPointF offset = lastPathShape->
normalize();
158 matrix.translate(-offset.x(), -offset.y());
159 for (
int j = 0; j < updateBefore; ++j) {
173 QMap<KoPathShape *, QList<KoPathPointIndex>> pointsMap;
177 if (lastPathShape && lastPathShape != pd.
pathShape) {
192 for (
auto it = pointsMap.constBegin(); it != pointsMap.constEnd(); ++it) {
193 it.key()->recommendPointSelectionChange(it.value());
QPair< int, int > KoPathPointIndex
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
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
KoPathPointRemoveCommandPrivate()
QList< KoPathPointData > pointDataList
~KoPathPointRemoveCommandPrivate()
QList< KoPathPoint * > points
void undo() override
revert the actions done in redo
void redo() override
redo the command
static KUndo2Command * createCommand(const QList< KoPathPointData > &pointDataList, KoShapeController *shapeController, KUndo2Command *parent=0)
Create command for removing points from path shapes.
KoPathPointRemoveCommandPrivate * d
KoPathPointRemoveCommand(const QList< KoPathPointData > &pointDataList, KUndo2Command *parent=0)
Command to remove a points from path shapes.
~KoPathPointRemoveCommand() override
A KoPathPoint represents a point in a path.
The position of a path point within a path shape.
int subpathPointCount(int subpathIndex) const
Returns the number of points in a subpath.
virtual QPointF normalize()
Normalizes the path data.
KoPathPoint * removePoint(const KoPathPointIndex &pointIndex)
Removes a point from the path.
int subpathCount() const
Returns the number of subpaths in the path.
bool insertPoint(KoPathPoint *point, const KoPathPointIndex &pointIndex)
Inserts a new point into the given subpath at the specified position.
void update() const override
reimplemented
KUndo2Command * removeShapes(const QList< KoShape * > &shapes, KUndo2Command *parent=0)
The undo / redo command for removing a subpath.
KUndo2MagicString kundo2_i18n(const char *text)