[332] Höhenlinie: Höhenkoten und Punktmarker als Stützpunkte fürs Gelände
This commit is contained in:
8 files changed
+98
-18
No files matched your search
@@ -94,6 +94,24 @@ describe("contourLineCommand", () => {
|
||||
expect(mesh && mesh.type === "terrainMesh" ? mesh.indices.length : 0).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("Höhenkote anklicken: ihr Wert gilt sofort als Höhenpunkt, der Vorschlag für Linien bleibt", () => {
|
||||
let p = project();
|
||||
p = { ...p, drawings2d: [...p.drawings2d, { id: "k", type: "drawing2d", levelId: "eg", categoryCode: "20", geom: { shape: "kote", at: { x: 10, y: 20 }, value: 3.4, kind: "okFertig", rotation: 0 } }] } as Project;
|
||||
const cmd = contourLineCommand;
|
||||
let [s, r] = cmd.onInput(cmd.init(), { kind: "point", point: { x: 0.05, y: 0 } }, ctxOf(p));
|
||||
[s, r] = cmd.onInput(s, { kind: "number", value: 2 }, ctxOf(p));
|
||||
p = r.commit!(p);
|
||||
[s, r] = cmd.onInput(s, { kind: "point", point: { x: 10.05, y: 20 } }, ctxOf(p));
|
||||
expect(s.phase).toBe("pick");
|
||||
p = r.commit!(p);
|
||||
expect(contours(p).map((c) => [c.z, c.pts.length])).toEqual([[2, expect.any(Number)], [3.4, 1]]);
|
||||
expect(suggestedZ(p)).toBe(3);
|
||||
// Gelände aus einer Linie und dem Höhenpunkt.
|
||||
const withTerrain = terrainCommand.autoRun!(ctxOf(p)).commit!(p);
|
||||
const mesh = (withTerrain.context ?? []).find((o) => o.type === "terrainMesh");
|
||||
expect(mesh && mesh.type === "terrainMesh" ? mesh.indices.length : 0).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("vorgewählte Linie: getippte Zahl ist gleich ihre Höhe", () => {
|
||||
const p = project();
|
||||
const [, r] = contourLineCommand.onInput(contourLineCommand.init(), { kind: "number", value: 3.5 }, ctxOf(p, ["b"]));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// [332] Höhenlinie — eigene Gelände-Höhenlinien aus gezeichneten Linien (Linie, Polylinie, Spline, Bogen, Kreis,
|
||||
// Ellipse, Rechteck). Ablauf wie beim Extrudieren:
|
||||
// Ellipse, Rechteck) und Höhenpunkte (Kote: ihr Wert, sofort übernommen; Punktmarker: getippte Höhe; beim Gelände
|
||||
// Stützpunkte). Ablauf wie beim Extrudieren:
|
||||
// 1) Linie anklicken (oder eine vorgewählte nehmen),
|
||||
// 2) „Höhe:" → Zahl tippen, Enter übernimmt den Vorschlag (letzte Höhe + Äquidistanz).
|
||||
// Die Linie wird zur Höhenlinie (Kern `contour_draw.rs`, ein Undo-Schritt je Linie) und der Befehl wartet auf die
|
||||
@@ -11,8 +12,11 @@ import { createMutation, createQuery, xy } from "../createCore";
|
||||
/** Getroffene Linie (Kern): Id, Linienzug, geschlossen? */
|
||||
export interface LineHit {
|
||||
id: string;
|
||||
/** Linienzug; ein Punkt = Höhenpunkt (Kote, Punktmarker). */
|
||||
pts: Vec2[];
|
||||
closed: boolean;
|
||||
/** Eigene Höhe (Kote): wird ohne Tippen übernommen. */
|
||||
z?: number;
|
||||
}
|
||||
|
||||
/** Zuletzt getippte Höhe und Äquidistanz (Abstand der letzten beiden Höhen) über Aufrufe hinweg. */
|
||||
@@ -100,6 +104,10 @@ export const contourLineCommand: Command = {
|
||||
if (input.kind !== "point") return [s, { draft: null }];
|
||||
const hit = query(ctx.project, { q: "pickContourLine", level: ctx.level.id, pt: xy(input.point) });
|
||||
if (!hit) return [s, { draft: null, notice: { key: "cmd.contourLine.noLine", kind: "warning" } }];
|
||||
// Kote: ihr Wert ist die Höhe — gleich übernehmen (der Vorschlag für die Linien bleibt).
|
||||
if (hit.z !== undefined && Number.isFinite(hit.z)) {
|
||||
return [{ ...PICK }, { draft: null, commit: createMutation(ctx, { cmd: "contourLine", source: hit.id }) }];
|
||||
}
|
||||
return [{ phase: "height", hit, lastPoint: null } as ClHeight, draftOf(hit, input.point, ctx.project)];
|
||||
}
|
||||
if (input.kind === "number" && Number.isFinite(input.value)) return commit(s.hit, input.value, ctx);
|
||||
|
||||
+2
-2
@@ -2709,9 +2709,9 @@ export const de = {
|
||||
"cmd.extrude.height": "Höhe:",
|
||||
"cmd.extrude.taper": "Verjüngung (0–1, 1=Spitze):",
|
||||
"cmd.contourLine.label": "Höhenlinie",
|
||||
"cmd.contourLine.pick": "Linie für die Höhenlinie wählen (Enter: fertig):",
|
||||
"cmd.contourLine.pick": "Linie oder Höhenkote wählen (Enter: fertig):",
|
||||
"cmd.contourLine.height": "Höhe (m ü. M. bzw. Projekthöhe, Enter: Vorschlag):",
|
||||
"cmd.contourLine.noLine": "Hier liegt keine Linie (Linie, Polylinie, Spline, Bogen, Kreis, Ellipse oder Rechteck anklicken)",
|
||||
"cmd.contourLine.noLine": "Hier liegt keine Linie (Linie, Polylinie, Spline, Bogen, Kreis, Ellipse, Rechteck, Höhenkote oder Punktmarker anklicken)",
|
||||
"cmd.contourLine.done": "Höhenlinien übernommen — „Gelände“ erzeugt daraus das Geländemodell",
|
||||
// Trim (Quick-Trim): auf den wegzuschneidenden Abschnitt klicken; wiederholend.
|
||||
"cmd.trim.label": "Stutzen",
|
||||
|
||||
+2
-2
@@ -2697,9 +2697,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.extrude.height": "Height:",
|
||||
"cmd.extrude.taper": "Taper (0–1, 1=point):",
|
||||
"cmd.contourLine.label": "Contour line",
|
||||
"cmd.contourLine.pick": "Select line for the contour (Enter: done):",
|
||||
"cmd.contourLine.pick": "Select line or spot level (Enter: done):",
|
||||
"cmd.contourLine.height": "Elevation (m a.s.l. or project height, Enter: suggestion):",
|
||||
"cmd.contourLine.noLine": "No line here (click a line, polyline, spline, arc, circle, ellipse or rectangle)",
|
||||
"cmd.contourLine.noLine": "No line here (click a line, polyline, spline, arc, circle, ellipse, rectangle, spot level or point marker)",
|
||||
"cmd.contourLine.done": "Contours added — “Terrain” builds the terrain model from them",
|
||||
// Trim (quick-trim): click the part to cut away; repeats until Esc.
|
||||
"cmd.trim.label": "Trim",
|
||||
|
||||
Reference in new issue
Block a user