[284] Geschoss löschen nimmt 2D, Körper, Bäume, Kameras mit; Geländer in Darstellungs-Regeln, Klasse der Auswahl, Mass-Assoziation; Robustheits-Fixture wettbewerb neu
This commit is contained in:
8 files changed
+80
-4
No files matched your search
@@ -110,6 +110,7 @@ export interface SelectionMembers {
|
||||
columnIds?: readonly string[];
|
||||
roofIds?: readonly string[];
|
||||
openingIds?: readonly string[];
|
||||
railingIds?: readonly string[];
|
||||
}
|
||||
|
||||
/** Kategorie-Codes aller gewählten Objekte (eindeutig, in Fundreihenfolge). */
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/** [284] Geschoss löschen nimmt 2D-Elemente, Körper, Bäume und Kameras des Geschosses mit. */
|
||||
import { describe, it, expect, beforeEach } from "vitest";
|
||||
import { getState } from "./appStore";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Drawing2D, Tree, Camera, ExtrudedSolid } from "../model/types";
|
||||
|
||||
const floors = sampleProject.drawingLevels.filter((l) => l.kind === "floor");
|
||||
const [A, B] = [floors[0].id, floors[1].id];
|
||||
|
||||
const drawing = (id: string, levelId: string): Drawing2D => ({
|
||||
id, type: "drawing2d", levelId, categoryCode: "00", geom: { shape: "line", a: { x: 0, y: 0 }, b: { x: 2, y: 0 } },
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
getState().loadProject(structuredClone({
|
||||
...sampleProject,
|
||||
drawings2d: [drawing("d-a", A), drawing("d-b", B)],
|
||||
extrudedSolids: [{ id: "s-a", levelId: A }, { id: "s-b", levelId: B }] as unknown as ExtrudedSolid[],
|
||||
trees: [{ id: "t-a", floorId: A }, { id: "t-b", floorId: B }] as unknown as Tree[],
|
||||
cameras: [{ id: "c-a", floorId: A }, { id: "c-b", floorId: B }] as unknown as Camera[],
|
||||
}));
|
||||
});
|
||||
|
||||
describe("deleteLevel", () => {
|
||||
it("entfernt 2D, Körper, Bäume, Kameras des Geschosses, lässt die anderen stehen", () => {
|
||||
getState().deleteLevel(A);
|
||||
const p = getState().project;
|
||||
expect(p.drawings2d.map((x) => x.id)).toEqual(["d-b"]);
|
||||
expect((p.extrudedSolids ?? []).map((x) => x.id)).toEqual(["s-b"]);
|
||||
expect((p.trees ?? []).map((x) => x.id)).toEqual(["t-b"]);
|
||||
expect((p.cameras ?? []).map((x) => x.id)).toEqual(["c-b"]);
|
||||
});
|
||||
});
|
||||
@@ -854,6 +854,11 @@ export function createProjectSlice(
|
||||
...removeItems(p, "columns", (c) => c.floorId === id),
|
||||
...removeItems(p, "beams", (b) => b.floorId === id),
|
||||
...removeItems(p, "railings", (r) => r.floorId === id),
|
||||
// [284] 2D-Elemente, Körper, Bäume und Kameras des Geschosses.
|
||||
...removeItems(p, "drawings2d", (d) => d.levelId === id),
|
||||
...removeItems(p, "extrudedSolids", (s) => s.levelId === id),
|
||||
...removeItems(p, "trees", (t) => t.floorId === id),
|
||||
...removeItems(p, "cameras", (c) => c.floorId === id),
|
||||
...removeItems(p, "openings", (o) => removedWallIds.has(o.hostWallId) || (!!o.hostCeilingId && removedCeilingIds.has(o.hostCeilingId)) || (!!o.hostRoofId && removedRoofIds.has(o.hostRoofId))),
|
||||
];
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user