Krita Source Code Documentation
Loading...
Searching...
No Matches
PathConnectionPoint Struct Reference

Small helper to keep track of a path point and its parent path shape. More...

#include <KoCreatePathTool_p.h>

Public Member Functions

bool isValid () const
 
bool operator!= (const PathConnectionPoint &rhs) const
 
PathConnectionPointoperator= (KoPathPoint *pathPoint)
 
bool operator== (const PathConnectionPoint &rhs) const
 
 PathConnectionPoint ()
 
void reset ()
 
void validate (KoCanvasBase *canvas)
 

Public Attributes

KoPathShapepath
 
KoPathPointpoint
 

Detailed Description

Small helper to keep track of a path point and its parent path shape.

Definition at line 31 of file KoCreatePathTool_p.h.

Constructor & Destructor Documentation

◆ PathConnectionPoint()

PathConnectionPoint::PathConnectionPoint ( )
inline

Definition at line 32 of file KoCreatePathTool_p.h.

33 : path(0), point(0) {
34 }

Member Function Documentation

◆ isValid()

bool PathConnectionPoint::isValid ( ) const
inline

Definition at line 60 of file KoCreatePathTool_p.h.

60 {
61 return path && point;
62 }

References point.

◆ operator!=()

bool PathConnectionPoint::operator!= ( const PathConnectionPoint & rhs) const
inline

Definition at line 52 of file KoCreatePathTool_p.h.

52 {
53 return rhs.path != path || rhs.point != point;
54 }

References path, and point.

◆ operator=()

PathConnectionPoint & PathConnectionPoint::operator= ( KoPathPoint * pathPoint)
inline

Definition at line 42 of file KoCreatePathTool_p.h.

42 {
43 if (!pathPoint || ! pathPoint->parent()) {
44 reset();
45 } else {
46 path = pathPoint->parent();
47 point = pathPoint;
48 }
49 return *this;
50 }
KoPathShape * parent() const
Get the path shape the point belongs to.

References KoPathPoint::parent(), point, and reset().

◆ operator==()

bool PathConnectionPoint::operator== ( const PathConnectionPoint & rhs) const
inline

Definition at line 56 of file KoCreatePathTool_p.h.

56 {
57 return rhs.path == path && rhs.point == point;
58 }

References path, and point.

◆ reset()

void PathConnectionPoint::reset ( )
inline

Definition at line 37 of file KoCreatePathTool_p.h.

37 {
38 path = 0;
39 point = 0;
40 }

References point.

◆ validate()

void PathConnectionPoint::validate ( KoCanvasBase * canvas)
inline

Definition at line 65 of file KoCreatePathTool_p.h.

65 {
66 // no point in validating an already invalid state
67 if (!isValid()) {
68 return;
69 }
70 // we need canvas to validate
71 if (!canvas) {
72 reset();
73 return;
74 }
75 // check if path is still part of the document
76 if (!canvas->shapeManager()->shapes().contains(path)) {
77 reset();
78 return;
79 }
80 // check if point is still part of the path
81 if (path->pathPointIndex(point) == KoPathPointIndex(-1, -1)) {
82 reset();
83 return;
84 }
85 }
QPair< int, int > KoPathPointIndex
Definition KoPathShape.h:28
virtual KoShapeManager * shapeManager() const =0
QList< KoShape * > shapes

References isValid(), point, reset(), KoCanvasBase::shapeManager(), and KoShapeManager::shapes.

Member Data Documentation

◆ path

KoPathShape* PathConnectionPoint::path

Definition at line 87 of file KoCreatePathTool_p.h.

◆ point

KoPathPoint* PathConnectionPoint::point

Definition at line 88 of file KoCreatePathTool_p.h.


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