33 #define PR(x) qDebug() << #x " = " << x; 44 static void loadSequential(
const QDomElement &dom_element,
const QString& seq, QStringList* list)
47 while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty())
49 list->append(dom_element.attribute(seq + QString::number(i+1)));
91 bool ajout_p1 =
terminal1 -> addConductor(
this);
92 bool ajout_p2 =
terminal2 -> addConductor(
this);
94 m_valid = (!ajout_p1 || !ajout_p2) ?
false :
true;
117 setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsScenePositionChanges);
118 setAcceptHoverEvents(
true);
168 QGraphicsObject::update(rect);
186 while(segment -> hasNextSegment()) {
187 path.lineTo(segment -> secondPoint());
188 segment = segment -> nextSegment();
191 path.lineTo(segment -> secondPoint());
222 Q_ASSERT_X(conductor_profile.
segmentsCount(
QET::Both) > 1,
"Conductor::priv_modifieConductor",
"pas de points a modifier");
223 Q_ASSERT_X(!conductor_profile.
isNull(),
"Conductor::priv_modifieConductor",
"pas de profil utilisable");
226 QPointF new_p1 = mapFromScene(p1);
227 QPointF new_p2 = mapFromScene(p2);
228 QRectF new_rect = QRectF(new_p1, new_p2);
231 qreal profile_width = conductor_profile.
width();
232 qreal profile_height = conductor_profile.
height();
235 qreal h_diff = (qAbs(new_rect.width()) - qAbs(profile_width) ) *
getSign(profile_width);
236 qreal v_diff = (qAbs(new_rect.height()) - qAbs(profile_height)) *
getSign(profile_height);
239 QHash<ConductorSegmentProfile *, qreal> segments_lengths;
244 int horiz_coeff =
getCoeff(new_rect.width(), profile_width);
245 int verti_coeff =
getCoeff(new_rect.height(), profile_height);
248 QList<QPointF> points;
250 int limit = conductor_profile.
segments.count() - 1;
251 for (
int i = 0 ; i < limit ; ++ i) {
253 QPointF previous_point = points.last();
259 qreal coeff = csp -> isHorizontal ? horiz_coeff : verti_coeff;
260 qreal offset_applied = segments_lengths[csp];
263 if (csp -> isHorizontal) {
265 previous_point.x() + (coeff * offset_applied),
271 previous_point.y() + (coeff * offset_applied)
287 const QList<ConductorSegmentProfile *> &segments_list,
288 const qreal &precision
291 QHash<ConductorSegmentProfile *, qreal> segments_hash;
293 segments_hash.insert(csp, csp ->
length);
297 QHash<ConductorSegmentProfile *, int> segments_signs;
305 qreal remaining_offset = offset;
306 while (remaining_offset > precision || remaining_offset < -precision) {
308 uint segments_count = 0;
311 qreal local_offset = remaining_offset / segments_count;
313 remaining_offset = 0.0;
316 if (!segments_hash[csp])
continue;
319 segments_hash[csp] += local_offset;
322 if (segments_signs[csp] !=
getSign(segments_hash[csp])) {
325 remaining_offset += qAbs(segments_hash[csp]) *
getSign(local_offset);
327 segments_hash[csp] = 0.0;
334 return(segments_hash);
345 QPointF sp1, sp2, depart, newp1, newp2, arrivee, depart0, arrivee0;
349 QList<QPointF> points;
352 sp1 = mapFromScene(p1);
353 sp2 = mapFromScene(p2);
360 if (newp1.x() <= newp2.x()) {
383 if (depart.y() < arrivee.y()) {
387 int ligne_inter_x = qRound(depart.x() + arrivee.x()) / 2;
389 points << QPointF(ligne_inter_x, depart.y());
390 points << QPointF(ligne_inter_x, arrivee.y());
393 int ligne_inter_y = qRound(depart.y() + arrivee.y()) / 2;
395 points << QPointF(depart.x(), ligne_inter_y);
396 points << QPointF(arrivee.x(), ligne_inter_y);
398 points << QPointF(arrivee.x(), depart.y());
400 points << QPointF(depart.x(), arrivee.y());
406 int ligne_inter_y = qRound(depart.y() + arrivee.y()) / 2;
408 points << QPointF(depart.x(), ligne_inter_y);
409 points << QPointF(arrivee.x(), ligne_inter_y);
412 int ligne_inter_x = qRound(depart.x() + arrivee.x()) / 2;
414 points << QPointF(ligne_inter_x, depart.y());
415 points << QPointF(ligne_inter_x, arrivee.y());
417 points << QPointF(depart.x(), arrivee.y());
419 points << QPointF(arrivee.x(), depart.y());
430 if (newp1.x() > newp2.x()) {
431 QList<QPointF> points2;
432 for (
int i = points.size() - 1 ; i >= 0 ; -- i) points2 << points.at(i);
448 QPointF extended_terminal;
449 switch(terminal_orientation) {
451 extended_terminal = QPointF(terminal.x(), terminal.y() - ext_size);
454 extended_terminal = QPointF(terminal.x() + ext_size, terminal.y());
457 extended_terminal = QPointF(terminal.x(), terminal.y() + ext_size);
460 extended_terminal = QPointF(terminal.x() - ext_size, terminal.y());
462 default: extended_terminal = terminal;
464 return(extended_terminal);
477 qp -> setRenderHint(QPainter::Antialiasing,
false);
482 final_conductor_color = QColor::fromRgb(69, 137, 255, 255);
484 final_conductor_color =QColor::fromRgb(255, 69, 0, 255);
485 }
else if (isSelected()) {
486 final_conductor_color = Qt::red;
489 if (!parent_diagram -> drawColoredConductors()) {
490 final_conductor_color = Qt::black;
503 final_conductor_pen.setColor(final_conductor_color);
505 final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin);
508 if (options && options -> levelOfDetail < 1.0) {
509 final_conductor_pen.setCosmetic(
true);
512 qp -> setPen(final_conductor_pen);
515 qp -> drawPath(
path());
520 final_conductor_pen.setStyle(Qt::CustomDashLine);
521 QVector<qreal> dash_pattern;
523 final_conductor_pen.setDashPattern(dash_pattern);
525 qp->setPen(final_conductor_pen);
526 qp->drawPath(
path());
531 qp -> setBrush(final_conductor_color);
535 QRectF(
middleSegment() -> middle() - QPointF(12.0, 12.0), QSizeF(24.0, 24.0))
537 if (isSelected()) qp -> setBrush(Qt::NoBrush);
541 QList<QPointF> junctions_list =
junctions();
542 if (!junctions_list.isEmpty()) {
543 final_conductor_pen.setStyle(Qt::SolidLine);
544 QBrush junction_brush(final_conductor_color, Qt::SolidPattern);
545 qp -> setPen(final_conductor_pen);
546 qp -> setBrush(junction_brush);
547 qp -> setRenderHint(QPainter::Antialiasing,
true);
548 foreach(QPointF point, junctions_list) {
549 qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
558 return(qobject_cast<Diagram *>(scene()));
575 if (e.tagName() !=
"conductor")
return(
false);
578 if (!e.hasAttribute(
"terminal1"))
return(
false);
579 if (!e.hasAttribute(
"terminal2"))
return(
false);
583 e.attribute(
"terminal1").toInt(&conv_ok);
584 if (!conv_ok)
return(
false);
587 e.attribute(
"terminal2").toInt(&conv_ok);
588 if (!conv_ok)
return(
false);
609 QGraphicsObject::mousePressEvent(event);
611 if (event->modifiers() & Qt::ControlModifier)
612 setSelected(!isSelected());
621 if (!(event -> modifiers() & Qt::ControlModifier))
622 QGraphicsObject::mouseReleaseEvent(event);
655 if (change == QGraphicsItem::ItemSelectedChange)
669 else if (change == QGraphicsItem::ItemSceneHasChanged)
675 else if (scene() && isSelected())
678 else if (change == QGraphicsItem::ItemVisibleHasChanged) {
681 else if (change == QGraphicsItem::ItemPositionHasChanged && isSelected()) {
685 return(QGraphicsObject::itemChange(change, value));
706 if(event->type() == QEvent::GraphicsSceneMousePress)
711 else if(event->type() == QEvent::GraphicsSceneMouseMove)
716 else if (event->type() == QEvent::GraphicsSceneMouseRelease)
721 else if (event->type() == QEvent::GraphicsSceneMouseDoubleClick)
744 QVector <QPointF> points_vector = mapToScene(
handlerPoints());
745 for (
int i = 0 ; i < points_vector.size() ; ++i)
837 handler->setColor(Qt::blue);
838 scene()->addItem(handler);
839 handler->installSceneEventFilter(
this);
840 handler->setZValue(this->zValue()+1);
864 QRectF
br =
shape().boundingRect();
865 return br.adjusted(-10, -10, 10, 10);
875 QPainterPathStroker pps;
879 QPainterPath shape_(pps.createStroke(
path()));
890 QPainterPathStroker pps;
893 return pps.createStroke(
path());
901 QList<ConductorSegment *> segments_list =
segmentsList();
905 if (conductor_segment ->
type() ==
type) ++ nb_seg;
916 QList<QPointF> points_list;
919 if (
segments ==
nullptr)
return(points_list);
922 points_list <<
segments -> firstPoint();
926 while(segment -> hasNextSegment()) {
927 points_list << segment -> secondPoint();
928 segment = segment -> nextSegment();
932 points_list << segment -> secondPoint();
948 for (
int i = 0 ; i < points_list.size() - 1 ; ++ i) {
949 last_segment =
new ConductorSegment(points_list.at(i), points_list.at(i + 1), last_segment);
962 setPos(dom_element.attribute(
"x",
nullptr).toDouble(),
963 dom_element.attribute(
"y",
nullptr).toDouble());
972 if (dom_element.hasAttribute(
"sequ_1") || dom_element.hasAttribute(
"sequf_1") || dom_element.hasAttribute(
"seqt_1") || dom_element.hasAttribute(
"seqtf_1") || dom_element.hasAttribute(
"seqh_1") || dom_element.hasAttribute(
"sequf_1"))
977 m_freeze_label = dom_element.attribute(
"freezeLabel") ==
"true"? true :
false;
991 QDomElement
Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int> &table_adr_id)
const 993 QDomElement dom_element = dom_document.createElement(
"conductor");
995 dom_element.setAttribute(
"x", QString::number(
pos().x()));
996 dom_element.setAttribute(
"y", QString::number(
pos().y()));
997 dom_element.setAttribute(
"terminal1", table_adr_id.value(
terminal1));
998 dom_element.setAttribute(
"terminal2", table_adr_id.value(
terminal2));
999 dom_element.setAttribute(
"freezeLabel",
m_freeze_label?
"true" :
"false");
1006 QDomElement current_segment;
1009 current_segment = dom_document.createElement(
"segment");
1010 current_segment.setAttribute(
"orientation", segment -> isHorizontal() ?
"horizontal" :
"vertical");
1011 current_segment.setAttribute(
"length", QString(
"%1").arg(segment ->
length()));
1012 dom_element.appendChild(current_segment);
1017 dom_element.appendChild(dom_seq);
1023 dom_element.setAttribute(
"userx", QString::number(
m_text_item->pos().x()));
1024 dom_element.setAttribute(
"usery", QString::number(
m_text_item->pos().y()));
1027 dom_element.setAttribute(
"rotation", QString::number(
m_text_item->rotation()));
1029 return(dom_element);
1041 QList<qreal> segments_x, segments_y;
1042 for (QDomNode node = e.firstChild() ; !node.isNull() ; node = node.nextSibling()) {
1044 QDomElement current_segment = node.toElement();
1045 if (current_segment.isNull() || current_segment.tagName() !=
"segment")
continue;
1048 if (!current_segment.hasAttribute(
"length"))
continue;
1052 qreal segment_length = current_segment.attribute(
"length").toDouble(&ok);
1055 if (current_segment.attribute(
"orientation") ==
"horizontal") {
1056 segments_x << segment_length;
1060 segments_y << segment_length;
1065 if (!segments_x.size()) {
1071 qreal width = 0.0, height = 0.0;
1072 foreach (qreal t, segments_x) width += t;
1073 foreach (qreal t, segments_y) height += t;
1074 QPointF t1 =
terminal1 -> dockConductor();
1075 QPointF t2 =
terminal2 -> dockConductor();
1076 qreal expected_width = t2.x() - t1.x();
1077 qreal expected_height = t2.y() - t1.y();
1081 qAbs(expected_width - width) > 1.0 ||
1082 qAbs(expected_height - height) > 1.0
1084 qDebug() <<
"Conductor::fromXml : les segments du conducteur ne semblent pas coherents - utilisation d'un trajet automatique";
1090 QList<QPointF> points_list;
1091 points_list << mapFromScene(t1);
1092 for (
int i = 0 ; i < segments_x.size() ; ++ i) {
1093 points_list << QPointF(
1094 points_list.last().x() + segments_x.at(i),
1095 points_list.last().y() + segments_y.at(i)
1125 QVector <QPointF> middle_points;
1128 middle_points.append(segment->
middle());
1130 return middle_points;
1135 if (
segments ==
nullptr)
return(QList<ConductorSegment *>());
1137 QList<ConductorSegment *> segments_vector;
1140 while (segment -> hasNextSegment()) {
1141 segments_vector << segment;
1142 segment = segment -> nextSegment();
1144 segments_vector << segment;
1145 return(segments_vector);
1153 return path().length();
1160 if (
segments ==
nullptr)
return(
nullptr);
1162 qreal half_length =
length() / 2.0;
1167 while (s -> hasNextSegment()) {
1168 l += qAbs(s ->
length());
1169 if (l >= half_length)
break;
1170 s = s -> nextSegment();
1186 bool all_segment_is_vertical =
true;
1187 bool all_segment_is_horizontal =
true;
1195 QPointF p1 = segment -> firstPoint();
1198 if (segment -> firstPoint().x() != segment -> secondPoint().x())
1199 all_segment_is_vertical =
false;
1200 if (segment -> firstPoint().y() != segment -> secondPoint().y())
1201 all_segment_is_horizontal =
false;
1203 while (segment -> hasNextSegment())
1205 segment = segment -> nextSegment();
1207 if (segment -> firstPoint().x() != segment -> secondPoint().x())
1208 all_segment_is_vertical =
false;
1209 if (segment -> firstPoint().y() != segment -> secondPoint().y())
1210 all_segment_is_horizontal =
false;
1214 int saved = biggest_segment ->
length();
1215 if (saved < 0) saved *= -1;
1216 int curent = segment->
length();
1217 if (curent < 0) curent *= -1;
1219 if (curent > saved) biggest_segment = segment;
1222 QPointF p2 = segment -> secondPoint();
1226 if (all_segment_is_vertical) {
1228 if (p1.y() > p2.y()) {
1229 p1.setY(p1.y() - (
length()/2));
1231 p1.setY(p1.y() + (
length()/2));
1233 }
else if (all_segment_is_horizontal) {
1235 if (p1.x() > p2.x()) {
1236 p1.setX(p1.x() - (
length()/2));
1238 p1.setX(p1.x() + (
length()/2));
1241 p1 = biggest_segment->
middle();
1258 if (
diagram() -> defaultConductorProperties.m_one_text_per_folio ==
true &&
1266 if(longuest_conductor !=
this)
1274 c ->
textItem() -> setVisible(
false);
1287 if (!near_shape.contains(text_item_pos)) {
1309 text_pos.ry() -=
m_text_item->boundingRect().height();
1315 text_pos.rx() -=
m_text_item->boundingRect().height();
1362 dia -> undoStack().push(undo_object);
1380 return(value < 0 ? -1 : 1);
1449 prepareGeometryChange();
1472 foreach(
Conductor *other_conductor, potential_list)
1564 QVariant old_value, new_value;
1569 new_value.setValue(new_properties);
1572 QUndoCommand *undo =
new QUndoCommand(
tr(
"Modifier les propriétés d'un conducteur",
"undo caption"));
1577 undo->setText(
tr(
"Modifier les propriétés de plusieurs conducteurs",
"undo caption"));
1581 old_value.setValue(potential_conductor->
properties());
1585 new_value.setValue(new_properties);
1605 bool declar_t_list =
false;
1606 if (t_list ==
nullptr)
1608 declar_t_list =
true;
1609 t_list =
new QList <Terminal *>;
1612 QSet <Conductor *> other_conductors;
1613 QList <Terminal *> this_terminal;
1617 for (
Terminal *terminal : this_terminal)
1619 if (!t_list->contains(terminal))
1621 t_list->append(terminal);
1622 QList <Conductor *> other_conductors_list_t = terminal->
conductors();
1628 if (!t_list->contains(t))
1630 t_list -> append(t);
1631 other_conductors_list_t += t->conductors();
1635 other_conductors_list_t.removeAll(
this);
1637 for (
Conductor *c : other_conductors_list_t) {
1638 other_conductors += c->relatedPotentialConductors(all_diagram, t_list);
1640 other_conductors += other_conductors_list_t.toSet();
1644 other_conductors.remove(
this);
1646 if (declar_t_list)
delete t_list;
1647 return(other_conductors);
1655 if (!
diagram())
return nullptr;
1656 if (
diagram() -> views().isEmpty())
return nullptr;
1658 QWidget *w =
const_cast<QGraphicsView *
>(
diagram() -> views().at(0));
1659 while (w -> parentWidget() && !w -> isWindow()) {
1660 w = w -> parentWidget();
1662 return(qobject_cast<QETDiagramEditor *>(w));
1690 if (old_formula.contains(
"%F"))
1691 old_formula.replace(
"%F",
diagram()->border_and_titleblock.folio());
1693 if (old_formula.contains(
"%id"))
1700 if (new_formula.contains(
"%F"))
1701 new_formula.replace(
"%F",
diagram()->border_and_titleblock.folio());
1703 if (new_formula.contains(
"%id"))
1714 bool isContained(
const QPointF &a,
const QPointF &b,
const QPointF &c) {
1725 QList<QPointF> junctions_list;
1729 QList<ConductorBend> bends_list =
bends();
1730 if (other_conductors.isEmpty() || bends_list.isEmpty()) {
1731 return(junctions_list);
1735 for (
int i = 1 ; i < (points.size() -1) ; ++ i) {
1736 QPointF point = points.at(i);
1739 bool is_bend =
false;
1740 Qt::Corner current_bend_type = Qt::TopLeftCorner;
1743 if (cb.first == point)
1746 current_bend_type = cb.second;
1751 if (!is_bend)
continue;
1753 bool is_junction =
false;
1754 QPointF scene_point = mapToScene(point);
1758 QPointF conductor_point = c -> mapFromScene(scene_point);
1760 QList<ConductorSegment *> c_segments = c ->
segmentsList();
1761 if (c_segments.isEmpty())
1764 for (
int j = 0 ; j < c_segments.count() ; ++ j)
1768 if (
isContained(conductor_point, segment -> firstPoint(), segment -> secondPoint()))
1772 QList<ConductorBend> other_conductor_bends = c ->
bends();
1775 if (cb.first == conductor_point && cb.second == current_bend_type)
1777 is_junction =
false;
1781 if (is_junction) junctions_list << point;
1785 return(junctions_list);
1795 QList<ConductorBend> points;
1799 QList<ConductorSegment *> visible_segments;
1801 while (segment -> hasNextSegment()) {
1802 if (!segment -> isPoint()) visible_segments << segment;
1803 segment = segment -> nextSegment();
1805 if (!segment -> isPoint()) visible_segments << segment;
1808 for (
int i = 0 ; i < visible_segments.count() -1 ; ++ i) {
1809 segment = visible_segments[i];
1810 next_segment = visible_segments[i + 1];
1811 if (!segment -> isPoint() && !next_segment -> isPoint()) {
1813 if (next_segment ->
type() != segment ->
type()) {
1814 Qt::Corner bend_type;
1816 qreal nsl = next_segment ->
length();
1818 if (segment -> isHorizontal()) {
1819 if (
sl < 0 && nsl < 0) {
1820 bend_type = Qt::BottomLeftCorner;
1821 }
else if (sl < 0 && nsl > 0) {
1822 bend_type = Qt::TopLeftCorner;
1823 }
else if (
sl > 0 && nsl < 0) {
1824 bend_type = Qt::BottomRightCorner;
1826 bend_type = Qt::TopRightCorner;
1829 if (
sl < 0 && nsl < 0) {
1830 bend_type = Qt::TopRightCorner;
1831 }
else if (sl < 0 && nsl > 0) {
1832 bend_type = Qt::TopLeftCorner;
1833 }
else if (
sl > 0 && nsl < 0) {
1834 bend_type = Qt::BottomRightCorner;
1836 bend_type = Qt::BottomLeftCorner;
1839 points << qMakePair(segment -> secondPoint(), bend_type);
1852 Qt::Corner result = Qt::BottomRightCorner;
1853 if (start.x() <= end.x()) {
1854 result = start.y() <= end.y() ? Qt::BottomRightCorner : Qt::TopRightCorner;
1856 result = start.y() <= end.y() ? Qt::BottomLeftCorner : Qt::TopLeftCorner;
1906 QList<QPolygonF> polygons = polygon.simplified().toSubpathPolygons();
1907 QList<QLineF> lines;
1908 QList<QPointF> points;
1909 foreach(QPolygonF polygon, polygons) {
1910 if (polygon.count() <= 1)
continue;
1913 for (
int i = 1 ; i < polygon.count() ; ++ i) {
1914 lines << QLineF(polygon.at(i - 1), polygon.at(i));
1915 points << polygon.at(i -1);
1921 QMap<qreal, QPointF> intersections;
1922 foreach (QLineF line, lines) {
1923 QPointF intersection_point;
1925 intersections.insert(QLineF(intersection_point, point).
length(), intersection_point);
1928 if (intersections.count()) {
1930 QPointF the_point = intersections[intersections.keys().first()];
1934 qreal minimum_length = -1;
1935 int point_index = -1;
1936 for (
int i = 0 ; i < points.count() ; ++ i) {
1937 qreal
length = qAbs(QLineF(points.at(i), point).
length());
1938 if (minimum_length < 0 ||
length < minimum_length) {
1946 return(points.at(point_index));
1957 Conductor *longuest_conductor = conductor;
1961 longuest_conductor = c;
1963 return longuest_conductor;
1973 QList<Conductor *> other_conductors_list = conductor ->
terminal1 -> conductors();
1975 other_conductors_list.removeAll(const_cast<Conductor *> (conductor));
1976 return(other_conductors_list);
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
QDomElement toXml(QDomDocument &, QHash< Terminal *, int > &) const
static int yGrid
ordinate grid step size
void generateConductorPath(const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation)
Conductor(Terminal *, Terminal *)
Conductor::Conductor Default constructor.
Qt::Alignment m_vertical_alignment
QList< Conductor * > conductors() const
ConductorProperties properties
Conductor::properties.
QVariant itemChange(GraphicsItemChange, const QVariant &) override
Conductor::itemChange.
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...
ConductorProfilesGroup conductor_profiles
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the with variable assigned (ready to be displayed) ...
bool isBetween(const T a, const T b, const T c)
virtual bool wasMovedByUser() const
ConductorSegment * previousSegment() const
void saveProfile(bool=true)
QETDiagramEditor * diagramEditor() const
Conductor::diagramEditor.
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
bool modified_path
Whether the conductor was manually modified by users.
autonum::sequentialNumbers m_autoNum_seq
bool isHorizontal() const
QList< QPointF > segmentsToPoints() const
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false...
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...
ConductorProfilesGroup profiles() const
static bool pen_and_brush_initialized
static void PropertiesDialog(Conductor *conductor, QWidget *parent=nullptr)
ConductorPropertiesDialog::PropertiesDialog Static method for open and apply properties.
SingleLineProperties singleLineProperties
bool fromXml(QDomElement &)
Conductor::fromXml Load the conductor and her information from xml element.
QList< ConductorBend > bends() const
ConductorProfile profile(Qt::Corner) const
bool isContained(const QPointF &a, const QPointF &b, const QPointF &c)
bool m_moving_segment
Attributs related to mouse interaction.
Qt::Alignment m_horizontal_alignment
ConductorSegment * segments
Segments composing the conductor.
~Conductor() override
Conductor::~Conductor Destructor. The conductor is removed from is terminal.
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mouseDoubleClickEvent Manage the mouse double click.
int type() const override
QPointF posForText(Qt::Orientations &flag)
Conductor::posForText Calculate and return the better pos for text.
QList< Terminal * > relatedPotentialTerminal(const Terminal *terminal, const bool all_diagram)
Conductor::relatedPotentialTerminal Return terminal at the same potential from the same parent elemen...
QList< ConductorSegmentProfile * > verticalSegments()
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMouseMoveEvent.
bool pathFromXml(const QDomElement &)
Conductor::pathFromXml Generate the path from xml file.
bool orthogonalProjection(const QPointF &, const QLineF &, QPointF *=nullptr)
QDomElement toXml(QDomDocument &document, const QString &tag_name=QString("sequentialNumbers")) const
sequentialNumbers::toXml export this sequential numbers into a QDomElement.
QRectF boundingRect() const override
Conductor::boundingRect.
void setPlainText(const QString &text)
QHash< ConductorSegmentProfile *, qreal > shareOffsetBetweenSegments(const qreal &offset, const QList< ConductorSegmentProfile *> &, const qreal &=0.01) const
void setColor(QColor color)
QetGraphicsHandlerItem::setColor.
void setPath(const QPainterPath &path)
QList< QPointF > junctions() const
void fromXml(QDomElement &)
ConductorProperties::fromXml Import conductor propertie, from the attribute of the xml element 'e'...
void setProperties(const ConductorProperties &property)
void setPropertyToPotential(const ConductorProperties &property, bool only_text=false)
Conductor::setPropertiesToPotential.
virtual void setHighlighted(Highlight)
static int xGrid
abscissa grid step size
static int getCoeff(const qreal &, const qreal &)
ConductorSegmentType
Known kinds of conductor segments.
QPointF before_mov_text_pos_
void addHandler()
Conductor::addHandler Add handlers for this item.
QHash< Qt::Corner, ConductorProfile > ConductorProfilesGroup
QList< ConductorSegmentProfile * > segments
Segments composing the conductor.
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
bool isFirstSegment() const
Diagram * diagram() const
ConductorSegment * middleSegment()
autonum::sequentialNumbers & rSequenceNum()
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mouseReleaseEvent.
QPainterPath path() const
ConductorTextItem * textItem() const
const QList< ConductorSegment * > segmentsList() const
ConductorSegment * m_moved_segment
void segmentsToPath()
Conductor::segmentsToPath Generate the QPainterPath from the list of points.
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
Conductor::hoverLeaveEvent Manage the mouse leave event.
bool isValid() const
Conductor::isValid.
void setUpConnectionForFormula(QString old_formula, QString new_formula)
Conductor::setUpConnectionForFormula setup connection according to the variable of formula...
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
Conductor::hoverEnterEvent Manage the hover enter event.
static bool valideXml(QDomElement &)
void pointsToSegments(const QList< QPointF > &)
void removeHandler()
Conductor::removeHandler Remove the handlers of this item.
QVector< QPointF > handlerPoints() const
Conductor::handlerPoints.
ConductorTextItem * m_text_item
Text input for non simple, non-singleline conductors.
uint segmentsCount(QET::ConductorSegmentType=QET::Both) const
ConductorProperties m_properties
Functional properties.
void setProfile(const ConductorProfile &, Qt::Corner)
qreal length() const
Conductor::length.
void editProperty()
Conductor::editProperty.
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMousePressEvent.
virtual bool wasRotateByUser() const
ConductorTextItem::wasRotateByUser.
QVector< QetGraphicsHandlerItem * > m_handler_vector
void projectDiagramsOrderChanged(QETProject *, int, int)
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMouseReleaseEvent.
Highlight must_highlight_
Define whether and how the conductor should be highlighted.
void calculateTextItemPosition()
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizont...
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
static Qt::Corner movementType(const QPointF &, const QPointF &)
static QBrush conductor_brush
QString m_tension_protocol
static QPen conductor_pen
QPen et QBrush objects used to draw conductors.
QPainterPath shape() const override
Conductor::shape.
void setFont(const QFont &font)
QPair< QPointF, Qt::Corner > ConductorBend
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mousePressEvent Manage the mouse press event.
QList< ConductorSegmentProfile * > horizontalSegments()
virtual QPainterPath nearShape() const
Conductor::nearShape.
void removeConductor(Conductor *conductor)
Terminal::removeConductor Remove a conductor from this terminal.
static void loadSequential(const QDomElement &dom_element, Conductor *conductor)
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &)
bool has_to_save_profile
Whether the current profile should be saved as soon as possible.
void fromXml(const QDomElement &element)
sequentialNumbers::fromXml Import sequential values from a QDomElement
static QVector< QetGraphicsHandlerItem * > handlerForPoint(const QVector< QPointF > &points, int size=10)
QetGraphicsHandlerItem::handlerForPoint.
QStringList hundred_folio
static int getSign(const qreal &)
QList< Conductor * > relatedConductors(const Conductor *conductor)
relatedConductors
void updatePath(const QRectF &=QRectF())
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram)
longuestConductorInPotential
ConductorProperties properties() const
void adjusteHandlerPos()
Conductor::adjusteHandlerPos Adjust the position of the handler item.
QETProject * project() const
void setSequenceNum(const autonum::sequentialNumbers &sn)
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal=9.0)
Diagram * diagram() const
void displayedTextChanged()
Conductor::displayedTextChanged Update the properties (text) of this conductor and other conductors a...
static void loadSequential(const QDomElement &dom_element, const QString &seq, QStringList *list)
uint segmentsCount(QET::ConductorSegmentType) const
ConductorProperties defaultConductorProperties
Default properties for new conductors.
Qt::Corner currentPathType() const
void setProfiles(const ConductorProfilesGroup &)
Conductor::setProfiles.
void deleteSegments()
Supprime les segments.
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &)
Orientation
Orientation (used for electrical elements and their terminals)
virtual Highlight highlight() const
void updateConductorPath(const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation)
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
Conductor::sceneEventFilter.