[285] Plakat: Massstab-Vorschlag im Dialog, Situation um die eigene Parzelle, Wohnungsspiegel auf dem Plakat
Massstab: der Dialog bietet den feineren Massstab (finerPresentationScale, nicht unter 1:100) mit Knopf an, statt nur nach dem Anlegen zu melden; kleinste Lösung, Anordnung/Spaltenraster bleibt. Situation: Ausschnitt = Haus ∪ Parzellenring (Baurecht) ± 10 m statt Haus ± 40 m, damit nicht alle Kataster-Parzellen als Kacheln erscheinen; ohne Parzelle Haus ± 30 m. Wohnungsspiegel (unitSchedule) als Plakat-Tabelle, wenn das Projekt Einheiten hat.
This commit is contained in:
10 files changed
+109
-13
No files matched your search
+1
-1
@@ -100,7 +100,7 @@ export { AI_TOOLS, AI_BRIDGE_DEFAULT_PORT, aiText, aiToolDef, hmacHex, randomHex
|
||||
export type { AiToolDef, AiToolResult, AiBridgeMsg } from "./aiToolDefs";
|
||||
export { callAiTool } from "./aiTools";
|
||||
export type { AiHost } from "./aiTools";
|
||||
export { PRESENTATION_SCALES, POSTER_EXTRAS_DEFAULT, POSTER_SITUATION_SCALE, PRESENTATION_DEFAULT_SCALE, levelHasContent, PRESENTATION_TEMPLATE_ID, presentationDefaults, presentationSheetOps, planPresentationSheet, fittingPresentationScale, finerPresentationScale } from "../plan/presentationSheet";
|
||||
export { PRESENTATION_SCALES, POSTER_EXTRAS_DEFAULT, posterExtrasDefault, POSTER_SITUATION_SCALE, PRESENTATION_DEFAULT_SCALE, levelHasContent, PRESENTATION_TEMPLATE_ID, presentationDefaults, presentationSheetOps, planPresentationSheet, fittingPresentationScale, finerPresentationScale } from "../plan/presentationSheet";
|
||||
export type { PresentationOptions, PosterExtras, PosterTableKind, PresentationPlan, PresentationLabels } from "../plan/presentationSheet";
|
||||
export { lineEndsOf, lineEndsCode, lineEndsFromCode, lineEndsSvgAttrs, planLineEndsProps, MITER_LIMIT as LINE_MITER_LIMIT } from "../model/lineEnds";
|
||||
export type { LineEnds } from "../model/lineEnds";
|
||||
|
||||
@@ -4196,9 +4196,13 @@ export const de = {
|
||||
"presentation.extras.areas": "Kennzahlen (SIA 416)",
|
||||
"presentation.extras.siteProof": "Baurecht-Nachweis",
|
||||
"presentation.extras.image": "Rahmen fürs 3D-Bild",
|
||||
"presentation.extras.units": "Wohnungsspiegel",
|
||||
"presentation.situation": "Situation",
|
||||
"presentation.table.areas": "Kennzahlen (SIA 416)",
|
||||
"presentation.table.siteProof": "Baurecht-Nachweis",
|
||||
"presentation.table.units": "Wohnungsspiegel",
|
||||
"presentation.finerSuggest": "Tipp: 1:{finer} passt auch aufs Blatt und füllt es besser als 1:{scale}",
|
||||
"presentation.finerApply": "1:{finer} übernehmen",
|
||||
"presentation.image.placeholder": "3D-Bild hier einsetzen",
|
||||
"presentation.image.hint": "Rendering-Dialog: „Ins Layout einsetzen“, oder Knopf „Bild“ im Blatt",
|
||||
"presentation.axo": "Axonometrie",
|
||||
|
||||
@@ -4182,9 +4182,13 @@ export const en: Record<TranslationKey, string> = {
|
||||
"presentation.extras.areas": "Key figures (SIA 416)",
|
||||
"presentation.extras.siteProof": "Zoning compliance",
|
||||
"presentation.extras.image": "Frame for the 3D image",
|
||||
"presentation.extras.units": "Unit schedule",
|
||||
"presentation.situation": "Site plan",
|
||||
"presentation.table.areas": "Key figures (SIA 416)",
|
||||
"presentation.table.siteProof": "Zoning compliance",
|
||||
"presentation.table.units": "Unit schedule",
|
||||
"presentation.finerSuggest": "Tip: 1:{finer} also fits and fills the sheet better than 1:{scale}",
|
||||
"presentation.finerApply": "Use 1:{finer}",
|
||||
"presentation.image.placeholder": "Insert 3D image here",
|
||||
"presentation.image.hint": "Rendering dialog: \"Insert into layout\", or the \"Image\" button on the sheet",
|
||||
"presentation.axo": "Axonometric",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { generatePlan } from "./generatePlan";
|
||||
import { getState } from "../state/appStore";
|
||||
import { sheetSizeMm } from "../model/layoutModel";
|
||||
import { posterMetrics } from "../model/posterTemplates";
|
||||
import { finerPresentationScale, fittingPresentationScale, POSTER_EXTRAS_DEFAULT, PRESENTATION_TEMPLATE_ID, levelHasContent, planPresentationSheet, presentationDefaults, presentationSheetOps } from "./presentationSheet";
|
||||
import { finerPresentationScale, fittingPresentationScale, POSTER_EXTRAS_DEFAULT, posterExtrasDefault, PRESENTATION_TEMPLATE_ID, levelHasContent, planPresentationSheet, presentationDefaults, presentationSheetOps } from "./presentationSheet";
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
const LABELS = {
|
||||
@@ -17,6 +17,7 @@ const LABELS = {
|
||||
situation: "Situation",
|
||||
tableAreas: "Kennzahlen (SIA 416)",
|
||||
tableSiteProof: "Baurecht-Nachweis",
|
||||
tableUnits: "Wohnungsspiegel",
|
||||
imagePlaceholder: "3D-Bild hier einsetzen",
|
||||
imageHint: "Hinweis",
|
||||
};
|
||||
@@ -467,4 +468,34 @@ describe("[66] Präsentationsplan", () => {
|
||||
expect(finerPresentationScale(p, { ...o, scale: 100 })).toBeNull();
|
||||
expect(finerPresentationScale(p, { ...o, paper: "a4" as const, scale: 50 })).toBeNull();
|
||||
}, 60_000);
|
||||
|
||||
// [285] Plakat: Situation um Baufeld statt alle Kataster-Parzellen, Wohnungsspiegel, Vorschlag 1:100.
|
||||
it("[285] Situation: Ausschnitt um die eigene Parzelle mit Rand, nicht um das ganze Ausmass", () => {
|
||||
st().loadProject(buildWettbewerbSampleProject());
|
||||
const p = st().project;
|
||||
const ring = p.siteRules!.parcel;
|
||||
const w = Math.max(...ring.map((q) => q.x)) - Math.min(...ring.map((q) => q.x));
|
||||
const h = Math.max(...ring.map((q) => q.y)) - Math.min(...ring.map((q) => q.y));
|
||||
const o = { ...presentationDefaults(p), scale: 200, poster: "poster-a1-landscape", extras: POSTER_EXTRAS_DEFAULT };
|
||||
const sit = planPresentationSheet(p, o).items.find((i) => i.kind === "situation")!;
|
||||
// Parzelle ± 10 m bei 1:500 (Papier-mm = Meter × 2) plus Rahmenrand 2 × 4 mm; weiter reicht der Ausschnitt nicht.
|
||||
expect(sit.widthMm).toBeLessThanOrEqual((w + 20) * 2 + 8 + 1e-6);
|
||||
expect(sit.heightMm).toBeLessThanOrEqual((h + 20) * 2 + 8 + 1e-6);
|
||||
}, 60_000);
|
||||
|
||||
it("[285] Wohnungsspiegel kommt aufs Plakat, wenn das Projekt Einheiten hat", () => {
|
||||
st().loadProject(buildWettbewerbSampleProject());
|
||||
const p = st().project;
|
||||
expect(p.units!.length).toBeGreaterThan(0);
|
||||
const ex = posterExtrasDefault(p);
|
||||
expect(ex.tables).toEqual(["areas", "siteProof", "unitSchedule"]);
|
||||
const plan = planPresentationSheet(p, { ...presentationDefaults(p), scale: 200, poster: "poster-a1-landscape", extras: ex });
|
||||
expect(plan.tables!.map((t) => t.id)).toEqual(["areas", "siteProof", "unitSchedule"]);
|
||||
const res = presentationSheetOps(p, { ...presentationDefaults(p), scale: 200, poster: "poster-a1-landscape", extras: ex }, LABELS, "u1")!;
|
||||
st().applyChange(res.ops);
|
||||
const sources = st().project.layouts!.filter((l) => res.layoutIds.includes(l.id)).flatMap((l) => (l.tables ?? []).map((t) => t.source));
|
||||
expect(sources).toEqual(["areas", "siteProof", "unitSchedule"]);
|
||||
// Ohne Einheiten keine Tabelle.
|
||||
expect(posterExtrasDefault({ ...p, units: [] }).tables).toEqual(["areas", "siteProof"]);
|
||||
}, 60_000);
|
||||
});
|
||||
@@ -61,7 +61,7 @@ export interface PresentationOptions {
|
||||
}
|
||||
|
||||
/** Kennzahlen (SIA 416) und Baurecht-Nachweis als Blatt-Tabellen. */
|
||||
export type PosterTableKind = "areas" | "siteProof";
|
||||
export type PosterTableKind = "areas" | "siteProof" | "unitSchedule";
|
||||
|
||||
export interface PosterExtras {
|
||||
/** Situationsplan 1:500 (Vorlage „Situation WBW“, Nordpfeil und Massstabsbalken aus der Modelldarstellung). */
|
||||
@@ -73,6 +73,10 @@ export interface PosterExtras {
|
||||
|
||||
/** Vorgabe beim Wählen einer Plakat-Vorlage: alles, was zu einer Wettbewerbs-Abgabe gehört. */
|
||||
export const POSTER_EXTRAS_DEFAULT: PosterExtras = { situation: true, tables: ["areas", "siteProof"], image: true };
|
||||
/** [285] Vorgabe je Projekt: mit Einheiten (Wohnungen) gehört der Wohnungsspiegel zum Plakat. */
|
||||
export function posterExtrasDefault(project: Project): PosterExtras {
|
||||
return (project.units ?? []).length > 0 ? { ...POSTER_EXTRAS_DEFAULT, tables: [...POSTER_EXTRAS_DEFAULT.tables, "unitSchedule"] } : { ...POSTER_EXTRAS_DEFAULT };
|
||||
}
|
||||
/** Massstab der Situation auf dem Plakat. */
|
||||
export const POSTER_SITUATION_SCALE = 500;
|
||||
/** Id der Standard-Ansichtsvorlage „Situation WBW 1:500“ und ihrer Modelldarstellung (`standards.rs`). */
|
||||
@@ -146,6 +150,8 @@ export interface PresentationLabels {
|
||||
situation?: string;
|
||||
tableAreas?: string;
|
||||
tableSiteProof?: string;
|
||||
/** [285] Titel des Wohnungsspiegels. */
|
||||
tableUnits?: string;
|
||||
imagePlaceholder?: string;
|
||||
imageHint?: string;
|
||||
/** [266] Name des 3D-Dokuments (Axonometrie) im Bild-Rahmen. */
|
||||
@@ -673,7 +679,7 @@ export function presentationSheetOps(
|
||||
const fontPt = posterTextMetrics(size).tablePt;
|
||||
for (const tb of plan.tables ?? []) {
|
||||
const lvl = sheetLevels[tb.page].id;
|
||||
const title = tb.id === "areas" ? labels.tableAreas : labels.tableSiteProof;
|
||||
const title = tb.id === "areas" ? labels.tableAreas : tb.id === "unitSchedule" ? labels.tableUnits : labels.tableSiteProof;
|
||||
if (title) drawings.push(sheetText(`d-pres-${stamp}-tt-${tb.id}`, lvl, cat, tb.xMm, tb.yMm + labelM.sizeMm * 1.1, title, labelM.sizeMm, true));
|
||||
tables[tb.page].push({
|
||||
id: `tbl-pres-${stamp}-${tb.id}`,
|
||||
|
||||
@@ -12,7 +12,7 @@ export function createPresentationSheet(o: PresentationOptions): string | null {
|
||||
const res = presentationSheetOps(
|
||||
st.project,
|
||||
o,
|
||||
{ sheetName: t("presentation.sheetName"), masterName: t("presentation.masterName", { format }), north: t("presentation.north"), northGroup: t("presentation.northGroup"), scaleBarGroup: t("presentation.scaleBarGroup"), situation: t("presentation.situation"), tableAreas: t("presentation.table.areas"), tableSiteProof: t("presentation.table.siteProof"), imagePlaceholder: t("presentation.image.placeholder"), imageHint: t("presentation.image.hint"), axo: t("presentation.axo") },
|
||||
{ sheetName: t("presentation.sheetName"), masterName: t("presentation.masterName", { format }), north: t("presentation.north"), northGroup: t("presentation.northGroup"), scaleBarGroup: t("presentation.scaleBarGroup"), situation: t("presentation.situation"), tableAreas: t("presentation.table.areas"), tableSiteProof: t("presentation.table.siteProof"), tableUnits: t("presentation.table.units"), imagePlaceholder: t("presentation.image.placeholder"), imageHint: t("presentation.image.hint"), axo: t("presentation.axo") },
|
||||
String(Date.now()),
|
||||
);
|
||||
if (!res) {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// Layouts-Panel ihn öffnen. Beim Bestätigen entsteht das Blatt in EINEM Undo-Schritt
|
||||
// (`state/presentationSheet.ts`); `onCreated` öffnet es. Overlay wie `LayoutCreateDialogs` (kein window.prompt).
|
||||
|
||||
import { memo, useCallback, useEffect, useState } from "react";
|
||||
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { enterConfirmsDialog, useModalFocus } from "./modalFocus";
|
||||
import { POSTER_EXTRAS_DEFAULT, PRESENTATION_SCALES, levelHasContent, presentationDefaults, type PosterTableKind, type PresentationOptions } from "../core";
|
||||
import { finerPresentationScale, posterExtrasDefault, PRESENTATION_SCALES, levelHasContent, presentationDefaults, type PosterTableKind, type PresentationOptions } from "../core";
|
||||
import type { LayoutOrientation, LayoutPaperFormat } from "../model/types";
|
||||
import { PAPER_FORMAT_GROUPS } from "../model/layoutModel";
|
||||
import { POSTER_TEMPLATES, posterTemplateLabel } from "../model/posterTemplates";
|
||||
@@ -52,6 +52,15 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [opts, close, confirm]);
|
||||
|
||||
// [285] Passt ein feinerer Massstab (≥ 1:100) auch aufs Blatt, wird er angeboten: sonst bleibt das Blatt eines kleinen Hauses halb leer.
|
||||
const finer = useMemo(() => {
|
||||
if (!opts?.scale || (opts.floors.length === 0 && opts.elevationIds.length === 0 && opts.sectionIds.length === 0)) return null;
|
||||
try {
|
||||
return finerPresentationScale(project, opts);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}, [project, opts]);
|
||||
if (!opts) return null;
|
||||
const floors = drawingLevels.filter((l) => l.kind === "floor" && !l.layoutId);
|
||||
const sections = drawingLevels.filter((l) => l.kind === "section");
|
||||
@@ -65,7 +74,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
const toggleSection = (id: string, on: boolean) =>
|
||||
set({ sectionIds: sections.map((x) => x.id).filter((x) => (x === id ? on : opts.sectionIds.includes(x))) });
|
||||
const toggleTable = (kind: PosterTableKind, on: boolean): PosterTableKind[] =>
|
||||
(["areas", "siteProof"] as const).filter((k) => (k === kind ? on : (opts.extras?.tables ?? []).includes(k)));
|
||||
(["areas", "siteProof", "unitSchedule"] as const).filter((k) => (k === kind ? on : (opts.extras?.tables ?? []).includes(k)));
|
||||
const empty = opts.floors.length === 0 && opts.elevationIds.length === 0 && opts.sectionIds.length === 0;
|
||||
// [224] Massstab je Viewport: "" = gemeinsamer Massstab.
|
||||
const scaleOf = (id: string) => String(opts.scales?.[id] ?? "");
|
||||
@@ -158,7 +167,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
data-testid="presentation-target"
|
||||
aria-label={t("presentation.sheet")}
|
||||
value={opts.poster ?? ""}
|
||||
onChange={(e) => set({ poster: e.target.value || undefined, extras: e.target.value ? (opts.extras ?? POSTER_EXTRAS_DEFAULT) : undefined })}
|
||||
onChange={(e) => set({ poster: e.target.value || undefined, extras: e.target.value ? (opts.extras ?? posterExtrasDefault(project)) : undefined })}
|
||||
>
|
||||
<option value="">{t("presentation.target.sheet")}</option>
|
||||
{POSTER_TEMPLATES.map((tpl) => (
|
||||
@@ -180,6 +189,14 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
{finer && (
|
||||
<div style={{ display: "flex", gap: 8, alignItems: "center", marginBottom: 6, fontSize: 12 }} data-testid="presentation-finer">
|
||||
<span>{t("presentation.finerSuggest", { scale: opts.scale!, finer })}</span>
|
||||
<button type="button" className="imp-btn" data-testid="presentation-finer-apply" onClick={() => set({ scale: finer })}>
|
||||
{t("presentation.finerApply", { finer })}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<div style={{ display: "flex", gap: 8, alignItems: "center", opacity: poster ? 0.5 : 1 }}>
|
||||
<select
|
||||
className="imp-select"
|
||||
@@ -218,6 +235,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
["situation", t("presentation.extras.situation"), opts.extras.situation, (on: boolean) => ({ situation: on })],
|
||||
["areas", t("presentation.extras.areas"), opts.extras.tables.includes("areas"), (on: boolean) => ({ tables: toggleTable("areas", on) })],
|
||||
["siteProof", t("presentation.extras.siteProof"), opts.extras.tables.includes("siteProof"), (on: boolean) => ({ tables: toggleTable("siteProof", on) })],
|
||||
...((project.units ?? []).length > 0 ? ([["unitSchedule", t("presentation.extras.units"), opts.extras.tables.includes("unitSchedule"), (on: boolean) => ({ tables: toggleTable("unitSchedule", on) })]] as const) : []),
|
||||
["image", t("presentation.extras.image"), opts.extras.image, (on: boolean) => ({ image: on })],
|
||||
] as const
|
||||
).map(([key, label, on, patch]) => (
|
||||
|
||||
Reference in new issue
Block a user