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

#include <KisMagneticGraph.h>

Public Types

enum  Direction {
  MIN = 0 , N = MIN , S , E ,
  W , NW , NE , SW ,
  SE , NONE
}
 

Public Member Functions

VertexDescriptor neighbor (Direction direction) const
 
bool operator!= (VertexDescriptor const &rhs) const
 
bool operator< (VertexDescriptor const &rhs) const
 
bool operator== (QPoint const &rhs) const
 
bool operator== (VertexDescriptor const &rhs) const
 
 VertexDescriptor ()
 
 VertexDescriptor (long _x, long _y)
 
 VertexDescriptor (QPoint pt)
 

Public Attributes

long x
 
long y
 

Detailed Description

Definition at line 19 of file KisMagneticGraph.h.

Member Enumeration Documentation

◆ Direction

Constructor & Destructor Documentation

◆ VertexDescriptor() [1/3]

VertexDescriptor::VertexDescriptor ( long _x,
long _y )
inline

Definition at line 27 of file KisMagneticGraph.h.

27 :
28 x(_x), y(_y)
29 { }

◆ VertexDescriptor() [2/3]

VertexDescriptor::VertexDescriptor ( QPoint pt)
inline

Definition at line 31 of file KisMagneticGraph.h.

31 :
32 x(pt.x()), y(pt.y())
33 { }

◆ VertexDescriptor() [3/3]

VertexDescriptor::VertexDescriptor ( )
inline

Definition at line 35 of file KisMagneticGraph.h.

35 :
36 x(0), y(0)
37 { }

Member Function Documentation

◆ neighbor()

VertexDescriptor VertexDescriptor::neighbor ( Direction direction) const
inline

Definition at line 61 of file KisMagneticGraph.h.

62 {
63 int dx = 0, dy = 0;
64
65 switch (direction) {
66 case W:
67 Q_FALLTHROUGH();
68 case SW:
69 Q_FALLTHROUGH();
70 case NW:
71 dx = -1;
72 break;
73 case E:
74 Q_FALLTHROUGH();
75 case SE:
76 Q_FALLTHROUGH();
77 case NE:
78 dx = 1;
79 default:
80 ;
81 }
82
83 switch (direction) {
84 case N:
85 Q_FALLTHROUGH();
86 case NW:
87 Q_FALLTHROUGH();
88 case NE:
89 dy = -1;
90 break;
91 case S:
92 Q_FALLTHROUGH();
93 case SW:
94 Q_FALLTHROUGH();
95 case SE:
96 dy = 1;
97 default:
98 ;
99 }
100
101 VertexDescriptor const neighbor(x + dx, y + dy);
102 return neighbor;
103 } // neighbor
VertexDescriptor neighbor(Direction direction) const

References E, N, NE, neighbor(), NW, S, SE, SW, W, x, and y.

◆ operator!=()

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

Definition at line 49 of file KisMagneticGraph.h.

50 {
51 return rhs.x != x || rhs.y != y;
52 }

References x, and y.

◆ operator<()

bool VertexDescriptor::operator< ( VertexDescriptor const & rhs) const
inline

Definition at line 54 of file KisMagneticGraph.h.

55 {
56 return x < rhs.x || (x == rhs.x && y < rhs.y);
57 }

References x, and y.

◆ operator==() [1/2]

bool VertexDescriptor::operator== ( QPoint const & rhs) const
inline

Definition at line 44 of file KisMagneticGraph.h.

45 {
46 return rhs.x() == x && rhs.y() == y;
47 }

References x, and y.

◆ operator==() [2/2]

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

Definition at line 39 of file KisMagneticGraph.h.

40 {
41 return rhs.x == x && rhs.y == y;
42 }

References x, and y.

Member Data Documentation

◆ x

long VertexDescriptor::x

Definition at line 20 of file KisMagneticGraph.h.

◆ y

long VertexDescriptor::y

Definition at line 20 of file KisMagneticGraph.h.


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