[180] Grau im 3D: Klassen im Darstellungsmodus „grau" als gedämpfte Geisterschicht
Kern ClassFilter mit grey/lock/ghost (Hauptmodell ohne graue Elemente, ghost nur sie; Öffnungen grau mit Klasse oder Wirt; gesperrte nicht anwählbar), render3d ghost.rs + set_ghost_model (hell entsättigt, durchscheinend), Viewer, natives 3D-Fenster (native.rs), CLI model3d --grey und render_png.
This commit is contained in:
20 files changed
+543
-54
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
selectionIds3d,
|
||||
setView3dFilter,
|
||||
showSelection3d,
|
||||
classDisplay3d,
|
||||
toFilter3d,
|
||||
} from "./view3dFilter";
|
||||
|
||||
@@ -47,6 +48,23 @@ describe("3D-Element-Filter [185]", () => {
|
||||
expect(toFilter3d(showSelection3d(["w1"]), [])).toEqual({ hide: [], only: ["w1"], hideIds: [], hideFloors: [] });
|
||||
});
|
||||
|
||||
it("[180] classDisplay3d: Darstellungsmodus je Klasse als Code-Listen (aus, grau, gesperrt)", () => {
|
||||
const modes: Record<string, { render: boolean; greyed: boolean; locked: boolean }> = {
|
||||
"20": { render: true, greyed: false, locked: false },
|
||||
"25": { render: true, greyed: true, locked: false },
|
||||
"31": { render: true, greyed: true, locked: true },
|
||||
"40": { render: false, greyed: false, locked: false },
|
||||
"41": { render: true, greyed: false, locked: true },
|
||||
};
|
||||
expect(classDisplay3d(Object.keys(modes), (c) => modes[c]!)).toEqual({ hide: ["40"], grey: ["25", "31"], lock: ["31", "41"] });
|
||||
});
|
||||
|
||||
it("[180] toFilter3d: graue und gesperrte Klassen gehen mit", () => {
|
||||
expect(toFilter3d(NO_VIEW3D_FILTER, ["40"], [], { grey: ["25"], lock: ["31"] })).toEqual({
|
||||
hide: ["40"], only: null, hideIds: [], hideFloors: [], grey: ["25"], lock: ["31"],
|
||||
});
|
||||
});
|
||||
|
||||
it("Store: setzen und beim Projektwechsel zurücksetzen", () => {
|
||||
setView3dFilter(showSelection3d(["w1"]));
|
||||
expect(isSelectionMode(getView3dFilter())).toBe(true);
|
||||
|
||||
@@ -48,9 +48,42 @@ export function hideSelection3d(f: View3dFilter, ids: readonly string[]): View3d
|
||||
return hidden.length === f.hidden.length ? f : { ...f, hidden };
|
||||
}
|
||||
|
||||
/** Filter für die 3D-Abfragen: Klassen-Codes `hide`, Geschosse mit ausgeschaltetem Auge ([196]) plus Element-Auswahl (Kern `ClassFilter::from_text`). */
|
||||
export function toFilter3d(f: View3dFilter, hide: readonly string[], hideFloors: readonly string[] = []): Filter3d {
|
||||
return { hide, only: f.only, hideIds: f.hidden, hideFloors };
|
||||
/**
|
||||
* Filter für die 3D-Abfragen: Klassen-Codes `hide`, Geschosse mit ausgeschaltetem Auge ([196]) plus Element-Auswahl
|
||||
* (Kern `ClassFilter::from_text`); dazu graue und gesperrte Klassen des Darstellungsmodus ([180], {@link classDisplay3d}).
|
||||
*/
|
||||
export function toFilter3d(
|
||||
f: View3dFilter,
|
||||
hide: readonly string[],
|
||||
hideFloors: readonly string[] = [],
|
||||
dim: { grey?: readonly string[]; lock?: readonly string[] } = {},
|
||||
): Filter3d {
|
||||
const out: Filter3d = { hide, only: f.only, hideIds: f.hidden, hideFloors };
|
||||
if (dim.grey?.length) out.grey = dim.grey;
|
||||
if (dim.lock?.length) out.lock = dim.lock;
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* [180] Darstellungsmodus des Ebenen-Panels je Klasse als Code-Listen fürs 3D, gleiche Logik wie im Grundriss:
|
||||
* `hide` = nicht gezeichnet, `grey` = gedämpft (Geisterschicht), `lock` = nicht anwählbar (Modi „grau + gesperrt"
|
||||
* und „gesperrt"; grau allein bleibt anwählbar wie im Grundriss).
|
||||
*/
|
||||
export function classDisplay3d(
|
||||
codes: readonly string[],
|
||||
display: (code: string) => { render: boolean; greyed: boolean; locked: boolean },
|
||||
): { hide: string[]; grey: string[]; lock: string[] } {
|
||||
const out = { hide: [] as string[], grey: [] as string[], lock: [] as string[] };
|
||||
for (const c of codes) {
|
||||
const d = display(c);
|
||||
if (!d.render) {
|
||||
out.hide.push(c);
|
||||
continue;
|
||||
}
|
||||
if (d.greyed) out.grey.push(c);
|
||||
if (d.locked) out.lock.push(c);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// ── Store ───────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user