[149] Baum als eigenes Objekt: Modell, Werkzeug, Plan/Schnitt/Ansicht/3D, Schatten, IFC
Rust-Modell `Tree` (Stamm-/Kronendurchmesser, Kronenansatz, Höhe, Form rund/oval/säulenförmig/ kegelförmig, Bestand bestehend/neu/zu fällen, Laub/Nadel, Art) und `Project.trees` (KNOWN_KEYS, Typen neu erzeugt). Geometrie `core/src/tree.rs` (Kronenprofil je Form, Fuss auf dem Gelände). Grundriss-Planzeichen (Wellen-/Zackenkranz, Stamm, neu rot, zu fällen gelb gestrichelt und gekreuzt), Silhouette in Schnitt/Ansicht, 3D-Stamm + Krone (wenige Polygone), Schatten nach eigener Höhe/Krone in sun.rs (Kreise der Ebene 13 bleiben Fallback), IFC als IfcGeographicElement (IFC2x3: IfcBuildingElementProxy) mit Mengen. Werkzeug „Baum“, Befehl „Kreise in Bäume umwandeln“, Objekt-Info, Griffe, Auswahl in 2D/3D, Verschieben/Kopieren/ Löschen/Zwischenablage mit Undo. Musterhaus komplex unverändert.
This commit is contained in:
51 files changed
+1869
-38
No files matched your search
@@ -85,6 +85,7 @@ describe("Selection", () => {
|
||||
stairIds: [],
|
||||
roomIds: [],
|
||||
openingIds: [],
|
||||
treeIds: [],
|
||||
});
|
||||
expect(toTransformSelection(s)).toEqual(c);
|
||||
});
|
||||
|
||||
@@ -37,6 +37,8 @@ export interface Selection {
|
||||
* bzw. `"siteRules"` (Baurechtslinie) — die Objekt-Info zeigt die Einstellungen der Quelle.
|
||||
*/
|
||||
site: string[];
|
||||
/** [149] Bäume (`Project.trees`). */
|
||||
trees: string[];
|
||||
/**
|
||||
* Gewählte Gruppen — rein informativ (Bounding-Box, Doppelklick-Ziel); die
|
||||
* Mitglieder stehen zusätzlich in den übrigen Arten (s. `groupActions.ts`).
|
||||
@@ -60,6 +62,7 @@ export const SELECTION_KINDS: readonly SelectionKind[] = [
|
||||
"contextObjects",
|
||||
"sectionLines",
|
||||
"site",
|
||||
"trees",
|
||||
"groups",
|
||||
];
|
||||
|
||||
@@ -138,6 +141,7 @@ export function toCommandSelection(sel: Selection): CommandSelection {
|
||||
stairIds: sel.stairs,
|
||||
roomIds: sel.rooms,
|
||||
openingIds: sel.openings,
|
||||
treeIds: sel.trees,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -157,7 +161,8 @@ export function hasTransformable(sel: Selection): boolean {
|
||||
sel.roofs.length > 0 ||
|
||||
sel.stairs.length > 0 ||
|
||||
sel.rooms.length > 0 ||
|
||||
sel.openings.length > 0
|
||||
sel.openings.length > 0 ||
|
||||
sel.trees.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -175,6 +180,8 @@ export interface SelectionIdLists {
|
||||
contextObjectIds: string[];
|
||||
sectionLineIds: string[];
|
||||
groupIds: string[];
|
||||
/** [149] Bäume (nicht gruppierbar; Zwischenablage, Nachauswahl). */
|
||||
treeIds?: string[];
|
||||
}
|
||||
|
||||
const ID_LIST_KEYS: [SelectionKind, keyof SelectionIdLists][] = [
|
||||
@@ -190,6 +197,7 @@ const ID_LIST_KEYS: [SelectionKind, keyof SelectionIdLists][] = [
|
||||
["contextObjects", "contextObjectIds"],
|
||||
["sectionLines", "sectionLineIds"],
|
||||
["groups", "groupIds"],
|
||||
["trees", "treeIds"],
|
||||
];
|
||||
|
||||
/** Auswahl → `…Ids`-Listen (passt strukturell auf `GroupMembership` und `BcfSelection`). */
|
||||
|
||||
@@ -37,6 +37,8 @@ import type { BodyTarget } from "../views/plan/PlanView";
|
||||
import type { CommandLineHandle } from "../ui/CommandLine";
|
||||
import type { CommandEngine } from "../commands/engine";
|
||||
import { single } from "./selection";
|
||||
import { getState as storeState } from "./appStore";
|
||||
import { patchItem } from "../core";
|
||||
import type { Selection } from "./selection";
|
||||
|
||||
export interface GripEditFieldsState {
|
||||
@@ -162,6 +164,13 @@ export function useGripEditing(opts: {
|
||||
} = opts;
|
||||
const selectedOpeningId = single(selection, "openings");
|
||||
const selectedStairId = single(selection, "stairs");
|
||||
// [149] Baum: Griff in der Stammmitte (verschieben) und am Kronenrand (Kronendurchmesser).
|
||||
const selectedTreeId = single(selection, "trees");
|
||||
const selectedTree = selectedTreeId ? (project.trees ?? []).find((x) => x.id === selectedTreeId) : undefined;
|
||||
const treeGrips = (tr: NonNullable<typeof selectedTree>): Vec2[] => [
|
||||
tr.position,
|
||||
{ x: tr.position.x + tr.crownDiameter / 2, y: tr.position.y },
|
||||
];
|
||||
const selectedRoomId = single(selection, "rooms");
|
||||
const selectedCeilingId = single(selection, "ceilings");
|
||||
const selectedDrawingId = single(selection, "drawings");
|
||||
@@ -293,6 +302,11 @@ export function useGripEditing(opts: {
|
||||
gripOwnerRange.push([0, 0]);
|
||||
return [stairMoveHandle(st)];
|
||||
}
|
||||
if (selectedTree && modelEditable && !selectedTree.locked) {
|
||||
const pts = treeGrips(selectedTree);
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
return pts;
|
||||
}
|
||||
// [68] Baugrube: Umriss-Ecken + Sohlen-Griff (Lage: Schwerpunkt, y um die Sohlenhöhe versetzt).
|
||||
if (modelEditable && selectedExcavation && !selectedCeiling && effectiveDrawingIds.length === 0 && selectedWallIds.length === 0) {
|
||||
const pts = excavationGripPoints(selectedExcavation);
|
||||
@@ -833,6 +847,17 @@ export function useGripEditing(opts: {
|
||||
if (st) moveStairBy(st.id, sub(pt, stairMoveHandle(st)));
|
||||
return;
|
||||
}
|
||||
// [149] Baum: Stammmitte bzw. Kronenrand live, ein Undo-Schritt je Zug (gleicher coalesceKey).
|
||||
if (selectedTree) {
|
||||
const tr = selectedTree;
|
||||
if (tr.locked) return;
|
||||
const patch =
|
||||
index === 0
|
||||
? { position: { x: pt.x, y: pt.y } }
|
||||
: { crownDiameter: Math.max(0.2, 2 * Math.hypot(pt.x - tr.position.x, pt.y - tr.position.y)) };
|
||||
storeState().applyChange((p) => patchItem(p, "trees", tr.id, patch), `treeGrip:${tr.id}:${index}`);
|
||||
return;
|
||||
}
|
||||
// [68] Baugrube: Sohlen-Griff sofort (Höhe), Ecken als Vorschau bis zum Setzen.
|
||||
if (selectedExcavation && !selectedCeilingId && !selectedRoomId) {
|
||||
if (index >= selectedExcavation.outline.length) moveExcavationGrip(selectedExcavation.id, index, pt);
|
||||
|
||||
@@ -207,6 +207,7 @@ export function useMouseSelectionHandlers(opts: {
|
||||
roof: "roofs",
|
||||
context: "contextObjects",
|
||||
site: "site",
|
||||
tree: "trees",
|
||||
} as const satisfies Record<string, SelectionKind>;
|
||||
type Kind = keyof typeof channels;
|
||||
const target: { kind: Kind; id: string } | null = sel.sectionLineId
|
||||
@@ -225,7 +226,9 @@ export function useMouseSelectionHandlers(opts: {
|
||||
? { kind: "room", id: sel.roomId }
|
||||
: sel.extrudedSolidId
|
||||
? { kind: "solid", id: sel.extrudedSolidId }
|
||||
: sel.columnId
|
||||
: sel.treeId
|
||||
? { kind: "tree", id: sel.treeId }
|
||||
: sel.columnId
|
||||
? { kind: "column", id: sel.columnId }
|
||||
: sel.roofId
|
||||
? { kind: "roof", id: sel.roofId }
|
||||
@@ -289,7 +292,9 @@ export function useMouseSelectionHandlers(opts: {
|
||||
? ["contextObjects", sel.contextObjectId]
|
||||
: sel.siteId
|
||||
? ["site", sel.siteId]
|
||||
: null;
|
||||
: sel.treeId
|
||||
? ["trees", sel.treeId]
|
||||
: null;
|
||||
setSelection({ ...clearKinds(), groups: [], ...(one ? { [one[0]]: [one[1]] } : {}) });
|
||||
};
|
||||
// Links-Drag (Marquee) im Grundriss: die getroffene Wand-MENGE übernehmen
|
||||
@@ -387,6 +392,11 @@ export function useMouseSelectionHandlers(opts: {
|
||||
setSelection({ ...clearKinds(), columns: [hit.id] });
|
||||
return;
|
||||
}
|
||||
// [149] Baum: Objekt-Info wie im Grundriss.
|
||||
if (hit.kind === "tree") {
|
||||
setSelection({ ...clearKinds(), trees: [hit.id] });
|
||||
return;
|
||||
}
|
||||
// [137] Freier Körper (Loft, Rotation, Extrusion): Objekt-Info wie im Grundriss.
|
||||
if (hit.kind === "solid") {
|
||||
setSelection({ ...clearKinds(), solids: [hit.id] });
|
||||
|
||||
Reference in new issue
Block a user