QElectroTech
0.8-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. More... | |
Signals | |
void | propertiesChange () |
Public Member Functions | |
Conductor (Terminal *, Terminal *) | |
Conductor::Conductor Default constructor. More... | |
~Conductor () override | |
Conductor::~Conductor Destructor. The conductor is removed from is terminal. More... | |
bool | isValid () const |
Conductor::isValid. More... | |
int | type () const override |
type Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a conductor. More... | |
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. More... | |
QPainterPath | shape () const override |
Conductor::shape. More... | |
virtual QPainterPath | nearShape () const |
Conductor::nearShape. More... | |
qreal | length () const |
Conductor::length. More... | |
ConductorSegment * | middleSegment () |
QPointF | posForText (Qt::Orientations &flag) |
Conductor::posForText Calculate and return the better pos for text. More... | |
void | refreshText () |
Conductor::refreshText Refresh the text of this conductor. recalcule and set the text according to the formula. More... | |
void | setPath (const QPainterPath &path) |
QPainterPath | path () const |
bool | fromXml (QDomElement &) |
Conductor::fromXml Load the conductor and her information from xml element. More... | |
QDomElement | toXml (QDomDocument &, QHash< Terminal *, int > &) const |
Conductor::toXml Exporte les caracteristiques du conducteur sous forme d'une element XML. More... | |
QVector< QPointF > | handlerPoints () const |
Conductor::handlerPoints. More... | |
const QList< ConductorSegment * > | segmentsList () const |
void | setPropertyToPotential (const ConductorProperties &property, bool only_text=false) |
Conductor::setPropertiesToPotential. More... | |
void | setProperties (const ConductorProperties &property) |
Conductor::setProperties Set property as current property of conductor. More... | |
ConductorProperties | properties () const |
Conductor::properties. More... | |
void | setProfile (const ConductorProfile &, Qt::Corner) |
ConductorProfile | profile (Qt::Corner) const |
void | setProfiles (const ConductorProfilesGroup &) |
Conductor::setProfiles. More... | |
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. More... | |
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. More... | |
QETDiagramEditor * | diagramEditor () const |
Conductor::diagramEditor. More... | |
void | editProperty () |
Conductor::editProperty. More... | |
autonum::sequentialNumbers | sequenceNum () const |
autonum::sequentialNumbers & | rSequenceNum () |
void | setSequenceNum (const autonum::sequentialNumbers &sn) |
void | setFreezeLabel (bool freeze) |
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false. More... | |
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. More... | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
Conductor::mousePressEvent Manage the mouse press event. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
Conductor::mouseReleaseEvent. More... | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
Conductor::hoverEnterEvent Manage the hover enter event. More... | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
Conductor::hoverLeaveEvent Manage the mouse leave event. More... | |
QVariant | itemChange (GraphicsItemChange, const QVariant &) override |
Conductor::itemChange. More... | |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
Conductor::sceneEventFilter. More... | |
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. More... | |
void | setUpConnectionForFormula (QString old_formula, QString new_formula) |
Conductor::setUpConnectionForFormula setup connection according to the variable of formula. More... | |
void | adjusteHandlerPos () |
Conductor::adjusteHandlerPos Adjust the position of the handler item. More... | |
void | handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
Conductor::handlerMousePressEvent. More... | |
void | handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
Conductor::handlerMouseMoveEvent. More... | |
void | handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
Conductor::handlerMouseReleaseEvent. More... | |
void | addHandler () |
Conductor::addHandler Add handlers for this item. More... | |
void | removeHandler () |
Conductor::removeHandler Remove the handlers of this item. More... | |
void | segmentsToPath () |
Conductor::segmentsToPath Generate the QPainterPath from the list of points. More... | |
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 |
QList< QPointF > | junctions () const |
void | pointsToSegments (const QList< QPointF > &) |
Qt::Corner | currentPathType () const |
void | deleteSegments () |
Supprime les segments. More... | |
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=9.0) |
static Qt::Corner | movementType (const QPointF &, const QPointF &) |
static QPointF | movePointIntoPolygon (const QPointF &, const QPainterPath &) |
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. More... | |
ConductorTextItem * | m_text_item |
Text input for non simple, non-singleline conductors. More... | |
ConductorSegment * | segments |
Segments composing the conductor. More... | |
bool | m_moving_segment |
Attributs related to mouse interaction. More... | |
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. More... | |
bool | has_to_save_profile |
Whether the current profile should be saved as soon as possible. More... | |
ConductorProfilesGroup | conductor_profiles |
Highlight | must_highlight_ |
Define whether and how the conductor should be highlighted. More... | |
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. More... | |
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 is 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 |
Prolonge une borne.
terminal | Le point correspondant a la borne |
terminal_orientation | L'orientation de la borne |
ext_size | la taille de la prolongation |
|
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 |
|
private |
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 |
point | Un point situe a l'exterieur du polygone |
polygon | Le polygone dans lequel on veut rapatrier le point |
|
virtual |
|
override |
Dessine le conducteur sans antialiasing.
qp | 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 propertie 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 |
Attributs 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 |