[122] Kern: verstecktes zweites Dokument abgeschafft (Fang mit Ausschluss, withDocument für abgewandelte Projekte)
documentFor findet nur offene Dokumente (Store, CLI, withDocument); kein sync/Differenz-Abgleich mehr. Fang beim Ziehen: excludeIds -> doc_snap_hold(..., skip). Export/Publikation/Legende/Vorschau/Standards/ Stifte/Schnitt auf älterem Stand: kurzlebiges Dokument. Fremdes Projekt neben dem Store wirft in Dev/Tests.
This commit is contained in:
20 files changed
+277
-135
No files matched your search
@@ -6,6 +6,7 @@
|
||||
import type { Layout, LayoutLegend, Project } from "../model/types";
|
||||
import { collectVisibleCodes } from "../model/types";
|
||||
import { generatePlan, type Plan } from "../plan/generatePlan";
|
||||
import { withDocument } from "../core/document";
|
||||
import { legendDrawings, legendEntries } from "../analysis/legend";
|
||||
import { SHEET_SCALE_DENOMINATOR, sheetMmToModel } from "../model/layoutModel";
|
||||
import { planToPrintSvg } from "./planToPrintSvg";
|
||||
@@ -45,7 +46,8 @@ export function legendPlan(project: Project, layout: Layout, legend: LayoutLegen
|
||||
const levelId = `legend-${legend.id}`;
|
||||
const { drawings, widthMm, heightMm } = legendDrawings(project, legend, entries, levelId);
|
||||
const tmp = legendProject(project, layout, drawings, levelId);
|
||||
const plan = generatePlan(tmp, levelId, collectVisibleCodes(tmp.layers), undefined, "fein", false, false, false, SHEET_SCALE_DENOMINATOR, true);
|
||||
// Hilfsprojekt = eigenes, kurzlebiges Dokument ([122]); `forPrint` braucht danach nichts mehr davon.
|
||||
const plan = withDocument(tmp, () => generatePlan(tmp, levelId, collectVisibleCodes(tmp.layers), undefined, "fein", false, false, false, SHEET_SCALE_DENOMINATOR, true));
|
||||
return { plan, xMm: legend.xMm, yMm: legend.yMm, widthMm, heightMm };
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { legendDrawings, legendEntries } from "../analysis/legend";
|
||||
import { buildPagesPdf, layoutPages } from "./layoutPdf";
|
||||
import { buildPlanDwg, buildPlanDxfBinary } from "./exportDxf";
|
||||
import { loadFileio } from "../engine/fileioWasm";
|
||||
import { withDocument } from "../core/document";
|
||||
import type { PublishPlan } from "./publishSet";
|
||||
import type { FolderPdfPage } from "../model/layoutModel";
|
||||
|
||||
@@ -63,15 +64,23 @@ async function cadFile(project: Project, set: PublishSet, plan: PublishPlan, fil
|
||||
.find(Boolean);
|
||||
const levelId = firstSnap?.activeLevelId ?? scoped.drawingLevels.find((l) => !l.layoutId)?.id ?? scoped.drawingLevels[0]?.id ?? "";
|
||||
const scale = set.scaleOverride ?? 100;
|
||||
const p = generatePlan(scoped, levelId, collectVisibleCodes(scoped.layers), undefined, "fein", false, false, true, scale, true);
|
||||
const opts = { scaleDenominator: scale, paperLayout: true, levelId, title: set.name };
|
||||
const bytes = format === "dwg" ? buildPlanDwg(p, scoped, opts) : buildPlanDxfBinary(p, scoped, opts);
|
||||
// Gefilterte Kopie mit Legenden = eigenes, kurzlebiges Dokument ([122]).
|
||||
const bytes = withDocument(scoped, () => {
|
||||
const p = generatePlan(scoped, levelId, collectVisibleCodes(scoped.layers), undefined, "fein", false, false, true, scale, true);
|
||||
return format === "dwg" ? buildPlanDwg(p, scoped, opts) : buildPlanDxfBinary(p, scoped, opts);
|
||||
});
|
||||
return { fileName, bytes, mime: format === "dwg" ? "image/vnd.dwg" : "application/dxf" };
|
||||
}
|
||||
|
||||
/** Erzeugt alle Dateien des Plans. */
|
||||
export async function runPublish(project: Project, set: PublishSet, plan: PublishPlan): Promise<PublishedFile[]> {
|
||||
const shown = projectForPublish(project, plan);
|
||||
// Das veröffentlichte Projekt (Revisionen hochgezählt) = eigenes Dokument, solange der Lauf dauert ([122]).
|
||||
return withDocument(shown, () => publishFiles(shown, set, plan));
|
||||
}
|
||||
|
||||
async function publishFiles(shown: Project, set: PublishSet, plan: PublishPlan): Promise<PublishedFile[]> {
|
||||
const out: PublishedFile[] = [];
|
||||
for (const f of plan.files) {
|
||||
if (f.format === "dxf" || f.format === "dwg") {
|
||||
|
||||
Reference in new issue
Block a user