[271] Umbaufilter: Status Bestand/Abbruch/Neu mit Etappen, Filter wie Archicad in Grundriss, Schnitt, Ansicht, Axo, 3D, Kennzahlen, DXF und IFC
Modell (Rust, gen:types): `renovation: {status, phase?}` an Wand, Öffnung (ohne eigenen Status
folgt sie der Wand), Decke, Dach, Treppe, Stütze, Körper und Raum (Raum nur Sichtbarkeit und
Flächen, keine Farbe); `Project.renovation` (Etappen, Farben, eigene Filter, KNOWN_KEYS);
`renovationFilter`/`renovationPhase` an DrawingLevel, ViewTemplate und ViewSnapshot — der Filter
gehört zur Ebene wie die Modelldarstellung [173], damit je Reiter, Ausschnitt und Vorlage.
Kern `renovation.rs` als ein Ort für „sichtbar/wie gezeichnet im Filter“: Vorgaben Bestand,
Abbruch, Neubau, Umbauplan, Endzustand; SIA-400-Farben (Bestand grau, Abbruch gelb gestrichelt,
Neu rot), anpassbar; Etappe „bis n“; neue Öffnung in Bestandswand = Abbruch-Stück, zugemauerte
Öffnung = Ausfachung (die Wand schliesst, wo die Öffnung ausgeblendet ist, wie bei der Regel
„Ausblenden“). Angebunden: Grundriss (Ctx.hidden, Farben je Element-Bereich, nur Schnittflächen
gefüllt, Symbole in Linienfarbe), Schnitt (without_elements + CutRules::with_renovation), Ansicht,
Vektor-Axo, 3D (model3dParts mit Filter, 3D-Fenster nimmt den Filter der aktiven Ebene),
Kennzahlen/Flächen (Text = Zustand), DXF (Layer <Klasse>_Abbruch/_Neu), IFC (Status im
Pset_*Common, Etappe in Dossier_Umbau). Tusche behält die Umbau-Farben (extras::KeepColors).
Neue Bauteile der Zeichenbefehle tragen den Zeichen-Status (commands::stamp_renovation).
Bedienung: Objekt-Info/Objekteinstellungen „Umbau“ und „Etappe“ (Mehrfachauswahl, ein
Undo-Schritt), Statusleiste „Umbau: …“ mit Zeichen-Status und Umbaufilter der Ansicht (im
Überlauf „⋯“ mit der Pausfolie), Befehl `umbau` (B/A/N; getippte Options-Kürzel mit Enter),
Ressourcen-Tab „Umbau“ (Etappen, Farben), Flächenbilanz „Zustand“, Vorlage „Beispiel Umbau“
(CLI :umbau), CLI --renovation/--phase für plan, section, elevation, axo, model3d, kennzahlen.
Tests: Kern renovation_tests.rs (20: Vorgaben, Etappen, Öffnungen in Bestandswand, Grundriss,
Schnitt, Ansicht, Kennzahlen, DXF, IFC, 3D, Tusche, Zeichen-Status, Unsinn), Robustheit (Plan,
Schnitt, Ansicht, Kennzahlen, 3D mit Filter), vitest model/renovation.test.ts und
commands/cmds/renovation.test.ts, e2e renovation271.spec.ts (2× grün). Goldens unverändert.
Bilder doc/review-271 (CLI-SVG --hatch in Chromium, App). Nur im Linux-Container geprüft, nicht
in der Tauri-App/auf dem Mac (Prüfschritt RELEASE-1.0 13.37). Offen: TODO [271].
This commit is contained in:
73 files changed
+2888
-56
No files matched your search
+2
-1
@@ -406,7 +406,7 @@ export default function App() {
|
||||
);
|
||||
const {
|
||||
projectFileInputRef, projectTemplateFileInputRef, openImportForFile, onSaveProject, onSaveProjectAs, onRestoreBackup,
|
||||
onNewProject, onNewProjectFromSample, onNewProjectFromComplexSample, onNewProjectFromWettbewerbSample, onNewProjectFromTemplate,
|
||||
onNewProject, onNewProjectFromSample, onNewProjectFromComplexSample, onNewProjectFromWettbewerbSample, onNewProjectFromUmbauSample, onNewProjectFromTemplate,
|
||||
onProjectTemplateFileChosen, onExportIfc, onExportObj, onExportStl, onOpenProject, onProjectFileChosen,
|
||||
} = files;
|
||||
|
||||
@@ -715,6 +715,7 @@ export default function App() {
|
||||
onNewProjectFromSample,
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromTemplate,
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
|
||||
@@ -84,8 +84,9 @@ export interface Ivhb {
|
||||
}
|
||||
|
||||
/** SIA-416-Flächentabelle je Geschoss und total. */
|
||||
export function computeAreaTable(project: Project): AreaTable {
|
||||
return documentFor(project).query<AreaTable>("areaTable");
|
||||
export function computeAreaTable(project: Project, renovation = ""): AreaTable {
|
||||
// [271] `renovation`: Umbau-Zustand (Filter-Id); leer = alle Bauteile.
|
||||
return documentFor(project).query<AreaTable>("areaTable", [], renovation);
|
||||
}
|
||||
|
||||
/** IVHB-Kennziffern (GFZ, AZ, BMZ, ÜZ, GZ, Höhen). */
|
||||
|
||||
@@ -61,8 +61,9 @@ export function solidVolume(s: ExtrudedSolid): number {
|
||||
* Flächen je Geschoss (SIA 416), Gebäudevolumen, Ausnützungs- und Überbauungsziffer. Rechnet der
|
||||
* Kern auf dem Projekt-Dokument (`kennzahlen.rs`, [K4] S2).
|
||||
*/
|
||||
export function computeKennzahlen(project: Project): Kennzahlen {
|
||||
return documentFor(project).query<Kennzahlen>("kennzahlen");
|
||||
export function computeKennzahlen(project: Project, renovation = ""): Kennzahlen {
|
||||
// [271] `renovation`: Umbau-Zustand (Filter-Id, z. B. „bestand“ oder „endzustand“); leer = alle Bauteile.
|
||||
return documentFor(project).query<Kennzahlen>("kennzahlen", [], renovation);
|
||||
}
|
||||
|
||||
export type { ProgramStatus } from "./roomProgram";
|
||||
|
||||
+31
-5
@@ -19,6 +19,8 @@
|
||||
// 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]
|
||||
// --renovation <Filter> Umbaufilter (bestand, abbruch, neubau, umbauplan, endzustand oder eigener)
|
||||
// mit --phase <Etappe> (Name oder id); auch für axo, model3d und kennzahlen [271]
|
||||
// --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> axo [--view southeast|southwest|northeast|northwest|iso|…] [--projection iso|military|military30]
|
||||
@@ -60,7 +62,8 @@
|
||||
//
|
||||
// Statt einer Datei nimmt `:beispiel` das eingebaute Demo-Haus (sampleProject), `:musterhaus-komplex` das
|
||||
// grosse Beispiel (model/sampleProjectComplex.ts; als Datei: `dossier-cli :musterhaus-komplex migrate --out mk.obp`),
|
||||
// `:wettbewerb` das Wettbewerbs-Beispiel der Kurzanleitung (model/sampleProjectWettbewerb.ts, [210]).
|
||||
// `:wettbewerb` das Wettbewerbs-Beispiel der Kurzanleitung (model/sampleProjectWettbewerb.ts, [210]), `:umbau` das
|
||||
// Umbau-Beispiel (model/sampleProjectUmbau.ts, [271]).
|
||||
//
|
||||
// WASM-Pakete (src/engine/pkg*) werden aus DOSSIER_WASM_DIR bzw. `<repo>/src/engine` gelesen.
|
||||
|
||||
@@ -141,6 +144,8 @@ import {
|
||||
generateSectionPlan,
|
||||
viewportLevelPlan,
|
||||
generateAxoPlan,
|
||||
renovationFilterList,
|
||||
buildUmbauSampleProject,
|
||||
type AxoOptions,
|
||||
planToRenderScene,
|
||||
projectToModel3d,
|
||||
@@ -252,6 +257,7 @@ function loadProject(path: string, args: Args): Project {
|
||||
if (path === ":beispiel") return sampleProject;
|
||||
if (path === ":musterhaus-komplex") return buildComplexSampleProject();
|
||||
if (path === ":wettbewerb") return buildWettbewerbSampleProject();
|
||||
if (path === ":umbau") return buildUmbauSampleProject();
|
||||
if (path === ":gross") return buildBigSampleProject({ floors: Number(args.flags.get("floors") ?? 8), apartments: Number(args.flags.get("apartments") ?? 15) });
|
||||
let text: string;
|
||||
try {
|
||||
@@ -364,9 +370,28 @@ function withTemplate(project: Project, levelId: string, tpl: ViewTemplate | und
|
||||
if (!mv) fail(`Modelldarstellung nicht gefunden: ${mName} (vorhanden: grob, mittel, fein${(p.modelViewOptions ?? []).map((m) => `, ${m.name}`).join("")})`);
|
||||
p = { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === levelId ? { ...l, modelViewOptionId: mv } : l)) };
|
||||
}
|
||||
// [271] `--renovation <Filter>` (und `--phase <Etappe>`): Umbaufilter der Ebene; geht der Vorlage vor.
|
||||
const ren = renovationFlags(p, args);
|
||||
if (ren) p = { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === levelId ? { ...l, renovationFilter: ren.renovation, renovationPhase: ren.renovationPhase } : l)) };
|
||||
return p;
|
||||
}
|
||||
|
||||
/** [271] `--renovation <Filter>` und `--phase <Etappe>` geprüft (Filter-Id oder Name; Etappe Name oder id); ohne Flag `null`. */
|
||||
function renovationFlags(project: Project, args: Args): { renovation: string; renovationPhase?: string } | null {
|
||||
const name = args.flags.get("renovation");
|
||||
if (!name || name === "true") return null;
|
||||
const filters = renovationFilterList(project);
|
||||
const n = name.toLowerCase();
|
||||
const hit = filters.find((f) => f.id.toLowerCase() === n || f.name.toLowerCase() === n);
|
||||
if (!hit) fail(`Umbaufilter nicht gefunden: ${name} (vorhanden: ${filters.map((f) => f.name).join(", ")})`);
|
||||
const ph = args.flags.get("phase");
|
||||
if (!ph || ph === "true") return { renovation: hit.id };
|
||||
const phases = project.renovation?.phases ?? [];
|
||||
const p = phases.find((x) => x.id === ph || x.name.toLowerCase() === ph.toLowerCase());
|
||||
if (!p) fail(`Etappe nicht gefunden: ${ph} (vorhanden: ${phases.map((x) => x.name).join(", ") || "keine"})`);
|
||||
return { renovation: hit.id, renovationPhase: p.id };
|
||||
}
|
||||
|
||||
/** `--sketch` ([67]): die Ebene im Skizzenstil (wie `DrawingLevel.sketch`); sonst das Projekt unverändert. */
|
||||
function withSketch(project: Project, levelId: string, args: Args): Project {
|
||||
if (!args.flags.has("sketch")) return project;
|
||||
@@ -606,7 +631,7 @@ function importParsedDrawing(base: Project, parsed: ReturnType<typeof parseDxf>,
|
||||
/** Liest Eingabe nach Endung in ein Projekt: obp direkt, dxf/dwg als 2D-Zeichnung + Meshes, ifc als Kontext-Meshes (`--elements`: Bauteile). */
|
||||
async function importAny(path: string, args: Args): Promise<Project> {
|
||||
const ext = extOf(path);
|
||||
if (ext === "obp" || ext === "json" || path === ":beispiel" || path === ":musterhaus-komplex" || path === ":wettbewerb") return loadProject(path, args);
|
||||
if (ext === "obp" || ext === "json" || path === ":beispiel" || path === ":musterhaus-komplex" || path === ":wettbewerb" || path === ":umbau") return loadProject(path, args);
|
||||
let bytes: Uint8Array;
|
||||
try {
|
||||
bytes = new Uint8Array(readFileSync(path));
|
||||
@@ -1208,7 +1233,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
if (on("context")) opts.context = true;
|
||||
const mono = f.has("color") ? inkArg(args) : true;
|
||||
const t0 = Date.now();
|
||||
const plan = generateAxoPlan(project, { ...opts, visibleCodes: codes, scaleDenominator: axScale, mono });
|
||||
const plan = generateAxoPlan(project, { ...opts, ...(renovationFlags(project, args) ?? {}), visibleCodes: codes, scaleDenominator: axScale, mono });
|
||||
if (!plan) fail("kein 3D-Dokument (keine sichtbaren Bauteile oder unbrauchbare Kamera)");
|
||||
if (f.has("time")) process.stderr.write(`axo: ${Date.now() - t0} ms, ${plan.primitives.length} Primitive\n`);
|
||||
const name = `axo-${opts.view ?? opts.cameraId ?? "kamera"}`;
|
||||
@@ -1307,7 +1332,8 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
else throw new Error("--format: json, csv, svg oder pdf");
|
||||
return 0;
|
||||
}
|
||||
const k = computeKennzahlen(project);
|
||||
// [271] `--renovation bestand|endzustand`: Kennzahlen im Umbau-Zustand.
|
||||
const k = computeKennzahlen(project, renovationFlags(project, args)?.renovation ?? "");
|
||||
const prog = checkRoomProgram(project);
|
||||
const baurecht = checkSiteRules(project);
|
||||
// [68] Erdarbeiten je Baugrube (Abtrag/Auftrag/Hinterfüllung, m³).
|
||||
@@ -1492,7 +1518,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
const filter: Filter3d = { hide: hideFlagCodes(project, args), grey: hideFlagCodes(project, args, "grey"), greyFloors: greyFloorIds(project, args) };
|
||||
const ghost = ghostFilter3d(filter);
|
||||
const model = {
|
||||
...projectToModel3d(project, { explode, hide: filter }),
|
||||
...projectToModel3d(project, { explode, hide: filter, ...(renovationFlags(project, args) ?? {}) }),
|
||||
// Flächenmuster ([100]) des Modells (render_png zeichnet sie in den Kanten-Stilen).
|
||||
patternLines: Array.from(emitSurfacePatternLines(project, explode, filter)),
|
||||
// [212] Materialtabelle des Pathtracers (render_png `--style pathtrace`).
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// [271] Befehl „Umbau-Status setzen …“: Optionen B/A/N, Mehrfachauswahl in einem Schritt, ohne Auswahl kein Start.
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { renovationCommand, renovationSelectionIds } from "./renovation";
|
||||
import type { CommandContext } from "../types";
|
||||
import { sampleProject } from "../../model/sampleProject";
|
||||
import { applyOps } from "../../core/ops";
|
||||
|
||||
function ctx(sel: Partial<CommandContext["selection"]>): CommandContext {
|
||||
return {
|
||||
project: sampleProject,
|
||||
level: sampleProject.drawingLevels[0],
|
||||
defaultCategoryCode: "20",
|
||||
activeLineStyleId: "solid",
|
||||
activeWallTypeId: "aw",
|
||||
lastPoint: null,
|
||||
selection: { wallIds: [], drawingId: null, ...sel },
|
||||
};
|
||||
}
|
||||
|
||||
describe("[271] renovation", () => {
|
||||
it("ohne Auswahl: Hinweis statt Start", () => {
|
||||
expect(renovationCommand.precondition?.(ctx({}))).toBe("cmd.renovation.needsSelection");
|
||||
expect(renovationCommand.precondition?.(ctx({ wallIds: ["W1"] }))).toBeNull();
|
||||
});
|
||||
|
||||
it("Option „Abbruch“ setzt den Status aller gewählten Bauteile in einem Schritt", () => {
|
||||
const c = ctx({ wallIds: ["W9"], openingIds: ["O2"], ceilingIds: ["C1"] });
|
||||
expect(renovationSelectionIds(c.selection)).toEqual(["W9", "O2", "C1"]);
|
||||
expect(renovationCommand.options(renovationCommand.init()).map((o) => o.id)).toEqual(["existing", "demolish", "new"]);
|
||||
const [, res] = renovationCommand.onInput(renovationCommand.init(), { kind: "option", id: "demolish" }, c);
|
||||
expect(res.done).toBe(true);
|
||||
const ops = res.commit!.toOps(sampleProject);
|
||||
expect(ops).toHaveLength(3);
|
||||
const p = applyOps(sampleProject, ops);
|
||||
expect(p.walls.find((w) => w.id === "W9")?.renovation?.status).toBe("demolish");
|
||||
expect(p.openings?.find((o) => o.id === "O2")?.renovation?.status).toBe("demolish");
|
||||
});
|
||||
|
||||
it("getippt: Kürzel N; Unsinn bleibt im Schritt", () => {
|
||||
const c = ctx({ wallIds: ["W1"] });
|
||||
const [, bad] = renovationCommand.onInput(renovationCommand.init(), { kind: "text", text: "xyz" }, c);
|
||||
expect(bad.done).toBeFalsy();
|
||||
const [, res] = renovationCommand.onInput(renovationCommand.init(), { kind: "text", text: "n" }, c);
|
||||
const p = applyOps(sampleProject, res.commit!.toOps(sampleProject));
|
||||
expect(p.walls.find((w) => w.id === "W1")?.renovation).toEqual({ status: "new" });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
// [271] Befehl „Umbau-Status setzen …“ (`renovation`, Kürzel `umbau`): setzt den Umbau-Status der gewählten Bauteile —
|
||||
// Bestand, Abbruch oder Neu (Optionen B/A/N) — in einem Undo-Schritt. Die Etappe bleibt; sie stellt die Objekt-Info ein.
|
||||
// Ohne Auswahl startet der Befehl nicht (Hinweis).
|
||||
|
||||
import { opsMutation, setRenovationOps } from "../../core";
|
||||
import type { RenovationStatus } from "../../model/types";
|
||||
import type { CmdOption, Command, CommandContext, CommandResult, CommandSelection, CommandState } from "../types";
|
||||
|
||||
/** Gewählte Bauteile mit Umbau-Status (Wände, Öffnungen, Decken, Dächer, Treppen, Räume, Stütze, Körper). */
|
||||
export function renovationSelectionIds(sel: CommandSelection): string[] {
|
||||
return [
|
||||
...sel.wallIds,
|
||||
...(sel.openingIds ?? []),
|
||||
...(sel.ceilingIds ?? []),
|
||||
...(sel.roofIds ?? []),
|
||||
...(sel.stairIds ?? []),
|
||||
...(sel.roomIds ?? []),
|
||||
...(sel.columnId ? [sel.columnId] : []),
|
||||
...(sel.extrudedSolidId ? [sel.extrudedSolidId] : []),
|
||||
];
|
||||
}
|
||||
|
||||
const STATUS_OPTIONS: Array<{ id: RenovationStatus; key: string; labelKey: CmdOption["labelKey"] }> = [
|
||||
{ id: "existing", key: "B", labelKey: "renovation.status.existing" },
|
||||
{ id: "demolish", key: "A", labelKey: "renovation.status.demolish" },
|
||||
{ id: "new", key: "N", labelKey: "renovation.status.new" },
|
||||
];
|
||||
|
||||
const idle = (): CommandState => ({ phase: "pick", lastPoint: null });
|
||||
const done = (commit?: CommandResult["commit"]): [CommandState, CommandResult] => [idle(), { draft: null, done: true, ...(commit ? { commit } : {}) }];
|
||||
|
||||
export const renovationCommand: Command = {
|
||||
name: "renovation",
|
||||
labelKey: "cmd.renovation.label",
|
||||
prompt: () => "cmd.renovation.prompt",
|
||||
accepts: () => ["option"],
|
||||
options: () => STATUS_OPTIONS.map((o) => ({ id: o.id, labelKey: o.labelKey, key: o.key })),
|
||||
precondition: (ctx: CommandContext) => (renovationSelectionIds(ctx.selection).length === 0 ? "cmd.renovation.needsSelection" : null),
|
||||
init: idle,
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const id = input.kind === "option" ? input.id : input.kind === "text" ? input.text.trim().toLowerCase() : "";
|
||||
const hit = STATUS_OPTIONS.find((o) => o.id === id || o.key.toLowerCase() === id);
|
||||
if (!hit) return [state, { draft: null }];
|
||||
const ids = renovationSelectionIds(ctx.selection);
|
||||
if (ids.length === 0) return done();
|
||||
return done(opsMutation((p) => setRenovationOps(p, ids, hit.id)));
|
||||
},
|
||||
onMove: (state): [CommandState, CommandResult] => [state, { draft: null }],
|
||||
onConfirm: (): [CommandState, CommandResult] => done(),
|
||||
onCancel: (): [CommandState, CommandResult] => done(),
|
||||
};
|
||||
@@ -479,7 +479,8 @@ export class CommandEngine {
|
||||
if (accepts.includes("option")) {
|
||||
const opts = this.command.options(this.state);
|
||||
const q = text.toLowerCase();
|
||||
const hit = opts.find((o) => o.id.toLowerCase().startsWith(q));
|
||||
// [271] Sonst das Kürzel der Option (z. B. „A“ für Abbruch bei der Id `demolish`), getippt mit Enter.
|
||||
const hit = opts.find((o) => o.id.toLowerCase().startsWith(q)) ?? opts.find((o) => o.key?.toLowerCase() === q);
|
||||
if (hit) {
|
||||
this.feed({ kind: "option", id: hit.id });
|
||||
return;
|
||||
|
||||
@@ -47,6 +47,7 @@ import { textboxCommand } from "./cmds/textbox";
|
||||
import { mirrorCommand, moveCommand, rotateCommand } from "./cmds/transform";
|
||||
import { scaleCommand } from "./cmds/scale";
|
||||
import { explodeCommand } from "./cmds/explode";
|
||||
import { renovationCommand } from "./cmds/renovation";
|
||||
import { dimdetachCommand } from "./cmds/dimdetach";
|
||||
import { autodimCommand } from "./cmds/autodim";
|
||||
import { gridCommand } from "./cmds/grid";
|
||||
@@ -132,6 +133,7 @@ export const COMMANDS: Record<string, Command> = {
|
||||
rotate: rotateCommand,
|
||||
scale: scaleCommand,
|
||||
explode: explodeCommand,
|
||||
renovation: renovationCommand,
|
||||
dimdetach: dimdetachCommand,
|
||||
autodim: autodimCommand,
|
||||
grid: gridCommand,
|
||||
@@ -283,6 +285,7 @@ export const ALIASES: Record<string, string> = {
|
||||
skalieren: "scale",
|
||||
x: "explode",
|
||||
aufloesen: "explode",
|
||||
umbau: "renovation",
|
||||
bml: "dimdetach",
|
||||
bemassungloesen: "dimdetach",
|
||||
ab: "autodim",
|
||||
|
||||
@@ -181,6 +181,7 @@ export type QueryName =
|
||||
| "presentationSheet"
|
||||
| "kennzahlen"
|
||||
| "areaTable"
|
||||
| "renovationFilters"
|
||||
| "costEstimate"
|
||||
| "costDefaults"
|
||||
| "programCompare"
|
||||
|
||||
@@ -120,3 +120,10 @@ export type { CyclesHost, CyclesPackage, CyclesSceneInfo, CyclesSceneOptions, Cy
|
||||
export { computeCostEstimate, defaultCostEstimate, formatChf } from "../analysis/costEstimate";
|
||||
export type { CostResult, CostRow, CostQuantities, CostEstimate, CostGroup, CostMethod, CostBasis } from "../analysis/costEstimate";
|
||||
export { buildCostReport, costGroupLabel, costUnitLabel } from "../export/costReport";
|
||||
// [271] Umbau: Status je Bauteil, Etappen, Umbaufilter (Regeln im Kern `renovation.rs`)
|
||||
export {
|
||||
BUILTIN_RENOVATION_FILTERS, RENOVATION_STATUSES, RENOVATION_COLLECTIONS, DEFAULT_RENOVATION_STYLES, renovationFilterList, renovationStatus, renovationPhases,
|
||||
renovationForNew, setRenovationOps, renovatableIds, commonRenovation, setPhasesOps, newPhaseId,
|
||||
} from "../model/renovation";
|
||||
export type { RenovationFilterEntry, RenovationCollection } from "../model/renovation";
|
||||
export { buildUmbauSampleProject } from "../model/sampleProjectUmbau";
|
||||
@@ -4680,6 +4680,49 @@ export const de = {
|
||||
"preview.tip": "Noch nicht fertig — Ergebnisse können abweichen",
|
||||
"settings.update.onStart": "Beim Start nach Updates suchen",
|
||||
"settings.update.onStart.hint": "Aus: Dossier nimmt von sich aus keinen Kontakt zum Update-Server auf (Datenschutz). «Nach Updates suchen» und der Versionsverlauf (beim Öffnen dieses Reiters) fragen nur auf deinen Klick bzw. Reiterwechsel.",
|
||||
// [271] Umbau
|
||||
"renovation.label": "Umbau",
|
||||
"renovation.title": "Umbau",
|
||||
"renovation.mixed": "gemischt",
|
||||
"renovation.status.existing": "Bestand",
|
||||
"renovation.status.demolish": "Abbruch",
|
||||
"renovation.status.new": "Neu",
|
||||
"renovation.phase": "Etappe",
|
||||
"renovation.phase.none": "ohne Etappe",
|
||||
"renovation.phase.all": "alle Etappen",
|
||||
"renovation.filter": "Umbaufilter",
|
||||
"renovation.filter.none": "kein Filter",
|
||||
"renovation.filter.bestand": "Bestand",
|
||||
"renovation.filter.abbruch": "Abbruch",
|
||||
"renovation.filter.neubau": "Neubau",
|
||||
"renovation.filter.umbauplan": "Umbauplan",
|
||||
"renovation.filter.endzustand": "Endzustand",
|
||||
"renovation.short": "Umbau: {status}",
|
||||
"renovation.status.hint": "Neue Bauteile: {status} · Umbaufilter dieser Ansicht: {filter}",
|
||||
"renovation.drawStatus": "Neue Bauteile zeichnen als",
|
||||
"renovation.filterPhase": "Filter bis Etappe",
|
||||
"renovation.state": "Zustand",
|
||||
"renovation.state.all": "alle Bauteile",
|
||||
"renovation.phases.title": "Etappen",
|
||||
"renovation.phases.hint": "Reihenfolge der Bau- und Abbruch-Etappen. Ein Umbaufilter „bis Etappe n“ zeigt Neues früherer Etappen als Bestand und lässt Abbruch früherer Etappen weg.",
|
||||
"renovation.phases.empty": "Keine Etappen: alle Bauteile gehören zur ersten.",
|
||||
"renovation.phases.up": "Nach oben",
|
||||
"renovation.phases.down": "Nach unten",
|
||||
"renovation.phases.remove": "Etappe entfernen",
|
||||
"renovation.phases.add": "Etappe hinzufügen",
|
||||
"renovation.phases.defaultName": "Etappe {n}",
|
||||
"renovation.styles.title": "Umbau-Farben",
|
||||
"renovation.styles.hint": "Vorgabe nach SIA 400: Bestand grau, Abbruch gelb und gestrichelt, Neu rot. Gilt in Grundriss, Schnitt, Ansicht und 3D, wo der Umbaufilter einen Status farbig zeigt.",
|
||||
"renovation.styles.fill": "Füllung",
|
||||
"renovation.styles.line": "Linie",
|
||||
"renovation.styles.dashed": "gestrichelt",
|
||||
"renovation.styles.reset": "Vorgabe",
|
||||
"resources.tab.renovation": "Umbau",
|
||||
"file.newFromUmbauSample": "Neu aus Vorlage: Beispiel Umbau",
|
||||
"menu.native.newFromUmbauSample": "Beispiel Umbau",
|
||||
"cmd.renovation.label": "Umbau-Status setzen …",
|
||||
"cmd.renovation.prompt": "Umbau-Status der Auswahl",
|
||||
"cmd.renovation.needsSelection": "Zuerst Bauteile wählen, dann den Umbau-Status setzen.",
|
||||
} as const;
|
||||
|
||||
export type TranslationKey = keyof typeof de;
|
||||
@@ -4666,4 +4666,47 @@ export const en: Record<TranslationKey, string> = {
|
||||
"preview.tip": "Not finished yet — results may differ",
|
||||
"settings.update.onStart": "Check for updates on startup",
|
||||
"settings.update.onStart.hint": "Off: Dossier does not contact the update server on its own (privacy). “Check for updates” and the version history (loaded when you open this tab) only ask when you click or open the tab.",
|
||||
// [271] Umbau
|
||||
"renovation.label": "Renovation",
|
||||
"renovation.title": "Renovation",
|
||||
"renovation.mixed": "mixed",
|
||||
"renovation.status.existing": "Existing",
|
||||
"renovation.status.demolish": "To be demolished",
|
||||
"renovation.status.new": "New",
|
||||
"renovation.phase": "Phase",
|
||||
"renovation.phase.none": "no phase",
|
||||
"renovation.phase.all": "all phases",
|
||||
"renovation.filter": "Renovation filter",
|
||||
"renovation.filter.none": "no filter",
|
||||
"renovation.filter.bestand": "Existing",
|
||||
"renovation.filter.abbruch": "Demolition",
|
||||
"renovation.filter.neubau": "New construction",
|
||||
"renovation.filter.umbauplan": "Renovation plan",
|
||||
"renovation.filter.endzustand": "Final state",
|
||||
"renovation.short": "Renovation: {status}",
|
||||
"renovation.status.hint": "New elements: {status} · Renovation filter of this view: {filter}",
|
||||
"renovation.drawStatus": "Draw new elements as",
|
||||
"renovation.filterPhase": "Filter up to phase",
|
||||
"renovation.state": "State",
|
||||
"renovation.state.all": "all elements",
|
||||
"renovation.phases.title": "Phases",
|
||||
"renovation.phases.hint": "Order of construction and demolition phases. A renovation filter “up to phase n” shows new elements of earlier phases as existing and leaves out demolition of earlier phases.",
|
||||
"renovation.phases.empty": "No phases: all elements belong to the first.",
|
||||
"renovation.phases.up": "Move up",
|
||||
"renovation.phases.down": "Move down",
|
||||
"renovation.phases.remove": "Remove phase",
|
||||
"renovation.phases.add": "Add phase",
|
||||
"renovation.phases.defaultName": "Phase {n}",
|
||||
"renovation.styles.title": "Renovation colors",
|
||||
"renovation.styles.hint": "Default per SIA 400: existing grey, demolition yellow and dashed, new red. Applies in plan, section, elevation and 3D wherever the renovation filter shows a status in color.",
|
||||
"renovation.styles.fill": "Fill",
|
||||
"renovation.styles.line": "Line",
|
||||
"renovation.styles.dashed": "dashed",
|
||||
"renovation.styles.reset": "Default",
|
||||
"resources.tab.renovation": "Renovation",
|
||||
"file.newFromUmbauSample": "New From Template: Renovation Example",
|
||||
"menu.native.newFromUmbauSample": "Renovation Example",
|
||||
"cmd.renovation.label": "Set renovation status …",
|
||||
"cmd.renovation.prompt": "Renovation status of the selection",
|
||||
"cmd.renovation.needsSelection": "Select elements first, then set the renovation status.",
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
// [271] Umbau: Ops zum Setzen von Status/Etappe, gemeinsame Werte bei Mehrfachauswahl, Etappen-Liste, Kern-Abfragen am
|
||||
// Umbau-Beispiel (Grundriss je Filter, Kennzahlen Bestand/Endzustand, neue Bauteile mit Zeichen-Status).
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { applyOps } from "../core/ops";
|
||||
import { documentFor } from "../core/document";
|
||||
import { commonRenovation, renovationFilterList, renovationForNew, setPhasesOps, setRenovationOps } from "./renovation";
|
||||
import { buildUmbauSampleProject } from "./sampleProjectUmbau";
|
||||
import { sampleProject } from "./sampleProject";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import { computeKennzahlen } from "../analysis/kennzahlen";
|
||||
import { computeAreaTable } from "../analysis/areaTable";
|
||||
import type { Project } from "./types";
|
||||
|
||||
const ALL = new Set(["20", "21", "30", "31", "40", "60"]);
|
||||
|
||||
function fills(p: Project, filter?: string): string[] {
|
||||
const q = filter ? { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === "eg" ? { ...l, renovationFilter: filter } : l)) } : p;
|
||||
return generatePlan(q, "eg", ALL).primitives.flatMap((x) => (x.kind === "polygon" ? [x.fill] : []));
|
||||
}
|
||||
|
||||
describe("[271] Umbau", () => {
|
||||
it("Status und Etappe setzen: ein Op je geändertem Element, Bestand ohne Etappe entfernt das Feld", () => {
|
||||
const p = sampleProject;
|
||||
const ops = setRenovationOps(p, ["W1", "W9", "O1", "nix"], "new", "e1");
|
||||
expect(ops).toHaveLength(3);
|
||||
const q = applyOps(p, ops);
|
||||
expect(q.walls.find((w) => w.id === "W1")?.renovation).toEqual({ status: "new", phase: "e1" });
|
||||
expect(commonRenovation(q, ["W1", "W9"])).toEqual({ status: "new", phase: "e1" });
|
||||
expect(commonRenovation(q, ["W1", "W2"]).status).toBe("mixed");
|
||||
// Nur den Status ändern: Etappe bleibt.
|
||||
const r = applyOps(q, setRenovationOps(q, ["W1"], "demolish"));
|
||||
expect(r.walls.find((w) => w.id === "W1")?.renovation).toEqual({ status: "demolish", phase: "e1" });
|
||||
// Zurück auf Bestand ohne Etappe: Feld weg.
|
||||
const s = applyOps(r, setRenovationOps(r, ["W1"], "existing", null));
|
||||
expect(s.walls.find((w) => w.id === "W1")).not.toHaveProperty("renovation");
|
||||
// Nichts zu ändern: keine Op (kein leerer Undo-Schritt).
|
||||
expect(setRenovationOps(s, ["W1"], "existing", null)).toHaveLength(0);
|
||||
expect(renovationForNew("existing")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("Etappe entfernen: Elemente verlieren sie, Status bleibt", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
const q = applyOps(p, setPhasesOps(p, [{ id: "etappe-1", name: "Etappe 1" }]));
|
||||
expect(q.renovation?.phases).toHaveLength(1);
|
||||
expect(q.walls.find((w) => w.id === "W10")?.renovation).toEqual({ status: "new" });
|
||||
expect(q.walls.find((w) => w.id === "W9")?.renovation).toEqual({ status: "demolish", phase: "etappe-1" });
|
||||
});
|
||||
|
||||
it("Kern: Filterliste, Grundriss je Filter, Kennzahlen Bestand vs. Endzustand", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
expect(renovationFilterList(p).map((f) => f.id)).toEqual(["bestand", "abbruch", "neubau", "umbauplan", "endzustand"]);
|
||||
// Ohne Filter keine Umbau-Farben; Umbauplan grau, gelb und rot.
|
||||
expect(fills(p)).not.toContain("#e3001b");
|
||||
const u = fills(p, "umbauplan");
|
||||
for (const c of ["#a6a6a6", "#ffd800", "#e3001b"]) expect(u).toContain(c);
|
||||
// Neubau: kein Gelb (Abbruch weg), Rot da.
|
||||
const n = fills(p, "neubau");
|
||||
expect(n).not.toContain("#ffd800");
|
||||
expect(n).toContain("#e3001b");
|
||||
// Kennzahlen: der Anbau zählt nur im Endzustand.
|
||||
const b = computeKennzahlen(p, "bestand");
|
||||
const e = computeKennzahlen(p, "endzustand");
|
||||
expect(e.gf).toBeGreaterThan(b.gf);
|
||||
expect(computeAreaTable(p, "bestand")).not.toEqual(computeAreaTable(p, "endzustand"));
|
||||
});
|
||||
|
||||
it("Zeichen-Status: der Kern gibt ihn neuen Bauteilen eines Zeichenbefehls", () => {
|
||||
const p = sampleProject;
|
||||
const doc = documentFor(p);
|
||||
const req = { cmd: "column", ctx: { level: "eg", cat: "50" }, stamp: "t271", at: { x: 1, y: 1 } };
|
||||
const added = (r: object) => doc.cmdOps(r).flatMap((o) => (o.kind === "add" ? (o.items as unknown as Array<{ renovation?: unknown }>) : []));
|
||||
expect(added({ ...req, renovation: { status: "new", phase: "e2" } })[0].renovation).toEqual({ status: "new", phase: "e2" });
|
||||
// Vorgabe Bestand: ohne Feld.
|
||||
expect(added(req)[0]).not.toHaveProperty("renovation");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,147 @@
|
||||
// [271] Umbau (Archicad „Renovation“): Status je Bauteil, Etappen, Umbaufilter. Die Regeln („sichtbar/wie gezeichnet im
|
||||
// Filter F“) stehen im Kern (`src-tauri/core/src/renovation.rs`); hier nur, was die Oberfläche zum Lesen und Setzen braucht.
|
||||
|
||||
import type { CoreOp } from "../core/ops";
|
||||
import { documentFor } from "../core/document";
|
||||
import { patchItems, setField } from "../core/opsBuild";
|
||||
import type { Project, Renovation, RenovationPhase, RenovationStatus } from "./types";
|
||||
|
||||
/** Eingebaute Umbaufilter (Ids; Namen über `t("renovation.filter.<id>")`). */
|
||||
export const BUILTIN_RENOVATION_FILTERS = ["bestand", "abbruch", "neubau", "umbauplan", "endzustand"] as const;
|
||||
|
||||
/** Status in der Reihenfolge der Oberfläche. */
|
||||
export const RENOVATION_STATUSES: readonly RenovationStatus[] = ["existing", "demolish", "new"];
|
||||
|
||||
/** Listen mit Umbau-Status (Räume nur Sichtbarkeit/Flächen, keine Farbe). */
|
||||
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms"] as const;
|
||||
export type RenovationCollection = (typeof RENOVATION_COLLECTIONS)[number];
|
||||
|
||||
/** SIA-400-Vorgabe der Umbau-Farben (gleich wie `renovation::default_style` im Kern). */
|
||||
export const DEFAULT_RENOVATION_STYLES: Record<RenovationStatus, { fill: string; line?: string; dashed: boolean }> = {
|
||||
existing: { fill: "#a6a6a6", dashed: false },
|
||||
demolish: { fill: "#ffd800", dashed: true },
|
||||
new: { fill: "#e3001b", line: "#c00016", dashed: false },
|
||||
};
|
||||
|
||||
export interface RenovationFilterEntry {
|
||||
id: string;
|
||||
name: string;
|
||||
builtin: boolean;
|
||||
}
|
||||
|
||||
/** Eingebaute und eigene Umbaufilter (Kern-Abfrage `renovationFilters`). */
|
||||
export function renovationFilterList(project: Project): RenovationFilterEntry[] {
|
||||
return documentFor(project).query<RenovationFilterEntry[]>("renovationFilters");
|
||||
}
|
||||
|
||||
/** Status eines Elements (fehlt/unbekannt ⇒ Bestand). */
|
||||
export function renovationStatus(r: Renovation | undefined | null): RenovationStatus {
|
||||
return r?.status === "demolish" || r?.status === "new" ? r.status : "existing";
|
||||
}
|
||||
|
||||
/** Etappen des Projekts in ihrer Reihenfolge. */
|
||||
export function renovationPhases(project: Project): readonly RenovationPhase[] {
|
||||
return project.renovation?.phases ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Umbau-Angaben für ein neues Element nach dem aktuellen Zeichen-Status: Bestand (Vorgabe) ohne Feld, sonst Status
|
||||
* und Etappe.
|
||||
*/
|
||||
export function renovationForNew(status: RenovationStatus, phase?: string | null): Renovation | undefined {
|
||||
if (status === "existing" && !phase) return undefined;
|
||||
return phase ? { status, phase } : { status };
|
||||
}
|
||||
|
||||
/**
|
||||
* Ops: Status (und Etappe) für alle Elemente mit id in `ids` setzen (ein Undo-Schritt, wenn zusammen angewandt).
|
||||
* `phase`: `undefined` = Etappe unverändert, `null` = keine Etappe. Bestand ohne Etappe entfernt das Feld.
|
||||
*/
|
||||
export function setRenovationOps(project: Project, ids: Iterable<string>, status: RenovationStatus | undefined, phase?: string | null): CoreOp[] {
|
||||
const set = new Set(ids);
|
||||
const ops: CoreOp[] = [];
|
||||
for (const c of RENOVATION_COLLECTIONS) {
|
||||
ops.push(
|
||||
...patchItems(project, c, set, (e) => {
|
||||
const old = (e as { renovation?: Renovation }).renovation;
|
||||
const st = status ?? renovationStatus(old);
|
||||
const ph = phase === undefined ? old?.phase : phase ?? undefined;
|
||||
const next = renovationForNew(st, ph);
|
||||
const { renovation: _drop, ...rest } = e as { renovation?: Renovation } & Record<string, unknown>;
|
||||
void _drop;
|
||||
return (next ? { ...rest, renovation: next } : rest) as unknown as typeof e;
|
||||
}),
|
||||
);
|
||||
}
|
||||
return ops;
|
||||
}
|
||||
|
||||
/** Element-Ids der Auswahl, die einen Umbau-Status tragen können. */
|
||||
export function renovatableIds(project: Project, ids: Iterable<string>): string[] {
|
||||
const set = new Set(ids);
|
||||
const out: string[] = [];
|
||||
for (const c of RENOVATION_COLLECTIONS) {
|
||||
for (const e of (project[c] ?? []) as { id: string }[]) if (set.has(e.id)) out.push(e.id);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Gemeinsamer Status bzw. gemeinsame Etappe der Elemente `ids` (`"mixed"` bei verschiedenen Werten, `null` ohne Elemente). */
|
||||
export function commonRenovation(project: Project, ids: Iterable<string>): { status: RenovationStatus | "mixed" | null; phase: string | "mixed" | null } {
|
||||
const set = new Set(ids);
|
||||
let status: RenovationStatus | "mixed" | null = null;
|
||||
let phase: string | "mixed" | null = null;
|
||||
let first = true;
|
||||
for (const c of RENOVATION_COLLECTIONS) {
|
||||
for (const e of (project[c] ?? []) as { id: string; renovation?: Renovation }[]) {
|
||||
if (!set.has(e.id)) continue;
|
||||
const s = renovationStatus(e.renovation);
|
||||
const ph = e.renovation?.phase ?? "";
|
||||
if (first) {
|
||||
status = s;
|
||||
phase = ph;
|
||||
first = false;
|
||||
} else {
|
||||
if (status !== s) status = "mixed";
|
||||
if (phase !== ph) phase = "mixed";
|
||||
}
|
||||
}
|
||||
}
|
||||
return { status, phase };
|
||||
}
|
||||
|
||||
/** Ops: Etappen-Liste ersetzen (Namen, Reihenfolge); Elemente mit einer entfernten Etappe verlieren sie. */
|
||||
export function setPhasesOps(project: Project, phases: readonly RenovationPhase[]): CoreOp[] {
|
||||
const keep = new Set(phases.map((p) => p.id));
|
||||
const settings = { ...(project.renovation ?? {}), phases: phases.length ? [...phases] : undefined };
|
||||
if (!settings.phases) delete settings.phases;
|
||||
const ops: CoreOp[] = [setField("renovation", Object.keys(settings).length ? settings : undefined)];
|
||||
for (const c of RENOVATION_COLLECTIONS) {
|
||||
ops.push(
|
||||
...patchItems(
|
||||
project,
|
||||
c,
|
||||
(e) => {
|
||||
const ph = (e as { renovation?: Renovation }).renovation?.phase;
|
||||
return !!ph && !keep.has(ph);
|
||||
},
|
||||
(e) => {
|
||||
const r = (e as { renovation?: Renovation }).renovation!;
|
||||
const next = renovationForNew(renovationStatus(r), null);
|
||||
const { renovation: _drop, ...rest } = e as { renovation?: Renovation } & Record<string, unknown>;
|
||||
void _drop;
|
||||
return (next ? { ...rest, renovation: next } : rest) as unknown as typeof e;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
return ops;
|
||||
}
|
||||
|
||||
/** Nächste freie Etappen-Id. */
|
||||
export function newPhaseId(project: Project): string {
|
||||
const used = new Set(renovationPhases(project).map((p) => p.id));
|
||||
let i = used.size + 1;
|
||||
while (used.has(`etappe-${i}`)) i++;
|
||||
return `etappe-${i}`;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// [271] „Beispiel Umbau": das Demo-Haus (sampleProject) als Bestand, umgebaut in zwei Etappen — Vorlage für Tests, die
|
||||
// Kurzanleitung (Abschnitt Umbau) und die Prüfbilder (`doc/review-271`).
|
||||
//
|
||||
// Etappe 1 (innen): die Zwischenwand W9 wird abgebrochen, das Nordfenster O2 zugemauert (Öffnung „Abbruch“: im Neubau-
|
||||
// und Endzustand ist die Wand dort zu, mit roter Ausfachung im Umbauplan), in die Westwand W4 kommt ein neues Fenster O3
|
||||
// (Öffnung „Neu“ in Bestandswand: im Bestand ist die Wand dort zu, im Umbauplan gelbes Abbruch-Stück).
|
||||
// Etappe 2 (Anbau): ein eingeschossiger Anbau im Norden (Wände, Decke, Raum, Fenster) und eine neue Tür in W3.
|
||||
// Nur Modellfelder, keine Kern-Befehle: das Modul ist ohne geladenen Kern auswertbar.
|
||||
|
||||
import type { Ceiling, DrawingLevel, Opening, Project, Renovation, Room, Wall } from "./types";
|
||||
import { sampleProject } from "./sampleProject";
|
||||
|
||||
const E1: Renovation = { status: "new", phase: "etappe-1" };
|
||||
const E2: Renovation = { status: "new", phase: "etappe-2" };
|
||||
const D1: Renovation = { status: "demolish", phase: "etappe-1" };
|
||||
|
||||
const wall = (id: string, x0: number, y0: number, x1: number, y1: number): Wall => ({
|
||||
id, type: "wall", floorId: "eg", categoryCode: "20", start: { x: x0, y: y0 }, end: { x: x1, y: y1 }, wallTypeId: "aw", height: 2.6, renovation: E2,
|
||||
});
|
||||
|
||||
const win = (id: string, hostWallId: string, position: number, width: number, renovation?: Renovation): Opening => ({
|
||||
id, type: "opening", hostWallId, categoryCode: "21", kind: "window", typeId: "window-standard", position, width, height: 1.2, sillHeight: 0.9,
|
||||
...(renovation ? { renovation } : {}),
|
||||
});
|
||||
|
||||
/** Das Umbau-Beispiel (frische Kopie bei jedem Aufruf). */
|
||||
export function buildUmbauSampleProject(): Project {
|
||||
const base = structuredClone(sampleProject);
|
||||
const levels: DrawingLevel[] = [
|
||||
...base.drawingLevels,
|
||||
// Schnitt durch den Anbau (Nord–Süd, Blick nach Osten): zeigt Bestand, Abbruch W9 nicht, aber Anbau und neue Tür.
|
||||
{ id: "schnitt-b", name: "Schnitt B", kind: "section", visible: true, locked: false, linePoints: [{ x: 1.4, y: -1 }, { x: 1.4, y: 8 }], directionSign: -1 },
|
||||
];
|
||||
const walls: Wall[] = base.walls.map((w) => (w.id === "W9" ? { ...w, renovation: D1 } : w));
|
||||
walls.push(wall("W10", 0, 4, 0, 7), wall("W11", 0, 7, 3, 7), wall("W12", 3, 7, 3, 4));
|
||||
const openings: Opening[] = (base.openings ?? []).map((o) => (o.id === "O2" ? { ...o, renovation: D1 } : o));
|
||||
openings.push(
|
||||
win("O3", "W4", 1.5, 1.0, E1),
|
||||
// Neue Tür in der Bestandswand W3 (W3 läuft von x 5 nach x 0: Tür x 1.9–1.0) zum Anbau.
|
||||
{ id: "O4", type: "opening", hostWallId: "W3", categoryCode: "21", kind: "door", typeId: "door-standard", position: 3.1, width: 0.9, height: 2.1, sillHeight: 0, swing: "left", hinge: "start", renovation: E2 },
|
||||
// Fenster des Anbaus: ohne eigenen Status, folgt der neuen Wand.
|
||||
win("O5", "W11", 0.9, 1.2),
|
||||
);
|
||||
const c1 = (base.ceilings ?? [])[0];
|
||||
const ceilings: Ceiling[] = [
|
||||
...(base.ceilings ?? []),
|
||||
{ ...c1, id: "C2", outline: [{ x: 0, y: 4 }, { x: 3, y: 4 }, { x: 3, y: 7 }, { x: 0, y: 7 }], renovation: E2 },
|
||||
];
|
||||
const r1 = (base.rooms ?? [])[0];
|
||||
const h = 0.1725;
|
||||
const rooms: Room[] = [
|
||||
...(base.rooms ?? []),
|
||||
{
|
||||
...r1, id: "R2", name: "Anbau", siaCategory: "HNF",
|
||||
boundary: [{ x: h, y: 4 + h }, { x: 3 - h, y: 4 + h }, { x: 3 - h, y: 7 - h }, { x: h, y: 7 - h }],
|
||||
stampAnchor: { x: 1.5, y: 5.8 },
|
||||
renovation: E2,
|
||||
},
|
||||
];
|
||||
return {
|
||||
...base,
|
||||
id: "beispiel-umbau",
|
||||
name: "Beispiel Umbau",
|
||||
drawingLevels: levels,
|
||||
walls,
|
||||
openings,
|
||||
ceilings,
|
||||
rooms,
|
||||
renovation: {
|
||||
phases: [
|
||||
{ id: "etappe-1", name: "Etappe 1" },
|
||||
{ id: "etappe-2", name: "Etappe 2" },
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -222,6 +222,8 @@ export type Ceiling = {
|
||||
* Z-Wert; „floor" bindet die UK an ein Geschoss.
|
||||
*/
|
||||
bottom?: VerticalAnchor;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -327,6 +329,8 @@ export type Column = {
|
||||
strokeWeightSource?: AttributeSource;
|
||||
/** Quelle der Schraffur, analog {@link Column.foregroundSource}. */
|
||||
hatchSource?: AttributeSource;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1393,6 +1397,16 @@ export type DrawingLevel = {
|
||||
* Fehlt ⇒ der Detailgrad allein bestimmt die Darstellung (heutiges Verhalten).
|
||||
*/
|
||||
modelViewOptionId?: string;
|
||||
/**
|
||||
* [271] Umbaufilter (eingebaut „bestand“, „abbruch“, „neubau“, „umbauplan“, „endzustand“ oder Id aus
|
||||
* `Project.renovation.filters`). Fehlt ⇒ kein Filter: alle Bauteile wie ohne Umbau-Angaben.
|
||||
*/
|
||||
renovationFilter?: string;
|
||||
/**
|
||||
* [271] Etappe, bis zu der der Umbaufilter gilt (Id aus `Project.renovation.phases`): Neues späterer Etappen fehlt
|
||||
* noch, Abbruch späterer Etappen steht noch als Bestand. Fehlt ⇒ alle Etappen.
|
||||
*/
|
||||
renovationPhase?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1541,6 +1555,8 @@ export type ExtrudedSolid = {
|
||||
* Grundriss und im Schnitt. Fehlt = neutrale Körper-Füllung mit Rückfall-Schraffur.
|
||||
*/
|
||||
componentId?: string;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2779,6 +2795,10 @@ export type Opening = {
|
||||
doorFrameKind?: "zarge" | "blockrahmen" | "blendrahmen" | "umfassungszarge" | "eckzarge" | "blockzarge" | "futter";
|
||||
/** Übersteuert die Zargen-/Rahmenmasse des Türtyps feldweise ([105]). */
|
||||
doorFrame?: DoorFrameDetail;
|
||||
/**
|
||||
* [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand wie die Wand (eine neue Öffnung in einer Bestandswand bricht die Wand dort ab, eine Öffnung „Abbruch“ wird zugemauert).
|
||||
*/
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3233,6 +3253,8 @@ export type Project = {
|
||||
/** Anzeige-Adresse/Bezeichnung des Bezugspunkts. */
|
||||
label?: string;
|
||||
};
|
||||
/** [271] Umbau: Etappen, Farben je Status (SIA 400) und eigene Umbaufilter. */
|
||||
renovation?: RenovationSettings;
|
||||
};
|
||||
|
||||
/** Protokolleintrag einer Publikation ([79]): Datum, Blätter mit Revision, erzeugte Dateien. */
|
||||
@@ -3301,6 +3323,54 @@ export type ReferenceLineRule = {
|
||||
target: "all" | "exterior" | string;
|
||||
};
|
||||
|
||||
/** [271] Umbau-Angaben eines Elements. */
|
||||
export type Renovation = {
|
||||
status: RenovationStatus;
|
||||
/**
|
||||
* Etappe (`Project.renovation.phases`, Id): beim Status „neu“ die Bau-, bei „abbruch“ die Abbruch-Etappe.
|
||||
* Fehlt ⇒ erste Etappe.
|
||||
*/
|
||||
phase?: string;
|
||||
};
|
||||
|
||||
/** [271] Ein Umbaufilter (wie Archicads „Renovation Filter“): Darstellung je Status. */
|
||||
export type RenovationFilter = {
|
||||
id: string;
|
||||
name: string;
|
||||
existing: RenovationShow;
|
||||
demolish: RenovationShow;
|
||||
new: RenovationShow;
|
||||
};
|
||||
|
||||
/** [271] Eine Bau-Etappe (Reihenfolge = Reihenfolge der Liste). */
|
||||
export type RenovationPhase = { id: string; name: string };
|
||||
|
||||
/** [271] Umbau-Einstellungen des Projekts. */
|
||||
export type RenovationSettings = {
|
||||
/** Etappen in ihrer Reihenfolge (Neubau/Abbruch Etappe 1, 2 …). */
|
||||
phases?: Array<RenovationPhase>;
|
||||
styles?: RenovationStyles;
|
||||
/** Eigene Umbaufilter (zusätzlich zu den eingebauten). */
|
||||
filters?: Array<RenovationFilter>;
|
||||
};
|
||||
|
||||
/** [271] Darstellung eines Status im Umbaufilter. */
|
||||
export type RenovationShow = "show" | "hide" | "override";
|
||||
|
||||
/**
|
||||
* [271] Umbau-Status eines Bauteils (Archicad „Renovation Status“; SIA 400: Bestand schwarz/grau, Abbruch gelb,
|
||||
* Neu rot).
|
||||
*/
|
||||
export type RenovationStatus = "existing" | "demolish" | "new";
|
||||
|
||||
/**
|
||||
* [271] Umbau-Farbe eines Status: Füllung der Schnittflächen, Linienfarbe, gestrichelt. Fehlende Felder ⇒ SIA-Vorgabe.
|
||||
*/
|
||||
export type RenovationStyle = { fill?: string; line?: string; dashed?: boolean };
|
||||
|
||||
/** [271] Umbau-Farben je Status (fehlt ⇒ SIA-400-Vorgabe, `renovation::default_style`). */
|
||||
export type RenovationStyles = { existing?: RenovationStyle; demolish?: RenovationStyle; new?: RenovationStyle };
|
||||
|
||||
/** Wie eine Wandschicht an der Öffnung anschliesst ([106]). */
|
||||
export type RevealMode = "buendig" | "zurueck" | "leibung" | "ueberdaemmt";
|
||||
|
||||
@@ -3433,6 +3503,8 @@ export type Roof = {
|
||||
parapetWidth?: number;
|
||||
/** Attika: Bauteil/Material (Farbe, Schnittschraffur); fehlt ⇒ Wandfarbe ohne Schraffur. */
|
||||
parapetComponentId?: string;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3533,6 +3605,10 @@ export type Room = {
|
||||
ceilingFinish?: string;
|
||||
/** [158] Bodenaufbau als Freitext (z. B. „Parkett 15, UB 80, TSD 20"). */
|
||||
floorBuildUp?: string;
|
||||
/**
|
||||
* [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand (nur Sichtbarkeit und Flächen je Zustand, keine Umbau-Farbe: ein Raum ist kein Bauteil).
|
||||
*/
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3941,6 +4017,8 @@ export type Stair = {
|
||||
* [T3] Pfosten-Tiefe in Metern, quer zum Handlauf (rechteckig: fehlt = 0.03; Flachstahl: Dicke, fehlt = 0.01; rund: ohne Wirkung).
|
||||
*/
|
||||
postDepth?: number;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -4307,6 +4385,16 @@ export type ViewSnapshot = {
|
||||
* Blickwinkel `view3d`. Fehlt ⇒ Blickwinkel `view3d`, Isometrie, getönte Flächen.
|
||||
*/
|
||||
doc3d?: Doc3d;
|
||||
/**
|
||||
* [271] Umbaufilter (eingebaut „bestand“, „abbruch“, „neubau“, „umbauplan“, „endzustand“ oder Id aus
|
||||
* `Project.renovation.filters`). Fehlt ⇒ kein Filter: alle Bauteile wie ohne Umbau-Angaben.
|
||||
*/
|
||||
renovationFilter?: string;
|
||||
/**
|
||||
* [271] Etappe, bis zu der der Umbaufilter gilt (Id aus `Project.renovation.phases`): Neues späterer Etappen fehlt
|
||||
* noch, Abbruch späterer Etappen steht noch als Bestand. Fehlt ⇒ alle Etappen.
|
||||
*/
|
||||
renovationPhase?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -4368,6 +4456,16 @@ export type ViewTemplate = {
|
||||
* Fehlt ⇒ der Detailgrad allein bestimmt die Darstellung (heutiges Verhalten).
|
||||
*/
|
||||
modelViewOptionId?: string;
|
||||
/**
|
||||
* [271] Umbaufilter (eingebaut „bestand“, „abbruch“, „neubau“, „umbauplan“, „endzustand“ oder Id aus
|
||||
* `Project.renovation.filters`). Fehlt ⇒ kein Filter: alle Bauteile wie ohne Umbau-Angaben.
|
||||
*/
|
||||
renovationFilter?: string;
|
||||
/**
|
||||
* [271] Etappe, bis zu der der Umbaufilter gilt (Id aus `Project.renovation.phases`): Neues späterer Etappen fehlt
|
||||
* noch, Abbruch späterer Etappen steht noch als Bestand. Fehlt ⇒ alle Etappen.
|
||||
*/
|
||||
renovationPhase?: string;
|
||||
};
|
||||
|
||||
/** Ansichtstyp eines Geschosses (wie in App). */
|
||||
@@ -4524,6 +4622,8 @@ export type Wall = {
|
||||
* der Elementkante.
|
||||
*/
|
||||
surfacePatternOffset?: Vec2;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface NativeAppMenuHandlers {
|
||||
onNewProjectFromSample: () => void;
|
||||
onNewProjectFromComplexSample: () => void;
|
||||
onNewProjectFromWettbewerbSample: () => void;
|
||||
onNewProjectFromUmbauSample: () => void;
|
||||
onNewProjectFromTemplate: () => void;
|
||||
onOpenProject: () => void;
|
||||
onSaveProject: () => void;
|
||||
@@ -189,6 +190,10 @@ export function useNativeAppMenu(
|
||||
text: t("menu.native.newFromWettbewerbSample"),
|
||||
action: () => handlersRef.current.onNewProjectFromWettbewerbSample(),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.native.newFromUmbauSample"),
|
||||
action: () => handlersRef.current.onNewProjectFromUmbauSample(),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.native.newFromTemplateFile"),
|
||||
action: () => handlersRef.current.onNewProjectFromTemplate(),
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// kommt aus `checkRoomProgram`.
|
||||
// Änderungen laufen über `applyChange` (Ops) mit coalesceKey, damit Tippen einen Undo-Schritt ergibt.
|
||||
|
||||
import { useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { useStore } from "../state/appStore";
|
||||
@@ -37,13 +38,21 @@ function parseNum(text: string): number | null {
|
||||
return text.trim() !== "" && Number.isFinite(v) ? v : null;
|
||||
}
|
||||
|
||||
/** [271] Trägt ein Bauteil oder Raum einen Umbau-Status (sonst bleibt die Wahl „Zustand“ verborgen)? */
|
||||
function hasRenovation(p: Project): boolean {
|
||||
const lists = [p.walls, p.openings, p.ceilings, p.roofs, p.stairs, p.columns, p.extrudedSolids, p.rooms] as Array<readonly { renovation?: unknown }[] | undefined>;
|
||||
return lists.some((l) => (l ?? []).some((e) => e.renovation !== undefined));
|
||||
}
|
||||
|
||||
const fmt = (n: number, d = 1) => n.toLocaleString("de-CH", { minimumFractionDigits: d, maximumFractionDigits: d });
|
||||
|
||||
export function KennzahlenSection() {
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const notify = useStore((s) => s.notify);
|
||||
const project = useStore((s) => s.project);
|
||||
const k = computeKennzahlen(project);
|
||||
// [271] Umbau: Kennzahlen im Zustand Bestand bzw. Endzustand (Kern `renovation.rs`); leer = alle Bauteile.
|
||||
const [renState, setRenState] = useState("");
|
||||
const k = computeKennzahlen(project, renState);
|
||||
const prog = checkRoomProgram(project);
|
||||
const rows = project.roomProgram ?? [];
|
||||
|
||||
@@ -73,6 +82,16 @@ export function KennzahlenSection() {
|
||||
|
||||
return (
|
||||
<div className="kz-section">
|
||||
{hasRenovation(project) && (
|
||||
<label className="kz-parcel" data-testid="kz-renovation-state">
|
||||
<span>{t("renovation.state")}</span>
|
||||
<select className="kz-input" value={renState} onChange={(e) => setRenState(e.target.value)} aria-label={t("renovation.state")}>
|
||||
<option value="">{t("renovation.state.all")}</option>
|
||||
<option value="bestand">{t("renovation.filter.bestand")}</option>
|
||||
<option value="endzustand">{t("renovation.filter.endzustand")}</option>
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<div className="kz-bar">
|
||||
{tiles.map((tile) => (
|
||||
<div key={tile.label} className="kz-tile" title={t(tile.title)}>
|
||||
|
||||
@@ -38,6 +38,7 @@ import { LibObjectSection } from "./objectInfo/LibObjectSection";
|
||||
import { elementDimensions } from "./objectInfo/elementDims";
|
||||
import { InfoGroups, hasInfoGroups } from "./objectInfo/InfoGroups";
|
||||
import { infoGroupFrame, useInfoGroupState } from "./objectInfo/InfoGroup";
|
||||
import { RenovationField } from "./objectInfo/RenovationField";
|
||||
|
||||
// ── Bezugspunkt-Raster ───────────────────────────────────────────────────────
|
||||
// Neun Anker als 3×3-Raster. Zeile 0 = oben (fy=0), Spalte 0 = links (fx=0).
|
||||
@@ -195,6 +196,9 @@ export function ObjectInfoPanel({ showPlacement = true }: { showPlacement?: bool
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* [271] Umbau: Status und Etappe der Auswahl (Mehrfachauswahl in einem Undo-Schritt). */}
|
||||
<RenovationField />
|
||||
|
||||
{showPlacement && (
|
||||
<>
|
||||
{infoGroupFrame(gst, "refpoint", <>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// [271] Objekt-Info und Objekteinstellungen: „Umbau“ — Status (Bestand, Abbruch, Neu) und Etappe der Auswahl.
|
||||
// Mehrfachauswahl: alle gewählten Bauteile in einem Undo-Schritt; verschiedene Werte zeigen „gemischt“.
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { t } from "../../i18n";
|
||||
import type { RenovationStatus } from "../../model/types";
|
||||
import { commonRenovation, renovatableIds, renovationPhases, RENOVATION_STATUSES, setRenovationOps } from "../../core";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import type { Selection } from "../../state/selection";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
|
||||
const MIXED = "__mixed";
|
||||
const NO_PHASE = "";
|
||||
|
||||
/** Ids der Auswahl, die einen Umbau-Status tragen (Wände, Öffnungen, Decken, Dächer, Treppen, Stützen, Körper, Räume). */
|
||||
export function selectionRenovationIds(sel: Selection): string[] {
|
||||
return [...sel.walls, ...sel.openings, ...sel.ceilings, ...sel.roofs, ...sel.stairs, ...sel.columns, ...sel.solids, ...sel.rooms];
|
||||
}
|
||||
|
||||
export function RenovationField() {
|
||||
const project = useStore((s) => s.project);
|
||||
const selection = useStore((s) => s.selection);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const ids = useMemo(() => renovatableIds(project, selectionRenovationIds(selection)), [project, selection]);
|
||||
const common = useMemo(() => commonRenovation(project, ids), [project, ids]);
|
||||
if (ids.length === 0) return null;
|
||||
const phases = renovationPhases(project);
|
||||
const statusValue = common.status === "mixed" || common.status === null ? MIXED : common.status;
|
||||
const phaseValue = common.phase === "mixed" ? MIXED : (common.phase ?? NO_PHASE);
|
||||
const statusOptions = [
|
||||
...(statusValue === MIXED ? [{ value: MIXED, label: t("renovation.mixed") }] : []),
|
||||
...RENOVATION_STATUSES.map((s) => ({ value: s, label: t(`renovation.status.${s}`) })),
|
||||
];
|
||||
const phaseOptions = [
|
||||
...(phaseValue === MIXED ? [{ value: MIXED, label: t("renovation.mixed") }] : []),
|
||||
{ value: NO_PHASE, label: t("renovation.phase.none") },
|
||||
...phases.map((p) => ({ value: p.id, label: p.name })),
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-field" data-testid="objinfo-renovation">
|
||||
<span className="objinfo-flabel">{t("renovation.label")}</span>
|
||||
<Dropdown
|
||||
value={statusValue}
|
||||
onChange={(v) => {
|
||||
if (v === MIXED) return;
|
||||
applyChange((p) => setRenovationOps(p, ids, v as RenovationStatus));
|
||||
}}
|
||||
options={statusOptions}
|
||||
title={t("renovation.label")}
|
||||
width={150}
|
||||
/>
|
||||
</div>
|
||||
{phases.length > 0 && (
|
||||
<div className="objinfo-field" data-testid="objinfo-renovation-phase">
|
||||
<span className="objinfo-flabel">{t("renovation.phase")}</span>
|
||||
<Dropdown
|
||||
value={phaseValue}
|
||||
onChange={(v) => {
|
||||
if (v === MIXED) return;
|
||||
applyChange((p) => setRenovationOps(p, ids, undefined, v === NO_PHASE ? null : v));
|
||||
}}
|
||||
options={phaseOptions}
|
||||
title={t("renovation.phase")}
|
||||
width={150}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -21,6 +21,9 @@ export interface AxoOptions extends Doc3d {
|
||||
mono?: boolean;
|
||||
/** Massstabsnenner (Strichstärken nach Massstab); Vorgabe 100. */
|
||||
scaleDenominator?: number;
|
||||
/** [271] Umbaufilter (Id oder Name) und Etappe. */
|
||||
renovation?: string;
|
||||
renovationPhase?: string;
|
||||
}
|
||||
|
||||
/** Kern-Abfrage `axoPlan`. */
|
||||
|
||||
@@ -84,6 +84,9 @@ export function levelArg(level: DrawingLevel) {
|
||||
// [173] Modelldarstellung der Ebene (Schnitt: Schichten, Öffnungsdetail, Treppen; Ansicht: Schatten,
|
||||
// Materialschraffur, Fenster).
|
||||
modelViewOptionId: level.modelViewOptionId,
|
||||
// [271] Umbaufilter und Etappe der Ebene (Kern `renovation.rs`).
|
||||
renovationFilter: level.renovationFilter,
|
||||
renovationPhase: level.renovationPhase,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+23
-3
@@ -97,6 +97,10 @@ export function classFilterText(hide?: Hide3d, extra?: Record<string, unknown>):
|
||||
if (f.greyFloors?.length) h.greyFloors = f.greyFloors;
|
||||
if (f.lock?.length) h.lock = f.lock;
|
||||
if (f.ghost) h.ghost = true;
|
||||
if (f.renovation) {
|
||||
h.renovation = f.renovation;
|
||||
if (f.renovationPhase) h.renovationPhase = f.renovationPhase;
|
||||
}
|
||||
return Object.keys(h).length || extra ? JSON.stringify({ ...extra, ...h }) : "";
|
||||
}
|
||||
|
||||
@@ -118,6 +122,9 @@ export interface Filter3d {
|
||||
lock?: readonly string[];
|
||||
/** [180] Geisterschicht: nur die grauen Elemente. */
|
||||
ghost?: boolean;
|
||||
/** [271] Umbaufilter der Ansicht (Id) und Etappe: Ausgeblendetes fehlt, Bauteile in der Umbau-Farbe (ohne Teil-Cache). */
|
||||
renovation?: string;
|
||||
renovationPhase?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,6 +302,12 @@ export interface Model3dOptions {
|
||||
* Öffnungsdetail, „Handlauf aus" lässt die Handläufe weg. Rechnet ohne den inkrementellen Kern-Cache.
|
||||
*/
|
||||
modelView?: string;
|
||||
/**
|
||||
* [271] Umbaufilter (Id oder Name, `renovation.rs`) und Etappe: Ausgeblendetes fehlt, Bauteile in der Umbau-Farbe.
|
||||
* Rechnet ohne den inkrementellen Kern-Cache.
|
||||
*/
|
||||
renovation?: string;
|
||||
renovationPhase?: string;
|
||||
/**
|
||||
* [180] Klassen, die zusätzlich zum Ebenen-Baum nicht gezeichnet werden (Darstellungsmodus des Ebenen-Panels).
|
||||
* Ausgeblendete Klassen fehlen im Modell, in der Pick-Geometrie und im Export der Ansicht (Kern filtert nach dem
|
||||
@@ -315,8 +328,14 @@ export function projectToModel3d(project: Project, opts: Model3dOptions = {}): R
|
||||
const args = [layered ? 1 : 0, DETAIL_CODE[detail] ?? 3, opts.forSection ? 1 : 0, voids ? 1 : 0, explode];
|
||||
// Ohne Explosion inkrementell ([58]): nur geänderte Wände reisen aus dem Kern und werden gelesen.
|
||||
const doc = documentFor(project);
|
||||
const text = classFilterText(opts.hide, opts.modelView ? { modelView: opts.modelView } : undefined);
|
||||
const parts = opts.modelView || explode > 0 ? doc.query<Model3dParts>("model3dParts", args, text) : doc.model3dParts<Model3dParts>(args, text);
|
||||
const extra: Record<string, unknown> = {};
|
||||
if (opts.modelView) extra.modelView = opts.modelView;
|
||||
if (opts.renovation) {
|
||||
extra.renovation = opts.renovation;
|
||||
if (opts.renovationPhase) extra.renovationPhase = opts.renovationPhase;
|
||||
}
|
||||
const text = classFilterText(opts.hide, Object.keys(extra).length ? extra : undefined);
|
||||
const parts = opts.modelView || opts.renovation || filter3d(opts.hide).renovation || explode > 0 ? doc.query<Model3dParts>("model3dParts", args, text) : doc.model3dParts<Model3dParts>(args, text);
|
||||
// [115] Freie Körper als Kern-Netze (`model3d/solids.rs`) zwischen Kontext-Meshes und Stützen.
|
||||
const meshes: RMesh[] = [...parts.contextMeshes];
|
||||
for (const m of parts.solidMeshes) meshes.push(m);
|
||||
@@ -369,7 +388,8 @@ export interface Model3dPart {
|
||||
export function projectToModel3dParts(project: Project, opts: Model3dOptions = {}): Model3dPart[] | null {
|
||||
const layered = opts.layeredWalls ?? true;
|
||||
const detail = opts.detail ?? "fein";
|
||||
if (explodeGap(opts.explode) > 0) return null;
|
||||
// [271] Mit Umbaufilter ohne Teil-Cache: das ganze Modell (`projectToModel3d`).
|
||||
if (explodeGap(opts.explode) > 0 || opts.renovation || filter3d(opts.hide).renovation) return null;
|
||||
const voids = !!opts.voids;
|
||||
const args = [layered ? 1 : 0, DETAIL_CODE[detail] ?? 3, opts.forSection ? 1 : 0, voids ? 1 : 0, 0];
|
||||
const { parts, keyed } = documentFor(project).model3dPartsKeyed<Model3dParts>(args, classFilterText(opts.hide));
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { DrawingLevel, Project, ViewTemplate } from "../model/types";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
|
||||
/** Ebenen-Felder, die eine Vorlage setzt (fehlt das Vorlagen-Feld, bleibt die Ansicht unberührt). */
|
||||
export const TEMPLATE_LEVEL_KEYS = ["cutHeight", "viewTop", "viewBottom", "viewDepth", "shadows", "hiddenLines", "sketch", "cutHatch", "floorFinish", "showTerrain", "modelViewOptionId"] as const;
|
||||
export const TEMPLATE_LEVEL_KEYS = ["cutHeight", "viewTop", "viewBottom", "viewDepth", "shadows", "hiddenLines", "sketch", "cutHatch", "floorFinish", "showTerrain", "modelViewOptionId", "renovationFilter", "renovationPhase"] as const;
|
||||
|
||||
/** Teilobjekt für die Ebene aus den gesetzten Feldern der Vorlage. */
|
||||
export function templateLevelPatch(t: ViewTemplate): Partial<DrawingLevel> {
|
||||
|
||||
@@ -80,9 +80,19 @@ export async function viewportLevelPlan(
|
||||
*/
|
||||
export async function viewportSnapshotPlan(project: Project, snap: ViewSnapshot, visibleCodes: Set<string>, scaleDenominator: number, forPrint = false): Promise<Plan> {
|
||||
if (isDoc3dSnapshot(snap)) return snapshotAxoPlan(project, snap, visibleCodes, scaleDenominator, snapshotMono(project, snap)) ?? EMPTY;
|
||||
// [271] Umbaufilter des Ausschnitts: geht dem der Ebene vor (wie im Kern `sheet_viewports::viewport_args`).
|
||||
if (snap.renovationFilter) {
|
||||
const rp = projectWithRenovation(project, snap.activeLevelId, snap.renovationFilter, snap.renovationPhase);
|
||||
return withDocument(rp, () => viewportLevelPlan(rp, snap.activeLevelId, visibleCodes, snap.detail, scaleDenominator, forPrint, snapshotMono(rp, snap), snapshotOverrideRuleIds(rp, snap), snapshotTemplate(rp, snap), snap.modelViewOptionId));
|
||||
}
|
||||
return viewportLevelPlan(project, snap.activeLevelId, visibleCodes, snap.detail, scaleDenominator, forPrint, snapshotMono(project, snap), snapshotOverrideRuleIds(project, snap), snapshotTemplate(project, snap), snap.modelViewOptionId);
|
||||
}
|
||||
|
||||
/** [271] Das Projekt mit Umbaufilter `filter` (und Etappe) an der Ebene `levelId`. */
|
||||
export function projectWithRenovation(project: Project, levelId: string, filter: string, phase?: string): Project {
|
||||
return { ...project, drawingLevels: project.drawingLevels.map((l) => (l.id === levelId ? { ...l, renovationFilter: filter, ...(phase ? { renovationPhase: phase } : {}) } : l)) };
|
||||
}
|
||||
|
||||
/** [173] Das Projekt mit der Modelldarstellung `id` an der Ebene `levelId` (wie die Vorlage ein Ebenen-Feld). */
|
||||
export function projectWithModelView(project: Project, levelId: string, id: string): Project {
|
||||
return { ...project, drawingLevels: project.drawingLevels.map((l) => (l.id === levelId ? { ...l, modelViewOptionId: id } : l)) };
|
||||
|
||||
@@ -576,7 +576,10 @@ export function createProjectSlice(
|
||||
|
||||
// Befehl ([K4] S3, `commands.rs`): der Kern rechnet ihn auf dem Dokument und wendet ihn im selben
|
||||
// Aufruf an (`cmdMutation`); Prüfung, Verlauf und Meldungen wie `commitOps`.
|
||||
const applyCmd = (req: object, coalesceKey?: string) => {
|
||||
const applyCmd = (req0: object, coalesceKey?: string) => {
|
||||
// [271] Aktueller Zeichen-Status: der Kern gibt ihn neuen Bauteilen der Zeichenbefehle (`commands::stamp_renovation`).
|
||||
const dr = (get() as unknown as { drawRenovation?: { status: string; phase?: string } }).drawRenovation;
|
||||
const req = dr && (dr.status !== "existing" || dr.phase) ? { ...req0, renovation: dr } : req0;
|
||||
if (forwarded(() => storeDocument(get().project).cmdOps(req), coalesceKey)) return;
|
||||
let notice: string | undefined;
|
||||
set((s) => {
|
||||
|
||||
@@ -60,6 +60,10 @@ declare global {
|
||||
sectionWalls: () => Promise<{ n: number; area: number }>;
|
||||
/** [193] Gelände-/Umgebungs-Elemente (Art, Id, bei der Baugrube die erste Umrissecke, bei Höhenlinien der erste Punkt). */
|
||||
context: () => { id: string; type: string; first?: { x: number; y: number } }[];
|
||||
/** [271] Füllfarben der Element-Flächen im Grundriss der aktiven Ebene (Farbe → Anzahl, alle Klassen, 1:100). */
|
||||
planFillColors: () => Record<string, number>;
|
||||
/** [271] Umbau: Filter und Etappe der aktiven Ebene, Zeichen-Status, Status je Wand. */
|
||||
renovation: () => { filter: string | null; phase: string | null; draw: string; walls: Record<string, string> };
|
||||
/** [193] Gefüllte Flächen (Füllfarbe gesetzt) im Grundriss der aktiven Ebene (alle Kategorien, 1:100); bei 0 ist nichts Gefülltes mehr zu sehen. */
|
||||
planFills: () => number;
|
||||
/** [193] Höhe (z) des ersten Gelände-Netz-Punkts. */
|
||||
@@ -153,6 +157,33 @@ export function installTestHooks(): void {
|
||||
walk(s.project.layers);
|
||||
return generatePlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, true, 50).primitives.filter((q) => q.kind === "line" && q.cls === cls).length;
|
||||
},
|
||||
planFillColors: () => {
|
||||
const s = getState();
|
||||
const codes = new Set<string>();
|
||||
const walk = (cs: { code: string; children?: unknown[] }[]): void => {
|
||||
for (const c of cs) {
|
||||
codes.add(c.code);
|
||||
walk((c.children ?? []) as { code: string; children?: unknown[] }[]);
|
||||
}
|
||||
};
|
||||
walk(s.project.layers);
|
||||
const out: Record<string, number> = {};
|
||||
for (const q of generatePlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, true, 100).primitives) {
|
||||
if (q.kind !== "polygon" || !q.fill || !Object.entries(q).some(([k, v]) => k.endsWith("Id") && !!v)) continue;
|
||||
out[q.fill] = (out[q.fill] ?? 0) + 1;
|
||||
}
|
||||
return out;
|
||||
},
|
||||
renovation: () => {
|
||||
const s = getState();
|
||||
const l = s.project.drawingLevels.find((x) => x.id === s.activeLevelId);
|
||||
return {
|
||||
filter: l?.renovationFilter ?? null,
|
||||
phase: l?.renovationPhase ?? null,
|
||||
draw: s.drawRenovation.status,
|
||||
walls: Object.fromEntries(s.project.walls.map((w) => [w.id, w.renovation?.status ?? "existing"])),
|
||||
};
|
||||
},
|
||||
context: () =>
|
||||
(getState().project.context ?? []).map((c) => ({ id: c.id, type: c.type, first: c.type === "excavation" ? c.outline[0] : c.type === "contourSet" ? c.contours[0]?.pts[0] : undefined })),
|
||||
planFills: () => {
|
||||
|
||||
@@ -89,6 +89,7 @@ export function useNativeMenu(opts: {
|
||||
onNewProjectFromSample,
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromTemplate,
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
@@ -119,6 +120,7 @@ export function useNativeMenu(opts: {
|
||||
onNewProjectFromSample,
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromTemplate,
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
|
||||
@@ -50,6 +50,7 @@ import { emptyProject, sampleProject } from "../model/sampleProject";
|
||||
import { withNewProjectNames } from "../model/newProjectNames";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { buildWettbewerbSampleProject } from "../model/sampleProjectWettbewerb";
|
||||
import { buildUmbauSampleProject } from "../model/sampleProjectUmbau";
|
||||
import { withStandards } from "../model/standards";
|
||||
import type { Project } from "../model/types";
|
||||
import type { PlanViewHandle } from "../views/plan/PlanView";
|
||||
@@ -570,6 +571,13 @@ export function useProjectFileActions(
|
||||
getState().loadProject(next);
|
||||
lastSavedProjectRef.current = next;
|
||||
});
|
||||
// [271] „Neu aus Vorlage: Beispiel Umbau" — Demo-Haus mit Abbruch, zugemauertem und neuem Fenster, Anbau in zwei Etappen.
|
||||
const onNewProjectFromUmbauSample = () => guardDiscard(() => {
|
||||
releaseCurrentProjectLock();
|
||||
const next = buildUmbauSampleProject();
|
||||
getState().loadProject(next);
|
||||
lastSavedProjectRef.current = next;
|
||||
});
|
||||
// „Neu aus Vorlage: Datei wählen…" — native `.obpt`-Dialog unter Tauri, sonst
|
||||
// das versteckte `<input type=file>` (projectTemplateFileInputRef).
|
||||
const onNewProjectFromTemplate = () => {
|
||||
@@ -914,6 +922,7 @@ export function useProjectFileActions(
|
||||
onNewProjectFromSample,
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromTemplate,
|
||||
onProjectTemplateFileChosen,
|
||||
releaseCurrentProjectLock,
|
||||
|
||||
@@ -18,6 +18,7 @@ import type { useProjectActions } from "./useProjectActions";
|
||||
import type { useTopBarState } from "./useTopBarState";
|
||||
import { useViewTemplateHandlers } from "./useViewTemplateHandlers";
|
||||
import { modelViewHandlers } from "./useModelViewHandlers";
|
||||
import { setField, setPhasesOps } from "../core";
|
||||
|
||||
type TopBar = ReturnType<typeof useTopBarState>;
|
||||
type Dialogs = ReturnType<typeof useDialogState>;
|
||||
@@ -135,6 +136,15 @@ export function useResourceHandlers(opts: {
|
||||
...viewTemplateHandlers,
|
||||
// [173] Modelldarstellung (neue Stufe über dem Detailgrad der Anzeige).
|
||||
...modelViewHandlers(applyChange, () => detail),
|
||||
// [271] Umbau: Etappen und Farben (Ressourcen-Tab „Umbau“).
|
||||
onSetRenovationPhases: (phases) => applyChange((p) => setPhasesOps(p, phases)),
|
||||
onSetRenovationStyles: (styles) =>
|
||||
applyChange((p) => {
|
||||
const next = { ...(p.renovation ?? {}) };
|
||||
if (styles) next.styles = styles;
|
||||
else delete next.styles;
|
||||
return [setField("renovation", Object.keys(next).length ? next : undefined)];
|
||||
}),
|
||||
onPatchComponent: patchComponent,
|
||||
onPatchWallType: patchWallType,
|
||||
onAddWallType: addWallType,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { DetailLevel, RenderMode, View3d, ViewType } from "../model/viewTypes";
|
||||
import type { TraceReference } from "../model/types";
|
||||
import type { TraceReference, RenovationStatus } from "../model/types";
|
||||
import type { DisplayMode } from "../panels/types";
|
||||
import { DEFAULT_MARQUEE_COLOR, DEFAULT_SNAP_COLOR } from "../theme/accents";
|
||||
import type { StoreApi } from "./store";
|
||||
@@ -21,6 +21,12 @@ const DEFAULT_DISPLAY_MODE: DisplayMode = "all";
|
||||
export interface ViewSlice {
|
||||
// Aktive Zeichnungsebene (Geschoss/Schnitt/Zeichnung).
|
||||
activeLevelId: string;
|
||||
/**
|
||||
* [271] Aktueller Zeichen-Status (Umbau): neue Bauteile der Zeichenbefehle tragen ihn (Vorgabe Bestand, Wunsch
|
||||
* Maintainer); mit Etappe. Zustand der Sitzung, kein Undo-Schritt.
|
||||
*/
|
||||
drawRenovation: { status: RenovationStatus; phase?: string };
|
||||
setDrawRenovation: (status: RenovationStatus, phase?: string) => void;
|
||||
// Ansichtstyp (Grundriss / Perspektive).
|
||||
viewType: ViewType;
|
||||
// Zuletzt gewählter Ansichtstyp je Zeichnungsebene — jeder Tab merkt sich
|
||||
@@ -92,6 +98,8 @@ export function createViewSlice(api: StoreApi<ViewSlice>): ViewSlice {
|
||||
const { set, get } = api;
|
||||
return {
|
||||
activeLevelId: sampleProject.drawingLevels[0].id,
|
||||
drawRenovation: { status: "existing" },
|
||||
setDrawRenovation: (status, phase) => set({ drawRenovation: phase ? { status, phase } : { status } }),
|
||||
viewType: "grundriss",
|
||||
viewTypeByLevel: {},
|
||||
detail: "mittel",
|
||||
|
||||
@@ -1289,6 +1289,39 @@ body {
|
||||
gap: 6px;
|
||||
padding: 6px 12px 2px;
|
||||
}
|
||||
/* [271] Umbau: Zeichen-Status als Farbpunkt (SIA: Bestand grau, Abbruch gelb, Neu rot), Filter im Popover. */
|
||||
.sb-renovation-popover {
|
||||
min-width: 240px;
|
||||
}
|
||||
.sb-renovation-popover select {
|
||||
max-width: 130px;
|
||||
}
|
||||
.sb-snap-head {
|
||||
font-weight: 600;
|
||||
opacity: 0.7;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.sb-renovation-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 5px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgba(0, 0, 0, 0.35);
|
||||
vertical-align: baseline;
|
||||
}
|
||||
.sb-renovation-existing {
|
||||
background: #a6a6a6;
|
||||
}
|
||||
.sb-renovation-demolish {
|
||||
background: #ffd800;
|
||||
}
|
||||
.sb-renovation-new {
|
||||
background: #e3001b;
|
||||
}
|
||||
.sb-toggle.sb-renovation-on {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ── Command-Line (Rhino-artig) — über der Statusleiste ──────────────────────
|
||||
Dunkle, ruhige Leiste mit Prompt links, klickbaren Inline-Optionen und einer
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface AppMenuBarProps {
|
||||
onNewProjectFromSample: () => void;
|
||||
onNewProjectFromComplexSample: () => void;
|
||||
onNewProjectFromWettbewerbSample: () => void;
|
||||
onNewProjectFromUmbauSample?: () => void;
|
||||
onNewProjectFromTemplate: () => void;
|
||||
onOpenProject: () => void;
|
||||
onSaveProject: () => void;
|
||||
@@ -75,6 +76,7 @@ export const AppMenuBar = memo(function AppMenuBar({
|
||||
onNewProjectFromSample,
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromTemplate,
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
@@ -111,6 +113,7 @@ export const AppMenuBar = memo(function AppMenuBar({
|
||||
{ label: t("file.newFromSample"), onSelect: onNewProjectFromSample },
|
||||
{ label: t("file.newFromComplexSample"), onSelect: onNewProjectFromComplexSample },
|
||||
{ label: t("file.newFromWettbewerbSample"), onSelect: onNewProjectFromWettbewerbSample },
|
||||
...(onNewProjectFromUmbauSample ? [{ label: t("file.newFromUmbauSample"), onSelect: onNewProjectFromUmbauSample }] : []),
|
||||
{ label: t("file.newFromTemplateFile"), onSelect: onNewProjectFromTemplate },
|
||||
{ divider: true },
|
||||
{ label: t("file.open"), onSelect: onOpenProject },
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
// [271] Umbau in der Statusleiste: zeigt den aktuellen Zeichen-Status (neue Bauteile tragen ihn) und den Umbaufilter der
|
||||
// aktiven Ansicht; das Popover stellt beides ein (Status und Etappe zum Zeichnen; Filter und Etappe der Ebene — wie die
|
||||
// Modelldarstellung ein Feld der Ebene, darum je Reiter/Ausschnitt eigen und mit Undo). Bei wenig Platz wandert es
|
||||
// mit der Pausfolie in „⋯“ ([263]).
|
||||
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { BUILTIN_RENOVATION_FILTERS, patchItem, renovationPhases, RENOVATION_STATUSES } from "../core";
|
||||
import type { RenovationStatus } from "../model/types";
|
||||
|
||||
/** Anzeigename eines Filters (eingebaut übersetzt, eigene mit ihrem Namen). */
|
||||
export function renovationFilterLabel(id: string, own: readonly { id: string; name: string }[]): string {
|
||||
if ((BUILTIN_RENOVATION_FILTERS as readonly string[]).includes(id)) return t(`renovation.filter.${id}` as TranslationKey);
|
||||
return own.find((f) => f.id === id)?.name ?? id;
|
||||
}
|
||||
|
||||
export function RenovationControl() {
|
||||
const project = useStore((s) => s.project);
|
||||
const activeLevelId = useStore((s) => s.activeLevelId);
|
||||
const draw = useStore((s) => s.drawRenovation);
|
||||
const setDraw = useStore((s) => s.setDrawRenovation);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const [open, setOpen] = useState(false);
|
||||
const wrapRef = useRef<HTMLSpanElement | null>(null);
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const onDown = (e: MouseEvent) => {
|
||||
if (wrapRef.current && !wrapRef.current.contains(e.target as Node)) setOpen(false);
|
||||
};
|
||||
const onKey = (e: KeyboardEvent) => e.key === "Escape" && setOpen(false);
|
||||
document.addEventListener("mousedown", onDown);
|
||||
document.addEventListener("keydown", onKey);
|
||||
return () => {
|
||||
document.removeEventListener("mousedown", onDown);
|
||||
document.removeEventListener("keydown", onKey);
|
||||
};
|
||||
}, [open]);
|
||||
const level = project.drawingLevels.find((l) => l.id === activeLevelId);
|
||||
const phases = renovationPhases(project);
|
||||
const own = useMemo(() => project.renovation?.filters ?? [], [project.renovation?.filters]);
|
||||
const filter = level?.renovationFilter ?? "";
|
||||
const levelEditable = !!level && (level.kind === "floor" || level.kind === "section" || level.kind === "elevation" || level.kind === "ceiling");
|
||||
const setLevel = (patch: { renovationFilter?: string; renovationPhase?: string }) => {
|
||||
if (!level) return;
|
||||
applyChange((p) =>
|
||||
patchItem(p, "drawingLevels", level.id, (l) => {
|
||||
const next = { ...l, ...patch };
|
||||
if (!next.renovationFilter) delete next.renovationFilter;
|
||||
if (!next.renovationPhase || !next.renovationFilter) delete next.renovationPhase;
|
||||
return next;
|
||||
}),
|
||||
);
|
||||
};
|
||||
const statusLabel = t(`renovation.status.${draw.status}` as TranslationKey);
|
||||
const filterLabel = filter ? renovationFilterLabel(filter, own) : t("renovation.filter.none");
|
||||
return (
|
||||
<span className="sb-snap-wrap" ref={wrapRef}>
|
||||
<button
|
||||
type="button"
|
||||
className={`sb-toggle${open ? " active" : ""}${filter ? " sb-renovation-on" : ""}`}
|
||||
data-testid="renovation-toggle"
|
||||
aria-haspopup="true"
|
||||
aria-expanded={open}
|
||||
title={t("renovation.status.hint", { status: statusLabel, filter: filterLabel })}
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
>
|
||||
<span className={`sb-renovation-dot sb-renovation-${draw.status}`} aria-hidden="true" />
|
||||
{t("renovation.short", { status: statusLabel })}
|
||||
</button>
|
||||
{open && (
|
||||
<div className="sb-snap-popover sb-renovation-popover" role="dialog" aria-label={t("renovation.title")} data-testid="renovation-panel">
|
||||
<div className="sb-snap-row sb-snap-head">{t("renovation.drawStatus")}</div>
|
||||
<label className="sb-snap-row sb-snap-row-num">
|
||||
<span>{t("renovation.label")}</span>
|
||||
<select
|
||||
value={draw.status}
|
||||
aria-label={t("renovation.drawStatus")}
|
||||
data-testid="renovation-draw-status"
|
||||
onChange={(e) => setDraw(e.target.value as RenovationStatus, draw.phase)}
|
||||
>
|
||||
{RENOVATION_STATUSES.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{t(`renovation.status.${s}` as TranslationKey)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{phases.length > 0 && (
|
||||
<label className="sb-snap-row sb-snap-row-num">
|
||||
<span>{t("renovation.phase")}</span>
|
||||
<select value={draw.phase ?? ""} aria-label={t("renovation.phase")} onChange={(e) => setDraw(draw.status, e.target.value || undefined)}>
|
||||
<option value="">{t("renovation.phase.none")}</option>
|
||||
{phases.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<div className="sb-snap-row sb-snap-head">{t("renovation.filter")}</div>
|
||||
<label className="sb-snap-row sb-snap-row-num">
|
||||
<span>{t("renovation.filter")}</span>
|
||||
<select
|
||||
value={filter}
|
||||
disabled={!levelEditable}
|
||||
aria-label={t("renovation.filter")}
|
||||
data-testid="renovation-filter"
|
||||
onChange={(e) => setLevel({ renovationFilter: e.target.value || undefined, renovationPhase: level?.renovationPhase })}
|
||||
>
|
||||
<option value="">{t("renovation.filter.none")}</option>
|
||||
{BUILTIN_RENOVATION_FILTERS.map((id) => (
|
||||
<option key={id} value={id}>
|
||||
{t(`renovation.filter.${id}` as TranslationKey)}
|
||||
</option>
|
||||
))}
|
||||
{own.map((f) => (
|
||||
<option key={f.id} value={f.id}>
|
||||
{f.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{phases.length > 0 && filter && (
|
||||
<label className="sb-snap-row sb-snap-row-num">
|
||||
<span>{t("renovation.filterPhase")}</span>
|
||||
<select
|
||||
value={level?.renovationPhase ?? ""}
|
||||
aria-label={t("renovation.filterPhase")}
|
||||
onChange={(e) => setLevel({ renovationFilter: filter, renovationPhase: e.target.value || undefined })}
|
||||
>
|
||||
<option value="">{t("renovation.phase.all")}</option>
|
||||
{phases.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -46,6 +46,8 @@ import { ViewTemplatesTab } from "./resourceManager/ViewTemplatesTab";
|
||||
import type { ViewTemplateHandlers } from "./resourceManager/ViewTemplatesTab";
|
||||
import { ModelViewsTab } from "./resourceManager/ModelViewsTab";
|
||||
import type { ModelViewHandlers } from "./resourceManager/ModelViewsTab";
|
||||
import { RenovationTab } from "./resourceManager/RenovationTab";
|
||||
import type { RenovationHandlers } from "./resourceManager/RenovationTab";
|
||||
import { PenSetsTab } from "./resourceManager/PenSetsTab";
|
||||
import { PalettesTab } from "./resourceManager/PalettesTab";
|
||||
import { TextStylesTab } from "./resourceManager/TextStylesTab";
|
||||
@@ -69,6 +71,7 @@ export type TabId =
|
||||
| "overrides"
|
||||
| "viewTemplates"
|
||||
| "modelViews"
|
||||
| "renovation"
|
||||
| "pens"
|
||||
| "palettes";
|
||||
|
||||
@@ -89,10 +92,11 @@ const TABS: { id: TabId; labelKey: string }[] = [
|
||||
{ id: "overrides", labelKey: "resources.tab.overrides" },
|
||||
{ id: "viewTemplates", labelKey: "resources.tab.viewTemplates" },
|
||||
{ id: "modelViews", labelKey: "resources.tab.modelViews" },
|
||||
{ id: "renovation", labelKey: "resources.tab.renovation" },
|
||||
];
|
||||
|
||||
/** Bündel der immutablen Mutationen (von App über setProject bereitgestellt). */
|
||||
export interface ResourceManagerHandlers extends ViewTemplateHandlers, ModelViewHandlers {
|
||||
export interface ResourceManagerHandlers extends ViewTemplateHandlers, ModelViewHandlers, RenovationHandlers {
|
||||
onPatchComponent: (id: string, patch: Partial<Component>) => void;
|
||||
onAddComponent: () => void;
|
||||
onDeleteComponent: (id: string) => void;
|
||||
@@ -491,6 +495,7 @@ export function ResourceManager({
|
||||
{tab === "materials" && <MaterialsTab />}
|
||||
{tab === "viewTemplates" && <ViewTemplatesTab project={project} handlers={handlers} />}
|
||||
{tab === "modelViews" && <ModelViewsTab project={project} handlers={handlers} />}
|
||||
{tab === "renovation" && <RenovationTab project={project} handlers={handlers} />}
|
||||
{tab === "overrides" && (
|
||||
<OverridesTab
|
||||
project={project}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { useEffect, useLayoutEffect, useRef, useState, memo } from "react";
|
||||
import type { SnapSettings } from "../tools/types";
|
||||
import { t } from "../i18n";
|
||||
import { TraceControl } from "./TraceControl";
|
||||
import { RenovationControl } from "./RenovationControl";
|
||||
import { BUILD_INFO, formatBuildShort } from "../update/buildInfo";
|
||||
|
||||
export interface StatusBarProps {
|
||||
@@ -424,7 +425,7 @@ export const StatusBar = memo(function StatusBar({
|
||||
const pickHint = usePickHint();
|
||||
// [263] Schriftbreite ist nicht planbar (Ersatzschriften je System): passt der Cluster nicht, wird er nach Priorität
|
||||
// gekürzt — nie abgeschnitten. Stufe 1: Beschriftungen weg (nur Werte, Tooltip bleibt) · 2: Einheit und Build weg ·
|
||||
// 3: Linien-Darstellung nach „⋯“ · 4: Pausfolie nach „⋯“ · 5: Fang und Referenzlinien nach „⋯“.
|
||||
// 3: Linien-Darstellung nach „⋯“ · 4: Pausfolie und Umbau ([271]) nach „⋯“ · 5: Fang und Referenzlinien nach „⋯“.
|
||||
const footerRef = useRef<HTMLElement | null>(null);
|
||||
const clusterRef = useRef<HTMLDivElement | null>(null);
|
||||
const innerRef = useRef<HTMLSpanElement | null>(null);
|
||||
@@ -486,6 +487,7 @@ export const StatusBar = memo(function StatusBar({
|
||||
<LineModeToggle lineMode={lineMode} onLineModeChange={onLineModeChange} lineModeEnabled={lineModeEnabled} />
|
||||
);
|
||||
const traceEl = <TraceControl enabled={!!traceEnabled} onRunCommand={onRunCommand} />;
|
||||
const renovationEl = <RenovationControl />;
|
||||
const snapEl = <SnapControl snap={snap} onSnapChange={onSnapChange} />;
|
||||
const refEl = (
|
||||
<button
|
||||
@@ -502,7 +504,7 @@ export const StatusBar = memo(function StatusBar({
|
||||
// Was in „⋯“ wandert (Reihenfolge = Wegfall-Priorität von oben nach unten).
|
||||
const inMore: React.ReactNode[] = [];
|
||||
if (level >= 3) inMore.push(<span key="lm">{lineModeEl}</span>);
|
||||
if (level >= 4) inMore.push(<span key="tr">{traceEl}</span>);
|
||||
if (level >= 4) inMore.push(<span key="tr">{traceEl}</span>, <span key="ren">{renovationEl}</span>);
|
||||
if (level >= 5) {
|
||||
inMore.push(<span key="sn">{snapEl}</span>, <span key="rf">{refEl}</span>);
|
||||
}
|
||||
@@ -531,6 +533,8 @@ export const StatusBar = memo(function StatusBar({
|
||||
<>
|
||||
{traceEl}
|
||||
<Sep />
|
||||
{renovationEl}
|
||||
<Sep />
|
||||
</>
|
||||
)}
|
||||
{level < 5 && (
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// [271] Ressourcen-Tab „Umbau“: Etappen (Name, Reihenfolge, hinzufügen/entfernen) und Umbau-Farben je Status
|
||||
// (Füllung, Linie, gestrichelt; Vorgabe SIA 400: Bestand grau, Abbruch gelb gestrichelt, Neu rot).
|
||||
// Reine Darstellung über Handler (wie die anderen Tabs, auch im macOS-Nebenfenster).
|
||||
|
||||
import { t } from "../../i18n";
|
||||
import type { TranslationKey } from "../../i18n";
|
||||
import type { Project, RenovationPhase, RenovationStatus, RenovationStyle, RenovationStyles } from "../../model/types";
|
||||
import { DEFAULT_RENOVATION_STYLES, newPhaseId, RENOVATION_STATUSES, renovationPhases } from "../../core";
|
||||
|
||||
export interface RenovationHandlers {
|
||||
/** Etappen-Liste ersetzen (Elemente einer entfernten Etappe verlieren sie). */
|
||||
onSetRenovationPhases?: (phases: RenovationPhase[]) => void;
|
||||
/** Umbau-Farben ersetzen (`undefined` = SIA-Vorgabe). */
|
||||
onSetRenovationStyles?: (styles: RenovationStyles | undefined) => void;
|
||||
}
|
||||
|
||||
export function RenovationTab({ project, handlers }: { project: Project; handlers: RenovationHandlers }) {
|
||||
const phases = renovationPhases(project);
|
||||
const styles = project.renovation?.styles ?? {};
|
||||
const setPhases = handlers.onSetRenovationPhases;
|
||||
const setStyles = handlers.onSetRenovationStyles;
|
||||
const move = (i: number, d: number) => {
|
||||
const j = i + d;
|
||||
if (!setPhases || j < 0 || j >= phases.length) return;
|
||||
const next = [...phases];
|
||||
[next[i], next[j]] = [next[j], next[i]];
|
||||
setPhases(next);
|
||||
};
|
||||
const patchStyle = (s: RenovationStatus, patch: Partial<RenovationStyle> | null) => {
|
||||
if (!setStyles) return;
|
||||
const next: RenovationStyles = { ...styles };
|
||||
if (patch === null) delete next[s];
|
||||
else next[s] = { ...(styles[s] ?? {}), ...patch };
|
||||
setStyles(Object.keys(next).length ? next : undefined);
|
||||
};
|
||||
return (
|
||||
<div className="rm-renovation" data-testid="rm-renovation">
|
||||
<h4 className="rm-subhead">{t("renovation.phases.title")}</h4>
|
||||
<p className="rm-hint">{t("renovation.phases.hint")}</p>
|
||||
{phases.length === 0 && <div className="rm-empty">{t("renovation.phases.empty")}</div>}
|
||||
{phases.map((ph, i) => (
|
||||
<div className="rm-row" key={ph.id} data-testid="rm-renovation-phase">
|
||||
<input
|
||||
type="text"
|
||||
value={ph.name}
|
||||
aria-label={t("renovation.phase")}
|
||||
disabled={!setPhases}
|
||||
onChange={(e) => setPhases?.(phases.map((x) => (x.id === ph.id ? { ...x, name: e.target.value } : x)))}
|
||||
/>
|
||||
<button type="button" className="rm-icon-btn" disabled={!setPhases || i === 0} title={t("renovation.phases.up")} aria-label={t("renovation.phases.up")} onClick={() => move(i, -1)}>
|
||||
▲
|
||||
</button>
|
||||
<button type="button" className="rm-icon-btn" disabled={!setPhases || i === phases.length - 1} title={t("renovation.phases.down")} aria-label={t("renovation.phases.down")} onClick={() => move(i, 1)}>
|
||||
▼
|
||||
</button>
|
||||
<button type="button" className="rm-icon-btn" disabled={!setPhases} title={t("renovation.phases.remove")} aria-label={t("renovation.phases.remove")} onClick={() => setPhases?.(phases.filter((x) => x.id !== ph.id))}>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
className="rm-add-btn"
|
||||
disabled={!setPhases}
|
||||
data-testid="rm-renovation-add-phase"
|
||||
onClick={() => setPhases?.([...phases, { id: newPhaseId(project), name: t("renovation.phases.defaultName", { n: String(phases.length + 1) }) }])}
|
||||
>
|
||||
{t("renovation.phases.add")}
|
||||
</button>
|
||||
|
||||
<h4 className="rm-subhead">{t("renovation.styles.title")}</h4>
|
||||
<p className="rm-hint">{t("renovation.styles.hint")}</p>
|
||||
{RENOVATION_STATUSES.map((s) => {
|
||||
const d = DEFAULT_RENOVATION_STYLES[s];
|
||||
const own = styles[s] ?? {};
|
||||
return (
|
||||
<div className="rm-row" key={s} data-testid={`rm-renovation-style-${s}`}>
|
||||
<span className="rm-label">{t(`renovation.status.${s}` as TranslationKey)}</span>
|
||||
<label className="rm-inline">
|
||||
{t("renovation.styles.fill")}
|
||||
<input type="color" value={own.fill ?? d.fill} disabled={!setStyles} onChange={(e) => patchStyle(s, { fill: e.target.value })} />
|
||||
</label>
|
||||
<label className="rm-inline">
|
||||
{t("renovation.styles.line")}
|
||||
<input type="color" value={own.line ?? d.line ?? "#000000"} disabled={!setStyles} onChange={(e) => patchStyle(s, { line: e.target.value })} />
|
||||
</label>
|
||||
<label className="rm-inline">
|
||||
<input type="checkbox" checked={own.dashed ?? d.dashed} disabled={!setStyles} onChange={(e) => patchStyle(s, { dashed: e.target.checked })} />
|
||||
{t("renovation.styles.dashed")}
|
||||
</label>
|
||||
<button type="button" className="rm-icon-btn" disabled={!setStyles || !styles[s]} title={t("renovation.styles.reset")} aria-label={t("renovation.styles.reset")} onClick={() => patchStyle(s, null)}>
|
||||
↺
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -30,6 +30,7 @@ export type TopBarEvents = Required<
|
||||
| "onNewProjectFromSample"
|
||||
| "onNewProjectFromComplexSample"
|
||||
| "onNewProjectFromWettbewerbSample"
|
||||
| "onNewProjectFromUmbauSample"
|
||||
| "onNewProjectFromTemplate"
|
||||
| "onOpenProject"
|
||||
| "onSaveProject"
|
||||
@@ -133,6 +134,7 @@ export function useTopBarElements(opts: {
|
||||
onNewProjectFromSample={ev.onNewProjectFromSample}
|
||||
onNewProjectFromComplexSample={ev.onNewProjectFromComplexSample}
|
||||
onNewProjectFromWettbewerbSample={ev.onNewProjectFromWettbewerbSample}
|
||||
onNewProjectFromUmbauSample={ev.onNewProjectFromUmbauSample}
|
||||
onNewProjectFromTemplate={ev.onNewProjectFromTemplate}
|
||||
onOpenProject={ev.onOpenProject}
|
||||
onSaveProject={ev.onSaveProject}
|
||||
|
||||
@@ -621,15 +621,22 @@ export function Wasm3DViewport({
|
||||
const greyKey = (greyCodes ?? []).join("\u0001");
|
||||
const greyFloorsKey = (greyFloors ?? []).join("\u0001");
|
||||
const lockKey = (lockedCodes ?? []).join("\u0001");
|
||||
// [271] Umbaufilter der aktiven Ebene (wie im Grundriss): Ausgeblendetes fehlt, Bauteile in der Umbau-Farbe.
|
||||
const renKey = useStore((s) => {
|
||||
const l = s.project.drawingLevels.find((x) => x.id === s.activeLevelId);
|
||||
return l?.renovationFilter ? `${l.renovationFilter}\u0001${l.renovationPhase ?? ""}` : "";
|
||||
});
|
||||
const hide = useMemo<Hide3d>(() => {
|
||||
const split = (k: string) => (k ? k.split("\u0001") : []);
|
||||
const codes = split(hiddenKey);
|
||||
const floors = split(floorsKey);
|
||||
const dim = { grey: split(greyKey), lock: split(lockKey), greyFloors: split(greyFloorsKey) };
|
||||
return onlyIds || hiddenIds.length || floors.length || dim.grey.length || dim.lock.length || dim.greyFloors.length
|
||||
? toFilter3d({ only: onlyIds, hidden: hiddenIds }, codes, floors, dim)
|
||||
const [renovation, renovationPhase] = split(renKey);
|
||||
const ren = renovation ? { renovation, ...(renovationPhase ? { renovationPhase } : {}) } : {};
|
||||
return onlyIds || hiddenIds.length || floors.length || dim.grey.length || dim.lock.length || dim.greyFloors.length || renovation
|
||||
? { ...toFilter3d({ only: onlyIds, hidden: hiddenIds }, codes, floors, dim), ...ren }
|
||||
: codes;
|
||||
}, [hiddenKey, floorsKey, greyKey, greyFloorsKey, lockKey, onlyIds, hiddenIds]);
|
||||
}, [hiddenKey, floorsKey, greyKey, greyFloorsKey, lockKey, onlyIds, hiddenIds, renKey]);
|
||||
const hideRef = useRef(hide);
|
||||
hideRef.current = hide;
|
||||
// Versatz je Geschoss ([65]) für Griffe und gezogene Höhen (Modell bleibt unversetzt).
|
||||
|
||||
Reference in new issue
Block a user