QElectroTech  0.70
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Properties | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Conductor Class Reference

#include <conductor.h>

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
 
Diagramdiagram () const
 
ConductorTextItemtextItem () 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...
 
ConductorSegmentmiddleSegment ()
 
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
 
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)
 
ConductorProperties properties () const
 
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...
 
QETDiagramEditordiagramEditor () const
 Conductor::diagramEditor. More...
 
void editProperty ()
 Conductor::editProperty. More...
 
autonum::sequentialNumbers sequenceNum () const
 
autonum::sequentialNumbersrSequenceNum ()
 
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

Terminalterminal1
 
Terminalterminal2
 

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
 Conductor::properties. More...
 
autonum::sequentialNumbers sequenceNum
 

Private Member Functions

 Conductor (const Conductor &)
 
bool pathFromXml (const QDomElement &)
 Conductor::pathFromXml Generate the path from 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< ConductorBendbends () 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...
 
ConductorTextItemm_text_item
 Text input for non simple, non-singleline conductors. More...
 
ConductorSegmentsegments
 Segments composing the conductor. More...
 
bool m_moving_segment
 Attributs related to mouse interaction. More...
 
int moved_point
 
qreal m_previous_z_value
 
ConductorSegmentm_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
 

Detailed Description

This class represents a conductor, i.e. a wire between two element terminals.

Definition at line 42 of file conductor.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 64 of file conductor.h.

◆ Highlight

Enumerator
None 
Normal 
Alert 

Definition at line 65 of file conductor.h.

Constructor & Destructor Documentation

◆ Conductor() [1/2]

Conductor::Conductor ( Terminal p1,
Terminal p2 
)

◆ ~Conductor()

Conductor::~Conductor ( )
override

Conductor::~Conductor Destructor. The conductor is removed from is terminal.

Definition at line 135 of file conductor.cpp.

References deleteSegments(), Terminal::removeConductor(), removeHandler(), terminal1, and terminal2.

◆ Conductor() [2/2]

Conductor::Conductor ( const Conductor )
private

Member Function Documentation

◆ addHandler()

void Conductor::addHandler ( )
private

◆ adjusteHandlerPos()

void Conductor::adjusteHandlerPos ( )
private

Conductor::adjusteHandlerPos Adjust the position of the handler item.

Definition at line 737 of file conductor.cpp.

References handlerPoints(), and m_handler_vector.

Referenced by itemChange(), and segmentsToPath().

◆ bends()

QList< ConductorBend > Conductor::bends ( ) const
private
Returns
la liste des bifurcations de ce conducteur ; ConductorBend est un typedef pour une QPair<QPointF, Qt::Corner>. Le point indique la position (en coordonnees locales) de la bifurcation tandis que le Corner indique le type de bifurcation.

Definition at line 1794 of file conductor.cpp.

References length(), segments, QET::Icons::sl, and type().

Referenced by junctions().

◆ boundingRect()

QRectF Conductor::boundingRect ( ) const
override

Conductor::boundingRect.

Returns

Definition at line 862 of file conductor.cpp.

References QET::Icons::br, and shape().

Referenced by calculateTextItemPosition(), and ConductorTextItem::setPos().

◆ calculateTextItemPosition()

void Conductor::calculateTextItemPosition ( )

◆ currentPathType()

Qt::Corner Conductor::currentPathType ( ) const
private
Returns
le type de trajet actuel de ce conducteur

Definition at line 1862 of file conductor.cpp.

References movementType(), terminal1, and terminal2.

Referenced by saveProfile(), setProfile(), setProfiles(), updateConductorPath(), and updatePath().

◆ deleteSegments()

void Conductor::deleteSegments ( )
private

Supprime les segments.

Definition at line 1890 of file conductor.cpp.

References segments.

Referenced by pointsToSegments(), and ~Conductor().

◆ diagram()

Diagram * Conductor::diagram ( ) const

◆ diagramEditor()

QETDiagramEditor * Conductor::diagramEditor ( ) const

Conductor::diagramEditor.

Returns
The parent diagram editor or nullptr;

Definition at line 1654 of file conductor.cpp.

References diagram().

Referenced by editProperty(), and ConductorAutoNumerotation::numeratePotential().

◆ displayedTextChanged

void Conductor::displayedTextChanged ( )
slot

Conductor::displayedTextChanged Update the properties (text) of this conductor and other conductors at the same potential of this conductor.

Definition at line 1562 of file conductor.cpp.

References diagram(), ConductorProperties::m_formula, m_properties, m_text_item, properties, relatedPotentialConductors(), ConductorProperties::text, QET::Icons::tr, and Diagram::undoStack().

Referenced by Conductor().

◆ editProperty()

void Conductor::editProperty ( )

◆ extendTerminal()

QPointF Conductor::extendTerminal ( const QPointF &  terminal,
Qet::Orientation  terminal_orientation,
qreal  ext_size = 9.0 
)
staticprivate

Prolonge une borne.

Parameters
terminalLe point correspondant a la borne
terminal_orientationL'orientation de la borne
ext_sizela taille de la prolongation
Returns
le point correspondant a la borne apres prolongation

Definition at line 447 of file conductor.cpp.

References Qet::East, Qet::North, Qet::South, and Qet::West.

Referenced by generateConductorPath().

◆ fakePath()

int Conductor::fakePath ( )
inline

Definition at line 83 of file conductor.h.

◆ fromXml()

bool Conductor::fromXml ( QDomElement &  dom_element)

Conductor::fromXml Load the conductor and her information from xml element.

Parameters
e
Returns
true is loading success else return false

Definition at line 960 of file conductor.cpp.

References autonum::sequentialNumbers::fromXml(), ConductorProperties::fromXml(), ConductorXmlRetroCompatibility::loadSequential(), m_autoNum_seq, m_freeze_label, m_text_item, pathFromXml(), and setProperties().

◆ generateConductorPath()

void Conductor::generateConductorPath ( const QPointF &  p1,
Qet::Orientation  o1,
const QPointF &  p2,
Qet::Orientation  o2 
)
private

Calcule un trajet "par defaut" pour le conducteur

Parameters
p1Coordonnees du point d'amarrage de la borne 1
o1Orientation de la borne 1
p2Coordonnees du point d'amarrage de la borne 2
o2Orientation de la borne 2

Definition at line 344 of file conductor.cpp.

References Qet::East, extendTerminal(), Qet::North, pointsToSegments(), segmentsToPath(), Qet::South, Qet::West, Diagram::xGrid, and Diagram::yGrid.

Referenced by Conductor(), pathFromXml(), setProfile(), setProfiles(), and updatePath().

◆ getCoeff()

int Conductor::getCoeff ( const qreal &  value1,
const qreal &  value2 
)
staticprivate
Parameters
value1Premiere valeur
value2Deuxieme valeur
Returns
1 si les deux valeurs sont de meme signe, -1 sinon

Definition at line 1371 of file conductor.cpp.

References getSign().

Referenced by updateConductorPath().

◆ getSign()

int Conductor::getSign ( const qreal &  value)
staticprivate
Parameters
valuevaleur
Returns
1 si valeur est negatif, 1 s'il est positif ou nul

Definition at line 1379 of file conductor.cpp.

Referenced by getCoeff(), shareOffsetBetweenSegments(), and updateConductorPath().

◆ handlerMouseMoveEvent()

void Conductor::handlerMouseMoveEvent ( QetGraphicsHandlerItem qghi,
QGraphicsSceneMouseEvent *  event 
)
private

◆ handlerMousePressEvent()

void Conductor::handlerMousePressEvent ( QetGraphicsHandlerItem qghi,
QGraphicsSceneMouseEvent *  event 
)
private

◆ handlerMouseReleaseEvent()

void Conductor::handlerMouseReleaseEvent ( QetGraphicsHandlerItem qghi,
QGraphicsSceneMouseEvent *  event 
)
private

◆ handlerPoints()

QVector< QPointF > Conductor::handlerPoints ( ) const

Conductor::handlerPoints.

Returns
The points used to draw the handler square, used to modify the path of the conductor. The points stored in the QVector are the middle point of each segments that compose the conductor, at exception of the first and last segment because there just here to extend the terminal.

Definition at line 1116 of file conductor.cpp.

References ConductorSegment::middle(), segmentsList(), and QET::Icons::sl.

Referenced by addHandler(), adjusteHandlerPos(), and segmentsToPath().

◆ highlight()

Conductor::Highlight Conductor::highlight ( ) const
virtual
Returns
true si le conducteur est mis en evidence

Definition at line 1545 of file conductor.cpp.

References must_highlight_.

◆ hoverEnterEvent()

void Conductor::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

Conductor::hoverEnterEvent Manage the hover enter event.

Parameters
event

Definition at line 630 of file conductor.cpp.

References m_mouse_over.

◆ hoverLeaveEvent()

void Conductor::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

Conductor::hoverLeaveEvent Manage the mouse leave event.

Parameters
event

Definition at line 641 of file conductor.cpp.

References m_mouse_over.

◆ isValid()

bool Conductor::isValid ( ) const

Conductor::isValid.

Returns
true if conductor is valid else false; A non valid conductor, is a conductor without two terminal

Definition at line 148 of file conductor.cpp.

References m_valid.

Referenced by Diagram::fromXml().

◆ itemChange()

QVariant Conductor::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overrideprotected

Conductor::itemChange.

Parameters
change
value
Returns

Definition at line 653 of file conductor.cpp.

References addHandler(), adjusteHandlerPos(), calculateTextItemPosition(), m_previous_z_value, and removeHandler().

◆ junctions()

QList< QPointF > Conductor::junctions ( ) const
private
Returns
la liste des positions des jonctions avec d'autres conducteurs

Definition at line 1724 of file conductor.cpp.

References bends(), isContained(), relatedConductors(), segmentsList(), and segmentsToPoints().

Referenced by paint().

◆ length()

qreal Conductor::length ( ) const

Conductor::length.

Returns
the length of this conductor

Definition at line 1152 of file conductor.cpp.

References path().

Referenced by bends(), longuestConductorInPotential(), middleSegment(), movePointIntoPolygon(), posForText(), shareOffsetBetweenSegments(), and toXml().

◆ middleSegment()

ConductorSegment * Conductor::middleSegment ( )
Returns
Le segment qui contient le point au milieu du conducteur

Definition at line 1159 of file conductor.cpp.

References length(), and segments.

Referenced by paint().

◆ mouseDoubleClickEvent()

void Conductor::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Conductor::mouseDoubleClickEvent Manage the mouse double click.

Parameters
event

Definition at line 597 of file conductor.cpp.

References editProperty().

◆ mousePressEvent()

void Conductor::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Conductor::mousePressEvent Manage the mouse press event.

Parameters
event

Definition at line 607 of file conductor.cpp.

◆ mouseReleaseEvent()

void Conductor::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Conductor::mouseReleaseEvent.

Parameters
event

Definition at line 619 of file conductor.cpp.

◆ movementType()

Qt::Corner Conductor::movementType ( const QPointF &  start,
const QPointF &  end 
)
staticprivate
Parameters
startPoint de depart
endPoint d'arrivee
Returns
le coin vers lequel se dirige le trajet de start vers end

Definition at line 1851 of file conductor.cpp.

Referenced by currentPathType().

◆ movePointIntoPolygon()

QPointF Conductor::movePointIntoPolygon ( const QPointF &  point,
const QPainterPath &  polygon 
)
staticprivate
Parameters
pointUn point situe a l'exterieur du polygone
polygonLe polygone dans lequel on veut rapatrier le point
Returns
la position du point, une fois ramene dans le polygone, ou plus exactement sur le bord du polygone

Definition at line 1904 of file conductor.cpp.

References length(), and QET::orthogonalProjection().

Referenced by calculateTextItemPosition().

◆ nearShape()

QPainterPath Conductor::nearShape ( ) const
virtual

Conductor::nearShape.

Returns
: An area in which it is considered a point is near this conductor.

Definition at line 888 of file conductor.cpp.

References conductor_pen, and path().

Referenced by calculateTextItemPosition(), and ConductorTextItem::mouseMoveEvent().

◆ paint()

void Conductor::paint ( QPainter *  qp,
const QStyleOptionGraphicsItem *  options,
QWidget *  qw 
)
override

◆ path()

QPainterPath Conductor::path ( ) const

Definition at line 1454 of file conductor.cpp.

References m_path.

Referenced by length(), nearShape(), paint(), segmentsToPath(), setPath(), and shape().

◆ pathFromXml()

bool Conductor::pathFromXml ( const QDomElement &  e)
private

Conductor::pathFromXml Generate the path from xml file.

Parameters
e
Returns
true if generate path success else return false

Definition at line 1038 of file conductor.cpp.

References generateConductorPath(), modified_path, pointsToSegments(), saveProfile(), segmentsToPath(), terminal1, and terminal2.

Referenced by fromXml().

◆ pointsToSegments()

void Conductor::pointsToSegments ( const QList< QPointF > &  points_list)
private

Regenere les segments de ce conducteur a partir de la liste de points passee en parametre

Parameters
points_listListe de points a utiliser pour generer les segments

Definition at line 942 of file conductor.cpp.

References deleteSegments(), and segments.

Referenced by generateConductorPath(), pathFromXml(), and updateConductorPath().

◆ posForText()

QPointF Conductor::posForText ( Qt::Orientations &  flag)

Conductor::posForText Calculate and return the better pos for text.

Parameters
flag: flag is used to know if text pos is near of a vertical or horizontal conductor segment.

Definition at line 1182 of file conductor.cpp.

References QET::Horizontal, ConductorSegment::isFirstSegment(), ConductorSegment::isHorizontal(), ConductorSegment::length(), length(), ConductorSegment::middle(), ConductorSegment::previousSegment(), segments, and QET::Vertical.

Referenced by calculateTextItemPosition().

◆ profile()

ConductorProfile Conductor::profile ( Qt::Corner  path_type) const
Returns
le profil de ce conducteur

Definition at line 1406 of file conductor.cpp.

References conductor_profiles.

◆ profiles()

ConductorProfilesGroup Conductor::profiles ( ) const
Returns
les profils de ce conducteur

Definition at line 1867 of file conductor.cpp.

References conductor_profiles.

◆ properties()

ConductorProperties Conductor::properties ( ) const

Referenced by setProfiles().

◆ propertiesChange

void Conductor::propertiesChange ( )
signal

◆ refreshText()

void Conductor::refreshText ( )

◆ relatedPotentialConductors()

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.

Parameters
all_diagram: if true search in all diagram of the project, false search only in the parent diagram of this conductor
t_list,alist of terminal already found for this potential.
Returns
a QSet of conductor at the same potential.

Definition at line 1603 of file conductor.cpp.

References Terminal::conductors(), relatedPotentialTerminal(), terminal1, and terminal2.

Referenced by calculateTextItemPosition(), displayedTextChanged(), ConductorCreator::existingPotential(), NewConductorPotentialSelector::getPotential(), longuestConductorInPotential(), Terminal::mouseReleaseEvent(), PotentialSelectorDialog::on_buttonBox_accepted(), DiagramContent::operator+=(), ConductorPropertiesDialog::PropertiesDialog(), and setPropertyToPotential().

◆ removeHandler()

void Conductor::removeHandler ( )
private

Conductor::removeHandler Remove the handlers of this item.

Definition at line 849 of file conductor.cpp.

References m_handler_vector.

Referenced by handlerMouseReleaseEvent(), itemChange(), segmentsToPath(), and ~Conductor().

◆ rSequenceNum()

autonum::sequentialNumbers& Conductor::rSequenceNum ( )
inline

◆ saveProfile()

void Conductor::saveProfile ( bool  undo = true)
private

Sauvegarde le profil courant du conducteur pour l'utiliser ulterieurement dans priv_modifieConductor.

Definition at line 1349 of file conductor.cpp.

References before_mov_text_pos_, conductor_profiles, currentPathType(), diagram(), m_text_item, and pos.

Referenced by handlerMouseReleaseEvent(), and pathFromXml().

◆ sceneEventFilter()

bool Conductor::sceneEventFilter ( QGraphicsItem *  watched,
QEvent *  event 
)
overrideprotected

◆ segmentsCount()

uint Conductor::segmentsCount ( QET::ConductorSegmentType  type = QET::Both) const
private
Parameters
typeType de Segments
Returns
Le nombre de segments composant le conducteur.

Definition at line 900 of file conductor.cpp.

References QET::Both, segmentsList(), and type().

Referenced by updatePath().

◆ segmentsList()

const QList< ConductorSegment * > Conductor::segmentsList ( ) const
Returns
les segments de ce conducteur

Definition at line 1134 of file conductor.cpp.

References segments.

Referenced by handlerMousePressEvent(), handlerPoints(), junctions(), segmentsCount(), and toXml().

◆ segmentsToPath()

void Conductor::segmentsToPath ( )
private

◆ segmentsToPoints()

QList< QPointF > Conductor::segmentsToPoints ( ) const
private

Genere une liste de points a partir des segments de ce conducteur

Returns
La liste de points representant ce conducteur

Definition at line 914 of file conductor.cpp.

References segments.

Referenced by junctions().

◆ sequenceNum()

autonum::sequentialNumbers Conductor::sequenceNum ( ) const
inline

Definition at line 122 of file conductor.h.

References m_autoNum_seq.

◆ setFreezeLabel()

void Conductor::setFreezeLabel ( bool  freeze)

Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false.

Parameters
freeze

Definition at line 1985 of file conductor.cpp.

References ConductorProperties::m_formula, m_freeze_label, m_properties, and setUpConnectionForFormula().

Referenced by Diagram::freezeConductors(), and MultiPasteDialog::on_m_button_box_accepted().

◆ setHighlighted()

void Conductor::setHighlighted ( Conductor::Highlight  hl)
virtual
Parameters
hltrue pour mettre le conducteur en evidence, false sinon

Definition at line 1552 of file conductor.cpp.

References must_highlight_.

◆ setPath()

void Conductor::setPath ( const QPainterPath &  path)

Definition at line 1444 of file conductor.cpp.

References m_path, and path().

Referenced by segmentsToPath().

◆ setProfile()

void Conductor::setProfile ( const ConductorProfile cp,
Qt::Corner  path_type 
)

Applique un nouveau profil a ce conducteur

Parameters
cpProfil a appliquer a ce conducteur
path_typeType de trajet pour lequel ce profil convient

Definition at line 1388 of file conductor.cpp.

References calculateTextItemPosition(), conductor_profiles, currentPathType(), generateConductorPath(), modified_path, ConductorProperties::Multi, terminal1, terminal2, type(), and updateConductorPath().

◆ setProfiles()

void Conductor::setProfiles ( const ConductorProfilesGroup cpg)

◆ setProperties()

void Conductor::setProperties ( const ConductorProperties property)

◆ setPropertyToPotential()

void Conductor::setPropertyToPotential ( const ConductorProperties property,
bool  only_text = false 
)

Conductor::setPropertiesToPotential.

Parameters
properties
only_textSet to conductor and every conductors in the same potential of . If 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

Definition at line 1467 of file conductor.cpp.

References ConductorProperties::m_formula, ConductorProperties::m_function, m_properties, ConductorProperties::m_tension_protocol, properties, relatedPotentialConductors(), setProperties(), and ConductorProperties::text.

◆ setSequenceNum()

void Conductor::setSequenceNum ( const autonum::sequentialNumbers sn)

Definition at line 1672 of file conductor.cpp.

References m_autoNum_seq, and refreshText().

Referenced by ConductorCreator::ConductorCreator().

◆ setUpConnectionForFormula()

void Conductor::setUpConnectionForFormula ( QString  old_formula,
QString  new_formula 
)
private

Conductor::setUpConnectionForFormula setup connection according to the variable of formula.

Parameters
old_formula
new_formula

Definition at line 1684 of file conductor.cpp.

References diagram(), m_freeze_label, Diagram::project(), QETProject::projectDiagramsOrderChanged(), and refreshText().

Referenced by setFreezeLabel(), and setProperties().

◆ shape()

QPainterPath Conductor::shape ( ) const
override

Conductor::shape.

Returns
the shape of conductor. The shape thickness is bigger when conductor is hovered

Definition at line 873 of file conductor.cpp.

References conductor_pen, m_mouse_over, and path().

Referenced by boundingRect().

◆ shareOffsetBetweenSegments()

QHash< ConductorSegmentProfile *, qreal > Conductor::shareOffsetBetweenSegments ( const qreal &  offset,
const QList< ConductorSegmentProfile *> &  segments_list,
const qreal &  precision = 0.01 
) const
private
Parameters
offsetLongueur a repartir entre les segments
segments_listSegments sur lesquels il faut repartir la longueur
precisionseuil en-deca duquel on considere qu'il ne reste rien a repartir

Definition at line 285 of file conductor.cpp.

References getSign(), and length().

Referenced by updateConductorPath().

◆ textItem()

ConductorTextItem * Conductor::textItem ( ) const

4

Returns
le champ de texte associe a ce conducteur

Definition at line 564 of file conductor.cpp.

References m_text_item.

Referenced by calculateTextItemPosition().

◆ toXml()

QDomElement Conductor::toXml ( QDomDocument &  dom_document,
QHash< Terminal *, int > &  table_adr_id 
) const

Exporte les caracteristiques du conducteur sous forme d'une element XML.

Parameters
dLe document XML a utiliser pour creer l'element XML
table_adr_idHash stockant les correspondances entre les ids des bornes dans le document XML et leur adresse en memoire
Returns
Un element XML representant le conducteur

Definition at line 991 of file conductor.cpp.

References length(), m_autoNum_seq, m_freeze_label, m_properties, m_text_item, modified_path, pos, segmentsList(), terminal1, terminal2, autonum::sequentialNumbers::toXml(), ConductorTextItem::wasMovedByUser(), and ConductorTextItem::wasRotateByUser().

◆ type()

int Conductor::type ( ) const
inlineoverride

Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a conductor.

Returns
the QGraphicsItem type

Definition at line 75 of file conductor.h.

References Type.

Referenced by bends(), ConductorAutoNumerotation::numerate(), segmentsCount(), setProfile(), and setProfiles().

◆ updateConductorPath()

void Conductor::updateConductorPath ( const QPointF &  p1,
Qet::Orientation  o1,
const QPointF &  p2,
Qet::Orientation  o2 
)
private

Gere les updates

Parameters
p1Coordonnees du point d'amarrage de la borne 1
o1Orientation de la borne 1
p2Coordonnees du point d'amarrage de la borne 2
o2Orientation de la borne 2

Definition at line 216 of file conductor.cpp.

References QET::Both, conductor_profiles, currentPathType(), getCoeff(), getSign(), ConductorProfile::height(), ConductorProfile::horizontalSegments(), ConductorProfile::isNull(), pointsToSegments(), ConductorProfile::segments, ConductorProfile::segmentsCount(), segmentsToPath(), shareOffsetBetweenSegments(), ConductorProfile::verticalSegments(), and ConductorProfile::width().

Referenced by setProfile(), setProfiles(), and updatePath().

◆ updatePath()

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.

Parameters
rectRectangle a mettre a jour
See also
QGraphicsPathItem::update()

Definition at line 159 of file conductor.cpp.

References calculateTextItemPosition(), conductor_profiles, currentPathType(), generateConductorPath(), segmentsCount(), terminal1, terminal2, and updateConductorPath().

Referenced by Terminal::updateConductor(), and updatePathAnimate().

◆ updatePathAnimate()

void Conductor::updatePathAnimate ( const int  = 1)
inline

Definition at line 82 of file conductor.h.

References updatePath().

◆ valideXml()

bool Conductor::valideXml ( QDomElement &  e)
static

Methode de validation d'element XML

Parameters
eUn element XML sense represente un Conducteur
Returns
true si l'element XML represente bien un Conducteur ; false sinon

Definition at line 573 of file conductor.cpp.

Referenced by Diagram::fromXml().

Member Data Documentation

◆ before_mov_text_pos_

QPointF Conductor::before_mov_text_pos_
private

Definition at line 169 of file conductor.h.

Referenced by handlerMousePressEvent(), and saveProfile().

◆ conductor_brush

QBrush Conductor::conductor_brush = QBrush()
staticprivate

Definition at line 184 of file conductor.h.

Referenced by Conductor(), and paint().

◆ conductor_pen

QPen Conductor::conductor_pen = QPen()
staticprivate

QPen et QBrush objects used to draw conductors.

Definition at line 183 of file conductor.h.

Referenced by Conductor(), nearShape(), paint(), and shape().

◆ conductor_profiles

ConductorProfilesGroup Conductor::conductor_profiles
private

conductor profile: "photography" of what the conductor is supposed to look like - there is one profile per kind of traject

Definition at line 176 of file conductor.h.

Referenced by Conductor(), profile(), profiles(), saveProfile(), setProfile(), setProfiles(), updateConductorPath(), and updatePath().

◆ has_to_save_profile

bool Conductor::has_to_save_profile
private

Whether the current profile should be saved as soon as possible.

Definition at line 173 of file conductor.h.

Referenced by handlerMouseMoveEvent(), and handlerMouseReleaseEvent().

◆ m_autoNum_seq

autonum::sequentialNumbers Conductor::m_autoNum_seq
private

◆ m_freeze_label

bool Conductor::m_freeze_label = false
private

Definition at line 180 of file conductor.h.

Referenced by fromXml(), refreshText(), setFreezeLabel(), setUpConnectionForFormula(), and toXml().

◆ m_handler_vector

QVector<QetGraphicsHandlerItem *> Conductor::m_handler_vector
private

◆ m_mouse_over

bool Conductor::m_mouse_over
private

Definition at line 157 of file conductor.h.

Referenced by hoverEnterEvent(), hoverLeaveEvent(), paint(), and shape().

◆ m_moved_segment

ConductorSegment* Conductor::m_moved_segment
private

Definition at line 168 of file conductor.h.

Referenced by handlerMouseMoveEvent(), and handlerMousePressEvent().

◆ m_moving_segment

bool Conductor::m_moving_segment
private

Attributs related to mouse interaction.

Definition at line 165 of file conductor.h.

Referenced by handlerMouseMoveEvent(), handlerMousePressEvent(), handlerMouseReleaseEvent(), and segmentsToPath().

◆ m_path

QPainterPath Conductor::m_path
private

Definition at line 186 of file conductor.h.

Referenced by path(), and setPath().

◆ m_previous_z_value

qreal Conductor::m_previous_z_value
private

Definition at line 167 of file conductor.h.

Referenced by Conductor(), and itemChange().

◆ m_properties

ConductorProperties Conductor::m_properties
private

◆ m_text_item

ConductorTextItem* Conductor::m_text_item
private

Text input for non simple, non-singleline conductors.

Definition at line 161 of file conductor.h.

Referenced by calculateTextItemPosition(), Conductor(), displayedTextChanged(), fromXml(), handlerMousePressEvent(), refreshText(), saveProfile(), setProperties(), textItem(), and toXml().

◆ m_valid

bool Conductor::m_valid
private

Definition at line 179 of file conductor.h.

Referenced by Conductor(), and isValid().

◆ m_vector_index

int Conductor::m_vector_index = -1
private

Definition at line 156 of file conductor.h.

Referenced by handlerMousePressEvent(), handlerMouseReleaseEvent(), and sceneEventFilter().

◆ modified_path

bool Conductor::modified_path
private

Whether the conductor was manually modified by users.

Definition at line 171 of file conductor.h.

Referenced by handlerMouseMoveEvent(), pathFromXml(), setProfile(), setProfiles(), and toXml().

◆ moved_point

int Conductor::moved_point
private

Definition at line 166 of file conductor.h.

◆ must_highlight_

Highlight Conductor::must_highlight_
private

Define whether and how the conductor should be highlighted.

Definition at line 178 of file conductor.h.

Referenced by highlight(), paint(), and setHighlighted().

◆ pen_and_brush_initialized

bool Conductor::pen_and_brush_initialized = false
staticprivate

Definition at line 185 of file conductor.h.

Referenced by Conductor().

◆ segments

ConductorSegment* Conductor::segments
private

Segments composing the conductor.

Definition at line 163 of file conductor.h.

Referenced by bends(), deleteSegments(), middleSegment(), pointsToSegments(), posForText(), segmentsList(), segmentsToPath(), and segmentsToPoints().

◆ terminal1

Terminal* Conductor::terminal1

◆ terminal2

Terminal* Conductor::terminal2

Property Documentation

◆ animPath

int Conductor::animPath
readwrite

Definition at line 47 of file conductor.h.

◆ pos

QPointF Conductor::pos
readwrite

◆ properties

ConductorProperties Conductor::properties
readwrite

◆ sequenceNum

autonum::sequentialNumbers Conductor::sequenceNum
readwrite

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