Merge [272] Varianten (mit Umbau-Panel zusammengeführt, Import selectionRenovationIds aus state/renovationHook)
This commit is contained in:
73 files changed
+2979
-100
No files matched your search
@@ -579,7 +579,11 @@ export function createProjectSlice(
|
||||
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;
|
||||
const req1 = dr && (dr.status !== "existing" || dr.phase) ? { ...req0, renovation: dr } : req0;
|
||||
// [272] Aktuelle Zeichen-Variante: neue Elemente der Zeichenbefehle gehören ihr (`design_options::stamp_ops`).
|
||||
const dopt = (get() as unknown as { drawDesignOption?: { set: string; option: string } | null }).drawDesignOption;
|
||||
const known = dopt && get().project.designOptionSets?.some((s) => s.id === dopt.set && s.options.some((o) => o.id === dopt.option));
|
||||
const req = known ? { ...req1, designOption: dopt } : req1;
|
||||
if (forwarded(() => storeDocument(get().project).cmdOps(req), coalesceKey)) return;
|
||||
let notice: string | undefined;
|
||||
set((s) => {
|
||||
|
||||
@@ -62,8 +62,12 @@ declare global {
|
||||
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>;
|
||||
/** [272] Öffnungs-Ids im Grundriss der aktiven Ebene (alle Klassen, 1:100). */
|
||||
planOpeningIds: () => string[];
|
||||
/** [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> };
|
||||
/** [272] Varianten: Kombination der aktiven Ebene, Zeichen-Variante, Variante je Element (`set/option`, leer = Hauptmodell), Sätze. */
|
||||
designOptions: () => { level: Record<string, string>; draw: string | null; elements: Record<string, string>; sets: 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. */
|
||||
@@ -157,6 +161,23 @@ 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;
|
||||
},
|
||||
planOpeningIds: () => {
|
||||
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 ids = new Set<string>();
|
||||
for (const q of generatePlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, true, 100).primitives) {
|
||||
const o = (q as { openingId?: string }).openingId;
|
||||
if (o) ids.add(o);
|
||||
}
|
||||
return [...ids].sort();
|
||||
},
|
||||
planFillColors: () => {
|
||||
const s = getState();
|
||||
const codes = new Set<string>();
|
||||
@@ -174,6 +195,15 @@ export function installTestHooks(): void {
|
||||
}
|
||||
return out;
|
||||
},
|
||||
designOptions: () => {
|
||||
const s = getState();
|
||||
const l = s.project.drawingLevels.find((x) => x.id === s.activeLevelId);
|
||||
const elements: Record<string, string> = {};
|
||||
for (const list of [s.project.walls, s.project.openings, s.project.roofs, s.project.ceilings, s.project.rooms]) {
|
||||
for (const e of (list ?? []) as { id: string; designOption?: { set: string; option: string } }[]) elements[e.id] = e.designOption ? `${e.designOption.set}/${e.designOption.option}` : "";
|
||||
}
|
||||
return { level: l?.designOptions ?? {}, draw: s.drawDesignOption ? `${s.drawDesignOption.set}/${s.drawDesignOption.option}` : null, elements, sets: (s.project.designOptionSets ?? []).map((x) => x.id) };
|
||||
},
|
||||
renovation: () => {
|
||||
const s = getState();
|
||||
const l = s.project.drawingLevels.find((x) => x.id === s.activeLevelId);
|
||||
|
||||
@@ -90,6 +90,7 @@ export function useNativeMenu(opts: {
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromVariantenSample,
|
||||
onNewProjectFromTemplate,
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
@@ -121,6 +122,7 @@ export function useNativeMenu(opts: {
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromVariantenSample,
|
||||
onNewProjectFromTemplate,
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
|
||||
@@ -51,6 +51,7 @@ import { withNewProjectNames } from "../model/newProjectNames";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { buildWettbewerbSampleProject } from "../model/sampleProjectWettbewerb";
|
||||
import { buildUmbauSampleProject } from "../model/sampleProjectUmbau";
|
||||
import { buildVariantenSampleProject } from "../model/sampleProjectVarianten";
|
||||
import { withStandards } from "../model/standards";
|
||||
import type { Project } from "../model/types";
|
||||
import type { PlanViewHandle } from "../views/plan/PlanView";
|
||||
@@ -578,6 +579,13 @@ export function useProjectFileActions(
|
||||
getState().loadProject(next);
|
||||
lastSavedProjectRef.current = next;
|
||||
});
|
||||
// [272] „Neu aus Vorlage: Beispiel Varianten" — Demo-Haus mit den Sätzen Dachform (Flach-/Satteldach) und Fassade.
|
||||
const onNewProjectFromVariantenSample = () => guardDiscard(() => {
|
||||
releaseCurrentProjectLock();
|
||||
const next = buildVariantenSampleProject();
|
||||
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 = () => {
|
||||
@@ -923,6 +931,7 @@ export function useProjectFileActions(
|
||||
onNewProjectFromComplexSample,
|
||||
onNewProjectFromWettbewerbSample,
|
||||
onNewProjectFromUmbauSample,
|
||||
onNewProjectFromVariantenSample,
|
||||
onNewProjectFromTemplate,
|
||||
onProjectTemplateFileChosen,
|
||||
releaseCurrentProjectLock,
|
||||
|
||||
@@ -18,7 +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";
|
||||
import { setField, setPhasesOps, addDesignOptionSetOps, renameDesignOptionSetOps, addDesignOptionOps, renameDesignOptionOps, setPrimaryOptionOps, acceptDesignOptionOps, deleteDesignOptionOps } from "../core";
|
||||
|
||||
type TopBar = ReturnType<typeof useTopBarState>;
|
||||
type Dialogs = ReturnType<typeof useDialogState>;
|
||||
@@ -145,6 +145,14 @@ export function useResourceHandlers(opts: {
|
||||
else delete next.styles;
|
||||
return [setField("renovation", Object.keys(next).length ? next : undefined)];
|
||||
}),
|
||||
// [272] Varianten (Ressourcen-Tab „Varianten“): Sätze/Varianten, Hauptvariante, Übernehmen, Löschen (je ein Undo-Schritt).
|
||||
onAddDesignOptionSet: (name) => applyChange((p) => addDesignOptionSetOps(p, name).ops),
|
||||
onRenameDesignOptionSet: (setId, name) => applyChange((p) => renameDesignOptionSetOps(p, setId, name), `dopt-set-${setId}`),
|
||||
onAddDesignOption: (setId) => applyChange((p) => addDesignOptionOps(p, setId)),
|
||||
onRenameDesignOption: (setId, optionId, name) => applyChange((p) => renameDesignOptionOps(p, setId, optionId, name), `dopt-${setId}-${optionId}`),
|
||||
onSetPrimaryDesignOption: (setId, optionId) => applyChange((p) => setPrimaryOptionOps(p, setId, optionId)),
|
||||
onAcceptDesignOption: (setId, optionId) => applyChange((p) => acceptDesignOptionOps(p, setId, optionId)),
|
||||
onDeleteDesignOption: (setId, optionId) => applyChange((p) => deleteDesignOptionOps(p, setId, optionId)),
|
||||
onPatchComponent: patchComponent,
|
||||
onPatchWallType: patchWallType,
|
||||
onAddWallType: addWallType,
|
||||
|
||||
@@ -27,6 +27,12 @@ export interface ViewSlice {
|
||||
*/
|
||||
drawRenovation: { status: RenovationStatus; phase?: string };
|
||||
setDrawRenovation: (status: RenovationStatus, phase?: string) => void;
|
||||
/**
|
||||
* [272] Aktuelle Zeichen-Variante: neue Elemente der Zeichenbefehle gehören ihr (`null` = Hauptmodell). Zustand der
|
||||
* Sitzung, kein Undo-Schritt.
|
||||
*/
|
||||
drawDesignOption: { set: string; option: string } | null;
|
||||
setDrawDesignOption: (target: { set: string; option: string } | null) => void;
|
||||
// Ansichtstyp (Grundriss / Perspektive).
|
||||
viewType: ViewType;
|
||||
// Zuletzt gewählter Ansichtstyp je Zeichnungsebene — jeder Tab merkt sich
|
||||
@@ -100,6 +106,8 @@ export function createViewSlice(api: StoreApi<ViewSlice>): ViewSlice {
|
||||
activeLevelId: sampleProject.drawingLevels[0].id,
|
||||
drawRenovation: { status: "existing" },
|
||||
setDrawRenovation: (status, phase) => set({ drawRenovation: phase ? { status, phase } : { status } }),
|
||||
drawDesignOption: null,
|
||||
setDrawDesignOption: (target) => set({ drawDesignOption: target }),
|
||||
viewType: "grundriss",
|
||||
viewTypeByLevel: {},
|
||||
detail: "mittel",
|
||||
|
||||
Reference in new issue
Block a user