Merge branch 'worktree-agent-a87b32501bda55f65' into claude/practical-noether-1hb2s1
This commit is contained in:
30 files changed
+797
-139
No files matched your search
+8
-1
@@ -28,7 +28,7 @@
|
||||
// das Projekt beim Aufruf aus dem Store (`getState()`).
|
||||
|
||||
import { useEffect, useMemo, useRef, type ComponentProps } from "react";
|
||||
import { patchItem } from "./core";
|
||||
import { patchItem, projectGeoOrigin } from "./core";
|
||||
import { collectVisibleCodes } from "./model/types";
|
||||
import { isSheetLevel, effectiveSheetSizeMm, findMaster, sheetMmToModel, SHEET_SCALE_DENOMINATOR } from "./model/layoutModel";
|
||||
import { setDxfImportTrigger } from "./io/dxfImportHook";
|
||||
@@ -126,6 +126,7 @@ export default function App() {
|
||||
const drawingLevels = useStore((s) => s.project.drawingLevels);
|
||||
const projectLayers = useStore((s) => s.project.layers);
|
||||
const projectName = useStore((s) => s.project.name);
|
||||
const geoAnchor = useStore((s) => s.project.geoAnchor);
|
||||
const textStyles = useStore((s) => s.project.textStyles);
|
||||
const modelViewOptions = useStore((s) => s.project.modelViewOptions);
|
||||
const masterLayouts = useStore((s) => s.project.masterLayouts);
|
||||
@@ -994,6 +995,12 @@ export default function App() {
|
||||
showCursor={planActive}
|
||||
unit="m"
|
||||
units={displayUnits}
|
||||
// [221] Landeskoordinaten des Zeigers im Grundriss (Modell lokal um den Projekt-Nullpunkt).
|
||||
geoOrigin={
|
||||
viewType === "grundriss" && !activeLevel.layoutId && (activeLevel.kind === "floor" || activeLevel.kind === "drawing")
|
||||
? projectGeoOrigin({ geoAnchor } as Parameters<typeof projectGeoOrigin>[0])
|
||||
: null
|
||||
}
|
||||
referenceLines={referenceLines}
|
||||
onReferenceLines={setReferenceLines}
|
||||
referenceLinesEnabled={planActive}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Project } from "../model/types";
|
||||
import { emptyProject, sampleProject } from "../model/sampleProject";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import type { Project, Room, Wall } from "../model/types";
|
||||
import { computeKennzahlen, checkRoomProgram, solidVolume } from "./kennzahlen";
|
||||
import { computeAreaTable } from "./areaTable";
|
||||
import { computeAreaTable, computeIvhb } from "./areaTable";
|
||||
|
||||
const sq = (x: number, y: number, s: number) => [
|
||||
{ x, y }, { x: x + s, y }, { x: x + s, y: y + s }, { x, y: y + s },
|
||||
@@ -20,10 +21,12 @@ describe("solidVolume", () => {
|
||||
|
||||
describe("computeKennzahlen", () => {
|
||||
const rooms = (p: Project) => p.rooms ?? [];
|
||||
it("GF/aGF je Geschoss aus Räumen und Summe", () => {
|
||||
it("GF = NGF + KF je Geschoss (SIA 416), NGF aus den Räumen, Summe", () => {
|
||||
const k = computeKennzahlen(sampleProject);
|
||||
const total = rooms(sampleProject).reduce((s, r) => s + Math.abs(areaOf(r.boundary)), 0);
|
||||
expect(k.gf).toBeCloseTo(total, 6);
|
||||
expect(k.ngf).toBeCloseTo(total, 6);
|
||||
expect(k.gf).toBeCloseTo(k.ngf + k.kf, 6);
|
||||
expect(k.kf).toBeGreaterThan(0);
|
||||
expect(k.levels.reduce((s, l) => s + l.gf, 0)).toBeCloseTo(k.gf, 6);
|
||||
});
|
||||
it("Ziffern nur mit Parzellenfläche", () => {
|
||||
@@ -49,6 +52,44 @@ describe("computeKennzahlen", () => {
|
||||
});
|
||||
});
|
||||
|
||||
/** Testgebäude des Referenz-Ablaufs (`e2e/release10.spec.ts`): Aussenwände 12 × 10 m, ein Raum innen, Parzelle 30 × 30 m. */
|
||||
function release10Project(): Project {
|
||||
const P = (x: number, y: number) => ({ x, y });
|
||||
const c = [P(48, 46), P(60, 46), P(60, 56), P(48, 56)];
|
||||
const walls: Wall[] = c.map((a, i) => ({ id: `w${i}`, type: "wall", floorId: "eg", categoryCode: "20", start: a, end: c[(i + 1) % 4], wallTypeId: "aw", height: 2.6 }) as Wall);
|
||||
const t = 0.345 / 2;
|
||||
const room = { id: "r1", type: "room", floorId: "eg", categoryCode: "40", name: "Raum 1", color: "#eee", siaCategory: "HNF", boundary: [P(48 + t, 46 + t), P(60 - t, 46 + t), P(60 - t, 56 - t), P(48 + t, 56 - t)] } as Room;
|
||||
return { ...emptyProject, walls, rooms: [room], siteRules: { parcel: [P(38, 38), P(68, 38), P(68, 68), P(38, 68)] } as Project["siteRules"] };
|
||||
}
|
||||
|
||||
describe("[225] Kennzahlenleiste = Flächentabelle (eine Quelle, SIA 416)", () => {
|
||||
const cases: [string, () => Project][] = [
|
||||
["Musterhaus", () => ({ ...sampleProject, parcelArea: 600 })],
|
||||
["Musterhaus komplex", () => buildComplexSampleProject()],
|
||||
["Referenz-Ablauf (release10)", release10Project],
|
||||
];
|
||||
it.each(cases)("%s", (_name, make) => {
|
||||
const p = make();
|
||||
const k = computeKennzahlen(p);
|
||||
const tab = computeAreaTable(p);
|
||||
const iv = computeIvhb(p);
|
||||
expect(k.gf).toBeCloseTo(tab.total.gf, 9);
|
||||
expect(k.ngf).toBeCloseTo(tab.total.ngf, 9);
|
||||
expect(k.hnf).toBeCloseTo(tab.total.hnf, 9);
|
||||
expect(k.gv).toBeCloseTo(tab.gv, 9);
|
||||
expect(k.agf).toBeCloseTo(iv.agf, 9);
|
||||
expect(k.az).toEqual(iv.az);
|
||||
expect(k.uez).toEqual(iv.uz);
|
||||
expect(k.levels.map((l) => l.gf)).toEqual(tab.levels.map((l) => l.gf));
|
||||
});
|
||||
it("Referenz-Ablauf: GF 127.7 m² (NGF 112.5 + KF), nicht nur die Räume", () => {
|
||||
const k = computeKennzahlen(release10Project());
|
||||
expect(k.ngf).toBeCloseTo(11.655 * 9.655, 3);
|
||||
expect(k.gf).toBeGreaterThan(k.ngf + 10);
|
||||
expect(k.uez).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
function areaOf(pts: { x: number; y: number }[]) {
|
||||
let a = 0;
|
||||
for (let i = 0; i < pts.length; i++) { const q = pts[(i + 1) % pts.length]; a += pts[i].x * q.y - q.x * pts[i].y; }
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// Kennzahlen und Raumprogramm-Prüfung (Wettbewerbswerkzeug, [41]/[61]/[62]/[70]).
|
||||
//
|
||||
// • Flächen je Geschoss aus den Räumen (SIA 416: GF, NGF/aGF), Summe über das Gebäude.
|
||||
// • Flächen je Geschoss nach SIA 416 (GF = NGF + KF, NGF, HNF), Summe über das Gebäude — dieselben Zahlen
|
||||
// wie die Flächentabelle ([225]: eine Quelle, `flaechen.rs`).
|
||||
// • Gebäudevolumen (GV) aus den freien Körpern (Massenmodell); Abzugskörper zählen nicht mit,
|
||||
// ihr Volumen wird abgezogen. Ohne freie Körper GF × Geschosshöhe wie die Flächentabelle ([206]).
|
||||
// • Ausnützungs-/Überbauungsziffer nur mit `project.parcelArea` oder der Parzellengrenze (`siteRules`).
|
||||
// • AZ/ÜZ wie die IVHB-Ziffern der Tabelle mit ihren Vorgaben (aGF = NGF oberirdisch, aGbF), nur mit
|
||||
// `project.parcelArea` oder der Parzellengrenze (`siteRules`).
|
||||
// • Raumprogramm (`project.roomProgram`, Soll) gegen die gezeichneten Räume.
|
||||
// Exakt für Prismen/Kegelstümpfe/Kreise, Näherung sonst (Fasen/Rundungen). Raumflächen je
|
||||
// Geschoss und Kategorie, Volumen, Parzellenfläche und die SIA-416-Zusammenfassung rechnet der
|
||||
@@ -19,24 +21,34 @@ import type { ProgramStatus } from "./roomProgram";
|
||||
export interface LevelKennzahlen {
|
||||
levelId: string;
|
||||
name: string;
|
||||
/** Geschossfläche (SIA 416 GF) aus den Räumen. */
|
||||
/** Geschossfläche SIA 416 (GF = NGF + KF), gleich der Zeile der Flächentabelle. */
|
||||
gf: number;
|
||||
/** Anrechenbare Fläche ≈ Nettogeschossfläche NGF (NF + VF + FF). */
|
||||
/** Anrechenbare Geschossfläche (Vorgabe NGF; Untergeschosse 0). */
|
||||
agf: number;
|
||||
/** Nettogeschossfläche (NF + VF + FF). */
|
||||
ngf: number;
|
||||
/** Hauptnutzfläche. */
|
||||
hnf: number;
|
||||
rooms: number;
|
||||
}
|
||||
|
||||
export interface Kennzahlen {
|
||||
levels: LevelKennzahlen[];
|
||||
/** Σ GF (SIA 416) = Summenzeile der Flächentabelle. */
|
||||
gf: number;
|
||||
/** Anrechenbare Geschossfläche (IVHB, Basis NGF, oberirdisch) = Zähler der AZ. */
|
||||
agf: number;
|
||||
ngf: number;
|
||||
hnf: number;
|
||||
/** Konstruktionsfläche (Σ). */
|
||||
kf: number;
|
||||
/** Gebäudevolumen aus den freien Körpern (m³), Abzugskörper abgezogen; ohne Körper GF × Geschosshöhe. */
|
||||
gv: number;
|
||||
/** Bebaute Fläche ≈ GF des untersten Geschosses (m²). */
|
||||
/** Anrechenbare Gebäudefläche (IVHB aGbF, m²) = Zähler der ÜZ. */
|
||||
footprint: number;
|
||||
/** Ausnützungsziffer aGF / Parzelle; `null` ohne Parzellenfläche. */
|
||||
az: number | null;
|
||||
/** Überbauungsziffer bebaute Fläche / Parzelle; `null` ohne Parzellenfläche. */
|
||||
/** Überbauungsziffer aGbF / Parzelle; `null` ohne Parzellenfläche. */
|
||||
uez: number | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -576,6 +576,7 @@ async function importAny(path: string, args: Args): Promise<Project> {
|
||||
terrainName: "Höhenlinien",
|
||||
parentName: `Import ${fileName}`,
|
||||
dashStyleTemplate: "PDF-Strich {pattern} mm",
|
||||
geoLabel: fileName,
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
|
||||
+15
-7
@@ -16,7 +16,7 @@
|
||||
import type { Vec2 } from "../model/types";
|
||||
import type { SnapResult, ToolDraft } from "../tools/types";
|
||||
import type { ProjectMutation } from "../core";
|
||||
import { NON_LENGTH_FIELDS, parseInput, resolvePoint, toModelInput } from "./parseInput";
|
||||
import { NON_LENGTH_FIELDS, fromWorldInput, parseInput, resolvePoint, toModelInput } from "./parseInput";
|
||||
import { MODEL_UNITS, type DisplayUnits } from "../tools/displayUnits";
|
||||
import { getCommand, resolveCommand, autocomplete } from "./registry";
|
||||
import { hasTransformSelection } from "../tools/transform";
|
||||
@@ -66,6 +66,11 @@ export interface EngineHost {
|
||||
* (s. `tools/displayUnits.ts`). Fehlt der Handler, gelten Meter.
|
||||
*/
|
||||
inputUnits?(): DisplayUnits;
|
||||
/**
|
||||
* Optional ([221]): LV95-Ursprung des Projekts (Standort-Bezug), wenn getippte Landeskoordinaten auf den
|
||||
* Projekt-Nullpunkt gerechnet werden sollen (Modell-Ebenen, nicht auf dem Layout-Blatt); `null` = keiner.
|
||||
*/
|
||||
inputGeoOrigin?(): { e: number; n: number } | null;
|
||||
/** Optional: Hinweis zeigen (i18n-Key), z. B. „erst Objekte wählen" (`Command.needsSelection`). */
|
||||
notify?(key: string, params?: Record<string, string | number>, kind?: "info" | "warning" | "error"): void;
|
||||
}
|
||||
@@ -484,12 +489,15 @@ export class CommandEngine {
|
||||
return;
|
||||
}
|
||||
|
||||
const parsed = toModelInput(
|
||||
parseInput(text),
|
||||
this.host.inputUnits?.() ?? MODEL_UNITS,
|
||||
// Nackte Zahl: Länge im Längen-Feld bzw. als Distanz-Lock eines Punkt-Schritts; reine Zahl-Schritte
|
||||
// (Anzahl, Faktor, Winkel …) bleiben ohne Umrechnung.
|
||||
this.hasFields() ? this.activeFieldUnit() : accepts.includes("point") ? "length" : "none",
|
||||
const parsed = fromWorldInput(
|
||||
toModelInput(
|
||||
parseInput(text),
|
||||
this.host.inputUnits?.() ?? MODEL_UNITS,
|
||||
// Nackte Zahl: Länge im Längen-Feld bzw. als Distanz-Lock eines Punkt-Schritts; reine Zahl-Schritte
|
||||
// (Anzahl, Faktor, Winkel …) bleiben ohne Umrechnung.
|
||||
this.hasFields() ? this.activeFieldUnit() : accepts.includes("point") ? "length" : "none",
|
||||
),
|
||||
this.host.inputGeoOrigin?.() ?? null,
|
||||
);
|
||||
|
||||
// Tab-Feld-Modus (§2.7): eine nackte Zahl LOCKT das aktive Feld (statt als
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { fromWorldInput, isLv95, parseInput } from "./parseInput";
|
||||
|
||||
describe("[221] getippte Landeskoordinaten", () => {
|
||||
const origin = { e: 2_600_000, n: 1_200_000 };
|
||||
it("absolute LV95-Eingabe wird bei Standort-Bezug auf den Projekt-Nullpunkt gerechnet", () => {
|
||||
expect(fromWorldInput(parseInput("2600048,1200046"), origin)).toEqual({ kind: "absolute", point: { x: 48, y: 46 } });
|
||||
});
|
||||
it("lokale, relative Eingaben und Projekte ohne Bezug bleiben", () => {
|
||||
expect(fromWorldInput(parseInput("48,46"), origin)).toEqual({ kind: "absolute", point: { x: 48, y: 46 } });
|
||||
expect(fromWorldInput(parseInput("r2600048,1200046"), origin).kind).toBe("relative");
|
||||
expect(fromWorldInput(parseInput("2600048,1200046"), null)).toEqual({ kind: "absolute", point: { x: 2600048, y: 1200046 } });
|
||||
});
|
||||
it("LV95-Bereich", () => {
|
||||
expect(isLv95(2_600_000, 1_200_000)).toBe(true);
|
||||
expect(isLv95(600_000, 200_000)).toBe(false);
|
||||
expect(isLv95(48, 46)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -132,6 +132,24 @@ export function toModelInput(p: ParsedInput, u: DisplayUnits, distance: "length"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [221] Liegt der Punkt in den Landeskoordinaten LV95 (Ost 2.4–2.9 Mio. m, Nord 1.0–1.4 Mio. m)? Dieselben
|
||||
* Grenzen wie der Kern beim Import (`src-tauri/core/src/import_drawing.rs::is_lv95`).
|
||||
*/
|
||||
export function isLv95(e: number, n: number): boolean {
|
||||
return e >= 2.4e6 && e <= 2.9e6 && n >= 1.0e6 && n <= 1.4e6;
|
||||
}
|
||||
|
||||
/**
|
||||
* [221] Getippte absolute Landeskoordinaten auf den Projekt-Nullpunkt rechnen: das Modell liegt lokal um den
|
||||
* Ursprung des Standort-Bezugs (`origin` = `projectGeoOrigin`, LV95 des Modell-Nullpunkts), getippt wird oft
|
||||
* aus dem Kataster (`2600048,1200046`). Ohne Bezug, ausserhalb LV95 und für relative Eingaben unverändert.
|
||||
*/
|
||||
export function fromWorldInput(p: ParsedInput, origin: { e: number; n: number } | null): ParsedInput {
|
||||
if (!origin || p.kind !== "absolute" || !isLv95(p.point.x, p.point.y)) return p;
|
||||
return { kind: "absolute", point: { x: p.point.x - origin.e, y: p.point.y - origin.n } };
|
||||
}
|
||||
|
||||
/** Punkt aus polarer Form (Distanz/Winkel) relativ zu einem Basispunkt. */
|
||||
export function polarPoint(base: Vec2, dist: number, angleDeg: number): Vec2 {
|
||||
const a = angleDeg * DEG;
|
||||
|
||||
@@ -45,6 +45,8 @@ export interface DrawingImportDecision {
|
||||
terrainContours?: boolean;
|
||||
/** [143] Name des Höhenlinien-Satzes (übersetzt). */
|
||||
terrainName?: string;
|
||||
/** [221] Bezeichnung des Standort-Bezugs, den ein Import in Landeskoordinaten neu setzt (Dateiname). */
|
||||
geoLabel?: string;
|
||||
}
|
||||
|
||||
/** Rohergebnis des IFC-Lesers (`fileio`): Bericht (JSON), Positionen, Indizes, Zahlen der Bauteil-Erkennung. */
|
||||
@@ -574,7 +576,8 @@ export class ProjectDocument {
|
||||
* Linienstile, 2D-Zeichnungen, Kontext-Meshes) und wendet sie als EINEN Undo-Schritt an.
|
||||
*/
|
||||
importDrawing(base: Project, src: ImportSource, decision: DrawingImportDecision, now: number) {
|
||||
return this.commitCore<{ levelId: string; drawings: number; meshes: number; terrainContours: number }>(base, (h) =>
|
||||
// `shift`: Verschiebung Datei → Modell ([221] Landeskoordinaten auf den Projekt-Nullpunkt, sonst 0).
|
||||
return this.commitCore<{ levelId: string; drawings: number; meshes: number; terrainContours: number; shift: [number, number] }>(base, (h) =>
|
||||
core().doc_import_drawing(h, src.geom, JSON.stringify(src.strings), JSON.stringify(src.source), JSON.stringify(decision), "", now),
|
||||
);
|
||||
}
|
||||
|
||||
+3
-1
@@ -340,6 +340,8 @@ export const de = {
|
||||
"status.element": "Element",
|
||||
"status.elements": "Elemente",
|
||||
"status.xy": "X/Y",
|
||||
"status.lv95": "LV95",
|
||||
"status.lv95.hint": "Landeskoordinaten des Zeigers (Projekt-Nullpunkt + X/Y). Getippte LV95-Koordinaten werden auf den Projekt-Nullpunkt gerechnet.",
|
||||
"status.unit": "Einheit",
|
||||
"status.scale": "Massstab",
|
||||
"status.zoom": "Zoom",
|
||||
@@ -2624,7 +2626,7 @@ export const de = {
|
||||
"import.layers.parentName": "Import: {name}",
|
||||
"import.layers.toActive": "Alles auf die aktive Kategorie ({code})",
|
||||
"import.placement.heading": "Platzierung",
|
||||
"import.placement.origin": "An DXF-Koordinaten (relativ zum Nullpunkt)",
|
||||
"import.placement.origin": "An DXF-Koordinaten (Landeskoordinaten LV95 relativ zum Projekt-Nullpunkt)",
|
||||
"import.placement.viewCenter": "In die Mitte der aktuellen Ansicht",
|
||||
"import.mesh.heading": "Meshes",
|
||||
"import.terrain.heading": "Höhenlinien",
|
||||
|
||||
+3
-1
@@ -338,6 +338,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"status.element": "element",
|
||||
"status.elements": "elements",
|
||||
"status.xy": "X/Y",
|
||||
"status.lv95": "LV95",
|
||||
"status.lv95.hint": "Swiss national coordinates of the pointer (project origin + X/Y). Typed LV95 coordinates are converted to the project origin.",
|
||||
"status.unit": "Unit",
|
||||
"status.scale": "Scale",
|
||||
"status.zoom": "Zoom",
|
||||
@@ -2612,7 +2614,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"import.layers.parentName": "Import: {name}",
|
||||
"import.layers.toActive": "Everything onto the active category ({code})",
|
||||
"import.placement.heading": "Placement",
|
||||
"import.placement.origin": "At DXF coordinates (relative to origin)",
|
||||
"import.placement.origin": "At DXF coordinates (Swiss LV95 coordinates relative to the project origin)",
|
||||
"import.placement.viewCenter": "Centered in the current view",
|
||||
"import.mesh.heading": "Meshes",
|
||||
"import.terrain.heading": "Contour lines",
|
||||
|
||||
@@ -34,11 +34,12 @@ describe("DXF-Import: Polylinien mit Bögen", () => {
|
||||
const [d] = toDrawings(dxf(PARZELLE));
|
||||
expect(d.geom.shape).toBe("polyline");
|
||||
if (d.geom.shape !== "polyline") return;
|
||||
// [221] Landeskoordinaten relativ zum Projekt-Nullpunkt (Kilometerpunkt E 2 600 000 / N 1 200 000 unter der Mitte).
|
||||
expect(d.geom.pts).toEqual([
|
||||
{ x: 2600000, y: 1200000 },
|
||||
{ x: 2600030, y: 1200000 },
|
||||
{ x: 2600030, y: 1200030 },
|
||||
{ x: 2600000, y: 1200030 },
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 30, y: 0 },
|
||||
{ x: 30, y: 30 },
|
||||
{ x: 0, y: 30 },
|
||||
]);
|
||||
// Vorzeichen umgekehrt: Modell-Bulge > 0 = Scheitel links der Sehne, DXF > 0 = Gegenuhrzeigersinn.
|
||||
expect(d.geom.bulge).toEqual([-0.12, 0, 0.25, 0]);
|
||||
@@ -49,7 +50,8 @@ describe("DXF-Import: Polylinien mit Bögen", () => {
|
||||
const contour = inspectDxf(dxf(PARZELLE)).contours[0].contours[0];
|
||||
const [d] = toDrawings(dxf(PARZELLE));
|
||||
if (d.geom.shape !== "polyline") throw new Error("Polylinie erwartet");
|
||||
const ours = bulgePolylinePoints(d.geom.pts, d.geom.bulge, true);
|
||||
// [221] Modell lokal um den Projekt-Nullpunkt: zurück in Landeskoordinaten wie die Tessellierung der Datei.
|
||||
const ours = bulgePolylinePoints(d.geom.pts, d.geom.bulge, true).map((p) => ({ x: p.x + 2_600_000, y: p.y + 1_200_000 }));
|
||||
// Jeder Punkt der Import-Tessellierung liegt auf dem Linienzug der Modell-Polylinie (≤ 15 cm: Sehnenfehler der gröberen Modell-Tessellierung; die falsche Seite läge Meter daneben).
|
||||
const dist = (p: Vec2) => {
|
||||
let best = Infinity;
|
||||
|
||||
@@ -609,4 +609,7 @@ export const emptyProject: Project = {
|
||||
extrudedSolids: [],
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
// [221] Schnitt A und Ansicht Süd folgen dem ersten Gebauten (bzw. der Parzelle), bis man sie bearbeitet
|
||||
// (Kern `auto_lines.rs`) — sonst lägen sie bei einem Projekt in Landeskoordinaten oder abseits des Nullpunkts daneben.
|
||||
drawingLevels: sampleProject.drawingLevels.map((l) => (l.kind === "section" || l.kind === "elevation" ? { ...l, autoLine: true } : l)),
|
||||
};
|
||||
@@ -1195,6 +1195,12 @@ export type DrawingLevel = {
|
||||
* folgt weiter der Verbindung der Endpunkte.
|
||||
*/
|
||||
bendPoints?: Array<Vec2>;
|
||||
/**
|
||||
* [221] Standard-Schnitt/-Ansicht eines neuen Projekts: die Linie folgt dem Gebäude (sonst der Parzelle), bis
|
||||
* sie bearbeitet wird (verschieben, drehen, Richtung wechseln löscht das Kennzeichen). Nur Schnitt/Ansicht;
|
||||
* der Kern führt die Linie im selben Undo-Schritt nach (`auto_lines.rs`).
|
||||
*/
|
||||
autoLine?: boolean;
|
||||
/**
|
||||
* [176] Schnittmarke im Grundriss: "arrow" (Pfeil mit Dreieck, Basis) oder "lAngle" (nur ein L je Ende). Fehlt ⇒ die
|
||||
* Vorgabe der Modelldarstellung (`sectionMarks.style`), sonst Pfeil. Nur Schnitt.
|
||||
|
||||
@@ -10,8 +10,8 @@ import type { DrawingLevel } from "../model/types";
|
||||
import type { SnapSettings, ToolDraft } from "../tools/types";
|
||||
import type { TransformSelection } from "../tools/transform";
|
||||
import { computeSnap } from "../tools/snapping";
|
||||
import { unitsForLevel } from "../tools/displayUnits";
|
||||
import { cmdMutation, type ProjectMutation } from "../core";
|
||||
import { MODEL_UNITS, unitsForLevel } from "../tools/displayUnits";
|
||||
import { cmdMutation, projectGeoOrigin, type ProjectMutation } from "../core";
|
||||
import { CommandEngine } from "../commands/engine";
|
||||
import type { EngineHost } from "../commands/engine";
|
||||
import type { CommandContext } from "../commands/types";
|
||||
@@ -172,6 +172,8 @@ export function useCommandEngineHost(opts: {
|
||||
notify: (key, params, kind) => notify(t(key as Parameters<typeof t>[0], params), kind ?? "info"),
|
||||
// Getippte Werte auf einem Layout-Blatt in Papier-mm, y nach unten ([93]).
|
||||
inputUnits: () => unitsForLevel(cmdLatest.current.activeLevel),
|
||||
// [221] Getippte Landeskoordinaten auf den Projekt-Nullpunkt (Standort-Bezug), nicht auf dem Layout-Blatt.
|
||||
inputGeoOrigin: () => (unitsForLevel(cmdLatest.current.activeLevel) === MODEL_UNITS ? projectGeoOrigin(getState().project) : null),
|
||||
// Frisch über `text`/`textbox` erzeugtes Element sofort inline editieren
|
||||
// (kein Lookup nötig — der Commit hat es bereits angehängt, s. engine.ts
|
||||
// applyResult-Reihenfolge commit→focusDrawing). Auswahl-Löschen wie
|
||||
|
||||
@@ -293,7 +293,10 @@ export function useProjectFileActions(
|
||||
}
|
||||
};
|
||||
|
||||
// [221] Dateiname des laufenden Imports: Bezeichnung des Standort-Bezugs, den ein Import in Landeskoordinaten setzt.
|
||||
const importFileNameRef = useRef("");
|
||||
const openImportForFile = (file: File) => {
|
||||
importFileNameRef.current = file.name;
|
||||
if (isPdfFile(file.name)) {
|
||||
openPdfImport(file);
|
||||
return;
|
||||
@@ -674,6 +677,7 @@ export function useProjectFileActions(
|
||||
importMeshes: decision.importMeshes,
|
||||
terrainContours: decision.terrainContours,
|
||||
terrainName: t("import.terrain.setName"),
|
||||
geoLabel: importFileNameRef.current,
|
||||
...(center ? { viewCenter: [center.x, center.y] as [number, number] } : {}),
|
||||
levelNameTemplate: t("default.drawingName", { n: "{n}" }),
|
||||
parentName: t("import.layers.parentName", { name: importParentName(decision) }),
|
||||
|
||||
+16
-2
@@ -28,6 +28,8 @@ export interface StatusBarProps {
|
||||
showCursor: boolean;
|
||||
/** Einheit aus dem Projekt (vorerst fix „m"). */
|
||||
unit: string;
|
||||
/** [221] LV95 des Modell-Nullpunkts (Standort-Bezug): zeigt die Landeskoordinaten des Zeigers dazu. */
|
||||
geoOrigin?: { e: number; n: number } | null;
|
||||
/** Anzeige-Einheiten der Cursor-Koordinaten (Layout-Blatt: Papier-mm, y nach unten, [93]). */
|
||||
units?: DisplayUnits;
|
||||
/** Referenzlinien (Wandachsen) an/aus — sitzt jetzt in der Statusleiste. */
|
||||
@@ -370,9 +372,11 @@ const fmt = (n: number): string => n.toFixed(3);
|
||||
const CursorField = memo(function CursorField({
|
||||
showCursor,
|
||||
units,
|
||||
geoOrigin,
|
||||
}: {
|
||||
showCursor: boolean;
|
||||
units: DisplayUnits;
|
||||
geoOrigin?: { e: number; n: number } | null;
|
||||
}) {
|
||||
const liveCursor = useCursor();
|
||||
const cursor = showCursor ? liveCursor : null;
|
||||
@@ -381,7 +385,16 @@ const CursorField = memo(function CursorField({
|
||||
? `${fmt(cursor.x)}, ${fmt(cursor.y)}`
|
||||
: `${fmtDisplay(units, xToDisplay(units, cursor.x))}, ${fmtDisplay(units, yToDisplay(units, cursor.y))}`
|
||||
: "—";
|
||||
return <Field label={t("status.xy")} value={coords} />;
|
||||
if (!geoOrigin) return <Field label={t("status.xy")} value={coords} />;
|
||||
const lv95 = cursor ? `${(cursor.x + geoOrigin.e).toFixed(2)}, ${(cursor.y + geoOrigin.n).toFixed(2)}` : "—";
|
||||
return (
|
||||
<>
|
||||
<Field label={t("status.xy")} value={coords} />
|
||||
<span title={t("status.lv95.hint")}>
|
||||
<Field label={t("status.lv95")} value={lv95} />
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
export const StatusBar = memo(function StatusBar({
|
||||
@@ -389,6 +402,7 @@ export const StatusBar = memo(function StatusBar({
|
||||
showCursor,
|
||||
unit,
|
||||
units = MODEL_UNITS,
|
||||
geoOrigin = null,
|
||||
referenceLines,
|
||||
onReferenceLines,
|
||||
referenceLinesEnabled,
|
||||
@@ -438,7 +452,7 @@ export const StatusBar = memo(function StatusBar({
|
||||
{t("status.referenceLines")}
|
||||
</button>
|
||||
<Sep />
|
||||
<CursorField showCursor={showCursor} units={units} />
|
||||
<CursorField showCursor={showCursor} units={units} geoOrigin={geoOrigin} />
|
||||
<Sep />
|
||||
<Field label={t("status.unit")} value={units === MODEL_UNITS ? unit : units.suffix} />
|
||||
<Sep />
|
||||
|
||||
Reference in new issue
Block a user