|
QElectroTech
0.8-dev
|
Go to the documentation of this file.
22 #include <QGraphicsPathItem>
46 Q_PROPERTY(QPointF
pos READ
pos WRITE setPos)
64 enum {
Type = UserType + 1001 };
87 void paint(QPainter *,
88 const QStyleOptionGraphicsItem *,
91 QPainterPath
shape()
const override;
98 QPainterPath
path()
const;
103 QDomElement
toXml (QDomDocument &,
114 bool only_text =
false);
126 const bool all_diagram =
true,
127 QList <Terminal *> *t_list=
nullptr);
151 QVariant
itemChange(GraphicsItemChange,
const QVariant &)
override;
204 QList<ConductorBend>
bends()
const;
209 static int getCoeff(
const qreal &,
const qreal &);
210 static int getSign(
const qreal &);
211 QHash<ConductorSegmentProfile *, qreal>
shareOffsetBetweenSegments(
const qreal &offset,
const QList<ConductorSegmentProfile *> &,
const qreal & = 0.01)
const;
213 static Qt::Corner
movementType(
const QPointF &,
const QPointF &);
222 template <
typename T>
224 return (b <= c)? (a >= b && a <= c) : (a <= b && a >= c);
Conductor(Terminal *, Terminal *)
Conductor::Conductor Default constructor.
Definition: conductor.cpp:77
bool m_show_text
Definition: conductorproperties.h:103
QVector< QetGraphicsHandlerItem * > m_handler_vector
Definition: conductor.h:164
QVector< QPointF > handlerPoints() const
Conductor::handlerPoints.
Definition: conductor.cpp:1153
virtual Highlight highlight() const
Definition: conductor.cpp:1589
@ Multi
Definition: conductorproperties.h:79
QHash< ConductorSegmentProfile *, qreal > shareOffsetBetweenSegments(const qreal &offset, const QList< ConductorSegmentProfile * > &, const qreal &=0.01) const
Definition: conductor.cpp:287
virtual bool wasMovedByUser() const
Definition: conductortextitem.cpp:84
QList< Conductor * > conductors() const
Terminal::conductors.
Definition: terminal.cpp:715
ConductorProfile profile(Qt::Corner) const
Definition: conductor.cpp:1443
autonum::sequentialNumbers sequenceNum
Definition: conductor.h:49
@ West
Definition: qet.h:209
int moved_point
Definition: conductor.h:175
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
Conductor::hoverLeaveEvent Manage the mouse leave event.
Definition: conductor.cpp:657
virtual QPainterPath nearShape() const
Conductor::nearShape.
Definition: conductor.cpp:904
@ Type
Definition: qetgraphicshandleritem.h:42
Terminal * terminal2
Definition: conductor.h:68
Definition: conductorprofile.h:28
QColor color
Definition: conductorproperties.h:85
void displayedTextChanged()
Conductor::displayedTextChanged Update the properties (text) of this conductor and other conductors a...
Definition: conductor.cpp:1606
Qt::PenStyle style
Definition: conductorproperties.h:110
Definition: assignvariables.h:35
void setProperties(const ConductorProperties &property)
Conductor::setProperties Set property as current property of conductor.
Definition: conductor.cpp:1538
QPair< QPointF, Qt::Corner > ConductorBend
Definition: conductor.h:34
void projectDiagramsOrderChanged(QETProject *, int, int)
ConductorSegment * previousSegment() const
Definition: conductorsegment.cpp:421
QColor text_color
Definition: conductorproperties.h:87
void updatePath(const QRectF &=QRectF())
Definition: conductor.cpp:161
void fromXml(const QDomElement &element)
sequentialNumbers::fromXml Import sequential values from a QDomElement
Definition: assignvariables.cpp:138
bool m_moving_segment
Attributs related to mouse interaction.
Definition: conductor.h:174
void pointsToSegments(const QList< QPointF > &)
Definition: conductor.cpp:958
bool isNull() const
Definition: conductorprofile.cpp:72
QUuid uuid() const
Element::uuid.
Definition: element.h:250
void setProfiles(const ConductorProfilesGroup &)
Conductor::setProfiles.
Definition: conductor.cpp:1924
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mousePressEvent Manage the mouse press event.
Definition: conductor.cpp:623
ConductorProfilesGroup profiles() const
Definition: conductor.cpp:1916
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
Conductor::sceneEventFilter.
Definition: conductor.cpp:710
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mouseDoubleClickEvent Manage the mouse double click.
Definition: conductor.cpp:613
QRectF boundingRect() const override
Conductor::boundingRect.
Definition: conductor.cpp:878
QList< ConductorBend > bends() const
Definition: conductor.cpp:1843
static bool pen_and_brush_initialized
Definition: conductor.h:194
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &)
Definition: conductor.cpp:1953
Diagram * diagram() const
Terminal::diagram.
Definition: terminal.cpp:814
autonum::sequentialNumbers sequenceNum() const
Definition: conductor.h:131
Definition: conductorsegmentprofile.h:26
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram)
longuestConductorInPotential
Definition: conductor.cpp:2005
bool fromXml(QDomElement &)
Conductor::fromXml Load the conductor and her information from xml element.
Definition: conductor.cpp:976
uint segmentsCount(QET::ConductorSegmentType) const
Definition: conductorprofile.cpp:104
ConductorTextItem * m_text_item
Text input for non simple, non-singleline conductors.
Definition: conductor.h:170
qreal length() const
Definition: conductorsegment.cpp:505
void setPath(const QPainterPath &path)
Definition: conductor.cpp:1481
@ Alert
Definition: conductor.h:65
Diagram * diagram() const
Definition: conductor.cpp:559
Highlight must_highlight_
Define whether and how the conductor should be highlighted.
Definition: conductor.h:187
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram=false)
longuestConductorInPotential
Definition: conductor.cpp:2005
static bool valideXml(QDomElement &)
Definition: conductor.cpp:575
QStringList unit_folio
Definition: assignvariables.h:50
QList< Conductor * > relatedConductors(const Conductor *conductor)
relatedConductors
Definition: conductor.cpp:2022
QVariant itemChange(GraphicsItemChange, const QVariant &) override
Conductor::itemChange.
Definition: conductor.cpp:669
void setPlainText(const QString &text)
Definition: diagramtextitem.cpp:218
QList< Terminal * > relatedPotentialTerminal(const Terminal *terminal, const bool all_diagram)
Conductor::relatedPotentialTerminal Return terminal at the same potential from the same parent elemen...
Definition: terminal.cpp:841
QPainterPath shape() const override
Conductor::shape.
Definition: conductor.cpp:889
qreal height() const
Definition: conductorprofile.cpp:92
Element * parentElement() const
Terminal::parentElement.
Definition: terminal.cpp:822
autonum::sequentialNumbers m_autoNum_seq
Definition: conductor.h:137
Definition: numerotationcontext.h:31
qreal length() const
Conductor::length.
Definition: conductor.cpp:1189
bool m_mouse_over
Definition: conductor.h:166
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal=9.0)
Definition: conductor.cpp:449
double verti_rotate_text
Definition: conductorproperties.h:100
bool m_valid
Definition: conductor.h:188
void updatePathAnimate(const int=1)
Definition: conductor.h:84
QUuid uuid() const
Definition: terminal.cpp:826
void addHandler()
Conductor::addHandler Add handlers for this item.
Definition: conductor.cpp:845
QPointF posForText(Qt::Orientations &flag)
Conductor::posForText Calculate and return the better pos for text.
Definition: conductor.cpp:1219
int m_dash_size
Definition: conductorproperties.h:97
QIcon Orientations
Definition: qeticons.cpp:126
Terminal * terminal1
Definition: conductor.h:67
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
Conductor::hoverEnterEvent Manage the hover enter event.
Definition: conductor.cpp:646
void adjusteHandlerPos()
Conductor::adjusteHandlerPos Adjust the position of the handler item.
Definition: conductor.cpp:753
Highlight
Definition: conductor.h:65
void setProfile(const ConductorProfile &, Qt::Corner)
Definition: conductor.cpp:1425
ConductorSegment * middleSegment()
Definition: conductor.cpp:1196
const QList< ConductorSegment * > segmentsList() const
Definition: conductor.cpp:1171
ConductorType type
Definition: conductorproperties.h:83
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
void setPropertyToPotential(const ConductorProperties &property, bool only_text=false)
Conductor::setPropertiesToPotential.
Definition: conductor.cpp:1507
bool orthogonalProjection(const QPointF &, const QLineF &, QPointF *=nullptr)
Definition: qet.cpp:166
int text_size
Definition: conductorproperties.h:96
Definition: conductorsegment.h:25
The ChangeConductorCommand class This command changes a particular conductor.
Definition: diagramcommands.h:239
autonum::sequentialNumbers & rSequenceNum()
Definition: conductor.h:132
void calculateTextItemPosition()
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizont...
Definition: conductor.cpp:1290
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mouseReleaseEvent.
Definition: conductor.cpp:635
SingleLineProperties singleLineProperties
Definition: conductorproperties.h:112
void segmentsToPath()
Conductor::segmentsToPath Generate the QPainterPath from the list of points.
Definition: conductor.cpp:177
void removeHandler()
Conductor::removeHandler Remove the handlers of this item.
Definition: conductor.cpp:865
void removeConductor(Conductor *conductor)
Terminal::removeConductor Remove a conductor from this terminal.
Definition: terminal.cpp:239
bool modified_path
Whether the conductor was manually modified by users.
Definition: conductor.h:180
static Qt::Corner movementType(const QPointF &, const QPointF &)
Definition: conductor.cpp:1900
Orientation
Orientation (used for electrical elements and their terminals)
Definition: qet.h:206
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMouseMoveEvent.
Definition: conductor.cpp:794
QHash< Qt::Corner, ConductorProfile > ConductorProfilesGroup
Definition: conductor.h:37
QStringList hundred_folio
Definition: assignvariables.h:54
int fakePath()
Definition: conductor.h:85
~Conductor() override
Conductor::~Conductor Destructor. The conductor is removed from is terminal.
Definition: conductor.cpp:137
qreal width() const
Definition: conductorprofile.cpp:83
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMousePressEvent.
Definition: conductor.cpp:771
void fromXml(QDomElement &)
ConductorProperties::fromXml Import conductor propertie, from the attribute of the xml element 'e'.
Definition: conductorproperties.cpp:307
void generateConductorPath(const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation)
Definition: conductor.cpp:346
QPointF pos
Definition: conductor.h:46
ConductorProperties properties
Definition: conductor.h:48
uint segmentsCount(QET::ConductorSegmentType=QET::Both) const
Definition: conductor.cpp:916
int animPath
Definition: conductor.h:47
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMouseReleaseEvent.
Definition: conductor.cpp:822
bool isBetween(const T a, const T b, const T c)
Definition: conductor.h:223
Conductor(const Conductor &)
void editProperty()
Conductor::editProperty.
Definition: conductor.cpp:1717
ConductorSegment * segments
Segments composing the conductor.
Definition: conductor.h:172
Qt::Alignment m_vertical_alignment
Definition: conductorproperties.h:108
void setUpConnectionForFormula(QString old_formula, QString new_formula)
Conductor::setUpConnectionForFormula setup connection according to the variable of formula.
Definition: conductor.cpp:1733
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &)
Definition: conductorproperties.cpp:65
QString m_function
Definition: conductorproperties.h:90
QUndoStack & undoStack()
Diagram::undoStack.
Definition: diagram.h:397
ConductorProfilesGroup conductor_profiles
Definition: conductor.h:185
ConductorProperties defaultConductorProperties
Default properties for new conductors.
Definition: diagram.h:81
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the formula with variable assigned (ready to be displayed)
Definition: assignvariables.cpp:187
void setColor(const QColor &color)
Definition: diagramtextitem.cpp:167
QPainterPath m_path
Definition: conductor.h:195
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
Definition: qetgraphicshandleritem.h:37
bool isFirstSegment() const
Definition: conductorsegment.cpp:409
QList< Conductor * > relatedConductors(const Conductor *conductor)
relatedConductors
Definition: conductor.cpp:2022
virtual void setHighlighted(Highlight)
Definition: conductor.cpp:1596
void setSequenceNum(const autonum::sequentialNumbers &sn)
Definition: conductor.cpp:1721
double horiz_rotate_text
Definition: conductorproperties.h:101
QList< ConductorSegmentProfile * > horizontalSegments()
Definition: conductorprofile.cpp:115
Qt::Alignment m_horizontal_alignment
Definition: conductorproperties.h:107
ConductorProperties m_properties
Functional properties.
Definition: conductor.h:168
static int xGrid
abscissa grid step size
Definition: diagram.h:85
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false.
Definition: conductor.cpp:2035
@ North
Definition: qet.h:206
bool pathFromXml(const QDomElement &)
Conductor::pathFromXml Generate the path (of the line) from xml file by checking the segments in the ...
Definition: conductor.cpp:1075
Definition: conductor.cpp:43
QColor m_color_2
Definition: conductorproperties.h:86
double cond_size
Definition: conductorproperties.h:99
bool isContained(const QPointF &a, const QPointF &b, const QPointF &c)
Definition: conductor.cpp:1763
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,...
Definition: conductor.cpp:1647
Definition: qetdiagrameditor.h:51
void setColor(QColor color)
QetGraphicsHandlerItem::setColor.
Definition: qetgraphicshandleritem.cpp:48
void saveProfile(bool=true)
Definition: conductor.cpp:1386
bool isValid() const
Conductor::isValid.
Definition: conductor.cpp:150
static int yGrid
ordinate grid step size
Definition: diagram.h:87
QString m_formula
Definition: conductorproperties.h:94
QPainterPath path() const
Definition: conductor.cpp:1491
static int getCoeff(const qreal &, const qreal &)
Definition: conductor.cpp:1408
QIcon sl
Definition: qeticons.cpp:202
bool isHorizontal() const
Definition: conductorsegment.cpp:442
int type() const override
type Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a conductor.
Definition: conductor.h:77
bool has_to_save_profile
Whether the current profile should be saved as soon as possible.
Definition: conductor.h:182
void updateConductorPath(const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation)
Definition: conductor.cpp:218
@ Vertical
Vertical segment.
Definition: qet.h:90
void setFont(const QFont &font)
Definition: diagramtextitem.cpp:153
@ Type
Definition: conductor.h:64
@ South
Definition: qet.h:208
int m_vector_index
Definition: conductor.h:165
The ConductorProperties class This class represents the functional properties of a particular conduct...
Definition: conductorproperties.h:68
QDomElement toXml(QDomDocument &, QHash< Terminal *, int > &) const
Conductor::toXml Exporte les caracteristiques du conducteur sous forme d'une element XML.
Definition: conductor.cpp:1010
QPointF before_mov_text_pos_
Definition: conductor.h:178
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
Definition: diagram.cpp:2240
@ Single
Definition: conductorproperties.h:79
static QBrush conductor_brush
Definition: conductor.h:193
QDomElement toXml(QDomDocument &document, const QString &tag_name=QString("sequentialNumbers")) const
sequentialNumbers::toXml export this sequential numbers into a QDomElement.
Definition: assignvariables.cpp:94
@ None
Definition: conductor.h:65
static QPen conductor_pen
QPen et QBrush objects used to draw conductors.
Definition: conductor.h:192
@ Both
Invalid segment.
Definition: qet.h:91
QStringList ten_folio
Definition: assignvariables.h:52
ConductorSegmentType
Known kinds of conductor segments.
Definition: qet.h:88
QPointF middle() const
Definition: conductorsegment.cpp:493
void deleteSegments()
Supprime les segments.
Definition: conductor.cpp:1939
@ Horizontal
Horizontal segment.
Definition: qet.h:89
QFont font
Definition: diagramtextitem.h:40
static void loadSequential(const QDomElement &dom_element, const QString &seq, QStringList *list)
Definition: conductor.cpp:46
bool m_bicolor
Definition: conductorproperties.h:105
Definition: conductor.h:43
@ East
Definition: qet.h:207
static void PropertiesDialog(Conductor *conductor, QWidget *parent=nullptr)
ConductorPropertiesDialog::PropertiesDialog Static method for open and apply properties.
Definition: conductorpropertiesdialog.cpp:62
QString m_wire_color
Definition: conductorproperties.h:92
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
Definition: conductor.cpp:475
The Terminal class This class represents a terminal of an electrical element, i.e....
Definition: terminal.h:35
QList< ConductorSegmentProfile * > verticalSegments()
Definition: conductorprofile.cpp:124
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
Definition: conductortextitem.h:30
virtual bool wasRotateByUser() const
ConductorTextItem::wasRotateByUser.
Definition: conductortextitem.cpp:92
QString text
Definition: conductorproperties.h:89
QETDiagramEditor * diagramEditor() const
Conductor::diagramEditor.
Definition: conductor.cpp:1703
QIcon br
Definition: qeticons.cpp:185
QList< QPointF > junctions() const
Definition: conductor.cpp:1773
ConductorTextItem * textItem() const
Definition: conductor.cpp:566
QString m_tension_protocol
Definition: conductorproperties.h:91
static QVector< QetGraphicsHandlerItem * > handlerForPoint(const QVector< QPointF > &points, int size=10)
QetGraphicsHandlerItem::handlerForPoint.
Definition: qetgraphicshandleritem.cpp:87
ConductorSegment * m_moved_segment
Definition: conductor.h:177
Qt::Corner currentPathType() const
Definition: conductor.cpp:1911
QList< QPointF > segmentsToPoints() const
Definition: conductor.cpp:930
QIcon tr
Definition: qeticons.cpp:206
bool m_freeze_label
Definition: conductor.h:189
QStringList unit
Definition: assignvariables.h:49
static int getSign(const qreal &)
Definition: conductor.cpp:1416
QString m_wire_section
Definition: conductorproperties.h:93
QStringList ten
Definition: assignvariables.h:51
void textEdited(const QString &old_str, const QString &new_str)
void refreshText()
Conductor::refreshText Refresh the text of this conductor. recalcule and set the text according to th...
Definition: conductor.cpp:1452
static void loadSequential(const QDomElement &dom_element, Conductor *conductor)
Definition: conductor.cpp:56
QList< ConductorSegmentProfile * > segments
Segments composing the conductor.
Definition: conductorprofile.h:40
@ Normal
Definition: conductor.h:65
qreal m_previous_z_value
Definition: conductor.h:176
QStringList hundred
Definition: assignvariables.h:53