[egui] Probe: native Oberfläche in egui (src-tauri/dossier-egui) + CLI bundle/plan --format json
Neues Crate dossier-egui (eframe/egui 0.35, egui_dock 0.20, wgpu 29 — gemeinsames Device mit render2d/render3d, die in Offscreen-Texturen rendern): Werkzeugleiste, Geschosse, Grundriss | 3D, Eigenschaften (nur Anzeige), Flächenbilanz, Werkzeug "Wand zeichnen" (Skizze, nicht gespeichert), hell/dunkel, Systemschrift, de/en. Daten aus dem neuen CLI-Befehl `bundle` (Ansichtspaket je Geschoss: render2d-Szene, 3D-Modell, Bauteile; Kennzahlen/Raumprogramm), dazu `plan --format json` und `:beispiel` (sampleProject, in src/core/extra.ts ergänzt). Nicht in npm run check/CI. Geprüft: cargo test im Crate, npm run check grün, Screenshots unter Xvfb + lavapipe im Linux-Container. Nicht auf dem Mac getestet. Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
22 files changed
+7615
-3
No files matched your search
+42
-1
@@ -5,7 +5,7 @@ import { mkdtempSync, readFileSync, writeFileSync, readdirSync, statSync } from
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { run } from "./main";
|
||||
import { serializeProject } from "../core";
|
||||
import { projectToModel3d, serializeProject } from "../core";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
|
||||
const dir = mkdtempSync(join(tmpdir(), "dossier-cli-"));
|
||||
@@ -47,6 +47,47 @@ describe("dossier-cli", () => {
|
||||
expect(svg).toContain("</svg>");
|
||||
});
|
||||
|
||||
it("Plan als render2d-Szene (JSON)", async () => {
|
||||
const out = join(dir, "eg.scene.json");
|
||||
expect(await call("plan", "--format", "json", "--out", out)).toBe(0);
|
||||
const scene = JSON.parse(readFileSync(out, "utf8"));
|
||||
expect(scene.fills.length).toBeGreaterThan(0);
|
||||
expect(scene.fills[0].pts[0]).toHaveLength(2);
|
||||
expect(scene.fills[0].color).toHaveLength(4);
|
||||
expect(Array.isArray(scene.texts)).toBe(true);
|
||||
});
|
||||
|
||||
it("Ansichtspaket (bundle) für die egui-Oberfläche", async () => {
|
||||
const out = join(dir, "demo.bundle.json");
|
||||
expect(await call("bundle", "--out", out)).toBe(0);
|
||||
const b = JSON.parse(readFileSync(out, "utf8"));
|
||||
expect(b.format).toBe("dossier-bundle");
|
||||
expect(b.version).toBe(1);
|
||||
expect(b.name).toBe(sampleProject.name);
|
||||
const floors = sampleProject.drawingLevels.filter((l) => l.kind === "floor");
|
||||
expect(b.levels.map((l: { id: string }) => l.id)).toEqual(floors.map((l) => l.id));
|
||||
const eg = b.levels[0];
|
||||
expect(eg.scene.fills.length).toBeGreaterThan(0);
|
||||
// 3D je Geschoss: zusammen ergeben die Geschosse das ganze Modell (Wand-Schichtbänder)
|
||||
expect(eg.model3d.walls.length).toBeGreaterThan(0);
|
||||
const sum = b.levels.reduce((s: number, l: { model3d: { walls: unknown[] } }) => s + l.model3d.walls.length, 0);
|
||||
expect(sum).toBe(projectToModel3d(sampleProject).walls.length);
|
||||
const wall = eg.elements.find((e: { kind: string }) => e.kind === "wall");
|
||||
expect(wall.shape.type).toBe("segment");
|
||||
expect(wall.shape.width).toBeGreaterThan(0);
|
||||
expect(wall.props.some(([k]: [string, unknown]) => k === "height")).toBe(true);
|
||||
const room = eg.elements.find((e: { kind: string }) => e.kind === "room");
|
||||
expect(room.shape.type).toBe("polygon");
|
||||
expect(b.kennzahlen.levels.length).toBe(floors.length);
|
||||
expect(b.raumprogramm).toBeDefined();
|
||||
});
|
||||
|
||||
it("Beispielprojekt ohne Datei (:beispiel)", async () => {
|
||||
const out = join(dir, "beispiel.bundle.json");
|
||||
expect(await run([":beispiel", "bundle", "--out", out])).toBe(0);
|
||||
expect(JSON.parse(readFileSync(out, "utf8")).name).toBe(sampleProject.name);
|
||||
});
|
||||
|
||||
it("IFC, OBJ, CSV, DXF", async () => {
|
||||
for (const [cmd, ext, needle] of [["ifc", "ifc", "ISO-10303-21"], ["obj", "obj", "v "], ["schedule", "csv", "Typ"], ["dxf", "dxf", "SECTION"]] as const) {
|
||||
const out = join(dir, `x.${ext}`);
|
||||
|
||||
Reference in new issue
Block a user