Merge branch 'worktree-agent-a6b600eecf6bd85ef' into claude/practical-noether-1hb2s1
# Conflicts: # src-tauri/core/src/plan/context.rs # src/plan/__golden__/komplex-ansicht-ansicht-sued.txt
This commit is contained in:
53 files changed
+680
-81
No files matched your search
@@ -9,7 +9,7 @@ const sq = (x: number, y: number, s: number) => [
|
||||
|
||||
describe("solidVolume", () => {
|
||||
it("Prisma, Kegelstumpf (taper) und Kreis", () => {
|
||||
const base = { id: "s", type: "extrudedSolid" as const, levelId: "eg", points: sq(0, 0, 2), height: 3 };
|
||||
const base = { id: "s", type: "extrudedSolid" as const, categoryCode: "20", levelId: "eg", points: sq(0, 0, 2), height: 3 };
|
||||
expect(solidVolume(base)).toBeCloseTo(12, 9);
|
||||
expect(solidVolume({ ...base, taper: 1 })).toBeCloseTo(4, 9); // Pyramide = A·h/3
|
||||
const r = { ...base, circle: { center: { x: 0, y: 0 }, r: 1 } };
|
||||
@@ -34,8 +34,8 @@ describe("computeKennzahlen", () => {
|
||||
const p: Project = {
|
||||
...sampleProject,
|
||||
extrudedSolids: [
|
||||
{ id: "a", type: "extrudedSolid", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 10), height: 3 } as never,
|
||||
{ id: "b", type: "extrudedSolid", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 1), height: 3, operation: "subtract" } as never,
|
||||
{ id: "a", type: "extrudedSolid", categoryCode: "20", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 10), height: 3 } as never,
|
||||
{ id: "b", type: "extrudedSolid", categoryCode: "20", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 1), height: 3, operation: "subtract" } as never,
|
||||
],
|
||||
};
|
||||
const k = computeKennzahlen(p);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// Override-Regel ein (auch Standard-Baustein, z. B. --rule "Deckenaufbau weiss") [33];
|
||||
// das Massstab-Kriterium einer Regel (ab/bis 1:n) gilt nach --scale;
|
||||
// --model-view <Name> wählt eine Modelldarstellung (eigene Stufe oder grob/mittel/fein) [173]
|
||||
// --hide <Code|Name,…> blendet Klassen aus (z. B. --hide "Schatten,Auto-Bemassung") [180]
|
||||
// dossier-cli <projekt.obp> ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation)
|
||||
// --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0)
|
||||
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei]
|
||||
@@ -235,6 +236,20 @@ function templateView(project: Project, levelId: string, args: Args, allCodes: S
|
||||
const tpl = templateFor(project, levelId, args);
|
||||
const d = templateDisplay(tpl);
|
||||
const hidden = new Set(d.hiddenCodes);
|
||||
// [180] --hide <Code|Name,…>: Klassen ausblenden (z. B. --hide "Schatten,Auto-Bemassung").
|
||||
for (const w of (args.flags.get("hide") ?? "").split(",").map((x) => x.trim().toLowerCase()).filter(Boolean)) {
|
||||
const find = (ls: Project["layers"]): string | undefined => {
|
||||
for (const l of ls) {
|
||||
if (l.code.toLowerCase() === w || l.name.toLowerCase() === w) return l.code;
|
||||
const c = l.children ? find(l.children) : undefined;
|
||||
if (c) return c;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const code = find(project.layers);
|
||||
if (!code) fail(`Klasse nicht gefunden: ${w}`);
|
||||
hidden.add(code);
|
||||
}
|
||||
return {
|
||||
tpl,
|
||||
detail: d.detail,
|
||||
|
||||
@@ -13,7 +13,7 @@ function combineSolids(project: typeof sampleProject, a: ExtrudedSolid, b: Extru
|
||||
|
||||
const box = (id: string, x0: number, y0: number, x1: number, y1: number, h: number): ExtrudedSolid => ({
|
||||
id,
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: [{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x1, y: y1 }, { x: x0, y: y1 }],
|
||||
height: h,
|
||||
|
||||
@@ -46,7 +46,7 @@ const volume = (m: { positions: number[]; indices: number[] }): number => {
|
||||
const build = (spec: unknown, tol = 0.01) => JSON.parse(mod.build_solid_mesh(JSON.stringify({ spec, tol })));
|
||||
|
||||
const box = (id: string, x0: number, y0: number, x1: number, y1: number, h: number): ExtrudedSolid => ({
|
||||
id, type: "extrudedSolid", levelId: "eg", height: h,
|
||||
id, type: "extrudedSolid", categoryCode: "20", levelId: "eg", height: h,
|
||||
points: [{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x1, y: y1 }, { x: x0, y: y1 }],
|
||||
});
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ function fixtureProject(): Project {
|
||||
const extrudedSolids: ExtrudedSolid[] = [
|
||||
{
|
||||
id: "E1",
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: [
|
||||
{ x: 0, y: 0 },
|
||||
|
||||
@@ -81,7 +81,7 @@ function projectWithPolygonExtrusion(pts: { x: number; y: number }[], height = 2
|
||||
const p = baseProject();
|
||||
const solid: ExtrudedSolid = {
|
||||
id: "E1",
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: pts,
|
||||
height,
|
||||
@@ -134,7 +134,7 @@ function fixtureProject(): Project {
|
||||
const extrudedSolids: ExtrudedSolid[] = [
|
||||
{
|
||||
id: "E1",
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: [
|
||||
{ x: 0, y: 0 },
|
||||
|
||||
@@ -96,7 +96,7 @@ function fixtureProject(): Project {
|
||||
const extrudedSolids: ExtrudedSolid[] = [
|
||||
{
|
||||
id: "E1",
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: [
|
||||
{ x: 0, y: 0 },
|
||||
|
||||
@@ -74,7 +74,7 @@ describe("STEP-Export Ende-zu-Ende (truck-WASM)", () => {
|
||||
const p = {
|
||||
...sampleProject,
|
||||
extrudedSolids: [{
|
||||
id: "v", type: "extrudedSolid" as const, levelId: w.floorId, operation: "subtract" as const, height: 0.8, baseOffset: 0.5,
|
||||
id: "v", type: "extrudedSolid" as const, categoryCode: "20", levelId: w.floorId, operation: "subtract" as const, height: 0.8, baseOffset: 0.5,
|
||||
points: [{ x: mx - 0.3, y: my - 1 }, { x: mx + 0.3, y: my - 1 }, { x: mx + 0.3, y: my + 1 }, { x: mx - 0.3, y: my + 1 }],
|
||||
}],
|
||||
};
|
||||
|
||||
@@ -990,6 +990,10 @@ export const de = {
|
||||
"nav.show": "Einblenden",
|
||||
"nav.categoryVisible": "{name} sichtbar",
|
||||
"nav.categorySelect": "{name} als aktive Ebene wählen (Zeichen-Ziel)",
|
||||
"nav.categoryDerived.08": "Abgeleitete Darstellung: Sonnenschatten im Grundriss, Schlagschatten in der Ansicht",
|
||||
"nav.categoryDerived.81": "Abgeleitete Darstellung: automatische Aussenbemassung (je Kette änderbar)",
|
||||
"nav.categoryDerived.82": "Abgeleitete Darstellung: automatische Höhenkoten in Schnitt und Ansicht",
|
||||
"nav.categoryDerived.91": "Abgeleitete Darstellung: Schnitt- und Ansichtsmarken im Grundriss",
|
||||
"nav.categorySettings": "Ebeneneinstellungen für {name}",
|
||||
"nav.drawingLevelsWindow": "Zeichnungsebenen als eigenes Fenster öffnen",
|
||||
|
||||
|
||||
@@ -985,6 +985,10 @@ export const en: Record<TranslationKey, string> = {
|
||||
"nav.show": "Show",
|
||||
"nav.categoryVisible": "{name} visible",
|
||||
"nav.categorySelect": "Make {name} the active layer (drawing target)",
|
||||
"nav.categoryDerived.08": "Derived display: sun shadows in plans, cast shadows in elevations",
|
||||
"nav.categoryDerived.81": "Derived display: automatic exterior dimensions (each chain can be reassigned)",
|
||||
"nav.categoryDerived.82": "Derived display: automatic level marks in sections and elevations",
|
||||
"nav.categoryDerived.91": "Derived display: section and elevation marks in plans",
|
||||
"nav.categorySettings": "Layer settings for {name}",
|
||||
"nav.drawingLevelsWindow": "Open drawing levels as its own window",
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// [180] Klassen der abgeleiteten Darstellung: alles Sichtbare liegt auf einer Klasse, auch was nicht zu einem
|
||||
// Element gehört (Schatten, Schnittmarken, automatische Koten) oder ein Befehl erzeugt (Aussenbemassung).
|
||||
// Die Codes stehen im Kern (`src-tauri/core/src/standards.rs`, `DERIVED_CATEGORIES`; „Standards laden" legt die
|
||||
// Klassen an); hier nur die Codes für die TS-Seite (Gleichheit prüft `derivedCategories.test.ts`).
|
||||
// Fehlt eine Klasse im Projekt, bleibt die Darstellung sichtbar (wie im Kern `standards::derived_visible`).
|
||||
|
||||
import type { LayerCategory } from "./types";
|
||||
import { findCategory } from "./layers";
|
||||
|
||||
/** Sonnenschatten im Grundriss, Schlagschatten in der Ansicht. */
|
||||
export const SHADOW_CATEGORY = "08";
|
||||
/** Automatische Aussenbemassung (Befehl `autodim`). */
|
||||
export const AUTO_DIM_CATEGORY = "81";
|
||||
/** Automatische Höhenkoten in Schnitt und Ansicht. */
|
||||
export const LEVEL_MARK_CATEGORY = "82";
|
||||
/** Schnitt- und Ansichtsmarken im Grundriss. */
|
||||
export const SECTION_MARK_CATEGORY = "91";
|
||||
|
||||
export const DERIVED_CATEGORY_CODES: readonly string[] = [SHADOW_CATEGORY, AUTO_DIM_CATEGORY, LEVEL_MARK_CATEGORY, SECTION_MARK_CATEGORY];
|
||||
|
||||
/** Abgeleitete Darstellung der Klasse `code` sichtbar: Klasse eingeblendet (`shown`) oder im Projekt nicht vorhanden. */
|
||||
export function derivedVisible(layers: LayerCategory[], code: string, shown: (code: string) => boolean): boolean {
|
||||
return shown(code) || !findCategory(layers, code);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ describe("translateProject", () => {
|
||||
it("Extrusion: points + Kreis-Mitte verschieben sich", () => {
|
||||
const solid: ExtrudedSolid = {
|
||||
id: "EX1",
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: [{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 1 }],
|
||||
height: 1,
|
||||
|
||||
@@ -88,8 +88,8 @@ export function richProject(): Project {
|
||||
{ type: "image", categoryCode: "03", id: "c4", name: "Luftbild", src: "data:image/png;base64,AAAA", min: { x: 0, y: 0 }, max: { x: 10, y: 10 }, opacity: 0.7, drape: true, filters: { saturation: 0.5, grayscale: 1 } },
|
||||
],
|
||||
extrudedSolids: [
|
||||
{ id: "x1", type: "extrudedSolid", levelId: lvl, points: [{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 1 }], height: 2, baseOffset: 0.1, operation: "subtract", taper: 0.1, cornerRadius: 0.05, chamfer: 0.02 },
|
||||
{ id: "x2", type: "extrudedSolid", levelId: lvl, points: [], height: 1, circle: { center: { x: 3, y: 3 }, r: 0.4 }, brep: { spec: { kind: "box", w: 1, nested: { a: [1, 2] } }, origin: { x: 0, y: 0 }, label: "Quader" } },
|
||||
{ id: "x1", type: "extrudedSolid", categoryCode: "20", levelId: lvl, points: [{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 1 }], height: 2, baseOffset: 0.1, operation: "subtract", taper: 0.1, cornerRadius: 0.05, chamfer: 0.02 },
|
||||
{ id: "x2", type: "extrudedSolid", categoryCode: "20", levelId: lvl, points: [], height: 1, circle: { center: { x: 3, y: 3 }, r: 0.4 }, brep: { spec: { kind: "box", w: 1, nested: { a: [1, 2] } }, origin: { x: 0, y: 0 }, label: "Quader" } },
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
|
||||
@@ -370,6 +370,9 @@ export const sampleProject: Project = {
|
||||
layers: [
|
||||
{ code: "00", name: "Raster", color: "#1a1a1a", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "01", name: "Vermessung", color: "#4a4a4a", lw: 0.18, visible: true, locked: false },
|
||||
// [180] Klassen der abgeleiteten Darstellung (wie „Standards laden", Kern `standards.rs`): Schatten,
|
||||
// Auto-Bemassung, automatische Höhenkoten in Schnitt/Ansicht, Schnitt-/Ansichtsmarken.
|
||||
{ code: "08", name: "Schatten", color: "#707078", lw: 0.13, visible: true, locked: false },
|
||||
// "05 Kontext" bündelt Bestand/Umgebung (manuell gezeichnet ODER importiert,
|
||||
// s. `contextCategories.ts::CONTEXT_PARENT_CATEGORY`) als Kinder statt als
|
||||
// gleichrangige Top-Level-Einträge (Nutzer-Wunsch 2026-08-31).
|
||||
@@ -409,7 +412,10 @@ export const sampleProject: Project = {
|
||||
{ code: "35", name: "Träger", color: "#0a0a0a", lw: 0.25, visible: true, locked: false },
|
||||
{ code: "50", name: "Text", color: "#1a1a1a", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "60", name: "Räume", color: "#4a4a4a", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "81", name: "Auto-Bemassung", color: "#303038", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "82", name: "Höhenkoten", color: "#1a1a1a", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "90", name: "Referenzen", color: "#1a1a1a", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "91", name: "Schnittmarken", color: "#1a1a1a", lw: 0.18, visible: true, locked: false },
|
||||
{ code: "99", name: "Konstruktion", color: "#404040", lw: 0.13, visible: true, locked: false },
|
||||
],
|
||||
// [140] Strichstärken folgen dem Massstab (neue Projekte; bestehende behalten ihre Einstellung).
|
||||
|
||||
@@ -484,9 +484,9 @@ const columns: NonNullable<Project["columns"]> = [
|
||||
|
||||
const extrudedSolids: NonNullable<Project["extrudedSolids"]> = [
|
||||
// Abzugskörper: Durchreiche Küche ↔ Atelier in der EG-Innenwand x = 6.
|
||||
{ id: "void-durchreiche", type: "extrudedSolid", levelId: "eg", points: rect(5.8, 6.6, 6.2, 7.8), height: 0.6, baseOffset: 1.0, operation: "subtract" },
|
||||
{ id: "void-durchreiche", type: "extrudedSolid", levelId: "eg", categoryCode: "20", points: rect(5.8, 6.6, 6.2, 7.8), height: 0.6, baseOffset: 1.0, operation: "subtract" },
|
||||
// Freier Körper: runder Brunnentrog im Garten (Kreisprofil, Fase).
|
||||
{ id: "koerper-brunnen", type: "extrudedSolid", levelId: "ug", points: [], circle: { center: P(4.5, -6.5), r: 0.7 }, height: 0.6, baseOffset: -0.1, chamfer: 0.03 },
|
||||
{ id: "koerper-brunnen", type: "extrudedSolid", levelId: "ug", categoryCode: "20", points: [], circle: { center: P(4.5, -6.5), r: 0.7 }, height: 0.6, baseOffset: -0.1, chamfer: 0.03 },
|
||||
];
|
||||
|
||||
// ═════════════════════════════════════════════════════════════════════════════
|
||||
@@ -872,6 +872,7 @@ export function buildComplexSampleProject(): Project {
|
||||
p = addRooms(p);
|
||||
|
||||
// Aussenbemassung (Massketten je Fassade) in UG, EG, OG.
|
||||
// [180] Die Ketten landen auf der Klasse „81 Auto-Bemassung" (Befehl `autodim`), nicht auf der aktiven.
|
||||
for (const f of ["ug", "eg", "og"]) p = runCmd(p, f, "autodim", {}, "80").project;
|
||||
return p;
|
||||
}
|
||||
@@ -1287,6 +1287,10 @@ export type ExtrudedSolid = {
|
||||
type: "extrudedSolid";
|
||||
/** Geschoss, dessen `baseElevation` die UK des Körpers bestimmt. */
|
||||
levelId: string;
|
||||
/**
|
||||
* [180] Klasse (Ebene/Kategorie) wie bei jedem Bauteil: Sichtbarkeit in Grundriss, Schnitt und Ansicht.
|
||||
*/
|
||||
categoryCode: string;
|
||||
/**
|
||||
* Geschlossenes Profil in der XY-Ebene (Grundriss), ≥3 Punkte. Bei einem
|
||||
* Kreis-Profil (`circle` gesetzt) eine Tessellierung des Kreises (48-Eck) —
|
||||
|
||||
@@ -30,6 +30,7 @@ import type { LayerCategory } from "./host";
|
||||
import type { DisplayMode } from "./types";
|
||||
import { DisplayModeSelect } from "./DisplayModeSelect";
|
||||
import { t } from "../i18n";
|
||||
import { DERIVED_CATEGORY_CODES } from "../model/derivedCategories";
|
||||
|
||||
/** Inhalt des Panels „Ebenen". */
|
||||
export function LayersPanel() {
|
||||
@@ -129,7 +130,11 @@ function CategoryRow({
|
||||
style={style}
|
||||
onClick={() => onSelect(category.code)}
|
||||
onContextMenu={(e) => onContext(category.code, e)}
|
||||
title={t("nav.categorySelect", { name: category.name })}
|
||||
title={
|
||||
DERIVED_CATEGORY_CODES.includes(category.code)
|
||||
? `${t("nav.categorySelect", { name: category.name })}\n${t(`nav.categoryDerived.${category.code}`)}`
|
||||
: t("nav.categorySelect", { name: category.name })
|
||||
}
|
||||
>
|
||||
<button
|
||||
className={`eye${category.visible ? " is-on" : ""}`}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -4.2 0 37.045 17.378
|
||||
bytes 197406
|
||||
bytes 194324
|
||||
circle 4
|
||||
g 1
|
||||
line 436
|
||||
line 546
|
||||
path 2
|
||||
polygon 1053
|
||||
polyline 156
|
||||
polygon 1045
|
||||
polyline 44
|
||||
rect 1
|
||||
svg 1
|
||||
text 4
|
||||
hash 1b43e968eef4f52b
|
||||
hash 9ddddce6f17fcd6d
|
||||
@@ -1,11 +1,11 @@
|
||||
viewBox 4.457 0 21.343 17.378
|
||||
bytes 28680
|
||||
bytes 28250
|
||||
circle 4
|
||||
g 1
|
||||
line 39
|
||||
line 37
|
||||
polygon 141
|
||||
polyline 16
|
||||
polyline 14
|
||||
rect 1
|
||||
svg 1
|
||||
text 3
|
||||
hash d2dde45c8a663cfa
|
||||
hash 9cdb25c298a73bb1
|
||||
@@ -0,0 +1,96 @@
|
||||
// [180] Alles Sichtbare liegt auf einer Klasse (Vorgabe Maintainer): Grundriss (alle Geschosse), Schnitte und
|
||||
// Ansichten beider Musterhäuser sind leer, wenn alle Klassen ausgeblendet sind; jede Klasse der abgeleiteten
|
||||
// Darstellung (Schatten, Auto-Bemassung, Höhenkoten, Schnittmarken) nimmt genau ihre Primitive mit.
|
||||
// Kern-Gegenstück mit dem Fixture-Projekt: `src-tauri/core/src/plan/derived_class_tests.rs`.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { computeSection, generateElevationPlan, generatePlan, generateSectionPlan, levelMarksEnabled } from "../core";
|
||||
import { sampleProject, emptyProject } from "../model/sampleProject";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { withStandards } from "../model/standards";
|
||||
import { flattenCategories } from "../model/layers";
|
||||
import { AUTO_DIM_CATEGORY, DERIVED_CATEGORY_CODES, LEVEL_MARK_CATEGORY, SECTION_MARK_CATEGORY, SHADOW_CATEGORY } from "../model/derivedCategories";
|
||||
import type { Primitive } from "./generatePlan";
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
const SHOW_ALL = () => ({ render: true, greyed: false, locked: false });
|
||||
const allCodes = (p: Project) => new Set(flattenCategories(p.layers).map((c) => c.code));
|
||||
const without = (s: Set<string>, code: string) => new Set([...s].filter((c) => c !== code));
|
||||
|
||||
const projects: [string, () => Project][] = [
|
||||
["muster", () => sampleProject],
|
||||
["komplex", buildComplexSampleProject],
|
||||
];
|
||||
|
||||
const floorPlan = (p: Project, floor: string, codes: Set<string>): readonly Primitive[] =>
|
||||
generatePlan(p, floor, codes, SHOW_ALL, "mittel", false, false, true, 100).primitives;
|
||||
const elevation = (p: Project, id: string, codes: Set<string>): readonly Primitive[] =>
|
||||
generateElevationPlan(p, p.drawingLevels.find((l) => l.id === id)!, { scaleDenominator: 100, visibleCodes: codes, categoryDisplay: SHOW_ALL })?.primitives ?? [];
|
||||
const describeLeft = (prims: readonly Primitive[]) =>
|
||||
prims.slice(0, 5).map((q) => JSON.stringify(q).slice(0, 160));
|
||||
|
||||
describe("[180] Klassen der abgeleiteten Darstellung", () => {
|
||||
it('„Standards laden“ legt sie an (Codes wie im Kern)', () => {
|
||||
const codes = allCodes(withStandards({ ...emptyProject, layers: [] }));
|
||||
for (const c of DERIVED_CATEGORY_CODES) expect(codes.has(c), c).toBe(true);
|
||||
// Die Musterprojekte haben sie schon.
|
||||
for (const c of DERIVED_CATEGORY_CODES) expect(allCodes(sampleProject).has(c), c).toBe(true);
|
||||
});
|
||||
|
||||
for (const [name, make] of projects) {
|
||||
describe(name, () => {
|
||||
const p = make();
|
||||
const all = allCodes(p);
|
||||
|
||||
for (const lvl of p.drawingLevels.filter((l) => l.kind === "floor")) {
|
||||
it(`Grundriss ${lvl.id}: ohne Klassen leer`, () => {
|
||||
expect(floorPlan(p, lvl.id, all).length).toBeGreaterThan(0);
|
||||
const rest = floorPlan(p, lvl.id, new Set());
|
||||
expect(rest.length, describeLeft(rest).join("\n")).toBe(0);
|
||||
});
|
||||
}
|
||||
|
||||
for (const lvl of p.drawingLevels.filter((l) => l.kind === "section")) {
|
||||
it(`Schnitt ${lvl.id}: ohne Klassen leer`, async () => {
|
||||
const out = (await computeSection(p, lvl))!;
|
||||
const plan = (codes: Set<string>) => generateSectionPlan(out, false, { visibleCodes: codes, categoryDisplay: SHOW_ALL, openings: true, scaleDenominator: 100 }).primitives;
|
||||
expect(plan(all).length).toBeGreaterThan(0);
|
||||
const rest = plan(new Set());
|
||||
expect(rest.length, describeLeft(rest).join("\n")).toBe(0);
|
||||
expect(levelMarksEnabled({ ...lvl, levelMarks: true }, p, (c) => all.has(c))).toBe(true);
|
||||
expect(levelMarksEnabled({ ...lvl, levelMarks: true }, p, (c) => c !== LEVEL_MARK_CATEGORY)).toBe(false);
|
||||
}, 30_000);
|
||||
}
|
||||
|
||||
for (const lvl of p.drawingLevels.filter((l) => l.kind === "elevation")) {
|
||||
it(`Ansicht ${lvl.id}: ohne Klassen leer, Schlagschatten auf „Schatten“`, () => {
|
||||
const shaded = { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === lvl.id ? { ...l, shadows: true } : l)) };
|
||||
const full = elevation(shaded, lvl.id, all);
|
||||
expect(full.length).toBeGreaterThan(0);
|
||||
const rest = elevation(shaded, lvl.id, new Set());
|
||||
expect(rest.length, describeLeft(rest).join("\n")).toBe(0);
|
||||
const shadows = (v: readonly Primitive[]) => v.filter((q) => q.kind === "polygon" && q.contextObjectId === "@viewShadows").length;
|
||||
expect(shadows(full)).toBeGreaterThan(0);
|
||||
expect(shadows(elevation(shaded, lvl.id, without(all, SHADOW_CATEGORY)))).toBe(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
it("komplex EG: Schatten, Auto-Bemassung und Schnittmarken einzeln aus", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
const all = allCodes(p);
|
||||
const full = floorPlan(p, "eg", all);
|
||||
const count = (v: readonly Primitive[], hit: (q: Primitive) => boolean) => v.filter(hit).length;
|
||||
const sun = (q: Primitive) => q.kind === "polygon" && q.contextObjectId === "@sunStudy";
|
||||
const autodim = (q: Primitive) => "drawingId" in q && typeof q.drawingId === "string" && q.drawingId.startsWith("autodim-");
|
||||
const marks = (q: Primitive) => q.kind === "polygon" && !!q.sectionLineId;
|
||||
for (const [code, hit] of [[SHADOW_CATEGORY, sun], [AUTO_DIM_CATEGORY, autodim], [SECTION_MARK_CATEGORY, marks]] as const) {
|
||||
const n = count(full, hit);
|
||||
expect(n, code).toBeGreaterThan(0);
|
||||
const off = floorPlan(p, "eg", without(all, code));
|
||||
expect(count(off, hit), code).toBe(0);
|
||||
}
|
||||
// Die Aussenbemassung trägt ihre Klasse (je Kette änderbar).
|
||||
expect(p.drawings2d.filter((d) => d.id.startsWith("autodim-")).every((d) => d.categoryCode === AUTO_DIM_CATEGORY)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -3,7 +3,7 @@ import type { ExtrudedSolid } from "../model/types";
|
||||
import { extrudedSolidSpec, needsBrepPath } from "./extrudedSolidSpec";
|
||||
|
||||
const sq = [{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 2 }, { x: 0, y: 2 }];
|
||||
const base: ExtrudedSolid = { id: "e1", type: "extrudedSolid", levelId: "eg", points: sq, height: 3 };
|
||||
const base: ExtrudedSolid = { id: "e1", type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: sq, height: 3 };
|
||||
|
||||
describe("extrudedSolidSpec", () => {
|
||||
it("Prisma ohne Besonderheiten bleibt auf dem alten Pfad", () => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* (cls "section-line"), Endmarken + ein unsichtbares Pick-Band (Polygon mit
|
||||
* `sectionLineId`). Ebenen OHNE Linie erzeugen nichts.
|
||||
*
|
||||
* Sichtbarkeit läuft über die feste Kategorie "90" (Referenzen) — NICHT über
|
||||
* Sichtbarkeit läuft über die Standard-Klasse "91" (Schnittmarken, [180]; früher "90" Referenzen) — NICHT über
|
||||
* das eigene `visible`-Flag der Schnitt-/Ansichtsebene (Nutzer-Feedback: "das
|
||||
* sollten Elemente sein, die sich auf einer Ebene befinden und nur damit
|
||||
* ein-/ausgeblendet werden"). Das Flag ist daher für dieses Symbol wirkungslos.
|
||||
@@ -15,7 +15,7 @@ import { generatePlan } from "./generatePlan";
|
||||
import type { CategoryDisplayResolver } from "./generatePlan";
|
||||
import type { DrawingLevel, Project } from "../model/types";
|
||||
|
||||
const visible = new Set(["20", "35", "90"]);
|
||||
const visible = new Set(["20", "35", "90", "91"]);
|
||||
|
||||
function baseProject(levels: DrawingLevel[]): Project {
|
||||
return {
|
||||
@@ -26,7 +26,10 @@ function baseProject(levels: DrawingLevel[]): Project {
|
||||
components: [],
|
||||
wallTypes: [],
|
||||
drawingLevels: levels,
|
||||
layers: [{ code: "20", name: "Wände", color: "#333", lw: 0.18, visible: true, locked: false }],
|
||||
layers: [
|
||||
{ code: "20", name: "Wände", color: "#333", lw: 0.18, visible: true, locked: false },
|
||||
{ code: "91", name: "Schnittmarken", color: "#1a1a1a", lw: 0.18, visible: true, locked: false },
|
||||
],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
@@ -106,7 +109,7 @@ describe("generatePlan — Schnittführungs-Symbol", () => {
|
||||
expect(prims.some((pr) => pr.kind === "line" && pr.cls === "section-line")).toBe(false);
|
||||
});
|
||||
|
||||
it("zeichnet TROTZDEM, auch wenn die Schnittebene selbst visible=false trägt (nur Kategorie '90' zählt)", () => {
|
||||
it("zeichnet TROTZDEM, auch wenn die Schnittebene selbst visible=false trägt (nur die Klasse '91' zählt)", () => {
|
||||
const p = baseProject([
|
||||
floor,
|
||||
{
|
||||
@@ -123,7 +126,7 @@ describe("generatePlan — Schnittführungs-Symbol", () => {
|
||||
expect(prims.some((pr) => pr.kind === "polygon" && pr.sectionLineId === "s-hidden")).toBe(true);
|
||||
});
|
||||
|
||||
it("zeichnet NICHTS, wenn Kategorie '90' NICHT sichtbar ist (visibleCodes ohne '90')", () => {
|
||||
it("zeichnet NICHTS, wenn die Klasse '91' NICHT sichtbar ist (visibleCodes ohne '91')", () => {
|
||||
const p = baseProject([
|
||||
floor,
|
||||
{
|
||||
@@ -136,11 +139,11 @@ describe("generatePlan — Schnittführungs-Symbol", () => {
|
||||
directionSign: 1,
|
||||
},
|
||||
]);
|
||||
const prims = generatePlan(p, "eg", new Set(["20", "35"])).primitives;
|
||||
const prims = generatePlan(p, "eg", new Set(["20", "35", "90"])).primitives;
|
||||
expect(prims.some((pr) => pr.kind === "polygon" && pr.sectionLineId === "s-cat")).toBe(false);
|
||||
});
|
||||
|
||||
it("dimmt (greyed), wenn categoryDisplay('90') greyed liefert", () => {
|
||||
it("dimmt (greyed), wenn categoryDisplay('91') greyed liefert", () => {
|
||||
const p = baseProject([
|
||||
floor,
|
||||
{
|
||||
@@ -154,7 +157,7 @@ describe("generatePlan — Schnittführungs-Symbol", () => {
|
||||
},
|
||||
]);
|
||||
const categoryDisplay: CategoryDisplayResolver = (code) =>
|
||||
code === "90" ? { render: true, greyed: true, locked: false } : { render: true, greyed: false, locked: false };
|
||||
code === "91" ? { render: true, greyed: true, locked: false } : { render: true, greyed: false, locked: false };
|
||||
const prims = generatePlan(p, "eg", visible, categoryDisplay).primitives;
|
||||
const line = prims.find((pr) => pr.kind === "line" && pr.cls === "section-line") as
|
||||
| { greyed?: boolean }
|
||||
|
||||
@@ -3,20 +3,28 @@
|
||||
// Gebäudes (First/OK Dach), links neben der Zeichnung mit einer kurzen
|
||||
// Bezugslinie zur Geometrie. Symbol = dieselbe SIA-400-Kote wie das 2D-Element
|
||||
// `kote`; gerechnet im Kern (`plan/drawings.rs::level_markers`, Abfrage `levelMarkers`).
|
||||
// Abschaltbar je Ebene (`DrawingLevel.levelMarks`) oder über die Modelldarstellung ([173]).
|
||||
// Abschaltbar je Ebene (`DrawingLevel.levelMarks`), über die Modelldarstellung ([173]) oder die Klasse
|
||||
// „Höhenkoten" ([180]).
|
||||
|
||||
import type { DrawingLevel, Project } from "../model/types";
|
||||
import type { Primitive } from "./generatePlan";
|
||||
import { documentFor } from "../core/document";
|
||||
import { decodePlanBuf } from "./planBuf";
|
||||
import { derivedVisible, LEVEL_MARK_CATEGORY } from "../model/derivedCategories";
|
||||
|
||||
/**
|
||||
* Ob eine Ebene automatische Koten trägt: Ebene > [173] Modelldarstellung der Ebene (`dimensions.levelMarks`,
|
||||
* Rangfolge wie Kern `model_view::Options::level_marks`) > an.
|
||||
*/
|
||||
export function levelMarksEnabled(level: DrawingLevel, project?: Pick<Project, "modelViewOptions">): boolean {
|
||||
export function levelMarksEnabled(
|
||||
level: DrawingLevel,
|
||||
project?: Pick<Project, "modelViewOptions"> & Partial<Pick<Project, "layers">>,
|
||||
shown?: (code: string) => boolean,
|
||||
): boolean {
|
||||
const mv = level.modelViewOptionId ? project?.modelViewOptions?.find((m) => m.id === level.modelViewOptionId) : undefined;
|
||||
return level.levelMarks ?? mv?.dimensions?.levelMarks ?? true;
|
||||
const on = level.levelMarks ?? mv?.dimensions?.levelMarks ?? true;
|
||||
// [180] Die Koten liegen auf der Klasse „Höhenkoten": ausgeblendet ⇒ ohne (`shown`: sichtbar und gezeichnet).
|
||||
return on && (!shown || !project?.layers || derivedVisible(project.layers, LEVEL_MARK_CATEGORY, shown));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ describe("Schnitt: Gelände und freie Körper", () => {
|
||||
// Kugel mitten auf der Schnittebene: Position aus der Schnittlinie des Beispiels
|
||||
const [px, , pz] = (await import("./toSection")).sectionPlaneFromLevel(section)!.point;
|
||||
const sphere: ExtrudedSolid = {
|
||||
id: "ball", type: "extrudedSolid", levelId: floor.id, height: 2,
|
||||
id: "ball", type: "extrudedSolid", categoryCode: "20", levelId: floor.id, height: 2,
|
||||
points: [{ x: px - 1, y: pz - 1 }, { x: px + 1, y: pz - 1 }, { x: px + 1, y: pz + 1 }, { x: px - 1, y: pz + 1 }],
|
||||
brep: { spec: { kind: "sphere", center: [px, pz, 1], r: 1 }, origin: { x: px - 1, y: pz - 1 } },
|
||||
};
|
||||
@@ -67,7 +67,7 @@ describe("Schnitt: Gelände und freie Körper", () => {
|
||||
const cy = (a.y + b.y) / 2;
|
||||
const r = 2;
|
||||
const ball: ExtrudedSolid = {
|
||||
id: "void-ball", type: "extrudedSolid", levelId: floor.id, height: 2 * r, operation: "subtract",
|
||||
id: "void-ball", type: "extrudedSolid", categoryCode: "20", levelId: floor.id, height: 2 * r, operation: "subtract",
|
||||
points: [{ x: cx - r, y: cy - r }, { x: cx + r, y: cy - r }, { x: cx + r, y: cy + r }, { x: cx - r, y: cy + r }],
|
||||
brep: { spec: { kind: "sphere", center: [cx, cy, 1], r }, origin: { x: cx - r, y: cy - r } },
|
||||
};
|
||||
|
||||
@@ -20,8 +20,8 @@ const base: Project = {
|
||||
{ id: "k1", type: "column", floorId: "eg", categoryCode: "25", position: { x: 20, y: 3 }, profile: { kind: "rect", width: 0.4, depth: 0.4 }, rotation: 0, height: 2.5 },
|
||||
],
|
||||
extrudedSolids: [
|
||||
{ id: "s1", type: "extrudedSolid", levelId: "og", points: [{ x: 30, y: 2 }, { x: 32, y: 2 }, { x: 32, y: 5 }, { x: 30, y: 5 }], height: 1.5, baseOffset: 0.5 },
|
||||
{ id: "v1", type: "extrudedSolid", levelId: "eg", points: [{ x: 40, y: 0 }, { x: 41, y: 0 }, { x: 41, y: 1 }], height: 1, operation: "subtract" },
|
||||
{ id: "s1", type: "extrudedSolid", categoryCode: "20", levelId: "og", points: [{ x: 30, y: 2 }, { x: 32, y: 2 }, { x: 32, y: 5 }, { x: 30, y: 5 }], height: 1.5, baseOffset: 0.5 },
|
||||
{ id: "v1", type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: [{ x: 40, y: 0 }, { x: 41, y: 0 }, { x: 41, y: 1 }], height: 1, operation: "subtract" },
|
||||
],
|
||||
} as Project;
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ async function levelPlan(
|
||||
}
|
||||
if (!raw || raw.primitives.length === 0) return EMPTY;
|
||||
const own = generatePlan(project, level.id, visibleCodes, undefined, detail, false, mono, false, scaleDenominator, forPrint, false, overrideRuleIds);
|
||||
const marks = levelMarksEnabled(level, project) ? levelMarkerPrimitives(project, raw.bounds, raw.primitives) : [];
|
||||
const marks = levelMarksEnabled(level, project, (c) => visibleCodes.has(c)) ? levelMarkerPrimitives(project, raw.bounds, raw.primitives) : [];
|
||||
const b = { ...raw.bounds };
|
||||
const grow = (x: number, y: number) => {
|
||||
b.minX = Math.min(b.minX, x);
|
||||
|
||||
@@ -9,7 +9,7 @@ const sq = (x0: number, y0: number, x1: number, y1: number): Pair[] => [[x0, y0]
|
||||
const area = (r: Pair[]) => Math.abs(r.reduce((s, p, i) => s + p[0] * r[(i + 1) % r.length][1] - r[(i + 1) % r.length][0] * p[1], 0) / 2);
|
||||
|
||||
function withVoid(p: Project, v: Partial<ExtrudedSolid>): Project {
|
||||
const solid: ExtrudedSolid = { id: "void1", type: "extrudedSolid", levelId: p.walls[0].floorId, operation: "subtract", height: 2, points: [], ...v };
|
||||
const solid: ExtrudedSolid = { id: "void1", type: "extrudedSolid", categoryCode: "20", levelId: p.walls[0].floorId, operation: "subtract", height: 2, points: [], ...v };
|
||||
return { ...p, extrudedSolids: [...(p.extrudedSolids ?? []), solid] };
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +346,11 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
case "contextObject":
|
||||
applyChange((p) => patchItem(p, "context", id, { categoryCode: code }));
|
||||
break;
|
||||
default: break; // extrudedSolid/door: keine Kategorie am Element
|
||||
// [180] Körper (Extrusion, B-Rep, Abzugskörper) tragen eine Klasse wie jedes Bauteil.
|
||||
case "extrudedSolid":
|
||||
applyChange((p) => patchItem(p, "extrudedSolids", id, { categoryCode: code }));
|
||||
break;
|
||||
default: break; // door: keine Kategorie am Element
|
||||
}
|
||||
},
|
||||
onSetSelectionLevel: (levelId) => {
|
||||
|
||||
@@ -53,7 +53,7 @@ describe("deriveSelection (Kern)", () => {
|
||||
const p = base();
|
||||
const lvl = p.drawingLevels[0].id;
|
||||
p.extrudedSolids = [
|
||||
{ id: "x", type: "extrudedSolid", levelId: lvl, points: [{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 3 }], height: 2 },
|
||||
{ id: "x", type: "extrudedSolid", categoryCode: "20", levelId: lvl, points: [{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 3 }], height: 2 },
|
||||
];
|
||||
const sel = deriveSelection(p, { solids: ["x"] })!;
|
||||
expect(sel.extrudedSolid!.area).toBeCloseTo(3, 12);
|
||||
|
||||
@@ -343,7 +343,7 @@ describe("commitTransform — ExtrudedSolid mit Kreis-Profil (REGRESSION: circle
|
||||
function circleSolid(id: string): ExtrudedSolid {
|
||||
return {
|
||||
id,
|
||||
type: "extrudedSolid",
|
||||
type: "extrudedSolid", categoryCode: "20",
|
||||
levelId: "eg",
|
||||
points: [{ x: -1, y: 0 }, { x: 0, y: 1 }, { x: 1, y: 0 }, { x: 0, y: -1 }], // grobe Tessellierung
|
||||
height: 2,
|
||||
@@ -499,7 +499,7 @@ describe("transformPreview — Vorschau für alle 2D-Formen (Kern, Plan-Primitiv
|
||||
|
||||
describe("commitTransform — B-Rep-Körper (Spezifikation als transform gewickelt)", () => {
|
||||
const body = {
|
||||
id: "b", type: "extrudedSolid", points: [{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 1 }, { x: 0, y: 1 }], height: 3,
|
||||
id: "b", type: "extrudedSolid", categoryCode: "20", points: [{ x: 0, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 1 }, { x: 0, y: 1 }], height: 3,
|
||||
brep: { spec: { kind: "cuboid", min: [0, 0, 0], max: [2, 1, 3] }, origin: { x: 0, y: 0 } },
|
||||
} as unknown as ExtrudedSolid;
|
||||
const p = { ...project([]), extrudedSolids: [body] } as Project;
|
||||
|
||||
@@ -1138,8 +1138,10 @@ function SectionPlanView({
|
||||
// Automatische Höhenkoten links neben der Zeichnung (abschaltbar je Ebene).
|
||||
const marks = useMemo(
|
||||
() =>
|
||||
rawPlan && levelMarksEnabled(level, project) ? levelMarkerPrimitives(project, rawPlan.bounds, rawPlan.primitives) : [],
|
||||
[rawPlan, level, project],
|
||||
rawPlan && levelMarksEnabled(level, project, (c) => visibleCodes.has(c) && categoryDisplay(c).render)
|
||||
? levelMarkerPrimitives(project, rawPlan.bounds, rawPlan.primitives)
|
||||
: [],
|
||||
[rawPlan, level, project, visibleCodes, categoryDisplay],
|
||||
);
|
||||
const withOverlay = useMemo(() => {
|
||||
if (!rawPlan) return rawPlan;
|
||||
|
||||
Reference in new issue
Block a user