Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathPointMoveCommandPrivate Class Reference

Public Member Functions

void applyOffset (qreal factor)
 
 KoPathPointMoveCommandPrivate ()
 

Public Attributes

QSet< KoPathShape * > paths
 
QMap< KoPathPointData, QPointF > points
 

Detailed Description

Definition at line 16 of file KoPathPointMoveCommand.cpp.

Constructor & Destructor Documentation

◆ KoPathPointMoveCommandPrivate()

KoPathPointMoveCommandPrivate::KoPathPointMoveCommandPrivate ( )
inline

Definition at line 19 of file KoPathPointMoveCommand.cpp.

19{ }

Member Function Documentation

◆ applyOffset()

void KoPathPointMoveCommandPrivate::applyOffset ( qreal factor)

Definition at line 101 of file KoPathPointMoveCommand.cpp.

102{
103 QList<KoShape*> shapes;
104 std::copy(paths.begin(), paths.end(), std::back_inserter(shapes));
105
106 KoShapeBulkActionLock lock(shapes);
107
108 QMap<KoPathPointData, QPointF>::iterator it(points.begin());
109 for (; it != points.end(); ++it) {
110 KoPathShape *path = it.key().pathShape;
111 // transform offset from document to shape coordinate system
112 QPointF shapeOffset = path->documentToShape(factor*it.value()) - path->documentToShape(QPointF());
113 QTransform matrix;
114 matrix.translate(shapeOffset.x(), shapeOffset.y());
115
116 KoPathPoint *p = path->pointByIndex(it.key().pointIndex);
117 if (p)
118 p->map(matrix);
119 }
120
121 foreach (KoPathShape *path, paths) {
122 path->normalize();
123 }
124
126}
const Params2D p
QMap< KoPathPointData, QPointF > points
A KoPathPoint represents a point in a path.
void map(const QTransform &matrix)
apply matrix on the point
The position of a path point within a path shape.
Definition KoPathShape.h:63
static void bulkShapesUpdate(const UpdatesList &updates)
QPointF documentToShape(const QPointF &point) const
Transforms point from document coordinates to shape coordinates.
Definition KoShape.cpp:1016

References KoShapeBulkActionLock::bulkShapesUpdate(), KoShape::documentToShape(), KoPathPoint::map(), p, paths, points, and KoShapeBulkActionLock::unlock().

Member Data Documentation

◆ paths

QSet<KoPathShape*> KoPathPointMoveCommandPrivate::paths

Definition at line 23 of file KoPathPointMoveCommand.cpp.

◆ points

QMap<KoPathPointData, QPointF > KoPathPointMoveCommandPrivate::points

Definition at line 22 of file KoPathPointMoveCommand.cpp.


The documentation for this class was generated from the following file: