[271] Umbau in Schnitt, Ansicht, 2D und Möbeln: Abbruch-Stück und Ausfachung auch im Schnitt und in der Ansicht (Bogenwände eingeschlossen), Projektionslinien und Ansichts-Öffnungen in Umbau-Farbe, 2D-Elemente/Möbel/Bäume mit Status

Schnitt und Ansicht rechnen die Ersatzstücke der Öffnungen aus dem Projekt mit allem (die zugemauerte Öffnung fehlt im gefilterten Projekt); Grundriss auch für Bogenwände. Projektionslinien des Schnitts über Output::edge_ids, Öffnungslinien der Ansicht über restyle_with. Drawing2D.renovation (Möbel/Symbole immer, übrige 2D-Elemente nur mit ausdrücklichem Status), Strichfarbe in drawings::emit; Bäume: Tree.status IST der Umbau-Status (tree_renovation), kein zweites Feld. Schnitt entfernt jetzt auch ausgeblendete Bäume/Körper (without_hidden). Beispiel :umbau mit Möbeln, Bäumen und Ansicht West; Bilder doc/review-271/06-09.
This commit is contained in:
Claude committed 2026-11-17 16:57:21 +00:00
1 parent 78791a347a
commit 6fef64aec9
26 files changed
+822 -50

No files matched your search

+40 -15
View File
@@ -4,7 +4,7 @@
import type { CoreOp } from "../core/ops";
import { documentFor } from "../core/document";
import { patchItems, setField } from "../core/opsBuild";
import type { Project, Renovation, RenovationPhase, RenovationShow, RenovationStatus } from "./types";
import type { Project, Renovation, RenovationPhase, RenovationShow, RenovationStatus, Tree, TreeStatus } from "./types";
/** Eingebaute Umbaufilter (Ids; Namen über `t("renovation.filter.<id>")`). */
export const BUILTIN_RENOVATION_FILTERS = ["bestand", "abbruch", "neubau", "umbauplan", "endzustand"] as const;
@@ -12,10 +12,20 @@ export const BUILTIN_RENOVATION_FILTERS = ["bestand", "abbruch", "neubau", "umba
/** Status in der Reihenfolge der Oberfläche. */
export const RENOVATION_STATUSES: readonly RenovationStatus[] = ["existing", "demolish", "new"];
/** Listen mit Umbau-Status (Räume nur Sichtbarkeit/Flächen, keine Farbe). */
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms"] as const;
/**
* Listen mit Umbau-Status (Räume nur Sichtbarkeit/Flächen, keine Farbe). `drawings2d`: Möbel und Symbole der Bibliothek
* (ohne Angabe = Bestand) sowie 2D-Elemente mit ausdrücklichem Status (Linienwerk, Masse …; Kern `drawing_takes_part`).
*/
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms", "drawings2d"] as const;
export type RenovationCollection = (typeof RENOVATION_COLLECTIONS)[number];
/**
* Bäume tragen kein eigenes `renovation`: ihr Bestand (`Tree.status`, [149]) IST der Umbau-Status
* (bestehend = Bestand, zu fällen = Abbruch, neu = Neu; Kern `renovation::tree_renovation`).
*/
const TREE_STATUS_OF: Record<RenovationStatus, TreeStatus> = { existing: "existing", demolish: "remove", new: "new" };
export const treeRenovationStatus = (t: Tree): RenovationStatus => (t.status === "remove" ? "demolish" : t.status === "new" ? "new" : "existing");
/** SIA-400-Vorgabe der Umbau-Farben (gleich wie `renovation::default_style` im Kern). */
export const DEFAULT_RENOVATION_STYLES: Record<RenovationStatus, { fill: string; line?: string; dashed: boolean }> = {
existing: { fill: "#a6a6a6", dashed: false },
@@ -73,6 +83,8 @@ export function setRenovationOps(project: Project, ids: Iterable<string>, status
}),
);
}
// Bäume: der Status ist ihr Bestand (Etappen kennen sie nicht).
if (status) ops.push(...patchItems(project, "trees", set, (t) => ({ ...t, status: TREE_STATUS_OF[status] })));
return ops;
}
@@ -83,6 +95,7 @@ export function renovatableIds(project: Project, ids: Iterable<string>): string[
for (const c of RENOVATION_COLLECTIONS) {
for (const e of (project[c] ?? []) as { id: string }[]) if (set.has(e.id)) out.push(e.id);
}
for (const t of project.trees ?? []) if (set.has(t.id)) out.push(t.id);
return out;
}
@@ -92,21 +105,22 @@ export function commonRenovation(project: Project, ids: Iterable<string>): { sta
let status: RenovationStatus | "mixed" | null = null;
let phase: string | "mixed" | null = null;
let first = true;
const add = (s: RenovationStatus, ph: string) => {
if (first) {
status = s;
phase = ph;
first = false;
} else {
if (status !== s) status = "mixed";
if (phase !== ph) phase = "mixed";
}
};
for (const c of RENOVATION_COLLECTIONS) {
for (const e of (project[c] ?? []) as { id: string; renovation?: Renovation }[]) {
if (!set.has(e.id)) continue;
const s = renovationStatus(e.renovation);
const ph = e.renovation?.phase ?? "";
if (first) {
status = s;
phase = ph;
first = false;
} else {
if (status !== s) status = "mixed";
if (phase !== ph) phase = "mixed";
}
if (set.has(e.id)) add(renovationStatus(e.renovation), e.renovation?.phase ?? "");
}
}
for (const t of project.trees ?? []) if (set.has(t.id)) add(treeRenovationStatus(t), "");
return { status, phase };
}
@@ -171,6 +185,12 @@ export function renovationStyleOf(project: Project, status: RenovationStatus): {
return { fill: o?.fill ?? d.fill, line: o?.line ?? d.line, dashed: o?.dashed ?? d.dashed };
}
/** Möbel und Symbole (Objekte der Bibliothek, Blöcke): nehmen ohne Angabe als Bestand am Umbaufilter teil. */
function isFurnitureShape(d: unknown): boolean {
const shape = (d as { geom?: { shape?: string } }).geom?.shape;
return shape === "libobj" || shape === "block";
}
/** Auswahl-Art je Liste (`extrudedSolids` heissen in der Auswahl `solids`). */
const SELECTION_KEY: Record<RenovationCollection, string> = {
walls: "walls",
@@ -181,6 +201,7 @@ const SELECTION_KEY: Record<RenovationCollection, string> = {
columns: "columns",
extrudedSolids: "solids",
rooms: "rooms",
drawings2d: "drawings",
};
/**
@@ -197,8 +218,10 @@ export function idsByRenovationStatus(
for (const c of RENOVATION_COLLECTIONS) {
const ids: string[] = [];
for (const e of (project[c] ?? []) as { id: string; floorId?: string; hostWallId?: string; renovation?: Renovation }[]) {
// Zeichnungen ohne ausdrücklichen Status (Linien, Masse …) nehmen nicht teil; Möbel und Symbole gelten als Bestand.
if (c === "drawings2d" && !e.renovation && !isFurnitureShape(e)) continue;
const wall = c === "openings" && e.hostWallId ? wallOf.get(e.hostWallId) : undefined;
const floor = e.floorId ?? wall?.floorId;
const floor = e.floorId ?? (e as { levelId?: string }).levelId ?? wall?.floorId;
if (opts.floorId && floor && floor !== opts.floorId) continue;
const r = e.renovation ?? wall?.renovation;
if (renovationStatus(r) !== status) continue;
@@ -207,6 +230,8 @@ export function idsByRenovationStatus(
}
if (ids.length) out[SELECTION_KEY[c]] = ids;
}
const trees = (project.trees ?? []).filter((t) => treeRenovationStatus(t) === status && (!opts.floorId || t.floorId === opts.floorId) && (opts.phase === undefined || opts.phase === "")).map((t) => t.id);
if (trees.length) out.trees = trees;
return out;
}