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

+19
View File
@@ -20,6 +20,7 @@
// 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]
// --snapshot <Name|id> übernimmt Geschoss, Massstab, Vorlage und Sichtbarkeit eines Ausschnitts [207]
// 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 [--no-mtl]|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]
@@ -817,6 +818,24 @@ async function execute(project: Project, file: string, command: string, rest: st
};
collectCodes(project.layers);
// [207] `--snapshot <Name|id>` (plan/section/elevation): Geschoss, Massstab, verknüpfte Ansichtsvorlage und Sichtbarkeit eines
// Ausschnitts (`viewSnapshots`) übernehmen, z. B. `plan --snapshot "Situation 1:500" --hatch`. Ausdrückliche Flags gehen vor.
const snapName = args.flags.get("snapshot");
if (snapName && (command === "plan" || command === "section" || command === "elevation")) {
const n = snapName.toLowerCase();
const snap = (project.viewSnapshots ?? []).find((s) => s.id.toLowerCase() === n || s.name.toLowerCase() === n);
if (!snap) fail(`Ausschnitt nicht gefunden: ${snapName}`);
const level = project.drawingLevels.find((l) => l.id === snap.activeLevelId);
if (!level) fail(`Ausschnitt ${snap.name}: Ebene ${snap.activeLevelId} fehlt`);
const f = args.flags;
if (!f.has("level")) f.set("level", level.id);
if (!f.has("scale")) f.set("scale", String(snap.scaleDenominator));
if (!f.has("template") && snap.templateId && snap.templateLinked) f.set("template", snap.templateId);
const hidden = [...allCodes].filter((c) => snap.layerVisibility[c] === false || !(c in snap.layerVisibility));
if (!f.has("hide") && hidden.length) f.set("hide", hidden.join(","));
if (command !== "plan") rest = [rest[0] ?? level.id];
}
switch (command) {
case "info": {
const levels = project.drawingLevels.map((l) => `${l.kind}:${l.name}`);
+1 -1
View File
@@ -38,5 +38,5 @@ describe("[66] Befehl praesentation", () => {
expect(q.layouts?.some((l) => l.id === id)).toBe(false);
expect(q.drawingLevels.some((l) => l.sketch)).toBe(false);
expect(q.drawingLevels.length).toBe(before.drawingLevels.length);
});
}, 60_000);
});
+6
View File
@@ -1357,6 +1357,12 @@ export const de = {
"resources.modelViews.opt.roomStamps.divider": "Trennlinie",
"resources.modelViews.opt.dimensions.chains": "Ketten der Aussenbemassung",
"resources.modelViews.opt.dimensions.levelMarks": "Höhenkoten",
"resources.modelViews.section.situation": "Situationsplan / Schwarzplan",
"resources.modelViews.opt.situation.own": "Eigenes Gebäude (Umriss über alle Geschosse)",
"resources.modelViews.opt.situation.context": "Kontextgebäude (Grundfläche)",
"resources.modelViews.opt.situation.symbols": "Nordpfeil und Massstabsbalken",
"resources.modelViews.val.black": "schwarz",
"resources.modelViews.val.grey": "grau",
"resources.modelViews.opt.stairs.stepNumbers": "Stufennummern",
"resources.modelViews.val.outer": "ohne Öffnungen",
"resources.modelViews.val.total": "nur Gesamtmass",
+6
View File
@@ -1351,6 +1351,12 @@ export const en: Record<TranslationKey, string> = {
"resources.modelViews.opt.roomStamps.divider": "Divider line",
"resources.modelViews.opt.dimensions.chains": "Exterior dimension chains",
"resources.modelViews.opt.dimensions.levelMarks": "Level marks",
"resources.modelViews.section.situation": "Site plan / figure-ground plan",
"resources.modelViews.opt.situation.own": "Own building (outline over all floors)",
"resources.modelViews.opt.situation.context": "Context buildings (footprint)",
"resources.modelViews.opt.situation.symbols": "North arrow and scale bar",
"resources.modelViews.val.black": "black",
"resources.modelViews.val.grey": "grey",
"resources.modelViews.opt.stairs.stepNumbers": "Step numbers",
"resources.modelViews.val.outer": "without openings",
"resources.modelViews.val.total": "overall only",
+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";
@@ -1,12 +1,12 @@
viewBox -4.2 0 37.045 18.478
bytes 207135
viewBox -25.5 0 81 18.478
bytes 209902
circle 4
g 1
line 495
line 503
path 3
polygon 998
polyline 179
polygon 1031
polyline 184
rect 1
svg 1
text 4
hash 7dd0774a2af69fe3
hash d3224b3989291365
+5 -3
View File
@@ -1,5 +1,5 @@
meshes [1962]
meshes[].color [3] x1962
meshes [1963]
meshes[].color [3] x1963
meshes[].indices [108] x6
meshes[].indices [1152]
meshes[].indices [1248] x3
@@ -9,6 +9,7 @@ meshes[].indices [154014]
meshes[].indices [1584]
meshes[].indices [1716]
meshes[].indices [180]
meshes[].indices [204]
meshes[].indices [2376]
meshes[].indices [31104]
meshes[].indices [348] x6
@@ -25,6 +26,7 @@ meshes[].positions [1044] x6
meshes[].positions [108] x30
meshes[].positions [1188]
meshes[].positions [120]
meshes[].positions [132]
meshes[].positions [16428]
meshes[].positions [180] x9
meshes[].positions [1890] x3
@@ -73,4 +75,4 @@ walls[].start [2] x1273
walls[].startCut [4] x873
walls[].topDrop [2] x115
walls[].topPlane [3] x271
hash 5af7a0a70a5b3624
hash 32750c509c57a271
@@ -0,0 +1,11 @@
viewBox -41.5 0 95 63.6
bytes 3579
g 1
line 3
path 1
polygon 10
polyline 2
rect 1
svg 1
text 8
hash c546873f54a3e7ff
@@ -0,0 +1,11 @@
viewBox -41.5 0 95 63.6
bytes 3579
g 1
line 3
path 1
polygon 10
polyline 2
rect 1
svg 1
text 8
hash c546873f54a3e7ff
+13 -1
View File
@@ -5,7 +5,7 @@
// und den Diff der Dateien im Commit ansehen. Zahlen sind gerundet (Plan 1e-3 m, 3D 1e-4 m).
import { describe, expect, it } from "vitest";
import { createHash } from "node:crypto";
import { computeSection, generateElevationPlan, generatePlan, generateSectionPlan, planToSvgString, projectToModel3d } from "../core";
import { computeSection, generateElevationPlan, generatePlan, generateSectionPlan, planToSvgString, projectToModel3d, projectWithTemplate } from "../core";
import { sampleProject } from "../model/sampleProject";
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
import type { Project } from "../model/types";
@@ -77,6 +77,18 @@ for (const [name, make] of projects) {
}
}
// [207] Situationsplan 1:500 (Ansichtsvorlage „Situation WBW") und Schwarzplan.
for (const [id, file] of [["std-vt-situation-wbw", "situation"], ["std-vt-schwarzplan", "schwarzplan"]]) {
it(`${file} 1:500`, async () => {
const tpl = p.viewTemplates?.find((t) => t.id === id);
if (!tpl) return;
const tp = projectWithTemplate(p, "eg", tpl);
const show = new Set([...codes].filter((c) => tpl.layerVisibility?.[c] !== false));
const svg = planToSvgString(generatePlan(tp, "eg", show, undefined, tpl.detail ?? "grob", false, true, true, 500), { scaleDenominator: 500 });
await expect(svgDigest(svg)).toMatchFileSnapshot(`__golden__/${name}-${file}-500.txt`);
});
}
it("Schnitt", async () => {
const sec = p.drawingLevels.find((l) => l.kind === "section");
if (!sec) return;
+2 -1
View File
@@ -78,7 +78,8 @@ describe("[66] Präsentationsplan", () => {
st().undo();
expect((st().project.layouts ?? []).length).toBe(layoutsBefore);
expect(st().project.viewSnapshots?.some((s) => s.id.startsWith("vs-pres-"))).toBe(false);
});
// [207] 60 s: mit den Nachbargebäuden des Musterhauses rechnet das Blatt im Container knapp über die 30 s des Standards.
}, 60_000);
it("gewählte Geschosse, ohne Ansichten/Schnitt, Skizze an, A3: kleinerer Massstab", () => {
const floors = project.drawingLevels.filter((l) => l.kind === "floor" && !l.layoutId).slice(0, 2).map((l) => l.id);
+1 -1
View File
@@ -136,7 +136,7 @@ describe("modelViews", () => {
it("[173] Etappe 3: Vorlagen aus den Standards übernehmen; wirken auf Raumstempel und Treppe", () => {
const lib = standardModelViews(sampleProject);
expect(lib.map((m) => m.id)).toEqual(["std-mv-wettbewerb-200", "std-mv-baueingabe-100", "std-mv-ausfuehrung-50", "std-mv-rohbau"]);
expect(lib.map((m) => m.id)).toEqual(["std-mv-wettbewerb-200", "std-mv-baueingabe-100", "std-mv-ausfuehrung-50", "std-mv-situation-wbw", "std-mv-schwarzplan", "std-mv-rohbau"]);
let p = applyOps(sampleProject, adoptModelViewOps(sampleProject, lib[2]!));
expect(p.modelViewOptions?.map((m) => m.id)).toEqual(["std-mv-ausfuehrung-50"]);
expect(adoptModelViewOps(p, lib[2]!)).toEqual([]);
+6 -1
View File
@@ -34,7 +34,8 @@ export type ModelViewSection =
| "site"
| "sectionMarks"
| "roomStamps"
| "dimensions";
| "dimensions"
| "situation";
/** Ein Eintrag der Auswahl (Werkzeugleiste, Vorlage): eingebaute Stufen zuerst, dann die eigenen. */
export interface ModelViewChoice {
@@ -216,6 +217,10 @@ export const MODEL_VIEW_FIELDS: readonly ModelViewField[] = [
{ section: "roomStamps", key: "divider", values: "bool" },
{ section: "dimensions", key: "chains", values: ["all", "outer", "total"] },
{ section: "dimensions", key: "levelMarks", values: "bool" },
// [207] Situationsplan/Schwarzplan: Füllung des eigenen Gebäudes und der Kontextgebäude, Nordpfeil + Massstabsbalken.
{ section: "situation", key: "own", values: ["black", "grey", "off"] },
{ section: "situation", key: "context", values: ["black", "grey", "off"] },
{ section: "situation", key: "symbols", values: "bool" },
];
/** Auswahlwert eines Feldes als Text (`""` = wie Basis); Gegenstück: {@link parseFieldValue}. */
+1 -1
View File
@@ -35,7 +35,7 @@ export interface ModelViewHandlers {
onSetModelViewOption?: (id: string, section: ModelViewSection, key: string, value: string | number | boolean | null) => void;
}
const SECTIONS: ModelViewSection[] = ["doors", "windows", "stairs", "walls", "slabs", "roofs", "columns", "elevation", "site", "sectionMarks", "roomStamps", "dimensions"];
const SECTIONS: ModelViewSection[] = ["doors", "windows", "stairs", "walls", "slabs", "roofs", "columns", "elevation", "site", "sectionMarks", "roomStamps", "dimensions", "situation"];
/** Anzeige eines Auswahlwerts (Zahlen mit Einheit, Rest übersetzt). */
function valueLabel(f: ModelViewField, v: string | number): string {