[181] [152] Importe als eigenständige Elemente: Klasse Pflicht, Herkunft nur Auskunft, keine Import-Liste

Gelände, Höhenlinien, Netzkörper (Nachbargebäude, IFC/OBJ/STEP/DXF-Netze), Luftbilder und Baugruben
(`Project.context`) sind normale Elemente:
- Modell: `categoryCode` Pflicht (String) an allen fünf Arten; `layer` (Gruppierung) und `hidden`
  (Einzel-Ausblenden) entfallen; neu `source` (Herkunft, ohne Wirkung). `ContextObject::category_code()`.
- Kern: Plan, Schnitt, Ansicht, 3D, Pick fragen nur die Klasse ab (kein „ohne Kategorie immer sichtbar").
  IFC-Gelände (IfcSite bzw. Name Gelände/Terrain) wird beim Import ein Gelände-Element
  (`import_context::ifc_meshes`); `mesh_view::is_terrain` entfällt, geschlossene Gelände-Netze schneidet
  der Schnitt als Oberkante. Importe setzen `source` statt `layer` (IFC-Klasse, DXF-Layer, STEP-Datei).
- Objekt-Info: Klasse im Kopf änderbar und Farbe der Klasse auch für Gelände-/Umgebungs-Elemente,
  Herkunft als Auskunft; Einzel-Ausblenden-Schalter entfernt.
- Panel „Gelände": Import-Liste entfernt (nur Aktionen); Elemente-Panel mit Knoten „Gelände & Umgebung".
- swissBUILDINGS3D/OSM/swissALTI3D/SWISSIMAGE setzen Klasse und `source`; Dach-Trennung über den DXF-Layer
  beim Import.
- Musterhaus komplex nachgeführt (ohne `layer`); Doku: ARCHITEKTUR Abschnitt 8 (Entwurf), Glossar, READMEs.

Geprüft: cargo test im Kern (bis auf den Zeit-Wächter ansicht_gross_schnell unter Last), vitest (alle),
tsc, Plan-/CLI-Goldens unverändert, e2e siteSelect/excavation/terrainHide angepasst und grün.
Musterhaus komplex mit zwei Nachbarnetzen: Grundriss EG/UG 1:200, Schnitt A-A, Ansicht Süd per CLI
vor/nach byte-gleich (angesehen). Nicht in der Tauri-App/auf dem Mac geprüft.
This commit is contained in:
Claude committed 2026-11-11 04:00:16 +00:00
1 parent a4c541bc50
commit cb9d8c3b0f
70 files changed
+616 -710

No files matched your search

+18 -27
View File
@@ -1,4 +1,4 @@
// Kontext-Schicht im Grundriss (generatePlan → addContextContours):
// Gelände-/Umgebungs-Elemente im Grundriss (generatePlan → addContextContours):
// • ImportedMesh -> [152] im Geschoss nach Ansichtsbereich: Schnittfläche, Aufsicht (mesh-view), Überkopf gestrichelt.
// • TerrainMesh -> nur 2D-Bounding-Box-Umriss (4 Linien).
// • Nutzer-Report: importierte Gebäude waren im Plan UNSICHTBAR (nur 3D).
@@ -29,7 +29,8 @@ function projectWith(context: Project["context"]): Project {
} as unknown as Project;
}
const visible = new Set<string>();
// [181] Klassen der Test-Elemente (Gelände „02", Luftbild „03", Netzkörper „10") eingeblendet.
const visible = new Set<string>(["02", "03", "10"]);
function contextLines(p: Project) {
return generatePlan(p, "eg", visible).primitives.filter(
@@ -55,25 +56,25 @@ function box(z0: number, z1: number) {
describe("generatePlan — importierte Netze im Grundriss ([152])", () => {
it("ein Gebäude durch die Schnitthöhe wird geschnitten (Poché, anwählbar)", () => {
const p = projectWith([{ id: "B1", type: "importedMesh", name: "Haus", ...box(0, 5) }]);
const p = projectWith([{ id: "B1", type: "importedMesh", categoryCode: "10", name: "Haus", ...box(0, 5) }]);
const cut = generatePlan(p, "eg", visible).primitives.filter((pr) => pr.kind === "polygon" && pr.contextObjectId === "B1" && pr.fill !== "none");
expect(cut).toHaveLength(1);
});
it("eine Fläche am Boden als Aufsicht, ohne Triangulations-Diagonale", () => {
const p = projectWith([{ id: "B1", type: "importedMesh", name: "Platte", positions: [0, 0, 0, 2, 0, 0, 2, 3, 0, 0, 3, 0], indices: [0, 1, 2, 0, 2, 3] }]);
const p = projectWith([{ id: "B1", type: "importedMesh", categoryCode: "10", name: "Platte", positions: [0, 0, 0, 2, 0, 0, 2, 3, 0, 0, 3, 0], indices: [0, 1, 2, 0, 2, 3] }]);
expect(meshLines(p)).toHaveLength(4);
});
it("ein Träger über der Schnitthöhe als gestrichelte Überkopf-Linie", () => {
const p = projectWith([{ id: "T1", type: "importedMesh", name: "Träger", ...box(2.2, 2.4) }]);
const p = projectWith([{ id: "T1", type: "importedMesh", categoryCode: "10", name: "Träger", ...box(2.2, 2.4) }]);
const lines = meshLines(p);
expect(lines).toHaveLength(4);
expect(lines.every((l) => l.kind === "line" && Array.isArray(l.dash))).toBe(true);
});
it("ein Netz des Geschosses darüber erscheint nicht", () => {
const p = projectWith([{ id: "O1", type: "importedMesh", name: "OG", ...box(2.6, 5) }]);
const p = projectWith([{ id: "O1", type: "importedMesh", categoryCode: "10", name: "OG", ...box(2.6, 5) }]);
expect(generatePlan(p, "eg", visible).primitives.filter((pr) => pr.kind === "polygon" && pr.contextObjectId === "O1")).toHaveLength(0);
});
});
@@ -83,7 +84,7 @@ describe("generatePlan — Kontext-Objekte anklickbar (Pick-Region)", () => {
const p = projectWith([
{
id: "B1",
type: "importedMesh",
type: "importedMesh", categoryCode: "10",
name: "Haus",
positions: [0, 0, 0, 2, 0, 0, 2, 3, 0, 0, 3, 0],
indices: [0, 1, 2, 0, 2, 3],
@@ -111,7 +112,7 @@ describe("generatePlan — Kontext-Objekte anklickbar (Pick-Region)", () => {
const p = projectWith([
{
id: "T1",
type: "terrainMesh",
type: "terrainMesh", categoryCode: "02",
name: "Gelände",
positions: [0, 0, 400, 10, 0, 401, 5, 8, 402],
indices: [0, 1, 2],
@@ -131,7 +132,7 @@ describe("generatePlan — Kontext-Umriss (TerrainMesh)", () => {
const p = projectWith([
{
id: "T1",
type: "terrainMesh",
type: "terrainMesh", categoryCode: "02",
name: "Gelände",
positions: [0, 0, 400, 10, 0, 401, 5, 8, 402],
indices: [0, 1, 2],
@@ -153,9 +154,8 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
const p = projectWith([
{
id: "IMG1",
type: "image",
type: "image", categoryCode: "03",
name: "Luftbild",
layer: "Luftbild",
src: "data:image/jpeg;base64,AAAA",
min: { x: -100, y: -80 },
max: { x: 100, y: 80 },
@@ -178,7 +178,7 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
const p = projectWith([
{
id: "IMG1",
type: "image",
type: "image", categoryCode: "03",
name: "Luftbild",
src: "data:image/jpeg;base64,AAAA",
min: { x: 0, y: 0 },
@@ -199,7 +199,7 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
const p = projectWith([
{
id: "IMG1",
type: "image",
type: "image", categoryCode: "03",
name: "Luftbild",
src: "data:image/jpeg;base64,AAAA",
min: { x: 0, y: 0 },
@@ -214,7 +214,7 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
const p = projectWith([
{
id: "IMG1",
type: "image",
type: "image", categoryCode: "03",
name: "Luftbild",
src: "data:image/jpeg;base64,AAAA",
min: { x: 0, y: 0 },
@@ -227,11 +227,10 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
});
describe("generatePlan — Kontext-Objekte: Ebenen-Sichtbarkeit (categoryCode)", () => {
// Ein Kontext-Objekt MIT `categoryCode` respektiert dieselbe visibleCodes-
// Allowlist wie jedes andere Bauteil (Wand/Dach/…) — Nutzer-Report: "sollten
// wie Gebäude/Dächer ausblendbar sein". Objekte OHNE categoryCode (ältere
// Importe) bleiben unabhängig davon immer sichtbar (Rückwärtskompatibilität).
const buildingMesh = (id: string, categoryCode?: string) => ({
// Gelände-/Umgebungs-Elemente respektieren dieselbe visibleCodes-Allowlist wie jedes andere Bauteil
// (Wand/Dach/…) — Nutzer-Report: "sollten wie Gebäude/Dächer ausblendbar sein". [181] Die Klasse ist
// Pflicht; ein „ohne Kategorie immer sichtbar" gibt es nicht mehr.
const buildingMesh = (id: string, categoryCode: string) => ({
id,
type: "importedMesh" as const,
name: "Haus",
@@ -258,12 +257,4 @@ describe("generatePlan — Kontext-Objekte: Ebenen-Sichtbarkeit (categoryCode)",
expect(lines.length).toBeGreaterThan(0);
});
it("ein Objekt OHNE categoryCode bleibt immer sichtbar (Altbestand)", () => {
const p = projectWith([buildingMesh("B1", undefined)]);
const visibleEmpty = new Set<string>(); // schliesst alles Benannte aus
const lines = generatePlan(p, "eg", visibleEmpty).primitives.filter(
(pr) => pr.kind === "line" && (pr as { cls?: string }).cls === "mesh-view",
);
expect(lines.length).toBeGreaterThan(0);
});
});
+1 -1
View File
@@ -27,7 +27,7 @@ function terrain(): TerrainMesh {
const a = j * n + i;
indices.push(a, a + 1, a + n, a + 1, a + n + 1, a + n);
}
return { id: "t1", type: "terrainMesh", name: "Gelände", positions, indices };
return { id: "t1", type: "terrainMesh", categoryCode: "02", name: "Gelände", positions, indices };
}
describe("Schnitt: Gelände und freie Körper", () => {
+6 -5
View File
@@ -45,13 +45,14 @@ describe("[137] 3D-Pick Treppengeländer und 2D-Flächen", () => {
expect(pick(base, down(24, 5))).toBeNull();
});
it("importiertes Netz: hidden entfernt die Pick-Dreiecke, Undo bringt sie zurück", () => {
const mesh = { type: "importedMesh", id: "im", name: "M", positions: [30, 0, 0, 32, 0, 0, 30, 2, 0], indices: [0, 1, 2] } as ImportedMesh;
setState({ project: { ...base, stairs: [], drawings2d: [], context: [mesh] }, undoDepth: 0, redoDepth: 0, canUndo: false, canRedo: false });
it("[181] Netzkörper in ausgeblendete Klasse verschoben: keine Pick-Dreiecke, Undo bringt sie zurück", () => {
const mesh = { type: "importedMesh", id: "im", name: "M", categoryCode: "10", positions: [30, 0, 0, 32, 0, 0, 30, 2, 0], indices: [0, 1, 2] } as ImportedMesh;
const off = { code: "99", name: "Aus", color: "#000000", lw: 0.1, visible: false } as Project["layers"][number];
setState({ project: { ...base, layers: [...base.layers, off], stairs: [], drawings2d: [], context: [mesh] }, undoDepth: 0, redoDepth: 0, canUndo: false, canRedo: false });
getState().clearHistory();
expect(pickGeometry(getState().project).contextMeshes.map((m) => m.contextObjectId)).toEqual(["im"]);
getState().patchContextObject("im", { hidden: true });
expect((getState().project.context![0] as ImportedMesh).hidden).toBe(true);
getState().patchContextObject("im", { categoryCode: "99" });
expect((getState().project.context![0] as ImportedMesh).categoryCode).toBe("99");
expect(pickGeometry(getState().project).contextMeshes).toEqual([]);
getState().undo();
expect(pickGeometry(getState().project).contextMeshes).toHaveLength(1);
+3 -3
View File
@@ -71,11 +71,11 @@ describe("[137] 3D-Pick freie Körper und Stützen", () => {
expect(selectionHighlightLines(base, [], [], rgb, [], [], [], [], 0, [], ["s1"]).length).toBe(4 * 3 * 12);
});
it("einzeln ausgeblendetes Gelände fängt im 3D keinen Klick", () => {
const terrain: TerrainMesh = { id: "t1", type: "terrainMesh", name: "G", positions: [0, 0, 0, 10, 0, 0, 10, 10, 0], indices: [0, 1, 2] };
it("[181] Gelände in ausgeblendeter Klasse fängt im 3D keinen Klick", () => {
const terrain: TerrainMesh = { id: "t1", type: "terrainMesh", categoryCode: "02", name: "G", positions: [0, 0, 0, 10, 0, 0, 10, 10, 0], indices: [0, 1, 2] };
const shown = { ...base, context: [{ ...terrain }] } as Project;
expect(pickGeometry(shown).contextMeshes.map((m) => m.contextObjectId)).toEqual(["t1"]);
const hidden = { ...base, context: [{ ...terrain, hidden: true }] } as Project;
const hidden = { ...base, layers: [...base.layers, { code: "02", name: "Gelände", color: "#808080", lw: 0.13, visible: false }], context: [{ ...terrain }] } as Project;
expect(pickGeometry(hidden).contextMeshes).toEqual([]);
});
});
+4 -4
View File
@@ -114,7 +114,7 @@ describe("selectionHighlightLines — Kontext-Objekte", () => {
context: [
{
id: "CTX1",
type: "importedMesh",
type: "importedMesh", categoryCode: "10",
name: "Testgebäude",
positions: [0, 0, 0, 2, 0, 0, 2, 3, 4],
indices: [0, 1, 2],
@@ -2559,7 +2559,7 @@ describe("pickGeometry — Kontext-Meshes (importierte Gebäude/Terrain)", () =>
context: [
{
id: "CTX1",
type: "importedMesh",
type: "importedMesh", categoryCode: "10",
name: "Testgebäude",
// model (x,y,z=Höhe) -> world (x, z, -y): ein Dreieck.
positions: [0, 0, 0, 2, 0, 0, 2, 3, 4],
@@ -2567,7 +2567,7 @@ describe("pickGeometry — Kontext-Meshes (importierte Gebäude/Terrain)", () =>
},
{
id: "CONTOURS1",
type: "contourSet",
type: "contourSet", categoryCode: "02",
name: "Höhenlinien",
contours: [],
},
@@ -2591,7 +2591,7 @@ describe("pickGeometry — Kontext-Meshes (importierte Gebäude/Terrain)", () =>
context: [
{
id: "CTX2",
type: "importedMesh",
type: "importedMesh", categoryCode: "10",
name: "Kaputt",
positions: [0, 0, 0, 1, 0, 0, 1, 1, 0],
indices: [0, 1, 99], // Index 99 existiert nicht