QElectroTech  0.70
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ConductorSegment Class Reference

#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 &)
 
ConductorSegmentpreviousSegment () const
 
ConductorSegmentnextSegment () 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

ConductorSegmentprevious_segment
 
ConductorSegmentnext_segment
 
QPointF point1
 
QPointF point2
 

Detailed Description

This class represents a conductor segment.

Definition at line 25 of file conductorsegment.h.

Constructor & Destructor Documentation

◆ ConductorSegment() [1/2]

ConductorSegment::ConductorSegment ( const QPointF &  p1,
const QPointF &  p2,
ConductorSegment cs1 = nullptr,
ConductorSegment cs2 = nullptr 
)

Constructeur

Parameters
p1Le point
p2
cs1Le segment precedent
cs2Le segment suivant

Definition at line 28 of file conductorsegment.cpp.

References setNextSegment(), and setPreviousSegment().

Referenced by moveX(), and moveY().

◆ ~ConductorSegment()

ConductorSegment::~ConductorSegment ( )
virtual

Destructeur - Relie le segment precedent au suivant

Definition at line 44 of file conductorsegment.cpp.

References hasNextSegment(), hasPreviousSegment(), nextSegment(), previousSegment(), setNextSegment(), and setPreviousSegment().

◆ ConductorSegment() [2/2]

ConductorSegment::ConductorSegment ( const ConductorSegment )
private

Member Function Documentation

◆ canMove1stPointX()

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.

Parameters
asked_dxLa valeur du mouvement demande
possible_dxLa valeur du mouvement possible (au maximum)
Returns
true si le mouvement est possible ; false s'il doit etre limite

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().

◆ canMove1stPointY()

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.

Parameters
asked_dyLa valeur du mouvement demande
possible_dyLa valeur du mouvement possible (au maximum)
Returns
true si le mouvement est possible ; false s'il doit etre limite

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().

◆ canMove2ndPointX()

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.

Parameters
asked_dxLa valeur du mouvement demande
possible_dxLa valeur du mouvement possible (au maximum)
Returns
true si le mouvement est possible ; false s'il doit etre limite

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().

◆ canMove2ndPointY()

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.

Parameters
asked_dyLa valeur du mouvement demande
possible_dyLa valeur du mouvement possible (au maximum)
Returns
true si le mouvement est possible ; false s'il doit etre limite

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().

◆ firstPoint()

QPointF ConductorSegment::firstPoint ( ) const
Returns
le premier point du segment

Definition at line 449 of file conductorsegment.cpp.

References point1.

Referenced by length().

◆ hasNextSegment()

bool ConductorSegment::hasNextSegment ( ) const
Returns
true si le segment a un segment suivant, false sinon

Definition at line 486 of file conductorsegment.cpp.

References next_segment.

Referenced by canMove2ndPointX(), canMove2ndPointY(), isLastSegment(), moveX(), moveY(), setNextSegment(), and ~ConductorSegment().

◆ hasPreviousSegment()

bool ConductorSegment::hasPreviousSegment ( ) const
Returns
true si le segment a un segment precedent, false sinon

Definition at line 479 of file conductorsegment.cpp.

References previous_segment.

Referenced by canMove1stPointX(), canMove1stPointY(), isFirstSegment(), moveX(), moveY(), setPreviousSegment(), and ~ConductorSegment().

◆ isFirstSegment()

bool ConductorSegment::isFirstSegment ( ) const
Returns
true si ce segment est le premier du conducteur

Definition at line 409 of file conductorsegment.cpp.

References hasPreviousSegment().

Referenced by isStatic(), moveX(), moveY(), and Conductor::posForText().

◆ isHorizontal()

bool ConductorSegment::isHorizontal ( ) const
Returns
true si le segment est horizontal, false sinon

Definition at line 442 of file conductorsegment.cpp.

References point1, and point2.

Referenced by canMove1stPointY(), canMove2ndPointY(), length(), moveX(), moveY(), Conductor::posForText(), and type().

◆ isLastSegment()

bool ConductorSegment::isLastSegment ( ) const
Returns
true si ce segment est le dernier du conducteur

Definition at line 414 of file conductorsegment.cpp.

References hasNextSegment().

Referenced by isStatic(), moveX(), and moveY().

◆ isPoint()

bool ConductorSegment::isPoint ( ) const
Returns
true si les deux points constituant le segment sont egaux

Definition at line 519 of file conductorsegment.cpp.

References point1, and point2.

◆ isStatic()

bool ConductorSegment::isStatic ( ) const
Returns
true si ce segment est un segment statique, cad un segment relie a une borne

Definition at line 404 of file conductorsegment.cpp.

References isFirstSegment(), and isLastSegment().

Referenced by canMove1stPointX(), canMove1stPointY(), canMove2ndPointX(), canMove2ndPointY(), moveX(), and moveY().

◆ isVertical()

bool ConductorSegment::isVertical ( ) const
Returns
true si le segment est vertical, false sinon

Definition at line 435 of file conductorsegment.cpp.

References point1, and point2.

Referenced by canMove1stPointX(), canMove2ndPointX(), moveX(), and moveY().

◆ length()

qreal ConductorSegment::length ( ) const
Returns
La longueur du conducteur

Definition at line 505 of file conductorsegment.cpp.

References firstPoint(), isHorizontal(), and secondPoint().

Referenced by canMove1stPointX(), canMove1stPointY(), canMove2ndPointX(), canMove2ndPointY(), and Conductor::posForText().

◆ middle()

QPointF ConductorSegment::middle ( ) const
Returns
Le centre du rectangle delimitant le conducteur

Definition at line 493 of file conductorsegment.cpp.

References point1, and point2.

Referenced by Conductor::handlerMouseMoveEvent(), Conductor::handlerPoints(), and Conductor::posForText().

◆ moveX()

void ConductorSegment::moveX ( const qreal &  dx)

◆ moveY()

void ConductorSegment::moveY ( const qreal &  dy)

◆ nextSegment()

ConductorSegment * ConductorSegment::nextSegment ( ) const
Returns
Le segment suivant

Definition at line 428 of file conductorsegment.cpp.

References next_segment.

Referenced by setNextSegment(), setPreviousSegment(), and ~ConductorSegment().

◆ previousSegment()

ConductorSegment * ConductorSegment::previousSegment ( ) const
Returns
Le segment precedent

Definition at line 421 of file conductorsegment.cpp.

References previous_segment.

Referenced by Conductor::posForText(), setNextSegment(), setPreviousSegment(), and ~ConductorSegment().

◆ secondPoint()

QPointF ConductorSegment::secondPoint ( ) const
Returns
le second point du segment

Definition at line 456 of file conductorsegment.cpp.

References point2.

Referenced by length().

◆ setFirstPoint()

void ConductorSegment::setFirstPoint ( const QPointF &  p)

Permet de changer la position du premier point du segment

Parameters
pLa nouvelle position du premier point

Definition at line 464 of file conductorsegment.cpp.

References point1.

Referenced by moveX(), and moveY().

◆ setNextSegment()

void ConductorSegment::setNextSegment ( ConductorSegment ns)

Change le segment suivant

Parameters
nsLe 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().

◆ setPreviousSegment()

void ConductorSegment::setPreviousSegment ( ConductorSegment ps)

Change le segment precedent

Parameters
psLe 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().

◆ setSecondPoint()

void ConductorSegment::setSecondPoint ( const QPointF &  p)

Permet de changer la position du second point du segment

Parameters
pLa nouvelle position du second point

Definition at line 472 of file conductorsegment.cpp.

References point2.

Referenced by moveX(), and moveY().

◆ type()

QET::ConductorSegmentType ConductorSegment::type ( ) const
Returns
QET::Horizontal si le segment est horizontal, QET::Vertical sinon

Definition at line 514 of file conductorsegment.cpp.

References QET::Horizontal, isHorizontal(), and QET::Vertical.

Member Data Documentation

◆ next_segment

ConductorSegment* ConductorSegment::next_segment
private

◆ point1

QPointF ConductorSegment::point1
private

◆ point2

QPointF ConductorSegment::point2
private

◆ previous_segment

ConductorSegment* ConductorSegment::previous_segment
private

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