[208] Anonyme Abgabe vollständig: Berichte, IFC, DXF-Blattnamen, STEP, Blender-Paket, Dateinamen über zentrale competitionIdentity; Test über alle Formate
This commit is contained in:
29 files changed
+488
-72
No files matched your search
+18
-17
@@ -95,6 +95,7 @@ import {
|
||||
areaReportToCsv,
|
||||
areaReportToSvg,
|
||||
buildAreaReportPdf,
|
||||
exportProjectName,
|
||||
sunPosition,
|
||||
shadowPolygons,
|
||||
projectLatLon,
|
||||
@@ -813,7 +814,7 @@ function blenderFailure(e: unknown): number {
|
||||
/** `dossier-cli … render`: Paket bauen, Blender starten, Bild nach `--out`. Rückgabe = Exit-Code. */
|
||||
async function runRender(project: Project, args: Args): Promise<number> {
|
||||
const pkg = await buildCliPackage(project, args, "render");
|
||||
const target = args.flags.get("out") ?? `${project.name || "projekt"}.png`;
|
||||
const target = args.flags.get("out") ?? `${exportProjectName(project) || "projekt"}.png`;
|
||||
try {
|
||||
const res = await runBlenderRender(nodeBlenderHost(args.flags.has("keep")), pkg, {
|
||||
script: renderScript(args),
|
||||
@@ -835,7 +836,7 @@ async function runRender(project: Project, args: Args): Promise<number> {
|
||||
/** [228] `dossier-cli … blend`: Szene wie fürs Rendering aufbauen und als .blend nach `--out` speichern (nicht rendern). */
|
||||
async function runBlend(project: Project, args: Args): Promise<number> {
|
||||
const pkg = await buildCliPackage(project, args, "save");
|
||||
const target = args.flags.get("out") ?? `${project.name || "projekt"}.blend`;
|
||||
const target = args.flags.get("out") ?? `${exportProjectName(project) || "projekt"}.blend`;
|
||||
try {
|
||||
const res = await runBlenderSave(nodeBlenderHost(args.flags.has("keep")), pkg, {
|
||||
script: renderScript(args),
|
||||
@@ -992,16 +993,16 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
case "ifc":
|
||||
await loadFileio();
|
||||
// --ebkph: eBKP-H-Hauptgruppen je Bauteilart; --ebenen: Ebene (categoryCode) des Modells als Klassifikation.
|
||||
out(args, exportIfcSpf(project, { ebkph: args.flags.has("ebkph"), layerCodes: args.flags.has("ebenen"), schema: ifcSchemaFlag(args) }), `${project.name || "projekt"}.ifc`);
|
||||
out(args, exportIfcSpf(project, { ebkph: args.flags.has("ebkph"), layerCodes: args.flags.has("ebenen"), schema: ifcSchemaFlag(args) }), `${exportProjectName(project) || "projekt"}.ifc`);
|
||||
return 0;
|
||||
case "obj":
|
||||
await loadFileio();
|
||||
// [201] Mit MTL (Farben) daneben: `--out haus.obj` schreibt auch `haus.mtl`; `--out -` oder `--no-mtl`: nur das OBJ
|
||||
// (Farben dann als Kommentar im Kopf).
|
||||
{
|
||||
const target = args.flags.get("out") ?? `${project.name || "projekt"}.obj`;
|
||||
const target = args.flags.get("out") ?? `${exportProjectName(project) || "projekt"}.obj`;
|
||||
if (target === "-" || args.flags.has("no-mtl")) {
|
||||
out(args, exportObj(project), `${project.name || "projekt"}.obj`);
|
||||
out(args, exportObj(project), `${exportProjectName(project) || "projekt"}.obj`);
|
||||
} else {
|
||||
const mtlPath = target.replace(/\.obj$/i, "") + ".mtl";
|
||||
out(args, exportObj(project, {}, basename(mtlPath)), target);
|
||||
@@ -1012,15 +1013,15 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
return 0;
|
||||
case "stl":
|
||||
await loadFileio();
|
||||
out(args, exportStl(project), `${project.name || "projekt"}.stl`);
|
||||
out(args, exportStl(project), `${exportProjectName(project) || "projekt"}.stl`);
|
||||
return 0;
|
||||
case "glb":
|
||||
await loadFileio();
|
||||
out(args, exportGlb(project, { byLevel: !args.flags.has("flat") }), `${project.name || "projekt"}.glb`);
|
||||
out(args, exportGlb(project, { byLevel: !args.flags.has("flat") }), `${exportProjectName(project) || "projekt"}.glb`);
|
||||
return 0;
|
||||
case "gltf":
|
||||
await loadFileio();
|
||||
out(args, exportGltf(project, { byLevel: !args.flags.has("flat") }), `${project.name || "projekt"}.gltf`);
|
||||
out(args, exportGltf(project, { byLevel: !args.flags.has("flat") }), `${exportProjectName(project) || "projekt"}.gltf`);
|
||||
return 0;
|
||||
case "kennzahlen": {
|
||||
// --sia416 / --ivhb: Flächentabelle bzw. IVHB-Kennziffern [70]; --format json|csv|svg|pdf (Default json).
|
||||
@@ -1038,7 +1039,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
const wantAreas = args.flags.has("sia416");
|
||||
const wantIvhb = args.flags.has("ivhb");
|
||||
const format = args.flags.get("format") ?? "json";
|
||||
const stem = `${project.name || "projekt"}-flaechen`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-flaechen`;
|
||||
if (format === "json") {
|
||||
const json = { ...(wantAreas ? { flaechentabelle: computeAreaTable(project) } : {}), ...(wantIvhb ? { ivhb: computeIvhb(project, ivhbOptions) } : {}) };
|
||||
out(args, JSON.stringify(json, null, 2), `${stem}.json`);
|
||||
@@ -1056,7 +1057,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
const baurecht = checkSiteRules(project);
|
||||
// [68] Erdarbeiten je Baugrube (Abtrag/Auftrag/Hinterfüllung, m³).
|
||||
const erdarbeiten = excavationQuantities(project);
|
||||
out(args, JSON.stringify({ kennzahlen: k, raumprogramm: prog, baurecht, erdarbeiten }, null, 2), `${project.name || "projekt"}-kennzahlen.json`);
|
||||
out(args, JSON.stringify({ kennzahlen: k, raumprogramm: prog, baurecht, erdarbeiten }, null, 2), `${exportProjectName(project) || "projekt"}-kennzahlen.json`);
|
||||
return 0;
|
||||
}
|
||||
case "raumprogramm": {
|
||||
@@ -1114,14 +1115,14 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
if (Number.isNaN(when.getTime())) throw new Error("--when: ungültiges Datum");
|
||||
const { lat, lon } = projectLatLon(project);
|
||||
const sun = sunPosition(lat, lon, when);
|
||||
out(args, JSON.stringify({ when: when.toISOString(), lat, lon, sun, shadows: shadowPolygons(project, sun) }, null, 2), `${project.name || "projekt"}-sonne.json`);
|
||||
out(args, JSON.stringify({ when: when.toISOString(), lat, lon, sun, shadows: shadowPolygons(project, sun) }, null, 2), `${exportProjectName(project) || "projekt"}-sonne.json`);
|
||||
return 0;
|
||||
}
|
||||
case "schedule": {
|
||||
// --openings: Fenster- und Türliste statt Bauteilliste [--format json|csv|svg|pdf] (Default csv)
|
||||
if (args.flags.has("openings")) {
|
||||
const format = args.flags.get("format") ?? "csv";
|
||||
const stem = `${project.name || "projekt"}-fenster-tueren`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-fenster-tueren`;
|
||||
if (format === "json") out(args, JSON.stringify(openingSchedule(project), null, 2), `${stem}.json`);
|
||||
else {
|
||||
const report = buildOpeningReport(project);
|
||||
@@ -1135,7 +1136,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
// --rooms: Raumbuch mit Oberflächen und Mengen ([158]) [--format json|csv|svg|pdf] (Default csv)
|
||||
if (args.flags.has("rooms")) {
|
||||
const format = args.flags.get("format") ?? "csv";
|
||||
const stem = `${project.name || "projekt"}-raumbuch`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-raumbuch`;
|
||||
if (format === "json") out(args, JSON.stringify(roomBook(project), null, 2), `${stem}.json`);
|
||||
else {
|
||||
const report = buildRoomBookReport(project);
|
||||
@@ -1149,7 +1150,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
// --elements: Bauteilliste mit U-Werten aus den Schichten ([71]) [--format json|csv|svg|pdf] (Default csv)
|
||||
if (args.flags.has("elements")) {
|
||||
const format = args.flags.get("format") ?? "csv";
|
||||
const stem = `${project.name || "projekt"}-bauteile`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-bauteile`;
|
||||
if (format === "json") out(args, JSON.stringify(elementSchedule(project), null, 2), `${stem}.json`);
|
||||
else {
|
||||
const report = buildElementReport(project);
|
||||
@@ -1160,13 +1161,13 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
out(args, exportScheduleCsv(project), `${project.name || "projekt"}-liste.csv`);
|
||||
out(args, exportScheduleCsv(project), `${exportProjectName(project) || "projekt"}-liste.csv`);
|
||||
return 0;
|
||||
}
|
||||
case "step": {
|
||||
const r = await exportProjectStep(project, project.name || "projekt");
|
||||
if (r.skipped.length) process.stderr.write(`${r.skipped.length} Körper übersprungen/ungeschnitten.\n`);
|
||||
out(args, r.text, `${project.name || "projekt"}.stp`);
|
||||
out(args, r.text, `${exportProjectName(project) || "projekt"}.stp`);
|
||||
return 0;
|
||||
}
|
||||
case "import-ifc": {
|
||||
@@ -1251,7 +1252,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
ghostPattern: Array.from(emitSurfacePatternLines(project, explode, ghost)),
|
||||
}
|
||||
: model;
|
||||
out(args, JSON.stringify(json), `${project.name || "projekt"}.model3d.json`);
|
||||
out(args, JSON.stringify(json), `${exportProjectName(project) || "projekt"}.model3d.json`);
|
||||
return 0;
|
||||
}
|
||||
case "bench": {
|
||||
|
||||
@@ -43,6 +43,8 @@ export { sheetTables, createTable, drawTablesPdf, tableCatalog, tableLabels, tab
|
||||
export type { TableOut, TablePrim, TableColumn } from "../export/sheetTable";
|
||||
export { computeAreaTable, computeIvhb } from "../analysis/areaTable";
|
||||
export type { AreaTable, AreaRow, Ivhb, IvhbOptions, AgfBasis } from "../analysis/areaTable";
|
||||
export { exportProjectName, competitionIdentity, isAnonymous, competitionKeyword, identityLeaks, NEUTRAL_DATE, NEUTRAL_ISO } from "../export/competitionIdentity";
|
||||
export type { CompetitionIdentity } from "../export/competitionIdentity";
|
||||
export { buildAreaReport, areaReportToCsv, parseAreaReportCsv, areaReportToSvg, buildAreaReportPdf } from "../export/areaReport";
|
||||
export type { AreaReport, AreaReportOptions } from "../export/areaReport";
|
||||
export { sunPosition, shadowPolygons, shadowOfPrism, projectLatLon } from "../analysis/sun";
|
||||
|
||||
@@ -17,6 +17,7 @@ Abschnitt 3.4).
|
||||
| `layoutPdf.ts` | alle Layouts eines Ordners als Mehrseiten-PDF |
|
||||
| `pdfLayers.ts` | PDF-Ebenen (Optional Content Groups, `[80]`) |
|
||||
| `pdfInfo.ts` | PDF-Info-Wörterbuch; bei anonymer Wettbewerbs-Abgabe nur das Kennwort, Producer/Datum längengleich neutralisiert (`[208]`) |
|
||||
| `competitionIdentity.ts` | Anonyme Abgabe ([208]): `competitionIdentity`, `exportProjectName`, `reportHead`, Gegenprüfer `identityLeaks`; alle Exporter holen Name/Autor/Zeitstempel hier. Test `competitionAnonymous.test.ts` |
|
||||
| `exportDxf.ts` | DXF/DWG des Grundrisses in Modellmetern; Schreiben in `src-tauri/fileio/src/export.rs` |
|
||||
| `legendSvg.ts` | Legende als Plan-/Druck-SVG (`[82]`) |
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
//
|
||||
// Die Flächenarten folgen SIA 416, die Kennziffern der IVHB; Herleitung im Kern (`flaechen.rs`).
|
||||
|
||||
import { reportHead } from "./competitionIdentity";
|
||||
import { anonymizeJsPdf } from "./pdfInfo";
|
||||
import { jsPDF } from "jspdf";
|
||||
import type { Project } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
@@ -36,6 +38,8 @@ export interface ReportSection {
|
||||
export interface AreaReport {
|
||||
title: string;
|
||||
projectName: string;
|
||||
/** Anonyme Wettbewerbs-Abgabe ([208]): `projectName` ist das Kennwort; das PDF trägt keine Erzeuger- und Datumsangaben. */
|
||||
anonymous?: boolean;
|
||||
sections: ReportSection[];
|
||||
/** Fussnoten (Quellen, Annahmen). */
|
||||
notes: string[];
|
||||
@@ -111,7 +115,7 @@ export function buildAreaReport(project: Project, opts: AreaReportOptions = {}):
|
||||
notes.push(t("areas.foot.ivhb"));
|
||||
addNotes(v.notes);
|
||||
}
|
||||
return { title: t("areas.title"), projectName: project.name ?? "", sections, notes };
|
||||
return { title: t("areas.title"), ...reportHead(project), sections, notes };
|
||||
}
|
||||
|
||||
// ── CSV, Seitenaufteilung, SVG: rechnet der Kern (`core/src/area_report.rs`, Bericht als JSON) ─────────────
|
||||
@@ -185,5 +189,6 @@ export function buildAreaReportPdf(report: AreaReport, o: ReportLayoutOptions =
|
||||
}
|
||||
}
|
||||
});
|
||||
if (report.anonymous) anonymizeJsPdf(doc, report.projectName);
|
||||
return doc;
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
// Achsen in `scene.json`: Modell-Koordinaten (x Ost, y Nord, z oben, Meter) — Blenders glTF-Import dreht das
|
||||
// Y-oben-GLB genau dorthin zurück, Kamera und Sonne brauchen im Skript keine Umrechnung.
|
||||
|
||||
import { exportProjectName } from "./competitionIdentity";
|
||||
import type { Camera, ComponentMaterial, LayoutOrientation, LayoutPaperFormat, Project } from "../model/types";
|
||||
import { projectLatLon, sunPosition } from "../analysis/sun";
|
||||
import { sheetSizeMm } from "../model/layoutModel";
|
||||
@@ -392,7 +393,7 @@ export async function buildRenderPackage(project: Project, opts: RenderOptions,
|
||||
|
||||
const scene: RenderScene = {
|
||||
version: 1,
|
||||
project: project.name || "projekt",
|
||||
project: exportProjectName(project) || "projekt",
|
||||
model: "model.glb",
|
||||
output: "render.png",
|
||||
resolution: { width: Math.round(opts.width), height: Math.round(opts.height) },
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
// [208] Anonyme Wettbewerbs-Abgabe: kein Export verrät Büro, Bearbeiter:in, Projektname oder Projektnummer — nur das
|
||||
// Kennwort. Ein Beispielprojekt mit gesetzten Namen geht durch alle Formate (PDF-Info und -Text, Berichte als CSV/PDF,
|
||||
// IFC4/IFC2x3, DXF ASCII/Binär/DWG, SVG, OBJ/MTL/STL/glTF, STEP, CSV, Blender-Paket); danach darf keiner der Namen
|
||||
// vorkommen (Gross-/Kleinschreibung egal). Gegenprobe: ohne Anonymität stehen die Namen in den Ausgaben, der Test
|
||||
// prüft also wirklich etwas. Muster: e2e `competition`, `layoutPdf.images.test.ts`.
|
||||
|
||||
import "../engine/fileioWasm.setup";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { inflateSync } from "node:zlib";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import { createPosterMaster, posterTemplate } from "../model/posterTemplates";
|
||||
import { flattenCategories } from "../model/types";
|
||||
import type { Layout, Project } from "../model/types";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import { buildPlanDwg, buildPlanDxf, buildPlanDxfBinary } from "./exportDxf";
|
||||
import { exportIfcSpf } from "./exportIfc";
|
||||
import { exportGlb, exportGltf, exportMtl, exportObj, exportStl } from "./exportMesh";
|
||||
import { exportScheduleCsv } from "./exportSchedule";
|
||||
import { exportProjectStep } from "./exportStep";
|
||||
import { buildPagesPdf, layoutPages, pdfBytes } from "./layoutPdf";
|
||||
import { planToSvgString } from "./planToSvgString";
|
||||
import { areaReportToCsv, buildAreaReport, buildAreaReportPdf } from "./areaReport";
|
||||
import { buildProgramReport } from "./programReport";
|
||||
import { buildRoomBookReport } from "./roomBook";
|
||||
import { buildOpeningReport } from "./openingSchedule";
|
||||
import { buildElementReport } from "./elementSchedule";
|
||||
import { buildCostReport } from "./costReport";
|
||||
import { buildRenderPackage } from "./blenderRender";
|
||||
import { identityLeaks, identifyingTexts, NEUTRAL_ISO } from "./competitionIdentity";
|
||||
import { pdfInfoText } from "./pdfInfo";
|
||||
|
||||
const OFFICE = "BUEROXYZ Architekten AG";
|
||||
const AUTHOR = "BEARBEITERQ Muster";
|
||||
const NAME = "PROJEKTNAMEZ Haus";
|
||||
const NUMBER = "NUMMER4711";
|
||||
const KEYWORD = "FALKE 7";
|
||||
const SECRETS = [OFFICE, AUTHOR, NAME, NUMBER];
|
||||
|
||||
/** Ganzes Beispielprojekt mit Büro-, Bearbeiter- und Projektangaben; Blatt mit Plakat-Kopf (zeigt Projekt/Autor). */
|
||||
function project(anonymous: boolean | null): Project {
|
||||
const master = createPosterMaster("m1", posterTemplate("poster-a1-landscape")!);
|
||||
master.titleBlock = { projectName: `${OFFICE} ${NAME}`, author: AUTHOR };
|
||||
const layout: Layout = { id: "l1", name: "Grundriss", paper: "a1", orientation: "landscape", masterId: "m1", viewports: [] };
|
||||
return {
|
||||
...sampleProject,
|
||||
name: NAME,
|
||||
projectNumber: NUMBER,
|
||||
masterLayouts: [master],
|
||||
layouts: [layout],
|
||||
...(anonymous === null ? {} : { competition: { anonymous, keyword: KEYWORD } }),
|
||||
} as Project;
|
||||
}
|
||||
|
||||
const latin1 = (b: Uint8Array): string => Buffer.from(b).toString("latin1");
|
||||
|
||||
/** Seiteninhalt (Flate-Streams) des PDF entpackt, hintereinander. */
|
||||
function streamsText(bytes: Uint8Array): string {
|
||||
const all = Buffer.from(bytes);
|
||||
const text = all.toString("latin1");
|
||||
let out = "";
|
||||
for (const m of text.matchAll(/stream\r?\n/g)) {
|
||||
const from = m.index! + m[0].length;
|
||||
const to = text.indexOf("endstream", from);
|
||||
try {
|
||||
out += inflateSync(all.subarray(from, to)).toString("latin1") + "\n";
|
||||
} catch {
|
||||
// kein Flate-Stream
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Alle Ausgaben, die ohne Browser/GPU entstehen: Name → Text (Binärformate als latin1). */
|
||||
async function allOutputs(p: Project): Promise<Record<string, string>> {
|
||||
const plan = generatePlan(p, "eg", new Set(flattenCategories(p.layers).map((l) => l.code)));
|
||||
const out: Record<string, string> = {};
|
||||
// PDF: Blatt (Info + Seiteninhalt) und Berichte (Info + Inhalt)
|
||||
const doc = await buildPagesPdf(p, layoutPages(p, ["l1"]));
|
||||
const sheet = pdfBytes(p, doc!);
|
||||
out["PDF-Blatt"] = latin1(sheet);
|
||||
out["PDF-Blatt-Text"] = streamsText(sheet);
|
||||
out["PDF-Blatt-Info"] = pdfInfoText(sheet);
|
||||
const reports = { Flaechen: buildAreaReport(p, { ivhb: true }), Programm: buildProgramReport(p), Raumbuch: buildRoomBookReport(p), Oeffnungen: buildOpeningReport(p), Bauteile: buildElementReport(p), Kosten: buildCostReport(p) };
|
||||
for (const [name, report] of Object.entries(reports)) {
|
||||
out[`CSV-${name}`] = areaReportToCsv(report);
|
||||
const bytes = new Uint8Array(buildAreaReportPdf(report).output("arraybuffer"));
|
||||
out[`PDF-${name}`] = latin1(bytes);
|
||||
out[`PDF-${name}-Text`] = streamsText(bytes);
|
||||
out[`PDF-${name}-Info`] = pdfInfoText(bytes);
|
||||
}
|
||||
// IFC
|
||||
out["IFC4"] = exportIfcSpf(p);
|
||||
out["IFC2x3"] = exportIfcSpf(p, { schema: "IFC2X3" });
|
||||
// DXF/DWG (mit Papierbereich der Projekt-Layouts)
|
||||
out["DXF"] = buildPlanDxf(plan, p, { paperLayout: true, levelId: "eg" });
|
||||
out["DXF-binaer"] = latin1(buildPlanDxfBinary(plan, p, { paperLayout: true, levelId: "eg" }));
|
||||
out["DWG"] = latin1(buildPlanDwg(plan, p, { paperLayout: true, levelId: "eg" }));
|
||||
// SVG, Mesh, CSV
|
||||
out["SVG"] = planToSvgString(plan, { hatch: true });
|
||||
out["OBJ"] = exportObj(p, {}, "m.mtl");
|
||||
out["OBJ-ohne-MTL"] = exportObj(p);
|
||||
out["MTL"] = exportMtl(p);
|
||||
out["STL"] = exportStl(p);
|
||||
out["glTF"] = exportGltf(p);
|
||||
out["GLB"] = latin1(exportGlb(p));
|
||||
out["CSV-Bauteilliste"] = exportScheduleCsv(p);
|
||||
// STEP (truck-WASM)
|
||||
const mod: any = await import("../engine/pkgTruck/trucksolid.js");
|
||||
await mod.default({ module_or_path: readFileSync("src/engine/pkgTruck/trucksolid_bg.wasm") });
|
||||
out["STEP"] = (await exportProjectStep(p)).text;
|
||||
// Blender-Paket (scene.json)
|
||||
const pkg = await buildRenderPackage(p, { width: 640, height: 360, samples: 16, when: new Date(Date.UTC(2026, 5, 21, 10, 0, 0)), camera: { preset: "iso" } });
|
||||
out["Blender-scene.json"] = new TextDecoder().decode(pkg.files.find((f) => f.path === "scene.json")!.bytes);
|
||||
return out;
|
||||
}
|
||||
|
||||
describe("anonyme Wettbewerbs-Abgabe in allen Ausgaben", () => {
|
||||
it("Gegenprobe: ohne Anonymität stehen die Angaben in den Ausgaben (der Test prüft etwas)", async () => {
|
||||
const p = project(false);
|
||||
expect(identifyingTexts(p)).toEqual(expect.arrayContaining([NAME, NUMBER, AUTHOR]));
|
||||
const o = await allOutputs(p);
|
||||
for (const [where, what] of [
|
||||
["IFC4", NAME],
|
||||
["CSV-Flaechen", NAME],
|
||||
["PDF-Flaechen-Text", NAME],
|
||||
["PDF-Blatt-Text", AUTHOR],
|
||||
["Blender-scene.json", NAME],
|
||||
] as const) {
|
||||
expect(o[where], where).toContain(what);
|
||||
}
|
||||
}, 120000);
|
||||
|
||||
it("anonym: keine Ausgabe nennt Büro, Bearbeiter:in, Projektname oder Projektnummer", async () => {
|
||||
const p = project(true);
|
||||
const o = await allOutputs(p);
|
||||
const leaks: string[] = [];
|
||||
for (const [where, text] of Object.entries(o)) {
|
||||
for (const secret of SECRETS) if (text.toLowerCase().includes(secret.toLowerCase())) leaks.push(`${where}: ${secret}`);
|
||||
for (const l of identityLeaks(p, text)) leaks.push(`${where}: ${l}`);
|
||||
}
|
||||
expect(leaks).toEqual([]);
|
||||
}, 120000);
|
||||
|
||||
it("anonym: das Kennwort steht, wo es stehen soll", async () => {
|
||||
const o = await allOutputs(project(true));
|
||||
expect(o["PDF-Blatt-Text"]).toContain(`(${KEYWORD})`);
|
||||
expect(o["PDF-Blatt-Info"]).toContain(`/Title (${KEYWORD})`);
|
||||
expect(o["PDF-Flaechen-Info"]).toContain(`/Title (${KEYWORD})`);
|
||||
expect(o["PDF-Flaechen-Text"]).toContain(KEYWORD);
|
||||
expect(o["CSV-Flaechen"].split("\n")[1]).toBe(KEYWORD);
|
||||
expect(o["IFC4"]).toContain(`IFCPROJECT('`);
|
||||
expect(o["IFC4"]).toContain(`'${KEYWORD}'`);
|
||||
expect(o["IFC4"]).toContain(`FILE_NAME('${KEYWORD}.ifc','${NEUTRAL_ISO}'`);
|
||||
expect(JSON.parse(o["Blender-scene.json"]).project).toBe(KEYWORD);
|
||||
}, 120000);
|
||||
|
||||
it("anonym: keine Zeit- und Erzeugerspuren in PDF-Info, IFC und STEP", async () => {
|
||||
const o = await allOutputs(project(true));
|
||||
const year = String(new Date().getFullYear());
|
||||
for (const key of ["PDF-Blatt-Info", "PDF-Flaechen-Info", "PDF-Raumbuch-Info"]) {
|
||||
expect(o[key], key).not.toMatch(/jsPDF|Dossier/i);
|
||||
expect(o[key], key).not.toContain(`D:${year}`);
|
||||
expect(o[key], key).toContain("D:20000101000000");
|
||||
}
|
||||
for (const key of ["IFC4", "IFC2x3"]) {
|
||||
// „Dossier_Qto_…" ist der Name eines Eigenschaftssatzes (Programm-Konvention), keine Angabe zur Herkunft.
|
||||
expect(o[key].replace(/Dossier_Qto_/g, ""), key).not.toMatch(/dossier/i);
|
||||
expect(o[key], key).not.toContain(`${year}-`);
|
||||
expect(o[key], key).toContain(`'${NEUTRAL_ISO}'`);
|
||||
}
|
||||
expect(o["STEP"]).not.toContain(`${year}-`);
|
||||
expect(o["STEP"]).toContain("2000-01-01 00:00:00.000");
|
||||
}, 120000);
|
||||
|
||||
it("anonym: Blattnamen der Projekt-Layouts erscheinen im DXF nur als „Blatt n“", async () => {
|
||||
const p = project(true);
|
||||
p.layouts = [{ ...p.layouts![0], name: `${OFFICE} Plan 1` }];
|
||||
const plan = generatePlan(p, "eg", new Set(flattenCategories(p.layers).map((l) => l.code)));
|
||||
const dxf = buildPlanDxf(plan, p, { paperLayout: true, levelId: "eg" });
|
||||
expect(dxf).not.toContain("BUEROXYZ");
|
||||
expect(dxf).toContain("Blatt_1");
|
||||
const plain = { ...p, competition: undefined } as Project;
|
||||
expect(buildPlanDxf(plan, plain, { paperLayout: true, levelId: "eg" })).toContain("BUEROXYZ_Architekten_AG_Plan_1");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
// Anonyme Wettbewerbs-Abgabe ([208]): EINE Stelle, die sagt, welche Angaben in eine Ausgabe dürfen. Ist
|
||||
// `Project.competition` anonym, trägt keine Ausgabe (PDF, IFC, DXF/DWG, SVG, CSV, Bilder, Blender-Paket, STEP …)
|
||||
// Büro, Bearbeiter:in, Projektname, Projektnummer, Adresse oder Benutzername — nur das Kennwort. Jeder Exporter holt
|
||||
// seine Angaben hier, statt `project.name` selbst zu lesen. Das Gegenstück im Kern: `src-tauri/core/src/competition.rs`
|
||||
// (IFC-Sammler, DXF-Blattnamen, Plankopf); dort gilt dieselbe Regel.
|
||||
//
|
||||
// Bezeichner englisch, Kommentare deutsch.
|
||||
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
type CompetitionSource = Pick<Project, "competition">;
|
||||
|
||||
/** Fester Zeitstempel anonymer Ausgaben (2000-01-01 00:00:00 UTC): keine Spur, wann und wo gespeichert wurde. */
|
||||
export const NEUTRAL_DATE = new Date(Date.UTC(2000, 0, 1, 0, 0, 0));
|
||||
/** Derselbe Zeitstempel als ISO-Text ohne Zone (STEP-/IFC-Kopf). */
|
||||
export const NEUTRAL_ISO = "2000-01-01T00:00:00";
|
||||
|
||||
/** Ist die Abgabe anonym? */
|
||||
export function isAnonymous(project: CompetitionSource): boolean {
|
||||
return project.competition?.anonymous === true;
|
||||
}
|
||||
|
||||
/** Kennwort der Abgabe (getrimmt, leer ohne Wettbewerb). */
|
||||
export function competitionKeyword(project: CompetitionSource): string {
|
||||
return (project.competition?.keyword ?? "").trim();
|
||||
}
|
||||
|
||||
/** Projektname für Schriftfelder, Berichtsköpfe, Dateinamen und Metadaten der Exporte: bei anonymer Abgabe das Kennwort. */
|
||||
export function exportProjectName(project: Pick<Project, "name" | "competition">): string {
|
||||
return isAnonymous(project) ? competitionKeyword(project) : (project.name ?? "");
|
||||
}
|
||||
|
||||
/** Was eine Ausgabe über die Herkunft sagen darf. */
|
||||
export interface CompetitionIdentity {
|
||||
anonymous: boolean;
|
||||
keyword: string;
|
||||
/** Projektname der Ausgabe (anonym: das Kennwort). */
|
||||
projectName: string;
|
||||
/** Bearbeiter:in der Ausgabe (anonym: leer). */
|
||||
author(raw?: string | null): string;
|
||||
/** Zeitstempel der Ausgabe (anonym: fest {@link NEUTRAL_DATE}). */
|
||||
timestamp(now?: Date): Date;
|
||||
/** Erzeuger-/Programmangabe in Metadaten (anonym: leer). */
|
||||
creator(name?: string): string;
|
||||
}
|
||||
|
||||
/** Die Angaben, die in die Ausgaben dieses Projekts dürfen. */
|
||||
export function competitionIdentity(project: Pick<Project, "name" | "competition">): CompetitionIdentity {
|
||||
const anonymous = isAnonymous(project);
|
||||
return {
|
||||
anonymous,
|
||||
keyword: competitionKeyword(project),
|
||||
projectName: exportProjectName(project),
|
||||
author: (raw) => (anonymous ? "" : (raw ?? "")),
|
||||
timestamp: (now = new Date()) => (anonymous ? NEUTRAL_DATE : now),
|
||||
creator: (name = "Dossier") => (anonymous ? "" : name),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Angaben des Projekts, die eine anonyme Ausgabe nicht verraten darf (Name, Nummer, Titelblock-Bearbeiter:in):
|
||||
* Grundlage für den Gegenprüfer {@link identityLeaks} und die Tests.
|
||||
*/
|
||||
export function identifyingTexts(project: Project): string[] {
|
||||
const out: string[] = [];
|
||||
const add = (s: string | null | undefined) => {
|
||||
const v = (s ?? "").trim();
|
||||
if (v.length >= 3) out.push(v);
|
||||
};
|
||||
add(project.name);
|
||||
add(project.projectNumber);
|
||||
for (const m of project.masterLayouts ?? []) {
|
||||
add(m.titleBlock?.projectName);
|
||||
add(m.titleBlock?.author);
|
||||
}
|
||||
return [...new Set(out)];
|
||||
}
|
||||
|
||||
/** Kopf der Berichte (Flächen, Raumbuch, Kosten …): Projektname der Ausgabe und Anonym-Kennzeichen für das PDF. */
|
||||
export function reportHead(project: Pick<Project, "name" | "competition">): { projectName: string; anonymous?: boolean } {
|
||||
return isAnonymous(project) ? { projectName: competitionKeyword(project), anonymous: true } : { projectName: project.name ?? "" };
|
||||
}
|
||||
|
||||
/** STEP-Kopf anonym: der Zeitstempel in FILE_NAME wird fest ({@link NEUTRAL_ISO}); Autor und Organisation schreibt truck leer. */
|
||||
export function neutralizeStepText(text: string): string {
|
||||
const stamp = `${NEUTRAL_ISO.replace("T", " ")}.000`;
|
||||
return text.replace(/(FILE_NAME\('[^']*', ')\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(')/, `$1${stamp}$2`);
|
||||
}
|
||||
|
||||
/** Welche der Angaben stehen (ohne Beachtung der Gross-/Kleinschreibung) im Text? Leer = sauber. */
|
||||
export function identityLeaks(project: Project, text: string): string[] {
|
||||
const hay = text.toLowerCase();
|
||||
return identifyingTexts(project).filter((s) => hay.includes(s.toLowerCase()));
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
// dieselben Ausgaben (CSV über `areaReportToCsv`, Vektor-PDF über `buildAreaReportPdf`). Gerechnet wird im
|
||||
// Kern (`analysis/costEstimate.ts` → `kosten.rs`); hier nur Aufbau und Beschriftung mit `t()`.
|
||||
|
||||
import { reportHead } from "./competitionIdentity";
|
||||
import type { Project } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import { computeCostEstimate, formatChf } from "../analysis/costEstimate";
|
||||
@@ -48,7 +49,7 @@ export function buildCostReport(project: Project, result: CostResult = computeCo
|
||||
|
||||
return {
|
||||
title: t("costs.title"),
|
||||
projectName: project.name ?? "",
|
||||
...reportHead(project),
|
||||
sections: [
|
||||
{
|
||||
heading: `${t("costs.table")} · ${t(`costs.method.${r.method}`)}`,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// `elementSchedule` und `uValue`); hier nur Beschriftung mit `t()` und das Berichtsmodell für CSV/SVG/PDF
|
||||
// (wie die Fenster-/Türliste, `openingSchedule.ts`).
|
||||
|
||||
import { reportHead } from "./competitionIdentity";
|
||||
import type { Layer, Project } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import { documentFor } from "../core/document";
|
||||
@@ -71,5 +72,5 @@ export function buildElementReport(project: Project): AreaReport {
|
||||
widths: [4, 1.6, 1.4, 1.3, 1.3, 1.4],
|
||||
rows: g.list.map((r): ReportRow => ({ cells: [r.typeName, r.floor, num(r.area, 2), num(r.thickness * 100, 1), r.u === null ? t("elemSchedule.incomplete") : num(r.u, 2), externalText(r.external)] })),
|
||||
}));
|
||||
return { title: t("elemSchedule.title"), projectName: project.name ?? "", sections, notes: [t("elemSchedule.foot")] };
|
||||
return { title: t("elemSchedule.title"), ...reportHead(project), sections, notes: [t("elemSchedule.foot")] };
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Koordinaten: Modell-Meter, X/Y = Grundriss, Z = Höhe (wie die Eingabe von render3d).
|
||||
|
||||
import { exportProjectName, isAnonymous, neutralizeStepText } from "./competitionIdentity";
|
||||
import type { Project } from "../model/types";
|
||||
import { documentFor } from "../core/document";
|
||||
import { exportStepSolids } from "../engine/truckSolid";
|
||||
@@ -52,8 +53,8 @@ export async function exportProjectStep(project: Project, fileName = ""): Promis
|
||||
const skipped: StepExportResult["skipped"] = [];
|
||||
// Erst alle zusammen versuchen (Normalfall); nur bei Fehler einzeln prüfen.
|
||||
try {
|
||||
const text = await exportStepSolids(specs, fileName || project.name);
|
||||
return { text, count: specs.length, skipped };
|
||||
const text = await exportStepSolids(specs, fileName || exportProjectName(project));
|
||||
return { text: isAnonymous(project) ? neutralizeStepText(text) : text, count: specs.length, skipped };
|
||||
} catch {
|
||||
/* einzeln weiter */
|
||||
}
|
||||
@@ -76,6 +77,6 @@ export async function exportProjectStep(project: Project, fileName = ""): Promis
|
||||
skipped.push({ index: i, error: e instanceof Error ? e.message : String(e) });
|
||||
}
|
||||
}
|
||||
const text = await exportStepSolids(good, fileName || project.name);
|
||||
return { text, count: good.length, skipped };
|
||||
const text = await exportStepSolids(good, fileName || exportProjectName(project));
|
||||
return { text: isAnonymous(project) ? neutralizeStepText(text) : text, count: good.length, skipped };
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
// und der Berichtsaufbau, damit CSV, SVG und PDF dieselbe Quelle haben wie der Flächennachweis
|
||||
// (`areaReport.ts`: `areaReportToCsv` / `areaReportToSvg` / `buildAreaReportPdf`).
|
||||
|
||||
import { reportHead } from "./competitionIdentity";
|
||||
import type { Project } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import { documentFor } from "../core/document";
|
||||
@@ -141,5 +142,5 @@ export function buildOpeningReport(project: Project): AreaReport {
|
||||
const doors = rows.filter((r) => r.kind === "door");
|
||||
if (windows.length) sections.push(windowSection(windows));
|
||||
if (doors.length) sections.push(doorSection(doors));
|
||||
return { title: t("openings.title"), projectName: project.name ?? "", sections, notes: rows.some((r) => r.revealAreas?.length) ? [t("openings.foot"), t("openings.revealFoot")] : [t("openings.foot")] };
|
||||
return { title: t("openings.title"), ...reportHead(project), sections, notes: rows.some((r) => r.revealAreas?.length) ? [t("openings.foot"), t("openings.revealFoot")] : [t("openings.foot")] };
|
||||
}
|
||||
+28
-14
@@ -7,21 +7,9 @@
|
||||
|
||||
import type { jsPDF } from "jspdf";
|
||||
import type { Project } from "../model/types";
|
||||
import { competitionKeyword, exportProjectName, isAnonymous } from "./competitionIdentity";
|
||||
|
||||
/** Ist die Abgabe anonym? */
|
||||
export function isAnonymous(project: Pick<Project, "competition">): boolean {
|
||||
return project.competition?.anonymous === true;
|
||||
}
|
||||
|
||||
/** Kennwort der Abgabe (getrimmt, leer ohne Wettbewerb). */
|
||||
export function competitionKeyword(project: Pick<Project, "competition">): string {
|
||||
return (project.competition?.keyword ?? "").trim();
|
||||
}
|
||||
|
||||
/** Projektname für Schriftfelder und Dateinamen der Exporte: bei anonymer Abgabe das Kennwort. */
|
||||
export function exportProjectName(project: Pick<Project, "name" | "competition">): string {
|
||||
return isAnonymous(project) ? competitionKeyword(project) : (project.name ?? "");
|
||||
}
|
||||
export { isAnonymous, competitionKeyword, exportProjectName };
|
||||
|
||||
/** Info-Felder, die ins PDF gehören: anonym nur das Kennwort als Titel, sonst Projektname und Autor des Titelblocks. */
|
||||
export function pdfInfoFields(project: Pick<Project, "name" | "competition">, author?: string): { title: string; author: string; subject: string; keywords: string; creator: string } {
|
||||
@@ -29,6 +17,32 @@ export function pdfInfoFields(project: Pick<Project, "name" | "competition">, au
|
||||
return { title: project.name ?? "", author: author ?? "", subject: "", keywords: "", creator: "Dossier" };
|
||||
}
|
||||
|
||||
/**
|
||||
* Anonymes jsPDF-Dokument: Info-Felder nur mit Kennwort, und `output("arraybuffer"|"blob")` sowie `save()` liefern die
|
||||
* nachbearbeiteten Bytes (jsPDF schreibt Producer und Datum selbst). So bleiben die Aufrufer (`doc.save(name)`) gleich.
|
||||
*/
|
||||
export function anonymizeJsPdf(doc: jsPDF, keyword: string): void {
|
||||
const project = { name: "", competition: { anonymous: true, keyword } };
|
||||
applyPdfInfo(doc, project);
|
||||
type Output = (type?: string, options?: unknown) => unknown;
|
||||
const output = (doc.output as unknown as Output).bind(doc);
|
||||
const bytes = () => finishPdfBytes(project, new Uint8Array(output("arraybuffer") as ArrayBuffer));
|
||||
(doc as unknown as { output: Output }).output = (type, options) => {
|
||||
if (type === "arraybuffer") return bytes().slice().buffer;
|
||||
if (type === "blob") return new Blob([bytes() as BlobPart], { type: "application/pdf" });
|
||||
return output(type, options);
|
||||
};
|
||||
doc.save = ((fileName?: string) => {
|
||||
const url = URL.createObjectURL(new Blob([bytes() as BlobPart], { type: "application/pdf" }));
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = fileName ?? "bericht.pdf";
|
||||
a.click();
|
||||
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
||||
return doc;
|
||||
}) as typeof doc.save;
|
||||
}
|
||||
|
||||
/** Setzt die Info-Felder auf dem jsPDF-Dokument. */
|
||||
export function applyPdfInfo(doc: jsPDF, project: Pick<Project, "name" | "competition">, author?: string): void {
|
||||
doc.setProperties(pdfInfoFields(project, author));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// (`areaReport.ts`), damit CSV, SVG und PDF dieselbe Quelle und denselben Seitenaufbau haben.
|
||||
// Die Zahlen rechnet der Kern (`analysis/roomProgram.ts`); hier nur die Beschriftung mit `t()`.
|
||||
|
||||
import { reportHead } from "./competitionIdentity";
|
||||
import type { Project } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import { compareRoomProgram } from "../analysis/roomProgram";
|
||||
@@ -75,5 +76,5 @@ export function buildProgramReport(project: Project): AreaReport {
|
||||
const notes = [t("program.report.note.tolerance", { pct: (c.tolerance * 100).toFixed(0), pct2: (c.tolerance * 200).toFixed(0) })];
|
||||
if (c.kinds.some((k) => k.key !== "")) notes.push(t("program.report.note.sia"));
|
||||
if (c.extra.length > 0) notes.push(t("program.compare.extra", { n: c.extra.length, area: c.extraArea.toFixed(1) }));
|
||||
return { title: t("program.report.title"), projectName: project.name ?? "", sections, notes };
|
||||
return { title: t("program.report.title"), ...reportHead(project), sections, notes };
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
// Beschriftung mit `t()` und der Berichtsaufbau, damit CSV, SVG und PDF dieselbe Quelle haben wie die
|
||||
// Fenster-/Türliste (`openingSchedule.ts`). Die Blatt-Tabelle (Quelle `roomBook`) rechnet der Kern selbst.
|
||||
|
||||
import { reportHead } from "./competitionIdentity";
|
||||
import type { Project, RoomUsage } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import type { TranslationKey } from "../i18n/translate";
|
||||
@@ -131,5 +132,5 @@ export function buildRoomBookReport(project: Project): AreaReport {
|
||||
const sections: ReportSection[] = [];
|
||||
if (b.rows.length) sections.push(roomSection(b.rows));
|
||||
if (b.quantities.length) sections.push(quantitySection(b.quantities));
|
||||
return { title: t("roomBook.title"), projectName: project.name ?? "", sections, notes: [t("roomBook.foot")] };
|
||||
return { title: t("roomBook.title"), ...reportHead(project), sections, notes: [t("roomBook.foot")] };
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { areaReportToCsv, buildAreaReport, buildAreaReportPdf } from "../core";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReport, buildAreaReportPdf } from "../core";
|
||||
import type { AgfBasis } from "../core";
|
||||
import { DEFAULT_AREA_INPUTS, ivhbOptionsOf, type AreaInputs } from "./areaInputs";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
@@ -26,7 +26,7 @@ export function AreaTableSection() {
|
||||
[project, inputs],
|
||||
);
|
||||
const set = (patch: Partial<AreaInputs>) => setInputs((i) => ({ ...i, ...patch }));
|
||||
const stem = `${project.name || "projekt"}-flaechen`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-flaechen`;
|
||||
|
||||
const exportPdf = () => {
|
||||
try {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildCostReport, computeCostEstimate, costGroupLabel, costUnitLabel, defaultCostEstimate, formatChf, setField } from "../core";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReportPdf, buildCostReport, computeCostEstimate, costGroupLabel, costUnitLabel, defaultCostEstimate, formatChf, setField } from "../core";
|
||||
import type { CostBasis, CostEstimate, CostGroup, CostMethod, CostResult } from "../core";
|
||||
import type { Project } from "../model/types";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
@@ -65,7 +65,7 @@ export function CostEstimateSection() {
|
||||
const notify = useStore((s) => s.notify);
|
||||
const res = useMemo(() => computeCostEstimate(project), [project]);
|
||||
const est: CostEstimate = useMemo(() => project.costEstimate ?? defaultCostEstimate(project, "gv"), [project]);
|
||||
const stem = `${project.name || "projekt"}-kosten`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-kosten`;
|
||||
|
||||
const update = (next: (e: CostEstimate) => CostEstimate, key: string) =>
|
||||
applyChange((p: Project) => [setField("costEstimate", next(p.costEstimate ?? defaultCostEstimate(p, "gv")))], `costEstimate.${key}`);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildElementReport, elementSchedule } from "../core";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReportPdf, buildElementReport, elementSchedule } from "../core";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
import { useStore } from "../state/appStore";
|
||||
|
||||
@@ -12,7 +12,7 @@ export function ElementScheduleSection() {
|
||||
const project = useStore((s) => s.project);
|
||||
const notify = useStore((s) => s.notify);
|
||||
const rows = useMemo(() => elementSchedule(project), [project]);
|
||||
const stem = `${project.name || "projekt"}-bauteile`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-bauteile`;
|
||||
const exportPdf = () => {
|
||||
try {
|
||||
buildAreaReportPdf(buildElementReport(project)).save(`${stem}.pdf`);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { useMemo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { usePanelHost } from "./host";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildOpeningReport, externalText, openingSchedule, patchItem, revealArea, revealColumns, roomsText, swingText } from "../core";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReportPdf, buildOpeningReport, externalText, openingSchedule, patchItem, revealArea, revealColumns, roomsText, swingText } from "../core";
|
||||
import type { OpeningScheduleRow } from "../core";
|
||||
import type { Opening, Project } from "../model/types";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
@@ -25,7 +25,7 @@ export function OpeningScheduleSection() {
|
||||
const rows = useMemo(() => openingSchedule(project), [project]);
|
||||
// [106] Leibungsflächen je Schicht: Spalten nur, wenn eine Öffnung Schichteinzug hat.
|
||||
const reveals = useMemo(() => revealColumns(rows), [rows]);
|
||||
const stem = `${project.name || "projekt"}-fenster-tueren`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-fenster-tueren`;
|
||||
|
||||
const patch = (id: string, change: Partial<Opening>, field: string) =>
|
||||
applyChange((p: Project) => patchItem(p, "openings", id, change), `opening:${id}:${field}`);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { usePanelHost } from "./host";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { addProgramSheetOps, areaReportToCsv, buildAreaReportPdf, buildProgramReport, buildProgramSheet, compareRoomProgram, defaultSheetLabels, DEFAULT_PROGRAM_TOLERANCE, setFieldIfChanged } from "../core";
|
||||
import { exportProjectName, addProgramSheetOps, areaReportToCsv, buildAreaReportPdf, buildProgramReport, buildProgramSheet, compareRoomProgram, defaultSheetLabels, DEFAULT_PROGRAM_TOLERANCE, setFieldIfChanged } from "../core";
|
||||
import type { CompareRow, CompareSum, Light } from "../core";
|
||||
import type { Project } from "../model/types";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
@@ -45,7 +45,7 @@ export function ProgramCompareSection({ statusLabel }: { statusLabel: (status: C
|
||||
const notify = useStore((s) => s.notify);
|
||||
const c = compareRoomProgram(project);
|
||||
if (c.rows.length === 0) return null;
|
||||
const stem = `${project.name || "projekt"}-raumprogramm`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-raumprogramm`;
|
||||
const hasGroups = c.groups.some((g) => g.key !== "");
|
||||
const hasKinds = c.kinds.some((k) => k.key !== "");
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildRoomBookReport, hasSlope, roomBook, usageLabel } from "../core";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReportPdf, buildRoomBookReport, hasSlope, roomBook, usageLabel } from "../core";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
import { useStore } from "../state/appStore";
|
||||
|
||||
@@ -16,7 +16,7 @@ export function RoomBookSection() {
|
||||
const notify = useStore((s) => s.notify);
|
||||
const book = useMemo(() => roomBook(project), [project]);
|
||||
const sloped = book.rows.some(hasSlope);
|
||||
const stem = `${project.name || "projekt"}-raumbuch`;
|
||||
const stem = `${exportProjectName(project) || "projekt"}-raumbuch`;
|
||||
|
||||
const exportPdf = () => {
|
||||
try {
|
||||
|
||||
@@ -22,6 +22,7 @@ import { emptyImport, type ParsedImport } from "../io/importSource";
|
||||
import { beginBusy, endBusy } from "./busyStore";
|
||||
import type { ImportDecision, PdfImportOptions } from "../ui/ImportDialog";
|
||||
import { isPdfFile, pdfImport, readPdfVector, type PdfRead } from "../io/pdfVector";
|
||||
import { exportProjectName } from "../export/competitionIdentity";
|
||||
import { exportScheduleCsv } from "../export/exportSchedule";
|
||||
import { exportIfcSpf, type IfcExportOptions } from "../export/exportIfc";
|
||||
import { loadFileio } from "../engine/fileioWasm";
|
||||
@@ -572,7 +573,7 @@ export function useProjectFileActions(
|
||||
) => {
|
||||
void saveTextFile(content, filename, mime);
|
||||
};
|
||||
const projectFileName = () => getState().project.name || "modell";
|
||||
const projectFileName = () => exportProjectName(getState().project) || "modell";
|
||||
// Führt den gewählten Direkt-Export (CSV/IFC/OBJ/STL) mit dem im Dialog
|
||||
// gewählten Dateinamen aus. Erzeugung aus dem jeweiligen reinen Kern, Download
|
||||
// über den robusten Helfer.
|
||||
|
||||
Reference in new issue
Block a user