diff --git a/src/App.tsx b/src/App.tsx index 2e3593ac..70850913 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -937,6 +937,7 @@ export default function App() { addDrawing, addSection, addElevation, + addCeiling, addCategory, patchCategory, addSubCategory, @@ -1644,7 +1645,7 @@ export default function App() { // das Handle ist null, Aktionen sind No-Ops). const planActive = activeLevel.kind === "floor" && viewType === "grundriss"; // 3D gibt es aus Geschoss, Schnitt und Ansicht ([115]); eine freie Zeichnung hat keine Höhe. - const has3dView = activeLevel.kind !== "drawing"; + const has3dView = activeLevel.kind !== "drawing" && activeLevel.kind !== "ceiling"; // Start-Protokoll: war der letzte Lauf unsauber beendet, kurz darauf hinweisen (Autosave sichert // die Daten); beim Schliessen die Sitzung als sauber markieren. useEffect(() => { @@ -1746,6 +1747,7 @@ export default function App() { onAddFloor: addFloor, onAddSection: addSection, onAddElevation: addElevation, + onAddCeiling: addCeiling, onAddDrawing: addDrawing, onSetDisplayMode: (mode) => setModeFor(BUILTIN_PANEL_IDS.drawingLevels, mode), }, @@ -1964,6 +1966,7 @@ export default function App() { addDrawing, addSection, addElevation, + addCeiling, addCategory, snapshotLayerVisibility, applyLayerVisibility, diff --git a/src/cli/main.ts b/src/cli/main.ts index 3a41fa75..75c23c80 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -5,7 +5,7 @@ // dossier-cli info // dossier-cli validate // dossier-cli migrate [--out neu.obp] -// dossier-cli plan [--level EG] [--scale 100] [--sketch] [--hatch] [--format svg|json] [--out eg.svg] +// dossier-cli plan [--level EG] [--ceiling] [--scale 100] [--sketch] [--hatch] [--format svg|json] [--out eg.svg] // json = render2d-Szene (planToRenderScene) // dossier-cli section [--sketch] [--hatch] [--out schnitt.svg] (--format json: render2d-Szene) // dossier-cli elevation [--sketch] [--hatch] [--out ansicht.svg] (--sketch: Skizzenstil [67]) @@ -595,10 +595,18 @@ async function execute(project: Project, file: string, command: string, rest: st return 0; case "plan": { // Geschosse und freie 2D-Zeichnungsebenen (z. B. das Blatt „Raumprogramm"). - const lvl = findLevel(project, ["floor", "drawing"], args.flags.get("level")); + let planProject = project; + let lvl = findLevel(project, ["floor", "drawing", "ceiling"], args.flags.get("level")); if (!lvl) fail(`Geschoss nicht gefunden: ${args.flags.get("level") ?? "(erstes)"}`); + // `--ceiling` ([100]): Deckenspiegel des Geschosses (vorhandene Ebene, sonst vorübergehend angelegt). + if (args.flags.has("ceiling") && lvl.kind === "floor") { + const floorId = lvl.id; + const own = project.drawingLevels.find((l) => l.kind === "ceiling" && l.ceilingOfId === floorId); + lvl = own ?? { id: `ceiling-${floorId}`, name: `Deckenspiegel ${lvl.name}`, kind: "ceiling", visible: true, locked: false, ceilingOfId: floorId }; + if (!own) planProject = { ...project, drawingLevels: [...project.drawingLevels, lvl] }; + } // Massstab geht in die Plan-Erzeugung ein (Bemassung in Papier-mm, Strichstärken nach Massstab). - const plan = generatePlan(withSketch(project, lvl.id, args), lvl.id, allCodes, undefined, "mittel", false, false, true, scale); + const plan = generatePlan(withSketch(planProject, lvl.id, args), lvl.id, allCodes, undefined, "mittel", false, false, true, scale); if (args.flags.get("format") === "json") { out(args, JSON.stringify(planToRenderScene(plan, scale)), `${lvl.name}.scene.json`); return 0; diff --git a/src/i18n/de.ts b/src/i18n/de.ts index f6e813c2..dba5d0b8 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -922,6 +922,7 @@ export const de = { "levels.addFloor": "+ Geschoss", "levels.addSection": "+ Schnitt", "levels.addElevation": "+ Ansicht", + "levels.addCeiling": "+ Deckenspiegel", "levels.addDrawing": "+ Zeichnung", "layers.addCategory": "+ Ebene", @@ -929,6 +930,7 @@ export const de = { "levelCat.floor": "Geschosse", "levelCat.section": "Schnitte", "levelCat.elevation": "Ansichten", + "levelCat.ceiling": "Deckenspiegel", "levelCat.drawing": "2D-Zeichnungen", "levelCat.collapse": "Kategorie ein-/ausklappen", "nav.visibility": "Sichtbarkeit", @@ -943,6 +945,7 @@ export const de = { "badge.floor": "Geschoss", "badge.section": "Schnitt", "badge.elevation": "Ansicht", + "badge.ceiling": "Deckenspiegel", "badge.drawing": "Zeichnung", // ── Darstellungsmodus-Umschalter ───────────────────────────────────────── @@ -1029,6 +1032,7 @@ export const de = { "editor.viewTop": "Oberkante Sicht", "editor.viewBottom": "Unterkante Sicht", "editor.viewDepth": "Darunter sichtbar bis", + "editor.ceilingOf": "Deckenspiegel von", "editor.sectionDepth": "Sichttiefe", "editor.sectionDepth.hint": "Bauteile weiter hinter der Schnitt-/Ansichtsebene entfallen in der Projektion (leer = unbegrenzt).", "editor.unit.mm": "mm", @@ -1066,6 +1070,7 @@ export const de = { "default.floorName": "Geschoss {n}", "default.sectionName": "Schnitt {n}", "default.elevationName": "Ansicht {n}", + "default.ceilingName": "Deckenspiegel {floor}", "default.drawingName": "Zeichnung {n}", "default.categoryName": "Neue Ebene", "default.subCategoryName": "Neue Sub-Ebene", @@ -2180,6 +2185,7 @@ export const de = { "import.badge.floor": "Geschoss", "import.badge.section": "Schnitt", "import.badge.elevation": "Ansicht", + "import.badge.ceiling": "Deckenspiegel", "import.badge.drawing": "Zeichnung", // ── PDF-Export ─────────────────────────────────────────────────────────── diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 7cc3d00f..5101b0d0 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -917,6 +917,7 @@ export const en: Record = { "levels.addFloor": "+ Floor", "levels.addSection": "+ Section", "levels.addElevation": "+ Elevation", + "levels.addCeiling": "+ Reflected ceiling plan", "levels.addDrawing": "+ Drawing", "layers.addCategory": "+ Layer", @@ -924,6 +925,7 @@ export const en: Record = { "levelCat.floor": "Floors", "levelCat.section": "Sections", "levelCat.elevation": "Elevations", + "levelCat.ceiling": "Reflected ceiling plans", "levelCat.drawing": "2D drawings", "levelCat.collapse": "Collapse/expand category", "nav.visibility": "Visibility", @@ -938,6 +940,7 @@ export const en: Record = { "badge.floor": "Floor", "badge.section": "Section", "badge.elevation": "Elevation", + "badge.ceiling": "RCP", "badge.drawing": "Drawing", // Display mode select. @@ -1023,6 +1026,7 @@ export const en: Record = { "editor.viewTop": "View top", "editor.viewBottom": "View bottom", "editor.viewDepth": "Visible below down to", + "editor.ceilingOf": "Ceiling plan of", "editor.sectionDepth": "View depth", "editor.sectionDepth.hint": "Elements farther behind the section/view plane are not projected (empty = unlimited).", "editor.unit.mm": "mm", @@ -1060,6 +1064,7 @@ export const en: Record = { "default.floorName": "Floor {n}", "default.sectionName": "Section {n}", "default.elevationName": "Elevation {n}", + "default.ceilingName": "Reflected ceiling plan {floor}", "default.drawingName": "Drawing {n}", "default.categoryName": "New layer", "default.subCategoryName": "New sub-layer", @@ -2168,6 +2173,7 @@ export const en: Record = { "import.badge.floor": "Floor", "import.badge.section": "Section", "import.badge.elevation": "Elevation", + "import.badge.ceiling": "RCP", "import.badge.drawing": "Drawing", // PDF export. diff --git a/src/menus/InlineEditors.tsx b/src/menus/InlineEditors.tsx index ca49a647..fd062e3a 100644 --- a/src/menus/InlineEditors.tsx +++ b/src/menus/InlineEditors.tsx @@ -271,6 +271,24 @@ export function LevelInlineEditor({ ))} )} + {/* Deckenspiegel ([100]): Geschoss, dessen Untersicht gezeigt wird. */} + {level.kind === "ceiling" && ( + + + + )} {/* Sichttiefe ([36]) für Schnitt/Ansicht: leer = unbegrenzt (Darstellung wie bisher). */} {(level.kind === "section" || level.kind === "elevation") && ( @@ -293,7 +311,7 @@ export function LevelInlineEditor({ )} {!isFloor && (
- {level.kind === "drawing" + {level.kind === "drawing" || level.kind === "ceiling" ? t("editor.noHeightDrawing") : t("editor.noHeightSection")}
diff --git a/src/native/DrawingLevelsWindowApp.tsx b/src/native/DrawingLevelsWindowApp.tsx index 27d0a770..0e155f2a 100644 --- a/src/native/DrawingLevelsWindowApp.tsx +++ b/src/native/DrawingLevelsWindowApp.tsx @@ -29,6 +29,7 @@ export function DrawingLevelsWindowApp() { const [collapsed, setCollapsed] = useState>({ floor: false, section: false, + ceiling: false, elevation: false, drawing: false, }); @@ -91,6 +92,7 @@ export function DrawingLevelsWindowApp() { floor: handlers.onAddFloor, section: handlers.onAddSection, elevation: handlers.onAddElevation, + ceiling: handlers.onAddCeiling, drawing: handlers.onAddDrawing, }; diff --git a/src/native/drawingLevelsWindow.ts b/src/native/drawingLevelsWindow.ts index 2abccdef..5cb075cc 100644 --- a/src/native/drawingLevelsWindow.ts +++ b/src/native/drawingLevelsWindow.ts @@ -36,6 +36,7 @@ export interface DrawingLevelsCommandHandlers { onAddFloor: () => void; onAddSection: () => void; onAddElevation: () => void; + onAddCeiling: () => void; onAddDrawing: () => void; onSetDisplayMode: (mode: DisplayMode) => void; } diff --git a/src/panels/DrawingLevelsPanel.tsx b/src/panels/DrawingLevelsPanel.tsx index 14326df5..9b264f33 100644 --- a/src/panels/DrawingLevelsPanel.tsx +++ b/src/panels/DrawingLevelsPanel.tsx @@ -30,6 +30,7 @@ const KIND_BADGE_KEY: Record = { floor: "badge.floor", section: "badge.section", elevation: "badge.elevation", + ceiling: "badge.ceiling", drawing: "badge.drawing", }; @@ -39,6 +40,7 @@ export const CATEGORY_ORDER: DrawingLevelKind[] = [ "floor", "section", "elevation", + "ceiling", "drawing", ]; @@ -47,6 +49,7 @@ export const CATEGORY_TITLE_KEY: Record = { floor: "levelCat.floor", section: "levelCat.section", elevation: "levelCat.elevation", + ceiling: "levelCat.ceiling", drawing: "levelCat.drawing", }; @@ -55,6 +58,7 @@ export const CATEGORY_ADD_KEY: Record = { floor: "levels.addFloor", section: "levels.addSection", elevation: "levels.addElevation", + ceiling: "levels.addCeiling", drawing: "levels.addDrawing", }; @@ -65,7 +69,7 @@ export function DrawingLevelsPanel() { // Auf-/Zu-Zustand je Kategorie, lokal — Default: alle aufgeklappt. const [collapsed, setCollapsed] = useState>( - { floor: false, section: false, elevation: false, drawing: false }, + { floor: false, section: false, elevation: false, ceiling: false, drawing: false }, ); const toggleCategory = (kind: DrawingLevelKind) => setCollapsed((c) => ({ ...c, [kind]: !c[kind] })); @@ -74,6 +78,7 @@ export function DrawingLevelsPanel() { floor: host.onAddFloor, section: host.onAddSection, elevation: host.onAddElevation, + ceiling: host.onAddCeiling, drawing: host.onAddDrawing, }; diff --git a/src/panels/host.ts b/src/panels/host.ts index 6978f3f1..bcfdb46b 100644 --- a/src/panels/host.ts +++ b/src/panels/host.ts @@ -103,6 +103,7 @@ export interface PanelHostValue { onAddDrawing: () => void; onAddSection: () => void; onAddElevation: () => void; + onAddCeiling: () => void; /** * Rechtsklick auf eine Zeichnungsebenen-Zeile: öffnet das Kontextmenü an der * Cursorposition. App hält das offene Menü und baut die Einträge diff --git a/src/state/projectSlice.ts b/src/state/projectSlice.ts index fd7a0cd6..16b29dbc 100644 --- a/src/state/projectSlice.ts +++ b/src/state/projectSlice.ts @@ -123,6 +123,8 @@ export interface ProjectSlice { addSection: () => void; /** Legt eine neue Ansichts-Zeichnungsebene (kind:"elevation") als Platzhalter an. */ addElevation: () => void; + /** Legt einen Deckenspiegel ([100], kind:"ceiling") des aktiven Geschosses an (sonst des ersten). */ + addCeiling: () => void; patchLevel: (id: string, patch: Partial) => void; duplicateLevel: (id: string) => void; deleteLevel: (id: string) => void; @@ -684,6 +686,24 @@ export function createProjectSlice( return addItems("drawingLevels", [elevation]); }), + addCeiling: () => { + const activeLevelId = get().activeLevelId; + applyChange((p) => { + const floors = p.drawingLevels.filter((z) => z.kind === "floor" && !z.layoutId); + const floor = floors.find((z) => z.id === activeLevelId) ?? floors[0]; + if (!floor) return []; + const ceiling: DrawingLevel = { + id: `ceiling-${Date.now()}`, + name: t("default.ceilingName", { floor: floor.name }), + kind: "ceiling", + visible: true, + locked: false, + ceilingOfId: floor.id, + }; + return addItems("drawingLevels", [ceiling]); + }); + }, + patchLevel: (id, patch) => applyChange((p) => fieldOps( diff --git a/src/state/usePanelHostBase.ts b/src/state/usePanelHostBase.ts index 8da24aa6..6610177b 100644 --- a/src/state/usePanelHostBase.ts +++ b/src/state/usePanelHostBase.ts @@ -139,6 +139,7 @@ export function usePanelHostBase(opts: { | "addDrawing" | "addSection" | "addElevation" + | "addCeiling" | "addCategory" | "snapshotLayerVisibility" | "applyLayerVisibility" @@ -253,6 +254,7 @@ export function usePanelHostBase(opts: { addDrawing, addSection, addElevation, + addCeiling, addCategory, snapshotLayerVisibility, applyLayerVisibility, @@ -350,6 +352,7 @@ export function usePanelHostBase(opts: { onAddDrawing: addDrawing, onAddSection: addSection, onAddElevation: addElevation, + onAddCeiling: addCeiling, onLevelContextMenu: (id, x, y) => setMenu({ kind: "level", id, x, y }), activeCategoryCode, diff --git a/src/state/useProjectActions.ts b/src/state/useProjectActions.ts index c257024a..0ec09e32 100644 --- a/src/state/useProjectActions.ts +++ b/src/state/useProjectActions.ts @@ -80,6 +80,7 @@ export function useProjectActions( const addDrawing = useStore((s) => s.addDrawing); const addSection = useStore((s) => s.addSection); const addElevation = useStore((s) => s.addElevation); + const addCeiling = useStore((s) => s.addCeiling); const addCategory = useStore((s) => s.addCategory); const patchCategory = useStore((s) => s.patchCategory); const addSubCategory = useStore((s) => s.addSubCategory); @@ -395,6 +396,7 @@ export function useProjectActions( addDrawing, addSection, addElevation, + addCeiling, addCategory, patchCategory, addSubCategory, diff --git a/src/ui/ImportDialog.tsx b/src/ui/ImportDialog.tsx index 3cfbca08..38c1c2f3 100644 --- a/src/ui/ImportDialog.tsx +++ b/src/ui/ImportDialog.tsx @@ -87,6 +87,8 @@ function kindBadgeKey(kind: DrawingLevelKind): TranslationKey { return "import.badge.section"; case "elevation": return "import.badge.elevation"; + case "ceiling": + return "import.badge.ceiling"; case "drawing": return "import.badge.drawing"; } diff --git a/src/views/viewportContent.tsx b/src/views/viewportContent.tsx index 4be8a2dd..d1e947a2 100644 --- a/src/views/viewportContent.tsx +++ b/src/views/viewportContent.tsx @@ -409,7 +409,8 @@ export const Content = memo(function Content({ // `drawings2d` nach `level.id`), nur OHNE Geschoss-Eigenschaftsleiste und ohne // 3D-Umschaltung — eine Zeichnung hat keine Höhe/3D. So sind importierte // DXF-Polylinien hier sofort sichtbar und mit den 2D-Werkzeugen bearbeitbar. - if (level.kind === "drawing") { + // Deckenspiegel ([100]): wie eine Zeichnung (2D, Inhalt aus dem Kern), ohne 3D-Umschaltung. + if (level.kind === "drawing" || level.kind === "ceiling") { // Blatt-Ebene eines offenen Layouts: Papier 1:1 (Massstab 1), Hintergrund + Viewports vom Blatt. const plan = (sheetPlan?: SheetPlanProps) => (