Add cable management: drawing, cores, numbering, cross-references and cable list

Cables are drawn line objects (toolbar button next to the auto
break/reconnect button, click-move-click, right click cancels), not
components. The type comes from a CSV catalog following the material
list pattern (designation, cores, core colours, editable through the
entry dialog with "Nouvelle entrée" / "Modifier l'entrée").

Each core is bound to the wire its colour label stands on, and the
cable reference is generated per core and written into the Conductor
entry via Conductor::setCableReference(label, cable uuid, slot). The
conductor entry is where it has to live because the terminal strip
plan (Klemmenplan) consumes it in the next step.

Numbering: "Cables" rule under Programmeinstellungen/Neues
Projekt/Nummerierung auto (mirrored in project properties), literal
"W" fallback without a rule, French gate dialog when no rule exists,
Nummerierung menu with the renumber dialog (preferred axis, per-folio
counter, rule and counter state written back, hand-typed names ask,
whole-project scope).

Also included: label block and under-line texts with per-text font and
alignment plus the material-list cell margins, free-core placement and
right-click removal, claim questions for wires of other cables,
multi-selection drag as one undo step, type change with confirmation,
cross-references for type "Cable" (%f-%l%c, own font, clickable links
in exported PDFs), report propagation of the cable definition,
Listes menu (table of contents, material list, terminal strip manager,
terminal generator plugin, cable list), cable list with freely
selectable columns (installation/localisation of cable, start and end,
Blatt start/end, length, used cores...), CSV export dialog with column
pick and preview in the Projekt menu, script API (addTable kind
"cable_list", exportCableList) and a unit test for the type catalog.
This commit is contained in:
Kellermorph
2026-10-08 15:56:00 +02:00
parent 1ca13ce62d
commit bf9b34398d
108 changed files with 18482 additions and 293 deletions
+19 -3
View File
@@ -19,6 +19,8 @@
#include "ElementsCollection/elementcollectionhandler.h"
#include "TerminalStrip/GraphicsItem/terminalstripitem.h"
#include "cable/cablecopy.h"
#include "cable/cablepart.h"
#include "xml/terminalstripitemxml.h"
#include "QPropertyUndoCommand/qpropertyundocommand.h"
#include "diagramcontent.h"
@@ -1404,9 +1406,10 @@ void Diagram::folioSequentialsToXml(QHash<QString,
bool Diagram::fromXml(QDomDocument &document,
QPointF position,
bool consider_informations,
DiagramContent *content_ptr) {
DiagramContent *content_ptr,
QList<CablePart *> *cables_added) {
QDomElement root = document.documentElement();
return(fromXml(root, position, consider_informations, content_ptr));
return(fromXml(root, position, consider_informations, content_ptr, cables_added));
}
/**
@@ -1564,7 +1567,8 @@ Terminal* findTerminal(int conductor_index,
bool Diagram::fromXml(QDomElement &document,
QPointF position,
bool consider_informations,
DiagramContent *content_ptr)
DiagramContent *content_ptr,
QList<CablePart *> *cables_added)
{
const QDomElement& root = document;
// The first element must be a diagram
@@ -1826,6 +1830,17 @@ bool Diagram::fromXml(QDomElement &document,
//Load terminal strip item
QVector<TerminalStripItem *> added_strips { TerminalStripItemXml::fromXml(this, root) };
//Load the cable lines a copy fragment carries -- built here
//rather than in the caller so that they are placed with the rest
//of the selection, but only when the caller asked to be handed
//them: a folio loaded from a project file holds no cable of its
//own, the cables of a project are read at project level.
QList<CablePart *> added_cables;
if (cables_added) {
added_cables = CableCopy::read(this, root);
*cables_added = added_cables;
}
//Translate items if a new position was given in parameter
if (position != QPointF())
{
@@ -1836,6 +1851,7 @@ bool Diagram::fromXml(QDomElement &document,
for (auto image : std::as_const(added_images )) added_items << image;
for (auto table : std::as_const(added_tables )) added_items << table;
for (const auto &strip : std::as_const(added_strips)) added_items << strip;
for (const auto &cable : std::as_const(added_cables)) added_items << cable;
//Get the top left corner of the rectangle that contain all added items
QRectF items_rect;