// Einstellungen eines Gelände-/Umgebungs-Elements (Netzkörper, Gelände, Baugrube) in der Objekt-Info ([137]: // ein angeklicktes Gelände bzw. eine Baugrube zeigt dort ihre Felder). Gelände zusätzlich: Sichtbarkeit seiner // Klasse und Glättung (aus den Höhenlinien neu erzeugt, ein Undo-Schritt); Raster-Gelände (swissALTI3D, ohne // Höhenlinien) additiv nachglätten. [181] Sichtbarkeit nur über die Klasse — kein Einzel-Ausblenden, keine Import-Liste. // // Bezeichner englisch, UI-Text/Kommentare deutsch. Alle sichtbaren Texte über t(...). import { t } from "../i18n"; import { usePanelHost } from "./host"; import { useStore } from "../state/appStore"; import type { ContextObject } from "../model/types"; import { flattenCategories } from "../model/types"; import { resmoothGridTerrain } from "../model/terrain"; import { useMemo } from "react"; import type { ExcavationQuantity } from "../core"; /** Zahl-Eingabe für ein Feld eines Kontext-Objekts (leer = Standard, ungültig = keine Änderung). */ export function NumField(props: { label: string; value: number | undefined; step: number; min?: number; placeholder?: string; onChange: (v: number | undefined) => void; }) { return ( ); } const fmt1 = (v: number) => v.toLocaleString("de-CH", { maximumFractionDigits: 1, minimumFractionDigits: 1 }); function ExcavationQty({ q }: { q: ExcavationQuantity | undefined }) { if (!q) return
{t("site.excavation.noTerrain")}
; return (
{t("site.excavation.qty", { cut: fmt1(q.cut), fill: fmt1(q.fill), backfill: fmt1(q.backfill) })}
); } /** Glättungsstufen der Gelände-Erzeugung (`terrain.rs`, 0 = roh). */ const SMOOTH_LEVELS = [0, 1, 2, 3] as const; /** [137] Zusätzliche Glättungs-Durchgänge für Raster-Gelände. */ const RESMOOTH_PASSES = [1, 2, 4] as const; /** Felder eines Kontext-Objekts; `null` für Arten ohne eigene Einstellungen (Höhenlinien, Luftbild). */ export function ContextObjectProps({ obj, quantities }: { obj: ContextObject; quantities: readonly ExcavationQuantity[] }) { const host = usePanelHost(); const project = useStore((s) => s.project); const notify = useStore((s) => s.notify); const regenerateTerrain = useStore((s) => s.regenerateTerrain); const resmoothTerrain = useStore((s) => s.resmoothTerrain); // [137] Raster-Gelände (swissALTI3D) lässt sich ohne Höhenlinien nachglätten; Prüfung nur bei Netz-Wechsel. const terrainPositions = obj.type === "terrainMesh" ? obj.positions : null; const isGrid = useMemo(() => (terrainPositions ? resmoothGridTerrain(terrainPositions, 0) !== null : false), [terrainPositions]); const patch = (field: string) => (v: number | undefined) => host.onPatchContextObject(obj.id, { [field]: v }, `site-${obj.id}-${field}`); if (obj.type === "importedMesh") { // [T4] Glatt oder kantig schattieren, Knickwinkel je Mesh (Vorgabe 30°). return (
{obj.smoothShading === true && ( )}
); } if (obj.type === "terrainMesh") { const cat = flattenCategories(project.layers).find((c) => c.code === obj.categoryCode); const hasSource = (project.context ?? []).some((o) => o.type === "contourSet"); return (
{cat && ( )} {hasSource && ( )} {!hasSource && ( )}
); } if (obj.type === "excavation") { return (
v !== undefined && patch("bottom")(v)} />
{t("site.excavation.shoring")} {obj.outline.map((_, i) => ( ))}
x.id === obj.id)} />
); } return null; }