[181] [152] Importe als eigenständige Elemente: Klasse Pflicht, Herkunft nur Auskunft, keine Import-Liste
Gelände, Höhenlinien, Netzkörper (Nachbargebäude, IFC/OBJ/STEP/DXF-Netze), Luftbilder und Baugruben (`Project.context`) sind normale Elemente: - Modell: `categoryCode` Pflicht (String) an allen fünf Arten; `layer` (Gruppierung) und `hidden` (Einzel-Ausblenden) entfallen; neu `source` (Herkunft, ohne Wirkung). `ContextObject::category_code()`. - Kern: Plan, Schnitt, Ansicht, 3D, Pick fragen nur die Klasse ab (kein „ohne Kategorie immer sichtbar"). IFC-Gelände (IfcSite bzw. Name Gelände/Terrain) wird beim Import ein Gelände-Element (`import_context::ifc_meshes`); `mesh_view::is_terrain` entfällt, geschlossene Gelände-Netze schneidet der Schnitt als Oberkante. Importe setzen `source` statt `layer` (IFC-Klasse, DXF-Layer, STEP-Datei). - Objekt-Info: Klasse im Kopf änderbar und Farbe der Klasse auch für Gelände-/Umgebungs-Elemente, Herkunft als Auskunft; Einzel-Ausblenden-Schalter entfernt. - Panel „Gelände": Import-Liste entfernt (nur Aktionen); Elemente-Panel mit Knoten „Gelände & Umgebung". - swissBUILDINGS3D/OSM/swissALTI3D/SWISSIMAGE setzen Klasse und `source`; Dach-Trennung über den DXF-Layer beim Import. - Musterhaus komplex nachgeführt (ohne `layer`); Doku: ARCHITEKTUR Abschnitt 8 (Entwurf), Glossar, READMEs. Geprüft: cargo test im Kern (bis auf den Zeit-Wächter ansicht_gross_schnell unter Last), vitest (alle), tsc, Plan-/CLI-Goldens unverändert, e2e siteSelect/excavation/terrainHide angepasst und grün. Musterhaus komplex mit zwei Nachbarnetzen: Grundriss EG/UG 1:200, Schnitt A-A, Ansicht Süd per CLI vor/nach byte-gleich (angesehen). Nicht in der Tauri-App/auf dem Mac geprüft.
This commit is contained in:
70 files changed
+616
-710
No files matched your search
+1
-1
@@ -20,7 +20,7 @@ geänderten Listen sind neu ([121]).
|
||||
| `selectionSlice.ts`, `selection.ts` | Auswahl als ein Wert (`Selection`, je Element-Art eine Menge) |
|
||||
| `viewSlice.ts` | Darstellung ohne Modell: aktive Ebene, Massstab, Detailgrad, Schwarz-Weiss … |
|
||||
| `layoutSlice.ts` | Panel-Layout (Docks, Tabs, schwebende Fenster) |
|
||||
| `siteSlice.ts`, `notifySlice.ts` | Kontext-Objekte; Kurzmeldungen (`notify()`) |
|
||||
| `siteSlice.ts`, `notifySlice.ts` | Gelände-/Umgebungs-Elemente (`project.context`, [181]); Kurzmeldungen (`notify()`) |
|
||||
| `busyStore.ts`, `cursorStore.ts`, `liveScaleStore.ts` | hochfrequente oder globale Werte ausserhalb von React-State |
|
||||
|
||||
## Verdrahtung (aus `App.tsx` herausgelöst)
|
||||
|
||||
@@ -8,7 +8,7 @@ import { excavationGripPoints } from "../core";
|
||||
|
||||
const pit: Excavation = {
|
||||
id: "bg",
|
||||
type: "excavation",
|
||||
type: "excavation", categoryCode: "07",
|
||||
name: "Baugrube",
|
||||
outline: [{ x: 0, y: 0 }, { x: 4, y: 0 }, { x: 4, y: 4 }, { x: 0, y: 4 }],
|
||||
bottom: -2,
|
||||
|
||||
@@ -342,6 +342,10 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
case "column":
|
||||
applyChange((p) => patchItem(p, "columns", id, { categoryCode: code }));
|
||||
break;
|
||||
// [181] Gelände-/Umgebungs-Elemente (Netzkörper, Gelände, Höhenlinien, Luftbild, Baugrube) wie jedes Element.
|
||||
case "contextObject":
|
||||
applyChange((p) => patchItem(p, "context", id, { categoryCode: code }));
|
||||
break;
|
||||
default: break; // extrudedSolid/door: keine Kategorie am Element
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Panel-Host, Teil Lage und Elemente-Baum ([121], aus `usePanelHostBase` herausgelöst):
|
||||
// Kontext-Objekte (Gelände, Aushub, Georeferenz, DXF-Import) und die Auswahl einer Zeile im
|
||||
// Gelände-/Umgebungs-Elemente (Gelände, Aushub, Georeferenz, DXF-Import, Auswahl im Elemente-Panel) und die Auswahl einer Zeile im
|
||||
// Elemente-Panel samt Geschosswechsel und Zoom.
|
||||
|
||||
import { setFieldIfChanged } from "../../core";
|
||||
@@ -8,12 +8,14 @@ import type { ScheduleKind } from "../../export/exportSchedule";
|
||||
import type { FlatHostOpts, HostPart } from "./types";
|
||||
|
||||
export function buildSiteHost(c: FlatHostOpts) {
|
||||
const { activeLevelId, addContextObjectsAndFit, applyChange, dxfInputRef, generateTerrain, onRunCommand, patchContextObject, planViewRef, removeContextObject, removeContextObjects, setActiveLevelId, setSelection } = c;
|
||||
const { activeLevelId, addContextObjectsAndFit, applyChange, dxfInputRef, generateTerrain, onRunCommand, patchContextObject, planViewRef, setActiveLevelId, setSelection } = c;
|
||||
return {
|
||||
// ── Site-/Kontext-Schicht ──────────────────────────────────────────────
|
||||
// ── Gelände und Umgebung ───────────────────────────────────────────────
|
||||
onAddContextObjects: addContextObjectsAndFit,
|
||||
onRemoveContextObject: removeContextObject,
|
||||
onRemoveContextObjects: removeContextObjects,
|
||||
onSelectSiteElement: (id: string, opts?: { zoom?: boolean }) => {
|
||||
setSelection({ ...clearKinds(), contextObjects: [id] });
|
||||
if (opts?.zoom) requestAnimationFrame(() => planViewRef.current?.fit());
|
||||
},
|
||||
onGenerateTerrain: generateTerrain,
|
||||
onPatchContextObject: patchContextObject,
|
||||
onStartExcavation: () => onRunCommand("excavation"),
|
||||
|
||||
@@ -92,8 +92,6 @@ export type PanelHostOpts = {
|
||||
| "importLineStyles"
|
||||
| "importHatches"
|
||||
| "addContextObjectsAndFit"
|
||||
| "removeContextObject"
|
||||
| "removeContextObjects"
|
||||
| "generateTerrain"
|
||||
| "patchContextObject"
|
||||
| "commitTransformOn"
|
||||
|
||||
@@ -38,6 +38,7 @@ describe("deriveSelection — Kontext-Objekt-Luftbild (ContextImage)", () => {
|
||||
id: "IMG1",
|
||||
type: "image",
|
||||
name: "Luftbild",
|
||||
categoryCode: "03",
|
||||
src: "data:image/jpeg;base64,AAAA",
|
||||
min: { x: 0, y: 0 },
|
||||
max: { x: 10, y: 10 },
|
||||
@@ -54,7 +55,7 @@ describe("deriveSelection — Kontext-Objekt-Luftbild (ContextImage)", () => {
|
||||
|
||||
it("opacity fällt auf 1 zurück, wenn das Bild keine eigene Deckkraft trägt", () => {
|
||||
const project = projectWith([
|
||||
{ id: "IMG1", type: "image", name: "Luftbild", src: "x", min: { x: 0, y: 0 }, max: { x: 1, y: 1 } },
|
||||
{ id: "IMG1", type: "image", name: "Luftbild", categoryCode: "03", src: "x", min: { x: 0, y: 0 }, max: { x: 1, y: 1 } },
|
||||
]);
|
||||
const sel = deriveSelection(project, { contextObjects: ["IMG1"] });
|
||||
expect(sel?.opacity).toBe(1);
|
||||
@@ -63,11 +64,22 @@ describe("deriveSelection — Kontext-Objekt-Luftbild (ContextImage)", () => {
|
||||
|
||||
it("isImage bleibt false/undefined für ein Nicht-Bild-Kontext-Objekt (z. B. importiertes Mesh)", () => {
|
||||
const project = projectWith([
|
||||
{ id: "M1", type: "importedMesh", name: "Haus", positions: [0, 0, 0, 1, 0, 0, 0, 1, 0], indices: [0, 1, 2] },
|
||||
{ id: "M1", type: "importedMesh", categoryCode: "10", name: "Haus", positions: [0, 0, 0, 1, 0, 0, 0, 1, 0], indices: [0, 1, 2] },
|
||||
]);
|
||||
const sel = deriveSelection(project, { contextObjects: ["M1"] });
|
||||
expect(sel?.isImage).toBeFalsy();
|
||||
expect(sel?.opacity).toBeUndefined();
|
||||
expect(sel?.imageFilters).toBeUndefined();
|
||||
});
|
||||
|
||||
it("[181] Klasse und Herkunft wie bei jedem Element (Klasse im Kopf änderbar, Farbe der Klasse)", () => {
|
||||
const project = projectWith([
|
||||
{ id: "B1", type: "importedMesh", name: "Haus", categoryCode: "12", source: "swissBUILDINGS3D", positions: [0, 0, 0, 1, 0, 0, 0, 1, 0], indices: [0, 1, 2] },
|
||||
]);
|
||||
project.layers = [{ code: "12", name: "Gebäude", color: "#123456", lw: 0.25, visible: true } as Project["layers"][number]];
|
||||
const sel = deriveSelection(project, { contextObjects: ["B1"] });
|
||||
expect(sel?.categoryCode).toBe("12");
|
||||
expect(sel?.color).toBe("#123456");
|
||||
expect(sel?.contextObject?.source).toBe("swissBUILDINGS3D");
|
||||
});
|
||||
});
|
||||
@@ -556,6 +556,8 @@ export interface DetailRefInfo {
|
||||
*/
|
||||
export interface ContextObjectInfo {
|
||||
objType: ContextObject["type"];
|
||||
/** [181] Herkunft (z. B. „swissBUILDINGS3D"), nur Auskunft. */
|
||||
source?: string;
|
||||
/** Reale LV95-Koordinate des Bbox-Mittelpunkts, falls `Project.geoAnchor`
|
||||
* gesetzt ist (sonst `undefined` — kein Bezug bekannt). */
|
||||
lv95Center?: { e: number; n: number };
|
||||
|
||||
@@ -89,7 +89,7 @@ describe("[137] Raster-Gelände (swissALTI3D) nachglätten", () => {
|
||||
const a = j * 6 + i;
|
||||
indices.push(a, a + 1, a + 7, a, a + 7, a + 6);
|
||||
}
|
||||
const grid: TerrainMesh = { id: "alti", type: "terrainMesh", name: "swissALTI3D", positions, indices, smooth: 1 };
|
||||
const grid: TerrainMesh = { id: "alti", type: "terrainMesh", categoryCode: "02", name: "swissALTI3D", positions, indices, smooth: 1 };
|
||||
setState({ project: { ...p, context: [grid] }, undoDepth: 0, redoDepth: 0, canUndo: false, canRedo: false });
|
||||
getState().clearHistory();
|
||||
const cur = () => getState().project.context!.find((c) => c.id === "alti") as TerrainMesh;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Site-/Kontext-Slice: verwaltet die Kontext-Schicht `project.context`
|
||||
// (importierte Meshes, Konturen-Sätze, abgeleitetes Gelände-TIN). Diese
|
||||
// Geometrie ist „dumm"/nicht-semantisch — sie liegt bewusst NEBEN dem BIM-Modell.
|
||||
// Site-Slice: Gelände- und Umgebungs-Elemente `project.context` (Netzkörper, Höhenlinien, Gelände, Luftbild,
|
||||
// Baugrube). [181] Normale Elemente mit Klasse — keine eigene „Kontext-Schicht" mit Import-Liste mehr.
|
||||
//
|
||||
// Entwurfsentscheidung: `context` ist Teil von `project` (ein einziger
|
||||
// Wahrheits-Baum, konsistent mit projectSlice). Diese Slice MUTIERT daher
|
||||
|
||||
@@ -353,8 +353,6 @@ export function useProjectActions(
|
||||
const pts = contextObjectsBounds(objs as ContextObject[]);
|
||||
if (pts) planViewRef.current?.fitBounds(pts);
|
||||
};
|
||||
const removeContextObject = useStore((s) => s.removeContextObject);
|
||||
const removeContextObjects = useStore((s) => s.removeContextObjects);
|
||||
const generateTerrain = useStore((s) => s.generateTerrain);
|
||||
const patchContextObject = useStore((s) => s.patchContextObject);
|
||||
const moveGripOf = useStore((s) => s.moveGripOf);
|
||||
@@ -475,8 +473,6 @@ export function useProjectActions(
|
||||
addContextObjects,
|
||||
addContextObjectsAndFit,
|
||||
fitToContextObjects,
|
||||
removeContextObject,
|
||||
removeContextObjects,
|
||||
generateTerrain,
|
||||
patchContextObject,
|
||||
moveGripOf,
|
||||
|
||||
Reference in new issue
Block a user