Merge [207] Situation/Schwarzplan 1:500

This commit is contained in:
Claude committed 2026-11-12 19:46:59 +00:00
commit d4e7597000
32 files changed
+812 -38

No files matched your search

+6 -1
View File
@@ -18,7 +18,12 @@ export const SECTION_MARK_CATEGORY = "91";
/** Kameras ([213]): Symbol mit Sichtkegel im Grundriss. */
export const CAMERA_CATEGORY = "92";
export const DERIVED_CATEGORY_CODES: readonly string[] = [SHADOW_CATEGORY, AUTO_DIM_CATEGORY, LEVEL_MARK_CATEGORY, SECTION_MARK_CATEGORY, CAMERA_CATEGORY];
/** [207] Eigenes Gebäude im Situationsplan/Schwarzplan (gefüllter Umriss über alle Geschosse). */
export const SITUATION_CATEGORY = "83";
/** [207] Planzeichen des Situationsplans: Nordpfeil und Massstabsbalken. */
export const SYMBOL_CATEGORY = "84";
export const DERIVED_CATEGORY_CODES: readonly string[] = [SHADOW_CATEGORY, AUTO_DIM_CATEGORY, LEVEL_MARK_CATEGORY, SECTION_MARK_CATEGORY, CAMERA_CATEGORY, SITUATION_CATEGORY, SYMBOL_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 {
+3
View File
@@ -417,6 +417,9 @@ export const sampleProject: Project = {
{ 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: "92", name: "Kameras", color: "#1a1a1a", lw: 0.18, visible: true, locked: false },
// [207] Situationsplan/Schwarzplan: eigenes Gebäude als gefüllter Umriss, Nordpfeil und Massstabsbalken.
{ code: "83", name: "Situation Gebäude", color: "#000000", lw: 0.13, visible: true, locked: false },
{ code: "84", name: "Planzeichen", color: "#000000", 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).
@@ -0,0 +1,51 @@
// [207] Musterhaus komplex: Ausschnitt „Situation 1:500" nutzt die Ansichtsvorlage „Situation WBW"; Situationsplan
// mit schwarzem eigenem Gebäude, grauen Nachbarn, Planzeichen und Klassen.
import { describe, expect, it } from "vitest";
import { generatePlan, planToSvgString, projectWithTemplate } from "../core";
import { buildComplexSampleProject } from "./sampleProjectComplex";
const p = buildComplexSampleProject();
const snap = p.viewSnapshots?.find((s) => s.id === "vs-situation");
const tpl = p.viewTemplates?.find((t) => t.id === "std-vt-situation-wbw");
type Plan = ReturnType<typeof generatePlan>;
type Poly = { kind: "polygon"; fill: string; wallId?: string; contextObjectId?: string; strokeWidthMm: number };
function planOf(hide: string[] = []): Plan {
const tp = projectWithTemplate(p, "eg", tpl!);
const show = new Set(Object.entries(snap!.layerVisibility).filter(([c, v]) => v && !hide.includes(c)).map(([c]) => c));
return generatePlan(tp, "eg", show, undefined, "grob", false, true, true, 500);
}
const polys = (pl: Plan): Poly[] => pl.primitives.filter((q) => q.kind === "polygon") as unknown as Poly[];
const isCtx = (q: Poly) => q.contextObjectId === "nachbarn";
const isOwn = (q: Poly) => q.fill === "#000000" && !q.contextObjectId && q.strokeWidthMm < 0.12; // Umriss 0.1 mm (nach Massstab skaliert), Planzeichen 0.18 mm
describe("Situation 1:500 im Musterhaus komplex", () => {
it("Ausschnitt ist an die Vorlage gebunden, Klassen der Vorlage sind aus", () => {
expect(snap?.templateId).toBe("std-vt-situation-wbw");
expect(snap?.templateLinked).toBe(true);
expect(tpl?.modelViewOptionId).toBe("std-mv-situation-wbw");
for (const [code, v] of Object.entries(tpl?.layerVisibility ?? {})) expect(snap?.layerVisibility[code], code).toBe(v);
});
it("eigenes Gebäude schwarz, Nachbarn grau, keine Bauteile", () => {
const ps = polys(planOf());
expect(ps.some((q) => q.wallId)).toBe(false);
expect(ps.filter(isOwn).length).toBeGreaterThanOrEqual(1);
expect(ps.filter((q) => isCtx(q) && q.fill === "#b8b8b8").length).toBe(5);
});
it("Klassen: Nachbarn (12), eigenes Gebäude (83), Planzeichen (84) schaltbar", () => {
expect(polys(planOf(["12"])).filter(isCtx).length).toBe(0);
expect(polys(planOf(["83"])).filter(isOwn).length).toBe(0);
const hasN = (pl: Plan) => pl.primitives.some((q) => q.kind === "drawingText" && (q as unknown as { text: string }).text === "N");
expect(hasN(planOf())).toBe(true);
expect(hasN(planOf(["84"]))).toBe(false);
});
it("SVG enthält schwarze und graue Flächen", () => {
const svg = planToSvgString(planOf(), { scaleDenominator: 500 });
expect(svg).toContain('fill="#000000"');
expect(svg).toContain('fill="#b8b8b8"');
});
});
+1 -1
View File
@@ -43,7 +43,7 @@ describe("Musterhaus komplex", () => {
expect(p.rooms!.length).toBeGreaterThanOrEqual(20);
expect(p.roofs!.some((r) => (r.dormers ?? []).length === 2)).toBe(true);
expect(p.stairs!.map((s) => s.shape).sort()).toEqual(["L", "spiral", "straight"]);
expect(p.context!.map((c) => c.type).sort()).toEqual(["contourSet", "excavation", "terrainMesh"]);
expect(p.context!.map((c) => c.type).sort()).toEqual(["contourSet", "excavation", "importedMesh", "terrainMesh"]);
expect(p.extrudedSolids!.filter((s) => s.brep).length).toBe(2);
expect(p.drawings2d.filter((d) => d.geom.shape === "dimension").length).toBeGreaterThan(8);
const frameKinds = new Set(p.doorTypes!.map((d) => d.frameKind ?? d.kind));
+35 -8
View File
@@ -16,6 +16,7 @@
import type {
CeilingType,
ContextObject,
Drawing2D,
Drawing2DGeom,
DoorType,
@@ -35,6 +36,7 @@ import type {
} from "./types";
import { sampleProject } from "./sampleProject";
import { withStandards } from "./standards";
import { buildingsToMesh, type GeoFeature } from "../io/geoContext";
import { applyOps, type CoreOp } from "../core/ops";
import { withDocument } from "../core/document";
@@ -527,6 +529,26 @@ const isMainContour = (z: number) => Math.abs((z + 2.7) * 2 - Math.round((z + 2.
// Parzelle (Kataster) mit Nachbarparzellen; Grenzabstände je Kante, Baulinie an der Strasse (Nord).
const PARCEL = [P(-14, -12), P(28, -13), P(29, 23), P(-15, 24)];
/**
* [207] Nachbargebäude (Kataster/swisstopo-Stil): ein Volumen-Netz auf der Klasse „12 Gebäude" ([181]), im Situationsplan
* grau (Schwarzplan: schwarz). Westen (Kat.-Nr. 2416, L-Form), Osten (2418, zwei Häuser), Norden jenseits des Musterwegs (nach Süden bleibt der Schnitt A-A ohne Fernkörper).
*/
function neighbours(): ContextObject {
const b = (pts: Vec2[], height: number): GeoFeature => ({ category: "building", pts, closed: true, height });
const mesh = buildingsToMesh(
[
b([P(-34, 0), P(-22, 0), P(-22, 9), P(-27, 9), P(-27, 14), P(-34, 14)], 7.5),
b([P(36, -6), P(46, -6), P(46, 4), P(36, 4)], 6.5),
b([P(36, 9), P(44, 9), P(44, 16), P(36, 16)], 6.5),
b([P(-8, 35), P(16, 35), P(16, 43), P(-8, 43)], 11),
b([P(22, 34), P(40, 34), P(40, 40), P(22, 40)], 9),
],
"Kataster (fiktiv)",
);
if (!mesh) throw new Error("Musterhaus komplex: Nachbargebäude nicht erzeugt");
return { ...mesh, id: "nachbarn", name: "Nachbargebäude" };
}
function cadastre(): Drawing2D[] {
const d: Drawing2D[] = [];
const add = (id: string, geom: Drawing2DGeom, extra: Partial<Drawing2D> = {}) =>
@@ -695,7 +717,10 @@ function addRooms(p: Project): Project {
/** Sichtbarkeit je Kategorie: Ausschnitte listen jede sichtbare Kategorie ausdrücklich (fehlt = aus). */
const codesOf = (ls: LayerCategory[]): string[] => ls.flatMap((l) => [l.code, ...codesOf(l.children ?? [])]);
const vis = (hidden: string[] = []): Record<string, boolean> => Object.fromEntries(codesOf(LAYERS).map((c) => [c, !hidden.includes(c)]));
const ALL = vis();
/** [207] Schnitte und Ansichten ohne die Nachbargebäude (Klasse „12 Gebäude"): sie weiten sonst den Ausschnitt weit über das Haus. */
const NO_NEIGHBOURS = vis(["12"]);
/** [207] Klassen, die die Ansichtsvorlage „Situation WBW" ausblendet (`standards.rs::SITUATION_HIDDEN`; Test `sampleProjectComplex.situation.test.ts`). */
const SITUATION_HIDDEN = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "99"];
const LEVEL_VIS: Record<string, boolean> = Object.fromEntries(LEVELS.map((l) => [l.id, true]));
/** Grundrisse auf Blättern: ohne Kataster, Strasse, Höhenlinien und Gelände. */
const PLAN_VIS = vis(["01", "02", "10", "11", "13", "14"]);
@@ -729,14 +754,15 @@ function views(): Pick<Project, "viewTemplates" | "viewSnapshots" | "viewSnapsho
snap("vs-og", "OG 1:100", "og", 100, P(7.5, 6), { folderId: "vf-gr", templateId: "vt-gr100", templateLinked: true }),
snap("vs-dg", "DG 1:100", "dg", 100, P(7.5, 5), { folderId: "vf-gr", templateId: "vt-gr100", templateLinked: true }),
snap("vs-eg50", "EG 1:50 Ausschnitt Wohnen", "eg", 50, P(10, 3.5), { folderId: "vf-gr", templateId: "vt-gr50", templateLinked: true }),
snap("vs-situation", "Situation 1:500", "eg", 500, P(7, 5), { folderId: "vf-gr", detail: "grob", layerVisibility: ALL }),
// [207] Situationsplan: Ansichtsvorlage „Situation WBW 1:500" (Standard-Ressource, Modelldarstellung „Situation WBW").
snap("vs-situation", "Situation 1:500", "eg", 500, P(7, 5), { folderId: "vf-gr", detail: "grob", templateId: "std-vt-situation-wbw", templateLinked: true, layerVisibility: vis(SITUATION_HIDDEN) }),
snap("vs-brand", "EG Brandschutz", "eg", 100, P(7.5, 6), { folderId: "vf-gr", templateId: "vt-brand", templateLinked: true, enabledOverrideRuleIds: ["or-brand"] }),
snap("vs-schnitt-a", "Schnitt A-A", "schnitt-a", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: ALL }),
snap("vs-schnitt-b", "Schnitt B-B", "schnitt-b", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: ALL }),
snap("vs-ansicht-s", "Ansicht Süd", "ansicht-sued", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: ALL }),
snap("vs-ansicht-o", "Ansicht Ost", "ansicht-ost", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: ALL }),
snap("vs-ansicht-n", "Ansicht Nord", "ansicht-nord", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: ALL }),
snap("vs-ansicht-w", "Ansicht West", "ansicht-west", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: ALL }),
snap("vs-schnitt-a", "Schnitt A-A", "schnitt-a", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: NO_NEIGHBOURS }),
snap("vs-schnitt-b", "Schnitt B-B", "schnitt-b", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: NO_NEIGHBOURS }),
snap("vs-ansicht-s", "Ansicht Süd", "ansicht-sued", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: NO_NEIGHBOURS }),
snap("vs-ansicht-o", "Ansicht Ost", "ansicht-ost", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: NO_NEIGHBOURS }),
snap("vs-ansicht-n", "Ansicht Nord", "ansicht-nord", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: NO_NEIGHBOURS }),
snap("vs-ansicht-w", "Ansicht West", "ansicht-west", 100, P(6, 3.3), { folderId: "vf-sa", layerVisibility: NO_NEIGHBOURS }),
snap("vs-detail", "Detail Deckenauflager 1:10", "detail-traufe", 10, P(DETAIL_X + 0.4, 1.0), { folderId: "vf-sa", detail: "fein", layerVisibility: HIDE_SITE }),
snap("vs-3d", "Axonometrie Südost", "eg", 100, P(7.5, 5), { folderId: "vf-3d", viewType: "perspektive", view3d: "isoFrontLeft", fov: 45 }),
],
@@ -832,6 +858,7 @@ export function buildComplexSampleProject(): Project {
extrudedSolids,
drawings2d: [...cadastre(), ...annotations()],
context: [
neighbours(),
{
type: "contourSet", id: "hoehenlinien", name: "Höhenlinien (Vermessung)", categoryCode: "14", source: "Vermessung (fiktiv)",
contours: CONTOUR_Z.map((z) => ({ z, pts: contourAt(z), closed: false, layer: isMainContour(z) ? "HL-Haupt" : "HL" })),
+1 -1
View File
@@ -36,7 +36,7 @@ describe("Standard-Bibliothek ([100]–[102])", () => {
expect(c.lineStyles).toBeGreaterThan(5);
expect(c.wallTypes + c.ceilingTypes + c.roofTypes).toBe(5);
expect(c.overrideRules).toBe(2);
expect(c.modelViewOptions).toBe(4);
expect(c.modelViewOptions).toBe(6);
expect(standardsMergeCounts(standardsMergeOps(withStandards(empty)))).toEqual({ lineStyles: 0, hatches: 0, components: 0, wallTypes: 0, ceilingTypes: 0, roofTypes: 0, viewTemplates: 0, blockDefs: 0, overrideRules: 0, modelViewOptions: 0 });
});
+25
View File
@@ -2189,6 +2189,11 @@ export type ModelViewOption = {
roomStamps?: ModelViewRoomStamps;
/** [173] Bemassung: Massketten der automatischen Aussenbemassung, Höhenkoten. */
dimensions?: ModelViewDimensions;
/**
* [207] Situationsplan / Schwarzplan: fehlt ⇒ gewöhnlicher Grundriss; vorhanden ⇒ statt der Bauteile das
* eigene Gebäude als gefüllter Umriss, die Kontextgebäude gefüllt, dazu Nordpfeil und Massstabsbalken.
*/
situation?: ModelViewSituation;
};
/** [173] Dächer in der Modelldarstellung (fehlt ⇒ wie Basis). */
@@ -2233,6 +2238,23 @@ export type ModelViewSite = {
terrain?: boolean;
};
/**
* [207] Situationsplan in der Modelldarstellung (≙ Schwarzplan): jede Option fehlt ⇒ Standard des
* Situationsplans (eigenes Gebäude schwarz, Kontext grau, mit Planzeichen).
*/
export type ModelViewSituation = {
/**
* Eigenes Gebäude: Umriss über alle Geschosse über Terrain und die Dächer, gefüllt (Basis: schwarz).
*/
own?: SituationFill;
/**
* Kontextgebäude (importierte Netze, Grundfläche aus der Aufsicht), gefüllt (Basis: grau; „Schwarzplan": schwarz).
*/
context?: SituationFill;
/** Nordpfeil und Massstabsbalken zeichnen (Basis: ja). */
symbols?: boolean;
};
/** [173] Decken und Böden in der Modelldarstellung. */
export type ModelViewSlabs = {
/** Bodenbelag-Muster im Grundriss (die Ebene geht vor; Basis: automatisch). */
@@ -3496,6 +3518,9 @@ export type SiteRules = {
profileHeight?: number;
};
/** [207] Füllung eines Gebäudes im Situationsplan. */
export type SituationFill = "black" | "grey" | "off";
/** Terminierungs-Regel einer Wand am Deckenanschluss (siehe {@link Wall.sliceTermination}). */
export type SliceTermination = "both" | "below" | "above";