Merge branch 'worktree-agent-a6dfad03524c70231' into claude/practical-noether-1hb2s1

This commit is contained in:
Claude committed 2026-11-16 16:25:05 +00:00
commit 0cd52acfe1
20 files changed
+281 -39

No files matched your search

+6
View File
@@ -6,6 +6,12 @@ describe("[221] getippte Landeskoordinaten", () => {
it("absolute LV95-Eingabe wird bei Standort-Bezug auf den Projekt-Nullpunkt gerechnet", () => {
expect(fromWorldInput(parseInput("2600048,1200046"), origin)).toEqual({ kind: "absolute", point: { x: 48, y: 46 } });
});
it("[266] Ergebnis auf mm gerundet, keine Gleitkomma-Reste", () => {
const o = { e: 2_600_000.1, n: 1_200_000.3 };
const r = fromWorldInput(parseInput("2600053.3,1200010.7"), o);
expect(r).toEqual({ kind: "absolute", point: { x: 53.2, y: 10.4 } });
expect(fromWorldInput(parseInput("2600053.2,1200000.1"), origin)).toEqual({ kind: "absolute", point: { x: 53.2, y: 0.1 } });
});
it("lokale, relative Eingaben und Projekte ohne Bezug bleiben", () => {
expect(fromWorldInput(parseInput("48,46"), origin)).toEqual({ kind: "absolute", point: { x: 48, y: 46 } });
expect(fromWorldInput(parseInput("r2600048,1200046"), origin).kind).toBe("relative");
+3 -1
View File
@@ -147,7 +147,9 @@ export function isLv95(e: number, n: number): boolean {
*/
export function fromWorldInput(p: ParsedInput, origin: { e: number; n: number } | null): ParsedInput {
if (!origin || p.kind !== "absolute" || !isLv95(p.point.x, p.point.y)) return p;
return { kind: "absolute", point: { x: p.point.x - origin.e, y: p.point.y - origin.n } };
// [266] Auf mm runden: 2600053.2 − 2600000 ergäbe sonst 53.200000000186 im Modell.
const mm = (v: number) => Math.round(v * 1000) / 1000;
return { kind: "absolute", point: { x: mm(p.point.x - origin.e), y: mm(p.point.y - origin.n) } };
}
/** Punkt aus polarer Form (Distanz/Winkel) relativ zu einem Basispunkt. */
+1 -1
View File
@@ -49,7 +49,7 @@ function expectRoomHeightsAndLayers(p: Project, c: Check) {
const rows = roomBook(p).rows;
expect(rows.length).toBeGreaterThan(0);
for (const row of rows) {
const h = c.stats.spaceHeights![row.number || row.id];
const h = c.stats.spaceHeights![row.number || row.name || row.id];
expect(h, row.number).toBeDefined();
expect(Math.abs(h.Height - row.clearHeight)).toBeLessThan(0.01);
expect(Math.abs(h.FinishCeilingHeight - row.heightMean)).toBeLessThan(0.01);
+8
View File
@@ -543,6 +543,14 @@ describe("Räume als IfcSpace", () => {
const contained = spf.split("\n").filter((l) => /=IFCRELCONTAINEDINSPATIALSTRUCTURE\(/.test(l) && spaceIds.some((id) => new RegExp(`${id}[,)]`).test(l)));
expect(contained).toEqual([]);
});
it("[266] Name = Raumnummer, LongName = Raumname; ohne Nummer der Raumname statt der internen Id", () => {
const p = withRooms();
p.rooms![0] = { ...p.rooms![0], stamp: { number: "1.01" } } as NonNullable<Project["rooms"]>[number];
const spaces = exportIfcSpf(p).split("\n").filter((l) => /=IFCSPACE\(/.test(l));
expect(spaces[0]).toMatch(/,'1\.01',\$,\$,#\d+,#\d+,'K\\X2\\00FC\\X0\\che',/);
expect(spaces[1]).toMatch(/,'Gang',\$,\$,#\d+,#\d+,'Gang',/);
expect(spaces.some((l) => l.includes("'R1'") || l.includes("'R2'"))).toBe(false);
});
it("Netto-Geschossfläche und SIA-416-Kategorie", () => {
const spf = exportIfcSpf(withRooms());
expect(spf).toMatch(/IFCQUANTITYAREA\('NetFloorArea',\$,\$,12\.0,\$\)/);
+1
View File
@@ -4018,6 +4018,7 @@ export const de = {
"publish.none": "Kein Publikationssatz. Mit + Blätter zu einem Satz bündeln.",
"publish.defaultName": "Neuer Satz",
"publish.projectNumber": "Projektnummer",
"publish.projectName": "Projektname",
"publish.name": "Name",
"publish.format": "Ausgabe",
"publish.format.pdf-multi": "PDF, ein Dokument",
+1
View File
@@ -4004,6 +4004,7 @@ export const en: Record<TranslationKey, string> = {
"publish.none": "No publication set. Use + to bundle sheets into a set.",
"publish.defaultName": "New set",
"publish.projectNumber": "Project number",
"publish.projectName": "Project name",
"publish.name": "Name",
"publish.format": "Output",
"publish.format.pdf-multi": "PDF, one document",
+17 -14
View File
@@ -23,6 +23,9 @@ const symmetric = (p: Project, wallTypeId: string) => {
return l.every((x, i) => x.componentId === l[l.length - 1 - i].componentId && Math.abs(x.thickness - l[l.length - 1 - i].thickness) < 1e-9);
};
/** Leeres Projekt mit den Geschossen des Demo-Hauses (2.60 m): der Import ordnet Geschosse über die Höhe zu; die Vorgabe neuer Projekte (2.90 m, [266]) passt nicht dazu. */
const blankProject: Project = { ...emptyProject, drawingLevels: sampleProject.drawingLevels };
async function importInto(base: Project, src: Project) {
const r = await importIfcInto(base, bytesOf(exportIfcSpf(src)), { elements: true });
return { ...r, summary: r.summary as IfcElementsSummary };
@@ -30,7 +33,7 @@ async function importInto(base: Project, src: Project) {
describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
it("gleiche Wände (Achse, Typ, Höhe, Geschoss), Öffnungen, Decke, Raum; Rest als Mesh", async () => {
const { project: p, summary, report } = await importInto(emptyProject, sampleProject);
const { project: p, summary, report } = await importInto(blankProject, sampleProject);
expect(report.parseErrors).toBe(0);
expect(summary).toMatchObject({ walls: 9, openings: 3, ceilings: 1, columns: 0, rooms: 1, floors: 0, wallTypes: 0, ceilingTypes: 0, components: 0, kept: 0 });
// (6.11.) Dach und Treppe kommen als Bauteile zurück, kein Kontext-Mesh mehr.
@@ -110,7 +113,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
: o,
),
};
const { project: p } = await importInto(emptyProject, src);
const { project: p } = await importInto(blankProject, src);
const d = (p.openings ?? []).find((o) => o.kind === "door")!;
expect(d).toMatchObject({ fireRating: "EI30", soundClass: "Rw 32 dB", burglaryClass: "RC2", uValue: 1.3, isExternal: false });
const w = (p.openings ?? []).find((o) => o.kind === "window" && Math.abs(o.width - win.width) < 1e-6)!;
@@ -129,9 +132,9 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
expect(spf).toContain("Pset_SpaceCoveringRequirements");
expect(spf).toContain("Dossier_RoomBook");
// In ein Projekt mit demselben Material: Verweis über den Namen; sonst Freitext.
const { project: p } = await importInto({ ...emptyProject, components: [comp] }, src);
const { project: p } = await importInto({ ...blankProject, components: [comp] }, src);
expect(p.rooms![0]).toMatchObject({ usage: "bath", floorFinish: comp.id, wallFinish: "Abrieb 1 mm", ceilingFinish: "Weissputz", floorBuildUp: "UB 80, TSD 20" });
const { project: q } = await importInto({ ...emptyProject, components: [] }, src);
const { project: q } = await importInto({ ...blankProject, components: [] }, src);
expect(q.rooms![0]!.floorFinish).toBe(comp.name);
// Ohne Angaben: keine Raumbuch-Psets.
expect(exportIfcSpf(sampleProject)).not.toContain("Dossier_RoomBook");
@@ -155,7 +158,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
o.id === "D1" ? { ...o, hinge, swing, openingDir } : o.id === "O2" ? { ...o, wingCount: 2 } : o,
),
};
const { project: p } = await importInto(emptyProject, src);
const { project: p } = await importInto(blankProject, src);
const d1 = src.openings!.find((o) => o.id === "D1")!;
const w1 = src.walls.find((w) => w.id === d1.hostWallId)!;
const got = (p.openings ?? []).find((o) => o.kind === "door")!;
@@ -175,8 +178,8 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
it("in ein Projekt ohne Geschosse/Typen: legt Geschosse, Wand-/Deckentypen und Materialien an", async () => {
const bare: Project = {
...emptyProject,
drawingLevels: emptyProject.drawingLevels.filter((l) => l.kind !== "floor"),
...blankProject,
drawingLevels: blankProject.drawingLevels.filter((l) => l.kind !== "floor"),
wallTypes: [],
ceilingTypes: [],
components: [],
@@ -200,8 +203,8 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
});
it("über Ops angewandt und gespeichert/geladen bleibt alles gleich", async () => {
const { project: next } = await importInto(emptyProject, sampleProject);
const applied = applyOps(emptyProject, projectDiffOps(emptyProject, next));
const { project: next } = await importInto(blankProject, sampleProject);
const applied = applyOps(blankProject, projectDiffOps(blankProject, next));
expect(applied.walls).toEqual(next.walls);
expect(applied.openings).toEqual(next.openings);
const back = parseProjectFile(serializeProject(applied));
@@ -219,7 +222,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
{ id: "S2", type: "column", floorId: "og", categoryCode: "50", position: { x: 3, y: 2 }, profile: { kind: "round", radius: 0.15 }, rotation: 0, height: 2.5 },
];
const src: Project = { ...sampleProject, columns: cols };
const { project: p, summary } = await importInto(emptyProject, src);
const { project: p, summary } = await importInto(blankProject, src);
expect(summary.columns).toBe(2);
const s1 = p.columns!.find((c) => c.profile.kind === "rect")!;
expect(s1.floorId).toBe("eg");
@@ -246,7 +249,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
for (const [name, typeId, patch] of cases) {
it(`[151] Treppe ${name}: Rundreise`, async () => {
const st0: Stair = { ...base, ...patch, typeId };
const { project: p, summary } = await importInto(emptyProject, { ...sampleProject, stairs: [st0] });
const { project: p, summary } = await importInto(blankProject, { ...sampleProject, stairs: [st0] });
expect(summary.stairs).toBe(1);
const st = p.stairs![0];
expect([st.shape, st.stepCount, st.turn ?? null, st.midSteps ?? null], JSON.stringify(st)).toEqual([st0.shape, st0.stepCount, st0.turn ?? null, st0.midSteps ?? null]);
@@ -268,11 +271,11 @@ describe("Kontext-Mesh: Farbe und GlobalId", () => {
// Benennung, Farbe (#rrggbb, gemeinsame Farbe beim Zusammenlegen) und GlobalId prüft der Kern-Test
// `import_drawing_tests.rs::ifc_meshes_farbe_und_globalid`; hier die Rundreise aus einer Datei.
it("Farbe aus der Datei (IfcStyledItem) kommt am Mesh an und übersteht Speichern/Laden", async () => {
const { meshes } = await importIfcInto(emptyProject, new Uint8Array(readFileSync(new URL("./testdata/ifc-geometry-cases.ifc", import.meta.url))), { fileName: "cases.ifc" });
const { meshes } = await importIfcInto(blankProject, new Uint8Array(readFileSync(new URL("./testdata/ifc-geometry-cases.ifc", import.meta.url))), { fileName: "cases.ifc" });
expect(meshes.length).toBeGreaterThan(0);
expect(meshes.every((m) => m.ifcGlobalId && !m.name.includes("["))).toBe(true);
const withColor = { ...meshes[0], color: "#336699" };
const proj: Project = { ...emptyProject, context: [withColor] };
const proj: Project = { ...blankProject, context: [withColor] };
const back = parseProjectFile(serializeProject(proj));
expect(back.ok && back.project.context?.[0]).toEqual(withColor);
});
@@ -294,7 +297,7 @@ describe.skipIf(!samples || !existsSync(samples))("IFC-Import als Bauteile: Beis
walk(samples!);
const rows: string[] = [];
for (const f of files) {
const { project, summary } = await importIfcInto(emptyProject, new Uint8Array(readFileSync(f)), { fileName: f, elements: true });
const { project, summary } = await importIfcInto(blankProject, new Uint8Array(readFileSync(f)), { fileName: f, elements: true });
expect(validateProject(project), f).toEqual([]);
rows.push(`${f.slice(samples!.length + 1)}: ${JSON.stringify(summary)}`);
}
+16
View File
@@ -0,0 +1,16 @@
// [266] Neues Projekt: Geschosshöhe praxisgerecht (lichte Höhe ≥ 2.40 m), Beispielprojekte unverändert.
import { describe, expect, it } from "vitest";
import { emptyProject, sampleProject } from "./sampleProject";
describe("Geschosshöhe neuer Projekte [266]", () => {
it("lichte Höhe ≥ 2.40 m über der Decke des Typs, Geschosse gestapelt", () => {
const floors = emptyProject.drawingLevels.filter((l) => l.kind === "floor");
const slab = (emptyProject.ceilingTypes ?? [])[0].layers.reduce((a, l) => a + l.thickness, 0);
for (const f of floors) expect((f.floorHeight ?? 0) - slab).toBeGreaterThanOrEqual(2.4);
expect(floors[0].floorHeight).toBe(2.9);
expect(floors[1].baseElevation).toBe(2.9);
});
it("Beispielprojekt bleibt bei 2.60 m", () => {
expect(sampleProject.drawingLevels.find((l) => l.id === "eg")!.floorHeight).toBe(2.6);
});
});
+10 -1
View File
@@ -595,6 +595,9 @@ export const sampleProject: Project = {
* Leeres Projekt (nur Bibliotheken, keine Geometrie) — für manuelle Tests, die
* ohne das Demo-Haus starten wollen (z. B. Standort-Import auf leerer Fläche).
*/
/** [266] Geschosshöhe neuer Projekte (m), auch für „Geschoss hinzufügen“. */
export const EMPTY_FLOOR_HEIGHT = 2.9;
export const emptyProject: Project = {
...sampleProject,
id: "empty",
@@ -611,5 +614,11 @@ export const emptyProject: Project = {
context: [],
// [221] Schnitt A und Ansicht Süd folgen dem ersten Gebauten (bzw. der Parzelle), bis man sie bearbeitet
// (Kern `auto_lines.rs`) — sonst lägen sie bei einem Projekt in Landeskoordinaten oder abseits des Nullpunkts daneben.
drawingLevels: sampleProject.drawingLevels.map((l) => (l.kind === "section" || l.kind === "elevation" ? { ...l, autoLine: true } : l)),
// [266] Geschosshöhe 2.90 m (CH-Wohnbau 2.80–3.00 m): bei 30 cm Decke bleiben 2.60 m lichte Höhe (≥ 2.40 m für Wohnräume);
// die 2.60 m des Beispielprojekts ergaben nur 2.30 m. Die Beispielprojekte bleiben unverändert.
drawingLevels: sampleProject.drawingLevels.map((l) => {
if (l.kind === "section" || l.kind === "elevation") return { ...l, autoLine: true };
if (l.kind !== "floor") return l;
return { ...l, floorHeight: EMPTY_FLOOR_HEIGHT, baseElevation: l.id === "og" ? EMPTY_FLOOR_HEIGHT : l.baseElevation };
}),
};
+28 -1
View File
@@ -148,6 +148,29 @@ function SetEditor({ set }: { set: PublishSet }) {
);
}
/** [266] Projektname: Entwurf lokal, übernommen bei Enter/Verlassen (leer → alter Name bleibt). */
function ProjectNameInput({ name, onCommit }: { name: string; onCommit: (v: string) => void }) {
const [draft, setDraft] = useState<string | null>(null);
const commit = () => {
if (draft !== null && draft.trim() && draft !== name) onCommit(draft);
setDraft(null);
};
return (
<input
className="res-input"
style={{ flex: 1 }}
data-testid="project-name"
value={draft ?? name}
onChange={(e) => setDraft(e.target.value)}
onBlur={commit}
onKeyDown={(e) => {
if (e.key === "Enter") (e.target as HTMLInputElement).blur();
if (e.key === "Escape") setDraft(null);
}}
/>
);
}
export function PublishSection() {
const host = usePanelHost();
const project = useStore((s) => s.project);
@@ -165,7 +188,11 @@ export function PublishSection() {
</span>
</header>
<label style={{ display: "flex", gap: 6, alignItems: "center", padding: "2px 10px", fontSize: 12 }}>
<span>{t("publish.projectNumber")}</span>
<span style={{ minWidth: 82 }}>{t("publish.projectName")}</span>
<ProjectNameInput name={project.name} onCommit={host.onSetProjectName} />
</label>
<label style={{ display: "flex", gap: 6, alignItems: "center", padding: "2px 10px", fontSize: 12 }}>
<span style={{ minWidth: 82 }}>{t("publish.projectNumber")}</span>
<input
className="res-input mono"
style={{ flex: 1 }}
+2
View File
@@ -802,6 +802,8 @@ export interface PanelHostValue {
onDeletePublishSet: (id: string) => void;
/** Erzeugt und speichert alle Dateien des Satzes; zählt Indizes hoch und protokolliert. */
onPublishSet: (id: string) => void;
/** [266] Setzt den Projektnamen (leer → unverändert). */
onSetProjectName: (value: string) => void;
/** Setzt die Projektnummer (Dateinamen-Muster `{Projektnummer}`). */
onSetProjectNumber: (value: string) => void;
/** Wettbewerb ([208]): anonyme Abgabe und Kennwort setzen (Teil-Patch). */
+2
View File
@@ -182,6 +182,8 @@ export function buildLayoutsHost(c: FlatHostOpts) {
applyChange((p) => addWbwSetOps(p, id));
return id;
},
// [266] Projektname (Dateinamen der Exporte, Kopfzeilen); leer lässt den bisherigen Namen stehen.
onSetProjectName: (value) => applyChange((p) => (value.trim() ? fieldOps(p, "name", value) : []), "projectName"),
onSetProjectNumber: (value) => applyChange((p) => fieldOps(p, "projectNumber", value.trim() ? value : undefined), "projectNumber"),
onDeletePublishSet: (id) => applyChange((p) => deletePublishSetOps(p, id)),
onPublishSet: (id) => {
+23
View File
@@ -0,0 +1,23 @@
// [266] Projektname über Ops änderbar (ein Undo-Schritt), leerer Name wird ignoriert.
import { describe, expect, it } from "vitest";
import { getState } from "../appStore";
import { emptyProject } from "../../model/sampleProject";
import { buildLayoutsHost } from "./layoutsHost";
import type { FlatHostOpts } from "./types";
describe("onSetProjectName [266]", () => {
it("setzt den Namen, Undo stellt ihn zurück, leer ändert nichts", () => {
getState().loadProject(emptyProject);
const s = getState();
const host = buildLayoutsHost({ applyChange: s.applyChange, project: s.project } as unknown as FlatHostOpts);
const before = getState().project.name;
const depth = getState().undoDepth;
host.onSetProjectName("Haus am See");
expect(getState().project.name).toBe("Haus am See");
expect(getState().undoDepth).toBe(depth + 1);
host.onSetProjectName(" ");
expect(getState().project.name).toBe("Haus am See");
getState().undo();
expect(getState().project.name).toBe(before);
});
});
+2 -2
View File
@@ -25,7 +25,7 @@ import {
setFieldIfChanged,
} from "../core";
import type { PolylineVertexType } from "../core";
import { sampleProject } from "../model/sampleProject";
import { EMPTY_FLOOR_HEIGHT, sampleProject } from "../model/sampleProject";
import {
addChildByCode,
applyVisibilityByCode,
@@ -729,7 +729,7 @@ export function createProjectSlice(
kind: "floor",
visible: true,
locked: false,
floorHeight: 2.6,
floorHeight: EMPTY_FLOOR_HEIGHT,
cutHeight: 1.0,
};
return fieldOps(p, "drawingLevels", recomputeFloorElevations([...p.drawingLevels, floor]));