Number terminals and export wire numbers without building every folio (stage D5)

Terminal numbering builds only the folios holding a terminal. The wire
numbers export reads the wires of the folios not built from the project
database, and walks a built folio's own wires instead of a
DiagramContent, which followed their potentials through folio reports
and built the folios at the other end. The wiring list export names a
folio from its title block, which a folio not built has; it still
builds every folio, writing the whole project out (toXml()).

tst_lazyfolios: wire numbers exported as when built, from a .qet and a
.qetz, building no folio (fails with DiagramContent: 27 built);
terminal numbering builds 7 folios, those with a terminal (fails with
diagrams(): 47); the wiring list as when built. ctest 96/96 eager and
lazy; 342 corpus projects save the same in all four arms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-12 10:37:27 +13:00
parent e7fd820db6
commit b972dbec4b
6 changed files with 108 additions and 8 deletions
+26
View File
@@ -1263,6 +1263,32 @@ QList<projectDataBase::FolioSymbol> projectDataBase::symbolsOnFolios(const QList
return symbols;
}
/**
@brief projectDataBase::wiresOnFolios
@return the wires on the folios @p folios, folio by folio in that order,
read from the conductor table as it is (see elementTypesOnFolios())
*/
QList<projectDataBase::FolioWire> projectDataBase::wiresOnFolios(const QList<QUuid> &folios) const
{
QList<FolioWire> wires;
QSqlQuery query(m_data_base);
query.prepare(QStringLiteral("SELECT c.text, e1.type, e2.type FROM conductor c "
"LEFT JOIN element e1 ON e1.uuid = c.terminal1_element_uuid "
"LEFT JOIN element e2 ON e2.uuid = c.terminal2_element_uuid "
"WHERE c.diagram_uuid = :folio ORDER BY c.rowid"));
for (const QUuid &folio : folios) {
query.bindValue(QStringLiteral(":folio"), folio.toString());
if (!query.exec()) {
continue;
}
while (query.next()) {
wires.append({query.value(0).toString(), query.value(1).toString(),
query.value(2).toString()});
}
}
return wires;
}
/**
@brief projectDataBase::linkedSymbols
@return the symbols @p element is linked to, read from the link table
+4
View File
@@ -191,6 +191,10 @@ class projectDataBase : public QObject
};
QList<FolioSymbol> symbolsOnFolios(const QList<QUuid> &folios) const;
QList<QUuid> linkedSymbols(const QUuid &element) const;
/// A wire placed on a folio: its text and the kinds of the
/// symbols at its ends (ElementData::typeToString())
struct FolioWire { QString text; QString kind1; QString kind2; };
QList<FolioWire> wiresOnFolios(const QList<QUuid> &folios) const;
static QVariant sequenceValue(const autonum::sequentialNumbers &sequence);
static autonum::sequentialNumbers sequenceFromValue(const QVariant &value);