mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 06:34:14 +02:00
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:
@@ -642,6 +642,74 @@ namespace autonum
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief resetFolioCounters
|
||||
@param nc the rule to read
|
||||
@return the same rule, with the parts whose counter belongs to a
|
||||
single folio put back to the beginning that folio is numbered
|
||||
from -- the initial value the rule carries for it -- while the
|
||||
parts counting over the whole project are left alone
|
||||
*/
|
||||
NumerotationContext resetFolioCounters(const NumerotationContext &nc)
|
||||
{
|
||||
NumerotationContext out = nc;
|
||||
for (int i = 0; i < out.size(); ++i)
|
||||
{
|
||||
const QStringList parts = out.itemAt(i);
|
||||
if (parts.isEmpty()) continue;
|
||||
|
||||
const QString &type = parts.at(0);
|
||||
if (type == QLatin1String("unitfolio")
|
||||
|| type == QLatin1String("tenfolio")
|
||||
|| type == QLatin1String("hundredfolio"))
|
||||
{
|
||||
//The beginning a folio is numbered from is the one
|
||||
//written into the rule, never a hard 1: a counter
|
||||
//starting at 5 starts every folio at 5.
|
||||
const bool has_start = parts.size() > 3
|
||||
&& !parts.at(3).isEmpty();
|
||||
out.replaceValue(i, has_start ? parts.at(3)
|
||||
: QStringLiteral("1"));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief resetContextCounters
|
||||
@param nc the rule to read
|
||||
@return the same rule, with every part which counts set back to
|
||||
the value it started from
|
||||
*/
|
||||
NumerotationContext resetContextCounters(const NumerotationContext &nc)
|
||||
{
|
||||
NumerotationContext out = resetFolioCounters(nc);
|
||||
for (int i = 0; i < out.size(); ++i)
|
||||
{
|
||||
const QStringList parts = out.itemAt(i);
|
||||
if (parts.isEmpty()) continue;
|
||||
|
||||
const QString &type = parts.at(0);
|
||||
if (type == QLatin1String("unit")
|
||||
|| type == QLatin1String("ten")
|
||||
|| type == QLatin1String("hundred"))
|
||||
{
|
||||
out.replaceValue(i, QStringLiteral("1"));
|
||||
}
|
||||
else if (type == QLatin1String("wrap"))
|
||||
{
|
||||
//A cyclic part walks over [0, modulus), so it goes
|
||||
//back to 0 rather than to 1
|
||||
out.replaceValue(i, QStringLiteral("0"));
|
||||
}
|
||||
else if (type == QLatin1String("alpha"))
|
||||
{
|
||||
out.replaceValue(i, QStringLiteral("a"));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief numerotationContextToFormula
|
||||
@param nc
|
||||
|
||||
Reference in New Issue
Block a user