Kern/Huelle Phase A.1: Kern-Lecks behoben (View-/Detail-Typen nach model/viewTypes, Pick-Typen nach plan/pickTypes, geomTransform/curves/lineSegments/layoutModel in den Kern verschoben)
This commit is contained in:
1 parent
1ea0fab6ce
commit
cb79c13753
46 files changed
+373
-344
No files matched your search
+1
-1
@@ -81,7 +81,7 @@ import {
|
||||
addAnnotation as addAnnotationToLayout,
|
||||
removeAnnotation as removeAnnotationFromLayout,
|
||||
patchAnnotation as patchAnnotationInLayout,
|
||||
} from "./panels/layoutModel";
|
||||
} from "./model/layoutModel";
|
||||
import { HatchSwatch } from "./ui/hatchPreview";
|
||||
import { TopBar, ViewRibbonTab } from "./ui/TopBar";
|
||||
import { AppMenuBar } from "./ui/AppMenuBar";
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import type { Drawing2D } from "../../model/types";
|
||||
import { uniqueId } from "../../tools/types";
|
||||
import { sampleBezierChain } from "../../tools/curves";
|
||||
import { sampleBezierChain } from "../../geometry/curves";
|
||||
import type {
|
||||
Command,
|
||||
CommandContext,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// Leere/rein-block-Auswahl → No-Op (kein Commit).
|
||||
|
||||
import type { BlockDef, Drawing2D } from "../../model/types";
|
||||
import { mvGeom } from "../../tools/transform";
|
||||
import { mvGeom } from "../../geometry/geomTransform";
|
||||
import { uniqueId } from "../../tools/types";
|
||||
import type {
|
||||
Command,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
import type { Drawing2D } from "../../model/types";
|
||||
import { segmentHud, uniqueId } from "../../tools/types";
|
||||
import { ellipsePts } from "../../tools/curves";
|
||||
import { ellipsePts } from "../../geometry/curves";
|
||||
import type {
|
||||
CmdOption,
|
||||
Command,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import type { Drawing2D } from "../../model/types";
|
||||
import { segmentHud, uniqueId } from "../../tools/types";
|
||||
import { sampleCatmullRom, sampleUniformBSpline } from "../../tools/curves";
|
||||
import { sampleCatmullRom, sampleUniformBSpline } from "../../geometry/curves";
|
||||
import type {
|
||||
Command,
|
||||
CommandContext,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import type { Drawing2D, Project, Vec2 } from "../model/types";
|
||||
import { geomBBox } from "../state/selectionInfo";
|
||||
import { mvGeom } from "../tools/transform";
|
||||
import { mvGeom } from "../geometry/geomTransform";
|
||||
|
||||
/** Ausrichtungskante bzw. -achse. */
|
||||
export type AlignMode = "left" | "right" | "centerX" | "top" | "bottom" | "centerY";
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
visibleCodesFromSnapshot,
|
||||
type FolderPdfPage,
|
||||
type ResolvedTitleBlock,
|
||||
} from "../panels/layoutModel";
|
||||
} from "../model/layoutModel";
|
||||
|
||||
export { folderPdfPages, type FolderPdfPage };
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
import type { HatchRender, Plan, Primitive } from "../plan/generatePlan";
|
||||
import type { Vec2 } from "../model/types";
|
||||
import { buildRandomHatchRuns, zigzagPoints, motifPoints } from "../plan/glPlan/glPlanHatch";
|
||||
import { dashHasDot } from "../ui/lineSegments";
|
||||
import { dashHasDot } from "../geometry/lineSegments";
|
||||
import { wrapDocToLines, type SvgLine } from "../text/renderHtml";
|
||||
import { docFromText } from "../text/richText";
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,166 @@
|
||||
// Punkt-Abbildung von 2D-Zeichengeometrie (Verschieben/Spiegeln/Drehen/Skalieren). Reine
|
||||
// Geometrie ohne UI — Quelle für Transformations-Befehle, Block-Rendering und den Plan-Generator.
|
||||
|
||||
import type { Drawing2DGeom, Vec2 } from "../model/types";
|
||||
|
||||
|
||||
/**
|
||||
* Erkennt, ob `fn` die Umlauf-Orientierung umkehrt (Spiegelung) — via
|
||||
* Flächenvorzeichen eines Test-Dreiecks unter `fn` (negativ ⇒ Spiegelung).
|
||||
* Funktioniert für JEDE Isometrie/Similarity (Move/Rotate/Scale erhalten die
|
||||
* Orientierung, Mirror kehrt sie um), ohne dass eine Operation ihre Spiegel-
|
||||
* Eigenschaft explizit markieren müsste.
|
||||
*/
|
||||
export function reversesOrientation(fn: (p: Vec2) => Vec2): boolean {
|
||||
const p0 = fn({ x: 0, y: 0 }), p1 = fn({ x: 1, y: 0 }), p2 = fn({ x: 0, y: 1 });
|
||||
return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y) < 0;
|
||||
}
|
||||
|
||||
/** Bildet jeden Punkt einer 2D-Zeichengeometrie unter `fn` ab (Move/Mirror/Rotate/Array + Block-Rendering). */
|
||||
/**
|
||||
* Wie {@link mvGeom}, zusätzlich für eine SKALIERUNG: `mvGeom` bildet nur
|
||||
* PUNKTE ab — Radien, Schrifthöhen und der Bemassungs-Abstand sind aber keine
|
||||
* Punkte und blieben sonst unverändert stehen (ein Kreis behielte unter einer
|
||||
* 2×-Skalierung seinen Radius). Diese Funktion zieht die betroffenen
|
||||
* Grössenfelder um denselben Faktor nach.
|
||||
*
|
||||
* Bewusst NICHT angefasst: `bulge` (ein Formverhältnis, skaleninvariant) und
|
||||
* die Papier-mm-Felder von Bemassung/Linienenden — die beziehen sich auf das
|
||||
* Blatt, nicht aufs Modell, und dürfen beim Skalieren des Objekts gleich
|
||||
* bleiben.
|
||||
*/
|
||||
/** Skalierungsfaktor eines `op:"scale"`-Punkte-Tripels bei Interpolation `t`. */
|
||||
export function scaleFactor(pts: Vec2[], t: number): number {
|
||||
const c = pts[0];
|
||||
const ref = Math.hypot(pts[1].x - c.x, pts[1].y - c.y) || 1;
|
||||
const tgt = Math.hypot(pts[2].x - c.x, pts[2].y - c.y);
|
||||
return 1 + (tgt / ref - 1) * t;
|
||||
}
|
||||
|
||||
export const scaleGeom = (geom: Drawing2DGeom, fn: (p: Vec2) => Vec2, f: number): Drawing2DGeom => {
|
||||
const g = mvGeom(geom, fn);
|
||||
switch (g.shape) {
|
||||
case "circle":
|
||||
return { ...g, r: g.r * f };
|
||||
case "arc":
|
||||
return { ...g, r: g.r * f };
|
||||
case "ellipse":
|
||||
return { ...g, rx: g.rx * f, ry: g.ry * f };
|
||||
case "dimension":
|
||||
// `offset` ist der Normalabstand der Masslinie in Modellmass.
|
||||
return { ...g, offset: g.offset * f };
|
||||
case "text":
|
||||
return {
|
||||
...g,
|
||||
height: g.height * f,
|
||||
...(g.width !== undefined ? { width: g.width * f } : {}),
|
||||
};
|
||||
case "scalebar":
|
||||
// Segmentlänge ist eine ECHTE Modell-Distanz (kein Papier-mm-Feld wie
|
||||
// bei Kote/Bemassung) — muss bei einer Modell-Skalierung mitwachsen,
|
||||
// sonst zeigt der Balken nach dem Skalieren die FALSCHE Distanz an.
|
||||
return { ...g, segmentLength: g.segmentLength * f };
|
||||
case "block":
|
||||
// Blockinstanz-Skalierung (s. Typ-Kommentar in model/types.ts) —
|
||||
// ohne diesen Fall wäre der `scale`-Befehl auf eine Blockinstanz ein
|
||||
// kompletter No-Op (kein Feld zum Multiplizieren).
|
||||
return { ...g, scale: (g.scale ?? 1) * f };
|
||||
default:
|
||||
return g;
|
||||
}
|
||||
};
|
||||
|
||||
export const mvGeom = (geom: Drawing2DGeom, fn: (p: Vec2) => Vec2): Drawing2DGeom => {
|
||||
switch (geom.shape) {
|
||||
case "line":
|
||||
case "xline":
|
||||
case "ray":
|
||||
return { ...geom, a: fn(geom.a), b: fn(geom.b) };
|
||||
case "polyline": {
|
||||
const pts = geom.pts.map(fn);
|
||||
if (!geom.bulge) return { ...geom, pts };
|
||||
// Bulge-Vorzeichen ist rein relativ zur Zeichenrichtung definiert (links
|
||||
// von a→b) — eine Spiegelung kehrt die Umlauf-Orientierung um und muss
|
||||
// daher auch jeden Bogen umkehren, sonst wandert er auf die falsche Seite.
|
||||
const bulge = reversesOrientation(fn) ? geom.bulge.map((b) => -b) : geom.bulge;
|
||||
return { ...geom, pts, bulge };
|
||||
}
|
||||
case "rect": {
|
||||
// Achsparallel nur bei reiner Verschiebung erhaltbar; sonst → Polylinie.
|
||||
const c = [
|
||||
geom.min,
|
||||
{ x: geom.max.x, y: geom.min.y },
|
||||
geom.max,
|
||||
{ x: geom.min.x, y: geom.max.y },
|
||||
].map(fn);
|
||||
const axisAligned =
|
||||
Math.abs(c[0].y - c[1].y) < 1e-6 &&
|
||||
Math.abs(c[1].x - c[2].x) < 1e-6 &&
|
||||
Math.abs(c[2].y - c[3].y) < 1e-6;
|
||||
if (axisAligned) {
|
||||
const xs = c.map((p) => p.x), ys = c.map((p) => p.y);
|
||||
return {
|
||||
shape: "rect",
|
||||
min: { x: Math.min(...xs), y: Math.min(...ys) },
|
||||
max: { x: Math.max(...xs), y: Math.max(...ys) },
|
||||
};
|
||||
}
|
||||
return { shape: "polyline", pts: c, closed: true };
|
||||
}
|
||||
case "circle":
|
||||
return { ...geom, center: fn(geom.center) };
|
||||
case "arc":
|
||||
return { ...geom, center: fn(geom.center) };
|
||||
case "ellipse":
|
||||
return { ...geom, center: fn(geom.center) };
|
||||
case "bezier":
|
||||
return { ...geom, pts: geom.pts.map(fn) };
|
||||
case "spline":
|
||||
return { ...geom, pts: geom.pts.map(fn) };
|
||||
case "dimension":
|
||||
return { ...geom, pts: geom.pts.map(fn) };
|
||||
case "kote":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "detailref":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "scalebar":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "pointmarker":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "text":
|
||||
// Leader-Ziel bzw. Pfadpunkte (Text-entlang-Pfad) müssen mitwandern,
|
||||
// sonst zeigt der Pfeil/Pfad nach einem Move/Mirror/Rotate/Array auf die
|
||||
// alte Position.
|
||||
return {
|
||||
...geom,
|
||||
at: fn(geom.at),
|
||||
...(geom.leaderTarget ? { leaderTarget: fn(geom.leaderTarget) } : {}),
|
||||
...(geom.leaderBendPoints ? { leaderBendPoints: geom.leaderBendPoints.map(fn) } : {}),
|
||||
...(geom.pathPts ? { pathPts: geom.pathPts.map(fn) } : {}),
|
||||
};
|
||||
case "block": {
|
||||
// Wie Column: Winkel aus einem transformierten Richtungspunkt zurück-
|
||||
// rechnen, damit Rotate/Mirror auch die Instanz-Ausrichtung mitnehmen
|
||||
// (nicht nur den Einfügepunkt) — reine Translation liesse die Symbole
|
||||
// beim Drehen der Auswahl in der alten Orientierung stehen.
|
||||
const tip = { x: geom.at.x + Math.cos(geom.rotation), y: geom.at.y + Math.sin(geom.rotation) };
|
||||
const nb = fn(geom.at);
|
||||
const nt = fn(tip);
|
||||
return { ...geom, at: nb, rotation: Math.atan2(nt.y - nb.y, nt.x - nb.x) };
|
||||
}
|
||||
case "image": {
|
||||
// Wie Text: nur die Position folgt der Transformation (Zentrum wandert
|
||||
// dorthin, wo `fn` es abbildet); die Box bleibt achsparallel/unverzerrt —
|
||||
// ein Bild kann nicht geschert/rotiert dargestellt werden (kein `angle`-Feld).
|
||||
const oldCenter = { x: (geom.min.x + geom.max.x) / 2, y: (geom.min.y + geom.max.y) / 2 };
|
||||
const newCenter = fn(oldCenter);
|
||||
const dx = newCenter.x - oldCenter.x;
|
||||
const dy = newCenter.y - oldCenter.y;
|
||||
return {
|
||||
...geom,
|
||||
min: { x: geom.min.x + dx, y: geom.min.y + dy },
|
||||
max: { x: geom.max.x + dx, y: geom.max.y + dy },
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
File renamed without changes.
File renamed without changes.
@@ -9,7 +9,7 @@ import type {
|
||||
MasterLayout,
|
||||
Project,
|
||||
ViewSnapshot,
|
||||
} from "../model/types";
|
||||
} from "./types";
|
||||
import {
|
||||
addAnnotation,
|
||||
addViewport,
|
||||
@@ -19,7 +19,7 @@ import type {
|
||||
MasterLayout,
|
||||
Project,
|
||||
ViewSnapshot,
|
||||
} from "../model/types";
|
||||
} from "./types";
|
||||
|
||||
// ── Blatt-Geometrie ──────────────────────────────────────────────────────────
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ export type { RichTextDoc } from "../text/richText";
|
||||
// Ansichts-Enums für Ausschnitte/View-Snapshots (Ansichtstyp, Kamera-Preset,
|
||||
// Detailgrad). Rein type-only importiert — zur Laufzeit erased, kein Zyklus
|
||||
// (TopBar importiert seinerseits nur `Project` als Typ). Wie SiaCategory oben.
|
||||
import type { DetailLevel, View3d, ViewType } from "../ui/TopBar";
|
||||
import type { DetailLevel, View3d, ViewType } from "./viewTypes";
|
||||
|
||||
// ── Ressourcen-Bibliotheken (Vectorworks-/DOSSIER-Stil) ────────────────────
|
||||
// Verwaltete, per id verwiesene Stil-Ressourcen. Verweis-Kette:
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// Ansichts-Typen (Geschoss-Ansicht, Detailgrad, 3D-Render-Modus, 3D-Blickwinkel). Gehören zum
|
||||
// Modell/Kern, nicht zur Top-Bar — Kern und Hülle importieren sie von hier.
|
||||
|
||||
/** Ansichtstyp eines Geschosses (wie in App). */
|
||||
export type ViewType = "grundriss" | "perspektive";
|
||||
|
||||
/**
|
||||
* Detailgrad der Darstellung (≙ DOSSIER Einfach/Standard/Detail). Wirkt im
|
||||
* Grundriss auf Tür-/Fenstersymbole + Schraffuren/Linienfeinheit (siehe
|
||||
* generatePlan.DetailLevel); in der Perspektive noch ohne Wirkung (deferred).
|
||||
*/
|
||||
export type DetailLevel = "grob" | "mittel" | "fein";
|
||||
|
||||
/**
|
||||
* Render-/Anzeigemodus der 3D-Ansicht: schattiert, einheitlich weiss (Clay-Look),
|
||||
* texturiert (echte PBR-Materialien je Bauteil), Drahtgitter, Verdeckte Kanten
|
||||
* (Hidden-Line), Schattiert mit Kanten (typischer BIM-Look: Bauteilfarben +
|
||||
* Modell-Kanten obenauf). Wirkt nur in der Perspektive. Der Slot „section"
|
||||
* (Schnittschraffur, Welle B) ist bewusst freigelassen.
|
||||
*/
|
||||
export type RenderMode =
|
||||
| "shaded"
|
||||
| "white"
|
||||
| "contour"
|
||||
| "textured"
|
||||
| "wireframe"
|
||||
| "hidden"
|
||||
| "shaded-edges";
|
||||
|
||||
/**
|
||||
* Kanonischer Blickwinkel der 3D-Ansicht (Vectorworks/DOSSIER-Stil). „front"/
|
||||
* „back"/„side"/„left" springen auf die vier Kardinalrichtungen (Vorne/Hinten/
|
||||
* Rechts/Links — KEINE Himmelsrichtungs-Labels, da es noch keinen Nordwinkel
|
||||
* gibt); „top" auf die Draufsicht. „iso"/„isoFrontLeft"/„isoBackRight"/
|
||||
* „isoBackLeft" sind die vier oberen Iso-Oktanten (untere vier bleiben im
|
||||
* Hochbau ungenutzt) — „iso" (vorne-oben-rechts) ist der bestehende Default.
|
||||
* „perspective" ist der freie 3/4-Blick. Wirkt nur in der Perspektive.
|
||||
*/
|
||||
export type View3d =
|
||||
| "front"
|
||||
| "back"
|
||||
| "side"
|
||||
| "left"
|
||||
| "top"
|
||||
| "iso"
|
||||
| "isoFrontLeft"
|
||||
| "isoBackRight"
|
||||
| "isoBackLeft"
|
||||
| "perspective";
|
||||
@@ -16,7 +16,7 @@ import { useEffect, useRef } from "react";
|
||||
import { isTauriRuntime } from "../io/projectFile";
|
||||
import { t } from "../i18n";
|
||||
import { APP_VERSION } from "../ui/TopBar";
|
||||
import type { View3d, ViewType } from "../ui/TopBar";
|
||||
import type { View3d, ViewType } from "../model/viewTypes";
|
||||
|
||||
/** Alle Aktionen, die die native Menüleiste auslösen kann. */
|
||||
export interface NativeAppMenuHandlers {
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
PAPER_FORMAT_GROUPS,
|
||||
type FolderNode,
|
||||
type MasterFolderNode,
|
||||
} from "./layoutModel";
|
||||
} from "../model/layoutModel";
|
||||
import {
|
||||
NewLayoutDialog,
|
||||
NewMasterLayoutDialog,
|
||||
|
||||
@@ -37,7 +37,7 @@ import type {
|
||||
} from "../model/types";
|
||||
import { SIA_CATEGORIES, siaLabelFull } from "../geometry/roomArea";
|
||||
import { Dropdown } from "../ui/Dropdown";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import { ColorHexField } from "../ui/ColorHexField";
|
||||
import { usePanelHost } from "./host";
|
||||
import type {
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ import type { MeasurementReadout, SnapSettings, ToolId } from "../tools/types";
|
||||
import type { Selection } from "../state/selectionInfo";
|
||||
import type { TextStylePreset } from "../text/richText";
|
||||
import type { ScheduleKind } from "../export/exportSchedule";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
|
||||
// ── Darstellungsmodus-Steuerung je Dock-Inhalt ────────────────────────────
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
import { layersStyleSig } from "./layerSig";
|
||||
import { ellipsePts, sampleBezierChain, sampleCatmullRom, sampleUniformBSpline } from "../../tools/curves";
|
||||
import { scaleGeom } from "../../tools/transform";
|
||||
import { ellipsePts, sampleBezierChain, sampleCatmullRom, sampleUniformBSpline } from "../../geometry/curves";
|
||||
import { scaleGeom } from "../../geometry/geomTransform";
|
||||
import { bulgeArc, bulgeArcPoints } from "../../geometry/bulge";
|
||||
import { END_MARK_DEFAULT_SIZE_MM, addEndMark, pullBack } from "./endMarks";
|
||||
import {
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// Minimal-Formen der Pick-Geometrie (Wand-/Öffnungs-/Dach-… Körper für den 3D-Raycast). Sie
|
||||
// stehen im Kern (`pickGeometry` in toWalls3d erzeugt sie); der Raycast der Hülle
|
||||
// (viewport/raycast3d.ts) konsumiert sie.
|
||||
|
||||
export type Vec3 = [number, number, number];
|
||||
|
||||
/** Minimal-Form eines Wand-Quaders für den Raycast (RWall erfüllt sie strukturell). */
|
||||
export interface PickWall {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
thickness: number;
|
||||
height: number;
|
||||
baseElevation: number;
|
||||
wallId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form einer Öffnungs-Box (Fenster/Tür) für den Raycast — dieselbe
|
||||
* orientierte-Quader-Form wie `PickWall` (Achse jambStart→jambEnd in der
|
||||
* XZ-Ebene, Dicke = Wanddicke am Sitz der Öffnung), nur über ihre EIGENE
|
||||
* vertikale Ausdehnung (Brüstung..Sturz) statt der vollen Wandhöhe.
|
||||
*/
|
||||
export interface PickOpening {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
thickness: number;
|
||||
height: number;
|
||||
baseElevation: number;
|
||||
openingId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Segments einer freien 2D-Zeichnung (Linie/Polylinie/
|
||||
* Rechteck) für den Raycast — dieselbe orientierte-Quader-Form wie
|
||||
* `PickOpening`, aber mit fester (grosszügiger) Klick-Toleranz statt echter
|
||||
* Bauteildicke: die sichtbare Boden-Spur im 3D ist nur 0.008m breit (s.
|
||||
* `toWalls3d/drawing2d.ts::DRAWING_LINE_HALF_WIDTH`) — zu schmal, um
|
||||
* zuverlässig zu treffen. `baseElevation` ist bereits die UNTERE Kante der
|
||||
* Pick-Box (Boden-Spur-Höhe minus halbe Toleranzhöhe), s. `pickDrawingSegs`.
|
||||
*/
|
||||
export interface PickDrawingSeg {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
baseElevation: number;
|
||||
drawingId: string;
|
||||
}
|
||||
|
||||
/** Klick-Toleranz für 2D-Zeichnungs-Boden-Spuren im 3D (Welt-Meter, s.
|
||||
* {@link PickDrawingSeg}) — quer zur Linie UND vertikal, je zur Hälfte um die
|
||||
* sichtbare Spur zentriert. Analog dem 2D-Plan-Pick-Radius
|
||||
* (`PlanView.tsx::LINE_PICK_PX`), hier als fester Welt-Wert statt Pixel-
|
||||
* Toleranz (im 3D gibt es keinen globalen Pixel/Meter-Faktor). */
|
||||
export const DRAWING_PICK_TOLERANCE = 0.12;
|
||||
|
||||
/** Minimal-Form eines Decken-Prismas für den Raycast (RSlab erfüllt sie strukturell). */
|
||||
export interface PickSlab {
|
||||
outline: ReadonlyArray<readonly [number, number]>;
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
ceilingId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Treppen-Bounding-Prismas für den Raycast: ein achsparalleles
|
||||
* Rechteck über den Grundriss-Fußabdruck (alle Tritte + Podest), extrudiert über
|
||||
* die vertikale Ausdehnung der Treppe. Pragmatische Näherung statt Tritt-für-
|
||||
* Tritt-Boxen — reicht für zuverlässiges Anklicken im 3D-Viewport.
|
||||
*/
|
||||
export interface PickStair {
|
||||
outline: ReadonlyArray<readonly [number, number]>;
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
stairId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Dachs für den Raycast: die Dachflächen + Giebel als
|
||||
* WORLD-Dreiecke (fan-trianguliert, dieselbe Konvention wie `emitRoofs`:
|
||||
* model (x,y,z=Höhe) → world (x, z, y)). Präzise geneigte Flächen statt eines
|
||||
* grosszügigen Bounding-Prismas — sonst stähle das Dach Klicks auf die
|
||||
* Fassade dahinter (pickNearest entscheidet über die Strahl-Distanz).
|
||||
*/
|
||||
export interface PickRoof {
|
||||
tris: ReadonlyArray<readonly [Vec3, Vec3, Vec3]>;
|
||||
roofId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Kontext-Meshes (importiertes Gebäude/Terrain, s.
|
||||
* `ContextObject`) für den Raycast: rohe WORLD-Dreiecke (dieselbe Konvention
|
||||
* wie {@link PickRoof} — model (x,y,z=Höhe) → world (x, z, y)), keine
|
||||
* Vereinfachung auf ein Bounding-Prisma (Gebäude-Meshes sind zu unregelmässig
|
||||
* dafür, ein grosszügiges Prisma stähle Klicks auf dahinterliegende Bauteile).
|
||||
*/
|
||||
export interface PickContextMesh {
|
||||
tris: ReadonlyArray<readonly [Vec3, Vec3, Vec3]>;
|
||||
contextObjectId: string;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { docToLines, wrapDocToLines, type SvgLine } from "../../text/renderHtml"
|
||||
import type { Vec2 } from "../../model/types";
|
||||
import { quantizePen } from "../../export/sceneToPrintSvg";
|
||||
import { buildRandomHatchRuns, zigzagPoints, motifPoints, DASH_MM_TO_M } from "../glPlan/glPlanHatch";
|
||||
import { dashHasDot } from "../../ui/lineSegments";
|
||||
import { dashHasDot } from "../../geometry/lineSegments";
|
||||
import { HAIRLINE_PX, PX_PER_M, mmToPx, printStrokeVb, visibleEdgeRuns } from "./geometry";
|
||||
|
||||
/** Basis-Kachelmaß (viewBox-Einheiten) einer Bild-Schraffur bei scaleX/scaleY = 1. */
|
||||
|
||||
+13
-4
@@ -42,16 +42,15 @@
|
||||
|
||||
import type { Project, Vec2, Wall } from "../model/types";
|
||||
import { getWallType, wallTypeThickness } from "../model/types";
|
||||
import type { ToolDraft } from "../tools/types";
|
||||
import { stairVerticalExtent } from "../model/wall";
|
||||
import { openingJambs, openingVerticalExtent } from "../geometry/opening";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import { stairBBox, stairGeometry } from "../geometry/stair";
|
||||
import { roofBaseElevation, roofGeometry } from "../geometry/roof";
|
||||
import type { Vec3 as RoofVec3 } from "../geometry/roof";
|
||||
import { computeJoins } from "../model/joins";
|
||||
import type { WallCuts } from "../model/joins";
|
||||
import type { PickOpening, PickRoof, PickStair, PickContextMesh, PickDrawingSeg } from "../viewport/raycast3d";
|
||||
import type { PickOpening, PickRoof, PickStair, PickContextMesh, PickDrawingSeg } from "./pickTypes";
|
||||
import {
|
||||
EPS,
|
||||
IMPORTED_RGB,
|
||||
@@ -538,6 +537,16 @@ const SNAP_MARKER_HALF = 0.06;
|
||||
* unendliche Linie liefe unkontrolliert durchs ganze Modell). */
|
||||
const SNAP_ANGLE_GUIDE_EXTEND_M = 6;
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Werkzeug-Drafts (`ToolDraft` der Hülle erfüllt sie strukturell): nur das,
|
||||
* was `draftWorldLines` liest. So hängt der Kern nicht an `tools/types`.
|
||||
*/
|
||||
export interface DraftLike {
|
||||
preview: Array<{ kind: "line"; a: Vec2; b: Vec2 } | { kind: "poly"; pts: Vec2[]; closed?: boolean }>;
|
||||
vertices: Vec2[];
|
||||
snap?: { point: Vec2; kind?: string; refA?: Vec2 } | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wandelt den aktiven Werkzeug-Draft (`ToolDraft.preview`, Modell-Meter,
|
||||
* Grundriss-Ebene) in dasselbe flache Weltraum-LineList-Format wie
|
||||
@@ -559,7 +568,7 @@ const SNAP_ANGLE_GUIDE_EXTEND_M = 6;
|
||||
* schon, wohin der erste Punkt fängt — deshalb NICHT mehr früh bei leerem
|
||||
* `preview` abgebrochen.
|
||||
*/
|
||||
export function draftWorldLines(draft: ToolDraft | null, planeY: number): Float32Array {
|
||||
export function draftWorldLines(draft: DraftLike | null, planeY: number): Float32Array {
|
||||
if (!draft) return new Float32Array(0);
|
||||
const out: number[] = [];
|
||||
const pushSeg = (a: Vec2, bPt: Vec2, rgb: RRgb = DRAFT_LINE_RGB) => {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import type { Drawing2D, Project, Vec2 } from "../../model/types";
|
||||
import { flattenCategories, getFloor } from "../../model/types";
|
||||
import { DRAWING_LINE_FALLBACK_RGB, hexToRgb, type RRgb } from "./shared";
|
||||
import { DRAWING_PICK_TOLERANCE, type PickDrawingSeg } from "../../viewport/raycast3d";
|
||||
import { DRAWING_PICK_TOLERANCE, type PickDrawingSeg } from "../pickTypes";
|
||||
|
||||
/** Höhen-Offset über der Geschossebene gegen Z-Fighting (wie addDrawing2DLines in Viewport3D.tsx). */
|
||||
const DRAWING_LINE_ELEVATION_EPS = 0.01;
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { FrameCornerJoin, Opening, Project, SashDef, Wall } from "../../mod
|
||||
import { getDoorType, getWindowType, glazingPanesOf, openingsOfWall } from "../../model/types";
|
||||
import { openingInterval, openingVerticalExtent } from "../../geometry/opening";
|
||||
import { wallVerticalExtent } from "../../model/wall";
|
||||
import type { DetailLevel } from "../../ui/TopBar";
|
||||
import type { DetailLevel } from "../../model/viewTypes";
|
||||
import { EPS, type RMesh, type RRgb } from "./shared";
|
||||
import { wallThicknessSafe } from "./bands";
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ import type {
|
||||
Wall,
|
||||
WallReferenceLine,
|
||||
} from "../model/types";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import { localToLv95 } from "../io/lv95";
|
||||
import {
|
||||
resolveForeground,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import type { CategoryDisplayResolver } from "../plan/generatePlan";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import type { DisplayResolver } from "../viewport/Viewport3D";
|
||||
import { savePlanPdf } from "../export/exportPdf";
|
||||
import { savePlanSvg } from "../export/exportSvg";
|
||||
|
||||
@@ -10,7 +10,8 @@ import { add, dot, leftNormal, normalize, scale, sub, wallCorners } from "../mod
|
||||
import type { Ceiling, Drawing2D, EdgeGrip, Project, Room, Stair, Vec2 } from "../model/types";
|
||||
import { wallTypeThickness } from "../model/types";
|
||||
import { drawingVertices } from "./projectSlice";
|
||||
import { areaMovePreview, mvGeom } from "../tools/transform";
|
||||
import { areaMovePreview } from "../tools/transform";
|
||||
import { mvGeom } from "../geometry/geomTransform";
|
||||
import { drawingPreviewShapes } from "../tools/drawingPreview";
|
||||
import type { DraftShape, SnapResult, SnapSettings, ToolDraft, ToolMods } from "../tools/types";
|
||||
import { applyAngleConstraint, computeSnap } from "../tools/snapping";
|
||||
|
||||
@@ -12,7 +12,7 @@ import { useMemo, type RefObject } from "react";
|
||||
import type { DrawingLevel, Layout, Project } from "../model/types";
|
||||
import { resolvePenColor } from "../model/penSets";
|
||||
import type { ToolId } from "../tools/types";
|
||||
import type { ViewType } from "../ui/TopBar";
|
||||
import type { ViewType } from "../model/viewTypes";
|
||||
import type { TransformSelection } from "../tools/transform";
|
||||
import type { PlanViewHandle } from "../plan/PlanView";
|
||||
import type { PanelHostValue } from "../panels/host";
|
||||
@@ -51,7 +51,7 @@ import {
|
||||
moveLayoutToFolder,
|
||||
moveFolderToFolder,
|
||||
patchAnnotation as patchAnnotationInLayout,
|
||||
} from "../panels/layoutModel";
|
||||
} from "../model/layoutModel";
|
||||
import { saveFolderPdf } from "../export/layoutPdf";
|
||||
import type { useProjectActions } from "./useProjectActions";
|
||||
import type { useSelectionState } from "./useSelectionState";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// neue Zeichnungen / Status-Leiste) — view-seitiger Zustand wie activeLevelId.
|
||||
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { DetailLevel, RenderMode, View3d, ViewType } from "../ui/TopBar";
|
||||
import type { DetailLevel, RenderMode, View3d, ViewType } from "../model/viewTypes";
|
||||
import type { DisplayMode } from "../panels/types";
|
||||
import { DEFAULT_MARQUEE_COLOR, DEFAULT_SNAP_COLOR } from "../theme/accents";
|
||||
import type { StoreApi } from "./store";
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import type { OverrideRule, ViewSnapshot, Vec2 } from "../model/types";
|
||||
import type { DetailLevel, View3d, ViewType } from "../ui/TopBar";
|
||||
import type { DetailLevel, View3d, ViewType } from "../model/viewTypes";
|
||||
|
||||
/**
|
||||
* Der wiederherstellbare KERNZUSTAND eines Ausschnitts — alle Felder, die ein
|
||||
|
||||
@@ -14,7 +14,7 @@ import { centroid as roomCentroid } from "../geometry/roomArea";
|
||||
import { columnFootprint } from "../geometry/column";
|
||||
import { stairOutline } from "../geometry/stair";
|
||||
import type { SnapKind, SnapResult, SnapSettings } from "./types";
|
||||
import { sampleBezierChain, sampleCatmullRom, sampleUniformBSpline } from "./curves";
|
||||
import { sampleBezierChain, sampleCatmullRom, sampleUniformBSpline } from "../geometry/curves";
|
||||
import { buildDrawingIndex, drawingsNear, isIndexable, pointSegDist, type DrawingIndex } from "../geometry/drawingIndex";
|
||||
import { sheetSnapSegments } from "./sheetSnapGeometry";
|
||||
|
||||
|
||||
+1
-161
@@ -29,6 +29,7 @@ import { columnFootprint } from "../geometry/column";
|
||||
import { stairOutline } from "../geometry/stair";
|
||||
import type { DraftShape } from "./types";
|
||||
import { drawingPreviewShapes } from "./drawingPreview";
|
||||
import { mvGeom, reversesOrientation, scaleFactor, scaleGeom } from "../geometry/geomTransform";
|
||||
import { uniqueId } from "./types";
|
||||
import type { CommandSelection } from "../commands/types";
|
||||
|
||||
@@ -262,18 +263,6 @@ function gatherItems(project: Project, sel: TransformSelection, op: TransformOp)
|
||||
* aktuellen Winkel) mit-transformiert und der neue Winkel daraus gemessen wird
|
||||
* — das ergibt für alle drei Operationen die korrekte neue Ausrichtung.
|
||||
*/
|
||||
/**
|
||||
* Erkennt, ob `fn` die Umlauf-Orientierung umkehrt (Spiegelung) — via
|
||||
* Flächenvorzeichen eines Test-Dreiecks unter `fn` (negativ ⇒ Spiegelung).
|
||||
* Funktioniert für JEDE Isometrie/Similarity (Move/Rotate/Scale erhalten die
|
||||
* Orientierung, Mirror kehrt sie um), ohne dass eine Operation ihre Spiegel-
|
||||
* Eigenschaft explizit markieren müsste.
|
||||
*/
|
||||
function reversesOrientation(fn: (p: Vec2) => Vec2): boolean {
|
||||
const p0 = fn({ x: 0, y: 0 }), p1 = fn({ x: 1, y: 0 }), p2 = fn({ x: 0, y: 1 });
|
||||
return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y) < 0;
|
||||
}
|
||||
|
||||
function mvColumn(col: Column, fn: (p: Vec2) => Vec2): Column {
|
||||
const base = col.position;
|
||||
const rot = col.rotation ?? 0;
|
||||
@@ -283,155 +272,6 @@ function mvColumn(col: Column, fn: (p: Vec2) => Vec2): Column {
|
||||
return { ...col, position: nb, rotation: Math.atan2(nt.y - nb.y, nt.x - nb.x) };
|
||||
}
|
||||
|
||||
/** Bildet jeden Punkt einer 2D-Zeichengeometrie unter `fn` ab (Move/Mirror/Rotate/Array + Block-Rendering). */
|
||||
/**
|
||||
* Wie {@link mvGeom}, zusätzlich für eine SKALIERUNG: `mvGeom` bildet nur
|
||||
* PUNKTE ab — Radien, Schrifthöhen und der Bemassungs-Abstand sind aber keine
|
||||
* Punkte und blieben sonst unverändert stehen (ein Kreis behielte unter einer
|
||||
* 2×-Skalierung seinen Radius). Diese Funktion zieht die betroffenen
|
||||
* Grössenfelder um denselben Faktor nach.
|
||||
*
|
||||
* Bewusst NICHT angefasst: `bulge` (ein Formverhältnis, skaleninvariant) und
|
||||
* die Papier-mm-Felder von Bemassung/Linienenden — die beziehen sich auf das
|
||||
* Blatt, nicht aufs Modell, und dürfen beim Skalieren des Objekts gleich
|
||||
* bleiben.
|
||||
*/
|
||||
/** Skalierungsfaktor eines `op:"scale"`-Punkte-Tripels bei Interpolation `t`. */
|
||||
export function scaleFactor(pts: Vec2[], t: number): number {
|
||||
const c = pts[0];
|
||||
const ref = Math.hypot(pts[1].x - c.x, pts[1].y - c.y) || 1;
|
||||
const tgt = Math.hypot(pts[2].x - c.x, pts[2].y - c.y);
|
||||
return 1 + (tgt / ref - 1) * t;
|
||||
}
|
||||
|
||||
export const scaleGeom = (geom: Drawing2DGeom, fn: (p: Vec2) => Vec2, f: number): Drawing2DGeom => {
|
||||
const g = mvGeom(geom, fn);
|
||||
switch (g.shape) {
|
||||
case "circle":
|
||||
return { ...g, r: g.r * f };
|
||||
case "arc":
|
||||
return { ...g, r: g.r * f };
|
||||
case "ellipse":
|
||||
return { ...g, rx: g.rx * f, ry: g.ry * f };
|
||||
case "dimension":
|
||||
// `offset` ist der Normalabstand der Masslinie in Modellmass.
|
||||
return { ...g, offset: g.offset * f };
|
||||
case "text":
|
||||
return {
|
||||
...g,
|
||||
height: g.height * f,
|
||||
...(g.width !== undefined ? { width: g.width * f } : {}),
|
||||
};
|
||||
case "scalebar":
|
||||
// Segmentlänge ist eine ECHTE Modell-Distanz (kein Papier-mm-Feld wie
|
||||
// bei Kote/Bemassung) — muss bei einer Modell-Skalierung mitwachsen,
|
||||
// sonst zeigt der Balken nach dem Skalieren die FALSCHE Distanz an.
|
||||
return { ...g, segmentLength: g.segmentLength * f };
|
||||
case "block":
|
||||
// Blockinstanz-Skalierung (s. Typ-Kommentar in model/types.ts) —
|
||||
// ohne diesen Fall wäre der `scale`-Befehl auf eine Blockinstanz ein
|
||||
// kompletter No-Op (kein Feld zum Multiplizieren).
|
||||
return { ...g, scale: (g.scale ?? 1) * f };
|
||||
default:
|
||||
return g;
|
||||
}
|
||||
};
|
||||
|
||||
export const mvGeom = (geom: Drawing2DGeom, fn: (p: Vec2) => Vec2): Drawing2DGeom => {
|
||||
switch (geom.shape) {
|
||||
case "line":
|
||||
case "xline":
|
||||
case "ray":
|
||||
return { ...geom, a: fn(geom.a), b: fn(geom.b) };
|
||||
case "polyline": {
|
||||
const pts = geom.pts.map(fn);
|
||||
if (!geom.bulge) return { ...geom, pts };
|
||||
// Bulge-Vorzeichen ist rein relativ zur Zeichenrichtung definiert (links
|
||||
// von a→b) — eine Spiegelung kehrt die Umlauf-Orientierung um und muss
|
||||
// daher auch jeden Bogen umkehren, sonst wandert er auf die falsche Seite.
|
||||
const bulge = reversesOrientation(fn) ? geom.bulge.map((b) => -b) : geom.bulge;
|
||||
return { ...geom, pts, bulge };
|
||||
}
|
||||
case "rect": {
|
||||
// Achsparallel nur bei reiner Verschiebung erhaltbar; sonst → Polylinie.
|
||||
const c = [
|
||||
geom.min,
|
||||
{ x: geom.max.x, y: geom.min.y },
|
||||
geom.max,
|
||||
{ x: geom.min.x, y: geom.max.y },
|
||||
].map(fn);
|
||||
const axisAligned =
|
||||
Math.abs(c[0].y - c[1].y) < 1e-6 &&
|
||||
Math.abs(c[1].x - c[2].x) < 1e-6 &&
|
||||
Math.abs(c[2].y - c[3].y) < 1e-6;
|
||||
if (axisAligned) {
|
||||
const xs = c.map((p) => p.x), ys = c.map((p) => p.y);
|
||||
return {
|
||||
shape: "rect",
|
||||
min: { x: Math.min(...xs), y: Math.min(...ys) },
|
||||
max: { x: Math.max(...xs), y: Math.max(...ys) },
|
||||
};
|
||||
}
|
||||
return { shape: "polyline", pts: c, closed: true };
|
||||
}
|
||||
case "circle":
|
||||
return { ...geom, center: fn(geom.center) };
|
||||
case "arc":
|
||||
return { ...geom, center: fn(geom.center) };
|
||||
case "ellipse":
|
||||
return { ...geom, center: fn(geom.center) };
|
||||
case "bezier":
|
||||
return { ...geom, pts: geom.pts.map(fn) };
|
||||
case "spline":
|
||||
return { ...geom, pts: geom.pts.map(fn) };
|
||||
case "dimension":
|
||||
return { ...geom, pts: geom.pts.map(fn) };
|
||||
case "kote":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "detailref":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "scalebar":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "pointmarker":
|
||||
return { ...geom, at: fn(geom.at) };
|
||||
case "text":
|
||||
// Leader-Ziel bzw. Pfadpunkte (Text-entlang-Pfad) müssen mitwandern,
|
||||
// sonst zeigt der Pfeil/Pfad nach einem Move/Mirror/Rotate/Array auf die
|
||||
// alte Position.
|
||||
return {
|
||||
...geom,
|
||||
at: fn(geom.at),
|
||||
...(geom.leaderTarget ? { leaderTarget: fn(geom.leaderTarget) } : {}),
|
||||
...(geom.leaderBendPoints ? { leaderBendPoints: geom.leaderBendPoints.map(fn) } : {}),
|
||||
...(geom.pathPts ? { pathPts: geom.pathPts.map(fn) } : {}),
|
||||
};
|
||||
case "block": {
|
||||
// Wie Column: Winkel aus einem transformierten Richtungspunkt zurück-
|
||||
// rechnen, damit Rotate/Mirror auch die Instanz-Ausrichtung mitnehmen
|
||||
// (nicht nur den Einfügepunkt) — reine Translation liesse die Symbole
|
||||
// beim Drehen der Auswahl in der alten Orientierung stehen.
|
||||
const tip = { x: geom.at.x + Math.cos(geom.rotation), y: geom.at.y + Math.sin(geom.rotation) };
|
||||
const nb = fn(geom.at);
|
||||
const nt = fn(tip);
|
||||
return { ...geom, at: nb, rotation: Math.atan2(nt.y - nb.y, nt.x - nb.x) };
|
||||
}
|
||||
case "image": {
|
||||
// Wie Text: nur die Position folgt der Transformation (Zentrum wandert
|
||||
// dorthin, wo `fn` es abbildet); die Box bleibt achsparallel/unverzerrt —
|
||||
// ein Bild kann nicht geschert/rotiert dargestellt werden (kein `angle`-Feld).
|
||||
const oldCenter = { x: (geom.min.x + geom.max.x) / 2, y: (geom.min.y + geom.max.y) / 2 };
|
||||
const newCenter = fn(oldCenter);
|
||||
const dx = newCenter.x - oldCenter.x;
|
||||
const dy = newCenter.y - oldCenter.y;
|
||||
return {
|
||||
...geom,
|
||||
min: { x: geom.min.x + dx, y: geom.min.y + dy },
|
||||
max: { x: geom.max.x + dx, y: geom.max.y + dy },
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Bildet Umriss + Aussparungen einer Decke unter `fn` ab. */
|
||||
function mvCeiling(c: Ceiling, fn: (p: Vec2) => Vec2): Ceiling {
|
||||
return {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import type { DropdownItem } from "./Dropdown";
|
||||
import { t } from "../i18n";
|
||||
import type { View3d, ViewType } from "./TopBar";
|
||||
import type { View3d, ViewType } from "../model/viewTypes";
|
||||
|
||||
export interface AppMenuBarProps {
|
||||
/** Datei: Neu/Neu aus Vorlage/Öffnen/Speichern/Importieren. */
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
LayoutPaperFormat,
|
||||
MasterLayout,
|
||||
} from "../model/types";
|
||||
import { PAPER_FORMAT_GROUPS } from "../panels/layoutModel";
|
||||
import { PAPER_FORMAT_GROUPS } from "../model/layoutModel";
|
||||
|
||||
/** Startwerte eines neuen Blatts/Masters (Grösse). */
|
||||
export interface LayoutSizeStart {
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
resolveTitleBlock,
|
||||
resolveViewportScale,
|
||||
visibleCodesFromSnapshot,
|
||||
} from "../panels/layoutModel";
|
||||
} from "../model/layoutModel";
|
||||
import {
|
||||
annotationBoundsMm,
|
||||
applyHandleDrag,
|
||||
|
||||
+1
-47
@@ -27,6 +27,7 @@ import {
|
||||
isMarkActive,
|
||||
toggleMark,
|
||||
} from "../text/richText";
|
||||
import type { DetailLevel, RenderMode, View3d, ViewType } from "../model/viewTypes";
|
||||
import type {
|
||||
Align,
|
||||
BoolMark,
|
||||
@@ -35,53 +36,6 @@ import type {
|
||||
TextStylePreset,
|
||||
} from "../text/richText";
|
||||
|
||||
/** Ansichtstyp eines Geschosses (wie in App). */
|
||||
export type ViewType = "grundriss" | "perspektive";
|
||||
|
||||
/**
|
||||
* Detailgrad der Darstellung (≙ DOSSIER Einfach/Standard/Detail). Wirkt im
|
||||
* Grundriss auf Tür-/Fenstersymbole + Schraffuren/Linienfeinheit (siehe
|
||||
* generatePlan.DetailLevel); in der Perspektive noch ohne Wirkung (deferred).
|
||||
*/
|
||||
export type DetailLevel = "grob" | "mittel" | "fein";
|
||||
|
||||
/**
|
||||
* Render-/Anzeigemodus der 3D-Ansicht: schattiert, einheitlich weiss (Clay-Look),
|
||||
* texturiert (echte PBR-Materialien je Bauteil), Drahtgitter, Verdeckte Kanten
|
||||
* (Hidden-Line), Schattiert mit Kanten (typischer BIM-Look: Bauteilfarben +
|
||||
* Modell-Kanten obenauf). Wirkt nur in der Perspektive. Der Slot „section"
|
||||
* (Schnittschraffur, Welle B) ist bewusst freigelassen.
|
||||
*/
|
||||
export type RenderMode =
|
||||
| "shaded"
|
||||
| "white"
|
||||
| "contour"
|
||||
| "textured"
|
||||
| "wireframe"
|
||||
| "hidden"
|
||||
| "shaded-edges";
|
||||
|
||||
/**
|
||||
* Kanonischer Blickwinkel der 3D-Ansicht (Vectorworks/DOSSIER-Stil). „front"/
|
||||
* „back"/„side"/„left" springen auf die vier Kardinalrichtungen (Vorne/Hinten/
|
||||
* Rechts/Links — KEINE Himmelsrichtungs-Labels, da es noch keinen Nordwinkel
|
||||
* gibt); „top" auf die Draufsicht. „iso"/„isoFrontLeft"/„isoBackRight"/
|
||||
* „isoBackLeft" sind die vier oberen Iso-Oktanten (untere vier bleiben im
|
||||
* Hochbau ungenutzt) — „iso" (vorne-oben-rechts) ist der bestehende Default.
|
||||
* „perspective" ist der freie 3/4-Blick. Wirkt nur in der Perspektive.
|
||||
*/
|
||||
export type View3d =
|
||||
| "front"
|
||||
| "back"
|
||||
| "side"
|
||||
| "left"
|
||||
| "top"
|
||||
| "iso"
|
||||
| "isoFrontLeft"
|
||||
| "isoBackRight"
|
||||
| "isoBackLeft"
|
||||
| "perspective";
|
||||
|
||||
/**
|
||||
* Farb-Modus des Grundrisses: „color" zeigt Kategorie-/Element-Farben (heutiges
|
||||
* Verhalten), „mono" erzeugt einen reinen Schwarz-Weiss-Plan. Wirkt nur im
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import { useId } from "react";
|
||||
import type { HatchStyle, LineStyle } from "../model/types";
|
||||
import { dashHasDot } from "./lineSegments";
|
||||
import { dashHasDot } from "../geometry/lineSegments";
|
||||
|
||||
// ── Kleiner deterministischer PRNG (mulberry32) ────────────────────────────
|
||||
// Für „random"-Striche: stabil pro Seed, damit die Vorschau bei gleichem
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
type LineSegment,
|
||||
type LineSegmentType,
|
||||
type LinePresetKey,
|
||||
} from "../lineSegments";
|
||||
} from "../../geometry/lineSegments";
|
||||
import { MotifEditor } from "../MotifEditor";
|
||||
import { t } from "../../i18n";
|
||||
import {
|
||||
|
||||
@@ -47,7 +47,7 @@ import type { Project, Wall, Drawing2D, Ceiling, Roof, Vec2 } from "../model/typ
|
||||
import { ceilingVerticalExtent, wallVerticalExtent } from "../model/wall";
|
||||
import { roofBaseElevation, roofGeometry } from "../geometry/roof";
|
||||
import { projectToModel3d, pickGeometry, draftWorldLines, TRUCK_MESH_READY_EVENT } from "../plan/toWalls3d";
|
||||
import type { DetailLevel, RenderMode, View3d } from "../ui/TopBar";
|
||||
import type { DetailLevel, RenderMode, View3d } from "../model/viewTypes";
|
||||
import type { ToolDraft } from "../tools/types";
|
||||
import { hudSegments, type HudFieldsState } from "../tools/hudFormat";
|
||||
import type { EngineMods } from "../commands/engine";
|
||||
|
||||
@@ -5,15 +5,17 @@ import {
|
||||
raySlabPrism,
|
||||
rayDrawingSeg,
|
||||
pickNearest,
|
||||
DRAWING_PICK_TOLERANCE,
|
||||
type RayCamera,
|
||||
} from "./raycast3d";
|
||||
import {
|
||||
DRAWING_PICK_TOLERANCE,
|
||||
type PickWall,
|
||||
type PickSlab,
|
||||
type PickOpening,
|
||||
type PickStair,
|
||||
type PickContextMesh,
|
||||
type PickDrawingSeg,
|
||||
} from "./raycast3d";
|
||||
} from "../plan/pickTypes";
|
||||
|
||||
// Kamera bei (0,1,10), Blick entlang -Z auf (0,1,0). Zentraler Strahl (ndc 0,0)
|
||||
// zeigt in -Z. World-Konvention: Modell (x,y) → world (x, elevation, y).
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
// wandert lateral mit dem Pixel — exakte Umkehrung von `worldToScreen`s
|
||||
// Ortho-Zweig, keine perspektivische Näherung mehr.
|
||||
|
||||
export type Vec3 = [number, number, number];
|
||||
|
||||
import { DRAWING_PICK_TOLERANCE } from "../plan/pickTypes";
|
||||
import type { Vec3, PickWall, PickOpening, PickDrawingSeg, PickSlab, PickStair, PickRoof, PickContextMesh } from "../plan/pickTypes";
|
||||
export type { Vec3 } from "../plan/pickTypes";
|
||||
|
||||
/** Kamera-Parameter für den Pick-Strahl (Teilmenge von Camera3d). */
|
||||
export interface RayCamera {
|
||||
@@ -38,99 +41,6 @@ export interface Ray {
|
||||
dir: Vec3;
|
||||
}
|
||||
|
||||
/** Minimal-Form eines Wand-Quaders für den Raycast (RWall erfüllt sie strukturell). */
|
||||
export interface PickWall {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
thickness: number;
|
||||
height: number;
|
||||
baseElevation: number;
|
||||
wallId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form einer Öffnungs-Box (Fenster/Tür) für den Raycast — dieselbe
|
||||
* orientierte-Quader-Form wie `PickWall` (Achse jambStart→jambEnd in der
|
||||
* XZ-Ebene, Dicke = Wanddicke am Sitz der Öffnung), nur über ihre EIGENE
|
||||
* vertikale Ausdehnung (Brüstung..Sturz) statt der vollen Wandhöhe.
|
||||
*/
|
||||
export interface PickOpening {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
thickness: number;
|
||||
height: number;
|
||||
baseElevation: number;
|
||||
openingId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Segments einer freien 2D-Zeichnung (Linie/Polylinie/
|
||||
* Rechteck) für den Raycast — dieselbe orientierte-Quader-Form wie
|
||||
* `PickOpening`, aber mit fester (grosszügiger) Klick-Toleranz statt echter
|
||||
* Bauteildicke: die sichtbare Boden-Spur im 3D ist nur 0.008m breit (s.
|
||||
* `toWalls3d/drawing2d.ts::DRAWING_LINE_HALF_WIDTH`) — zu schmal, um
|
||||
* zuverlässig zu treffen. `baseElevation` ist bereits die UNTERE Kante der
|
||||
* Pick-Box (Boden-Spur-Höhe minus halbe Toleranzhöhe), s. `pickDrawingSegs`.
|
||||
*/
|
||||
export interface PickDrawingSeg {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
baseElevation: number;
|
||||
drawingId: string;
|
||||
}
|
||||
|
||||
/** Klick-Toleranz für 2D-Zeichnungs-Boden-Spuren im 3D (Welt-Meter, s.
|
||||
* {@link PickDrawingSeg}) — quer zur Linie UND vertikal, je zur Hälfte um die
|
||||
* sichtbare Spur zentriert. Analog dem 2D-Plan-Pick-Radius
|
||||
* (`PlanView.tsx::LINE_PICK_PX`), hier als fester Welt-Wert statt Pixel-
|
||||
* Toleranz (im 3D gibt es keinen globalen Pixel/Meter-Faktor). */
|
||||
export const DRAWING_PICK_TOLERANCE = 0.12;
|
||||
|
||||
/** Minimal-Form eines Decken-Prismas für den Raycast (RSlab erfüllt sie strukturell). */
|
||||
export interface PickSlab {
|
||||
outline: ReadonlyArray<readonly [number, number]>;
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
ceilingId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Treppen-Bounding-Prismas für den Raycast: ein achsparalleles
|
||||
* Rechteck über den Grundriss-Fußabdruck (alle Tritte + Podest), extrudiert über
|
||||
* die vertikale Ausdehnung der Treppe. Pragmatische Näherung statt Tritt-für-
|
||||
* Tritt-Boxen — reicht für zuverlässiges Anklicken im 3D-Viewport.
|
||||
*/
|
||||
export interface PickStair {
|
||||
outline: ReadonlyArray<readonly [number, number]>;
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
stairId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Dachs für den Raycast: die Dachflächen + Giebel als
|
||||
* WORLD-Dreiecke (fan-trianguliert, dieselbe Konvention wie `emitRoofs`:
|
||||
* model (x,y,z=Höhe) → world (x, z, y)). Präzise geneigte Flächen statt eines
|
||||
* grosszügigen Bounding-Prismas — sonst stähle das Dach Klicks auf die
|
||||
* Fassade dahinter (pickNearest entscheidet über die Strahl-Distanz).
|
||||
*/
|
||||
export interface PickRoof {
|
||||
tris: ReadonlyArray<readonly [Vec3, Vec3, Vec3]>;
|
||||
roofId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Kontext-Meshes (importiertes Gebäude/Terrain, s.
|
||||
* `ContextObject`) für den Raycast: rohe WORLD-Dreiecke (dieselbe Konvention
|
||||
* wie {@link PickRoof} — model (x,y,z=Höhe) → world (x, z, y)), keine
|
||||
* Vereinfachung auf ein Bounding-Prisma (Gebäude-Meshes sind zu unregelmässig
|
||||
* dafür, ein grosszügiges Prisma stähle Klicks auf dahinterliegende Bauteile).
|
||||
*/
|
||||
export interface PickContextMesh {
|
||||
tris: ReadonlyArray<readonly [Vec3, Vec3, Vec3]>;
|
||||
contextObjectId: string;
|
||||
}
|
||||
|
||||
/** Ergebnis eines Picks: getroffenes Bauteil + Distanz entlang des Strahls. */
|
||||
export interface PickHit {
|
||||
kind: "wall" | "ceiling" | "opening" | "stair" | "roof" | "contextObject" | "drawing";
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { ContextImage, Project } from "../model/types";
|
||||
import { emitDrawingLineVerts, projectToModel3d } from "../plan/toWalls3d";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import { loadEngine3d } from "../engine/engine3d";
|
||||
import { decodeMaterialTextures } from "./materialTextures";
|
||||
import { decodeImageToRgba } from "../io/swissImage";
|
||||
|
||||
@@ -49,7 +49,7 @@ import type { Pick3dHit } from "../viewport/Wasm3DViewport";
|
||||
import { DrawingTabs } from "../DrawingTabs";
|
||||
import type { ViewSnapshotTabsHandlers } from "../DrawingTabs";
|
||||
import type { ToolDraft, ToolHandlers, ToolId } from "../tools/types";
|
||||
import type { DetailLevel, RenderMode, View3d, ViewType } from "../ui/TopBar";
|
||||
import type { DetailLevel, RenderMode, View3d, ViewType } from "../model/viewTypes";
|
||||
|
||||
/**
|
||||
* Akzentfarbe der 3D-Auswahl-Hervorhebung (Umriss-Linien, WASM-Viewport, s.
|
||||
|
||||
Reference in new issue
Block a user