QElectroTech
0.70
|
#include <conductorsegment.h>
Public Member Functions | |
ConductorSegment (const QPointF &, const QPointF &, ConductorSegment *=nullptr, ConductorSegment *=nullptr) | |
virtual | ~ConductorSegment () |
void | moveX (const qreal &) |
void | moveY (const qreal &) |
ConductorSegment * | previousSegment () const |
ConductorSegment * | nextSegment () const |
bool | hasPreviousSegment () const |
bool | hasNextSegment () const |
void | setPreviousSegment (ConductorSegment *) |
void | setNextSegment (ConductorSegment *) |
bool | isStatic () const |
bool | isFirstSegment () const |
bool | isLastSegment () const |
QPointF | firstPoint () const |
QPointF | secondPoint () const |
void | setFirstPoint (const QPointF &) |
void | setSecondPoint (const QPointF &) |
QPointF | middle () const |
bool | isHorizontal () const |
bool | isVertical () const |
QET::ConductorSegmentType | type () const |
qreal | length () const |
bool | isPoint () const |
bool | canMove1stPointX (const qreal &, qreal &) const |
bool | canMove2ndPointX (const qreal &, qreal &) const |
bool | canMove1stPointY (const qreal &, qreal &) const |
bool | canMove2ndPointY (const qreal &, qreal &) const |
Private Member Functions | |
ConductorSegment (const ConductorSegment &) | |
Private Attributes | |
ConductorSegment * | previous_segment |
ConductorSegment * | next_segment |
QPointF | point1 |
QPointF | point2 |
This class represents a conductor segment.
Definition at line 25 of file conductorsegment.h.
ConductorSegment::ConductorSegment | ( | const QPointF & | p1, |
const QPointF & | p2, | ||
ConductorSegment * | cs1 = nullptr , |
||
ConductorSegment * | cs2 = nullptr |
||
) |
Constructeur
p1 | Le point |
p2 | |
cs1 | Le segment precedent |
cs2 | Le segment suivant |
Definition at line 28 of file conductorsegment.cpp.
References setNextSegment(), and setPreviousSegment().
|
virtual |
Destructeur - Relie le segment precedent au suivant
Definition at line 44 of file conductorsegment.cpp.
References hasNextSegment(), hasPreviousSegment(), nextSegment(), previousSegment(), setNextSegment(), and setPreviousSegment().
|
private |
bool ConductorSegment::canMove1stPointX | ( | const qreal & | asked_dx, |
qreal & | possible_dx | ||
) | const |
Permet de savoir s'il est possible de deplacer le premier point du segment sans creer d'incoherence. La valeur du mouvement maximum qu'il est possible de faire sans incoherence est stockee dans le second parametre.
asked_dx | La valeur du mouvement demande |
possible_dx | La valeur du mouvement possible (au maximum) |
On ne bouge jamais le premier point d'un segment statique.
Si le segment precedent n'est pas statique, le mouvement est possible.
Si le segment precedent est vertical, le mouvement est possible : il induira la creation d'un segment horizontal supplementaire.
Il se peut que le mouvement doive etre limite de facon a ce que le segment statique conserve une taille minimale.
Definition at line 57 of file conductorsegment.cpp.
References hasPreviousSegment(), isStatic(), isVertical(), length(), point1, and previous_segment.
Referenced by moveX().
bool ConductorSegment::canMove1stPointY | ( | const qreal & | asked_dy, |
qreal & | possible_dy | ||
) | const |
Permet de savoir s'il est possible de deplacer le premier point du segment sans creer d'incoherence. La valeur du mouvement maximum qu'il est possible de faire sans incoherence est stockee dans le second parametre.
asked_dy | La valeur du mouvement demande |
possible_dy | La valeur du mouvement possible (au maximum) |
On ne bouge jamais le premier point d'un segment statique.
Si le segment precedent n'est pas statique, le mouvement est possible.
Si le segment precedent est horizontal, le mouvement est possible : il induira la creation d'un segment vertical supplementaire.
Il se peut que le mouvement doive etre limite de facon a ce que le segment statique conserve une taille minimale.
Definition at line 175 of file conductorsegment.cpp.
References hasPreviousSegment(), isHorizontal(), isStatic(), length(), point1, and previous_segment.
Referenced by moveY().
bool ConductorSegment::canMove2ndPointX | ( | const qreal & | asked_dx, |
qreal & | possible_dx | ||
) | const |
Permet de savoir s'il est possible de deplacer le second point du segment sans creer d'incoherence. La valeur du mouvement maximum qu'il est possible de faire sans incoherence est stockee dans le second parametre.
asked_dx | La valeur du mouvement demande |
possible_dx | La valeur du mouvement possible (au maximum) |
On ne modifie jamais l'abscisse du second point d'un segment statique.
Si le segment suivant n'est pas statique, le mouvement est possible.
Si le segment suivant est vertical, le mouvement est possible : il induira la creation d'un segment horizontal supplementaire.
Il se peut que le mouvement doive etre limite de facon a ce que le segment statique conserve une taille minimale.
Definition at line 116 of file conductorsegment.cpp.
References hasNextSegment(), isStatic(), isVertical(), length(), next_segment, and point2.
Referenced by moveX().
bool ConductorSegment::canMove2ndPointY | ( | const qreal & | asked_dy, |
qreal & | possible_dy | ||
) | const |
Permet de savoir s'il est possible de deplacer le second point du segment sans creer d'incoherence. La valeur du mouvement maximum qu'il est possible de faire sans incoherence est stockee dans le second parametre.
asked_dy | La valeur du mouvement demande |
possible_dy | La valeur du mouvement possible (au maximum) |
On ne modifie jamais l'abscisse du second point d'un segment statique.
Si le segment suivant n'est pas statique, le mouvement est possible.
Si le segment suivant est horizontal, le mouvement est possible : il induira la creation d'un segment vertical supplementaire.
Il se peut que le mouvement doive etre limite de facon a ce que le segment statique conserve une taille minimale.
Definition at line 234 of file conductorsegment.cpp.
References hasNextSegment(), isHorizontal(), isStatic(), length(), next_segment, and point2.
Referenced by moveY().
QPointF ConductorSegment::firstPoint | ( | ) | const |
Definition at line 449 of file conductorsegment.cpp.
References point1.
Referenced by length().
bool ConductorSegment::hasNextSegment | ( | ) | const |
Definition at line 486 of file conductorsegment.cpp.
References next_segment.
Referenced by canMove2ndPointX(), canMove2ndPointY(), isLastSegment(), moveX(), moveY(), setNextSegment(), and ~ConductorSegment().
bool ConductorSegment::hasPreviousSegment | ( | ) | const |
Definition at line 479 of file conductorsegment.cpp.
References previous_segment.
Referenced by canMove1stPointX(), canMove1stPointY(), isFirstSegment(), moveX(), moveY(), setPreviousSegment(), and ~ConductorSegment().
bool ConductorSegment::isFirstSegment | ( | ) | const |
Definition at line 409 of file conductorsegment.cpp.
References hasPreviousSegment().
Referenced by isStatic(), moveX(), moveY(), and Conductor::posForText().
bool ConductorSegment::isHorizontal | ( | ) | const |
Definition at line 442 of file conductorsegment.cpp.
References point1, and point2.
Referenced by canMove1stPointY(), canMove2ndPointY(), length(), moveX(), moveY(), Conductor::posForText(), and type().
bool ConductorSegment::isLastSegment | ( | ) | const |
Definition at line 414 of file conductorsegment.cpp.
References hasNextSegment().
Referenced by isStatic(), moveX(), and moveY().
bool ConductorSegment::isPoint | ( | ) | const |
Definition at line 519 of file conductorsegment.cpp.
bool ConductorSegment::isStatic | ( | ) | const |
Definition at line 404 of file conductorsegment.cpp.
References isFirstSegment(), and isLastSegment().
Referenced by canMove1stPointX(), canMove1stPointY(), canMove2ndPointX(), canMove2ndPointY(), moveX(), and moveY().
bool ConductorSegment::isVertical | ( | ) | const |
Definition at line 435 of file conductorsegment.cpp.
References point1, and point2.
Referenced by canMove1stPointX(), canMove2ndPointX(), moveX(), and moveY().
qreal ConductorSegment::length | ( | ) | const |
Definition at line 505 of file conductorsegment.cpp.
References firstPoint(), isHorizontal(), and secondPoint().
Referenced by canMove1stPointX(), canMove1stPointY(), canMove2ndPointX(), canMove2ndPointY(), and Conductor::posForText().
QPointF ConductorSegment::middle | ( | ) | const |
Definition at line 493 of file conductorsegment.cpp.
References point1, and point2.
Referenced by Conductor::handlerMouseMoveEvent(), Conductor::handlerPoints(), and Conductor::posForText().
void ConductorSegment::moveX | ( | const qreal & | dx | ) |
Gere les mouvements sur l'axe horizontal
dx | taille du deplacement en pixels |
Definition at line 289 of file conductorsegment.cpp.
References canMove1stPointX(), canMove2ndPointX(), ConductorSegment(), hasNextSegment(), hasPreviousSegment(), isFirstSegment(), isHorizontal(), isLastSegment(), isStatic(), isVertical(), next_segment, point1, point2, previous_segment, setFirstPoint(), and setSecondPoint().
void ConductorSegment::moveY | ( | const qreal & | dy | ) |
Gere les mouvements sur l'axe vertical
dy | taille du deplacement en pixels |
Definition at line 337 of file conductorsegment.cpp.
References canMove1stPointY(), canMove2ndPointY(), ConductorSegment(), hasNextSegment(), hasPreviousSegment(), isFirstSegment(), isHorizontal(), isLastSegment(), isStatic(), isVertical(), next_segment, point1, point2, previous_segment, setFirstPoint(), and setSecondPoint().
ConductorSegment * ConductorSegment::nextSegment | ( | ) | const |
Definition at line 428 of file conductorsegment.cpp.
References next_segment.
Referenced by setNextSegment(), setPreviousSegment(), and ~ConductorSegment().
ConductorSegment * ConductorSegment::previousSegment | ( | ) | const |
Definition at line 421 of file conductorsegment.cpp.
References previous_segment.
Referenced by Conductor::posForText(), setNextSegment(), setPreviousSegment(), and ~ConductorSegment().
QPointF ConductorSegment::secondPoint | ( | ) | const |
Definition at line 456 of file conductorsegment.cpp.
References point2.
Referenced by length().
void ConductorSegment::setFirstPoint | ( | const QPointF & | p | ) |
Permet de changer la position du premier point du segment
p | La nouvelle position du premier point |
Definition at line 464 of file conductorsegment.cpp.
References point1.
void ConductorSegment::setNextSegment | ( | ConductorSegment * | ns | ) |
Change le segment suivant
ns | Le nouveau segment suivant |
Definition at line 396 of file conductorsegment.cpp.
References hasNextSegment(), next_segment, nextSegment(), previousSegment(), and setPreviousSegment().
Referenced by ConductorSegment(), setPreviousSegment(), and ~ConductorSegment().
void ConductorSegment::setPreviousSegment | ( | ConductorSegment * | ps | ) |
Change le segment precedent
ps | Le nouveau segment precedent |
Definition at line 385 of file conductorsegment.cpp.
References hasPreviousSegment(), nextSegment(), previous_segment, previousSegment(), and setNextSegment().
Referenced by ConductorSegment(), setNextSegment(), and ~ConductorSegment().
void ConductorSegment::setSecondPoint | ( | const QPointF & | p | ) |
Permet de changer la position du second point du segment
p | La nouvelle position du second point |
Definition at line 472 of file conductorsegment.cpp.
References point2.
QET::ConductorSegmentType ConductorSegment::type | ( | ) | const |
Definition at line 514 of file conductorsegment.cpp.
References QET::Horizontal, isHorizontal(), and QET::Vertical.
|
private |
Definition at line 38 of file conductorsegment.h.
Referenced by canMove2ndPointX(), canMove2ndPointY(), hasNextSegment(), moveX(), moveY(), nextSegment(), and setNextSegment().
|
private |
Definition at line 39 of file conductorsegment.h.
Referenced by canMove1stPointX(), canMove1stPointY(), firstPoint(), isHorizontal(), isPoint(), isVertical(), middle(), moveX(), moveY(), and setFirstPoint().
|
private |
Definition at line 40 of file conductorsegment.h.
Referenced by canMove2ndPointX(), canMove2ndPointY(), isHorizontal(), isPoint(), isVertical(), middle(), moveX(), moveY(), secondPoint(), and setSecondPoint().
|
private |
Definition at line 37 of file conductorsegment.h.
Referenced by canMove1stPointX(), canMove1stPointY(), hasPreviousSegment(), moveX(), moveY(), previousSegment(), and setPreviousSegment().