QElectroTech 0.100.0-dev
|
#include <conductor.h>
Inherits QGraphicsObject.
Public Types | |
enum | { Type = UserType + 1001 } |
enum | Highlight { None , Normal , Alert } |
Public Slots | |
void | displayedTextChanged () |
Conductor::displayedTextChanged Update the properties (text) of this conductor and other conductors at the same potential of this conductor. | |
Signals | |
void | propertiesChange () |
Public Member Functions | |
Conductor (Terminal *, Terminal *) | |
Conductor::Conductor Default constructor. | |
~Conductor () override | |
Conductor::~Conductor Destructor. The conductor is removed from its terminal. | |
bool | isValid () const |
Conductor::isValid. | |
int | type () const override |
type Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a conductor. | |
Diagram * | diagram () const |
ConductorTextItem * | textItem () const |
void | updatePath (const QRectF &=QRectF()) |
void | updatePathAnimate (const int=1) |
int | fakePath () |
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
QRectF | boundingRect () const override |
Conductor::boundingRect. | |
QPainterPath | shape () const override |
Conductor::shape. | |
virtual QPainterPath | nearShape () const |
Conductor::nearShape. | |
qreal | length () const |
Conductor::length. | |
ConductorSegment * | middleSegment () |
QPointF | posForText (Qt::Orientations &flag) |
Conductor::posForText Calculate and return the better pos for text. | |
void | refreshText () |
Conductor::refreshText Refresh the text of this conductor. recalcule and set the text according to the formula. | |
void | setPath (const QPainterPath &path) |
QPainterPath | path () const |
bool | fromXml (QDomElement &) |
Conductor::fromXml Load the conductor and her information from xml element. | |
QDomElement | toXml (QDomDocument &, QHash< Terminal *, int > &) const |
Conductor::toXml Exporte les caracteristiques du conducteur sous forme d'une element XML. | |
QVector< QPointF > | handlerPoints () const |
Conductor::handlerPoints. | |
const QList< ConductorSegment * > | segmentsList () const |
void | setPropertyToPotential (const ConductorProperties &property, bool only_text=false) |
Conductor::setPropertiesToPotential. | |
void | setProperties (const ConductorProperties &property) |
Conductor::setProperties Set property as current property of conductor. | |
ConductorProperties | properties () const |
Conductor::properties. | |
void | setProfile (const ConductorProfile &, Qt::Corner) |
ConductorProfile | profile (Qt::Corner) const |
void | setProfiles (const ConductorProfilesGroup &) |
Conductor::setProfiles. | |
ConductorProfilesGroup | profiles () const |
void | calculateTextItemPosition () |
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizontal) otherwise, move conductor at the middle of the longest segment of conductor. If text was moved by user, this function do nothing, except check if text is near conductor. | |
virtual Highlight | highlight () const |
virtual void | setHighlighted (Highlight) |
QSet< Conductor * > | relatedPotentialConductors (const bool all_diagram=true, QList< Terminal * > *t_list=nullptr) |
Conductor::relatedPotentialConductors Return all conductors at the same potential of this conductor, this conductor isn't part of the returned QSet. | |
QETDiagramEditor * | diagramEditor () const |
Conductor::diagramEditor. | |
void | editProperty () |
Conductor::editProperty. | |
autonum::sequentialNumbers | sequenceNum () const |
autonum::sequentialNumbers & | rSequenceNum () |
void | setSequenceNum (const autonum::sequentialNumbers &sn) |
QList< QPointF > | junctions () const |
void | setFreezeLabel (bool freeze) |
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false. | |
Static Public Member Functions | |
static bool | valideXml (QDomElement &) |
Public Attributes | |
Terminal * | terminal1 |
Terminal * | terminal2 |
Protected Member Functions | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
Conductor::mouseDoubleClickEvent Manage the mouse double click. | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
Conductor::mousePressEvent Manage the mouse press event. | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
Conductor::mouseReleaseEvent. | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
Conductor::hoverEnterEvent Manage the hover enter event. | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
Conductor::hoverLeaveEvent Manage the mouse leave event. | |
QVariant | itemChange (GraphicsItemChange, const QVariant &) override |
Conductor::itemChange. | |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
Conductor::sceneEventFilter. | |
Properties | |
QPointF | pos |
int | animPath |
ConductorProperties | properties |
autonum::sequentialNumbers | sequenceNum |
Private Member Functions | |
Conductor (const Conductor &) | |
bool | pathFromXml (const QDomElement &) |
Conductor::pathFromXml Generate the path (of the line) from xml file by checking the segments in the xml file. | |
void | setUpConnectionForFormula (QString old_formula, QString new_formula) |
Conductor::setUpConnectionForFormula setup connection according to the variable of formula. | |
void | adjusteHandlerPos () |
Conductor::adjusteHandlerPos Adjust the position of the handler item. | |
void | handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
Conductor::handlerMousePressEvent. | |
void | handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
Conductor::handlerMouseMoveEvent. | |
void | handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
Conductor::handlerMouseReleaseEvent. | |
void | addHandler () |
Conductor::addHandler Add handlers for this item. | |
void | removeHandler () |
Conductor::removeHandler Remove the handlers of this item. | |
void | segmentsToPath () |
Conductor::segmentsToPath Generate the QPainterPath from the list of points. | |
void | saveProfile (bool=true) |
void | generateConductorPath (const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation) |
void | updateConductorPath (const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation) |
uint | segmentsCount (QET::ConductorSegmentType=QET::Both) const |
QList< QPointF > | segmentsToPoints () const |
QList< ConductorBend > | bends () const |
void | pointsToSegments (const QList< QPointF > &) |
Qt::Corner | currentPathType () const |
void | deleteSegments () |
Supprime les segments. | |
QHash< ConductorSegmentProfile *, qreal > | shareOffsetBetweenSegments (const qreal &offset, const QList< ConductorSegmentProfile * > &, const qreal &=0.01) const |
Static Private Member Functions | |
static int | getCoeff (const qreal &, const qreal &) |
static int | getSign (const qreal &) |
static QPointF | extendTerminal (const QPointF &, Qet::Orientation, qreal=10) |
Conductor::extendTerminal. | |
static Qt::Corner | movementType (const QPointF &, const QPointF &) |
static QPointF | movePointIntoPolygon (const QPointF &, const QPainterPath &) |
Conductor::movePointIntoPolygon. | |
Private Attributes | |
autonum::sequentialNumbers | m_autoNum_seq |
QVector< QetGraphicsHandlerItem * > | m_handler_vector |
int | m_vector_index = -1 |
bool | m_mouse_over |
ConductorProperties | m_properties |
Functional properties. | |
ConductorTextItem * | m_text_item |
Text input for non simple, non-singleline conductors. | |
ConductorSegment * | segments |
Segments composing the conductor. | |
bool | m_moving_segment |
Attributes related to mouse interaction. | |
int | moved_point |
qreal | m_previous_z_value |
ConductorSegment * | m_moved_segment |
QPointF | before_mov_text_pos_ |
bool | modified_path |
Whether the conductor was manually modified by users. | |
bool | has_to_save_profile |
Whether the current profile should be saved as soon as possible. | |
ConductorProfilesGroup | conductor_profiles |
Highlight | must_highlight_ |
Define whether and how the conductor should be highlighted. | |
bool | m_valid |
bool | m_freeze_label = false |
QPainterPath | m_path |
Static Private Attributes | |
static QPen | conductor_pen = QPen() |
QPen et QBrush objects used to draw conductors. | |
static QBrush | conductor_brush = QBrush() |
static bool | pen_and_brush_initialized = false |
This class represents a conductor, i.e. a wire between two element terminals.
enum Conductor::Highlight |
Conductor::Conductor Default constructor.
p1 | : first terminal of this conductor. |
p2 | : second terminal of this conductor. |
|
override |
Conductor::~Conductor Destructor. The conductor is removed from its terminal.
|
private |
|
private |
Conductor::addHandler Add handlers for this item.
|
private |
Conductor::adjusteHandlerPos Adjust the position of the handler item.
|
private |
|
override |
void Conductor::calculateTextItemPosition | ( | ) |
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizontal) otherwise, move conductor at the middle of the longest segment of conductor. If text was moved by user, this function do nothing, except check if text is near conductor.
|
private |
|
private |
Supprime les segments.
Diagram * Conductor::diagram | ( | ) | const |
QETDiagramEditor * Conductor::diagramEditor | ( | ) | const |
|
slot |
Conductor::displayedTextChanged Update the properties (text) of this conductor and other conductors at the same potential of this conductor.
void Conductor::editProperty | ( | ) |
|
staticprivate |
terminal | : point to extend (must be the docking point of a terminal) |
terminal_orientation | : the orientation of the terminal |
ext_size | : how many to extrend (10 by default) |
|
inline |
bool Conductor::fromXml | ( | QDomElement & | dom_element | ) |
Conductor::fromXml Load the conductor and her information from xml element.
dom_element |
|
private |
Calcule un trajet "par defaut" pour le conducteur
p1 | Coordonnees du point d'amarrage de la borne 1 |
o1 | Orientation de la borne 1 |
p2 | Coordonnees du point d'amarrage de la borne 2 |
o2 | Orientation de la borne 2 |
|
staticprivate |
value1 | Premiere valeur |
value2 | Deuxieme valeur |
|
staticprivate |
value | valeur |
|
private |
Conductor::handlerMouseMoveEvent.
qghi | |
event |
|
private |
Conductor::handlerMousePressEvent.
qghi | |
event |
|
private |
Conductor::handlerMouseReleaseEvent.
qghi | |
event |
QVector< QPointF > Conductor::handlerPoints | ( | ) | const |
|
virtual |
|
overrideprotected |
Conductor::hoverEnterEvent Manage the hover enter event.
event |
|
overrideprotected |
Conductor::hoverLeaveEvent Manage the mouse leave event.
event |
bool Conductor::isValid | ( | ) | const |
|
overrideprotected |
QList< QPointF > Conductor::junctions | ( | ) | const |
qreal Conductor::length | ( | ) | const |
ConductorSegment * Conductor::middleSegment | ( | ) |
|
overrideprotected |
Conductor::mouseDoubleClickEvent Manage the mouse double click.
event |
|
overrideprotected |
Conductor::mousePressEvent Manage the mouse press event.
event |
|
overrideprotected |
event |
|
staticprivate |
start | Point de depart |
end | Point d'arrivee |
|
staticprivate |
Conductor::movePointIntoPolygon.
point | : A point located outside the polygon |
polygon | : The polygon in which we want to move the point |
|
virtual |
|
override |
Dessine le conducteur sans antialiasing.
painter | Le QPainter a utiliser pour dessiner le conducteur |
options | Les options de style pour le conducteur |
qw | Le QWidget sur lequel on dessine |
QPainterPath Conductor::path | ( | ) | const |
|
private |
Conductor::pathFromXml Generate the path (of the line) from xml file by checking the segments in the xml file.
e |
|
private |
Regenere les segments de ce conducteur a partir de la liste de points passee en parametre
points_list | Liste de points a utiliser pour generer les segments |
QPointF Conductor::posForText | ( | Qt::Orientations & | flag | ) |
Conductor::posForText Calculate and return the better pos for text.
flag | : flag is used to know if text pos is near of a vertical or horizontal conductor segment. |
ConductorProfile Conductor::profile | ( | Qt::Corner | path_type | ) | const |
ConductorProfilesGroup Conductor::profiles | ( | ) | const |
ConductorProperties Conductor::properties | ( | ) | const |
|
signal |
void Conductor::refreshText | ( | ) |
Conductor::refreshText Refresh the text of this conductor. recalcule and set the text according to the formula.
QSet< Conductor * > Conductor::relatedPotentialConductors | ( | const bool | all_diagram = true , |
QList< Terminal * > * | t_list = nullptr |
||
) |
Conductor::relatedPotentialConductors Return all conductors at the same potential of this conductor, this conductor isn't part of the returned QSet.
all_diagram | : if true search in all diagram of the project, false search only in the parent diagram of this conductor |
t_list | : a list of terminal already found for this potential. |
|
private |
Conductor::removeHandler Remove the handlers of this item.
|
inline |
|
private |
Sauvegarde le profil courant du conducteur pour l'utiliser ulterieurement dans priv_modifieConductor.
|
overrideprotected |
watched | |
event |
|
private |
type | Type de Segments |
const QList< ConductorSegment * > Conductor::segmentsList | ( | ) | const |
|
private |
Conductor::segmentsToPath Generate the QPainterPath from the list of points.
|
private |
Genere une liste de points a partir des segments de ce conducteur
|
inline |
void Conductor::setFreezeLabel | ( | bool | freeze | ) |
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false.
freeze |
|
virtual |
hl | true pour mettre le conducteur en evidence, false sinon |
void Conductor::setPath | ( | const QPainterPath & | path | ) |
void Conductor::setProfile | ( | const ConductorProfile & | cp, |
Qt::Corner | path_type | ||
) |
Applique un nouveau profil a ce conducteur
cp | Profil a appliquer a ce conducteur |
path_type | Type de trajet pour lequel ce profil convient |
void Conductor::setProfiles | ( | const ConductorProfilesGroup & | cpg | ) |
cpg | : the new profils of conductor |
void Conductor::setProperties | ( | const ConductorProperties & | property | ) |
Conductor::setProperties Set property as current property of conductor.
property | : properties |
void Conductor::setPropertyToPotential | ( | const ConductorProperties & | property, |
bool | only_text = false |
||
) |
Conductor::setPropertiesToPotential.
property | |
only_text | Set property to conductor and every conductors in the same potential of conductor. If only_text is true only formula, text, function and tension/protocol is set to other conductor in the same potential, the other values of property stay unmodified |
void Conductor::setSequenceNum | ( | const autonum::sequentialNumbers & | sn | ) |
|
private |
Conductor::setUpConnectionForFormula setup connection according to the variable of formula.
old_formula | |
new_formula |
|
override |
|
private |
offset | Longueur a repartir entre les segments |
segments_list | Segments sur lesquels il faut repartir la longueur |
precision | seuil en-deca duquel on considere qu'il ne reste rien a repartir |
ConductorTextItem * Conductor::textItem | ( | ) | const |
4
QDomElement Conductor::toXml | ( | QDomDocument & | dom_document, |
QHash< Terminal *, int > & | table_adr_id | ||
) | const |
Conductor::toXml Exporte les caracteristiques du conducteur sous forme d'une element XML.
dom_document | : Le document XML a utiliser pour creer l'element XML |
table_adr_id | : Hash stockant les correspondances entre les ids des bornes dans le document XML et leur adresse en memoire |
|
inlineoverride |
type Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a conductor.
|
private |
Gere les updates
p1 | Coordonnees du point d'amarrage de la borne 1 |
o1 | Orientation de la borne 1 |
p2 | Coordonnees du point d'amarrage de la borne 2 |
o2 | Orientation de la borne 2 |
void Conductor::updatePath | ( | const QRectF & | rect = QRectF() | ) |
Met a jour la representation graphique du conducteur en recalculant son trace. Cette fonction est typiquement appelee lorsqu'une seule des bornes du conducteur a change de position.
rect | Rectangle a mettre a jour |
|
inline |
|
static |
Methode de validation d'element XML
e | Un element XML sense represente un Conducteur |
|
private |
|
staticprivate |
|
staticprivate |
QPen et QBrush objects used to draw conductors.
|
private |
conductor profile: "photography" of what the conductor is supposed to look like - there is one profile per kind of traject
|
private |
Whether the current profile should be saved as soon as possible.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Attributes related to mouse interaction.
|
private |
|
private |
|
private |
Functional properties.
|
private |
Text input for non simple, non-singleline conductors.
|
private |
|
private |
|
private |
Whether the conductor was manually modified by users.
|
private |
|
private |
Define whether and how the conductor should be highlighted.
|
staticprivate |
|
private |
Segments composing the conductor.
Terminal* Conductor::terminal1 |
Terminal* Conductor::terminal2 |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |