[63] Baurecht: Huelle im 3D und Vorsprungsregel im Lage-Panel
- Lage-Panel: Schalter Huelle im 3D, Vorspruenge bis (m), max. Anteil Fassade (%), Auswahl (Decke/Koerper) als Vorsprung markieren - 3D-Viewport: siteEnvelope3d -> render3d set_ghost bei jeder Modellaenderung - TODO [63] nachgefuehrt
This commit is contained in:
8 files changed
+147
-5
No files matched your search
@@ -4,8 +4,11 @@
|
||||
// • Grenzabstand: gesperrt ist alles, was näher als d_i an Kante i liegt (Puffer der Kante mit
|
||||
// gerundeten Enden) — so stimmen auch konkave Parzellen und einspringende Ecken.
|
||||
// • Baulinie: Halbebene auf der Seite des Parzellen-Schwerpunkts.
|
||||
// • Gebäude-Grundfläche: Wände aller Geschosse und freie Körper (ohne Abzugskörper). Vorsprünge
|
||||
// (Dachüberstand, Balkone) und ihre Sonderregeln zählen nicht.
|
||||
// • Gebäude-Grundfläche: Wände aller Geschosse und freie Körper (ohne Abzugskörper).
|
||||
// • Vorsprünge (nur mit `projectionDepth`): Dachüberstände und als Vorsprung markierte Decken/Körper
|
||||
// (`siteProjection`) dürfen bis zur Tiefe in den Abstand ragen, markierte zusätzlich höchstens
|
||||
// auf `projectionShare` der Fassadenlänge je Grenze.
|
||||
// • Zulässige Hülle im 3D (`siteEnvelope3d`, mit `show3d`): durchscheinend in render3d.
|
||||
// Gerechnet wird im Rust-Kern (`src-tauri/core/src/site_rules.rs`), die Prüfung des Modells auf dem
|
||||
// Projekt-Dokument; die Flächen-Hilfen (`allowedArea`, `multiPolygonArea`) nehmen flache Daten.
|
||||
|
||||
@@ -70,3 +73,12 @@ export function checkSiteRules(project: Project): SiteCheck | null {
|
||||
if (!project.siteRules) return null;
|
||||
return documentFor(project).query<SiteCheck | null>("siteCheck");
|
||||
}
|
||||
|
||||
/**
|
||||
* Zulässige Hülle im 3D ([63], Kern `site_rules::envelope3d`) für render3d `set_ghost`:
|
||||
* `[nDreieckWerte, Dreiecke (x y z r g b a)…, Kanten (x y z r g b)…]`; leer ohne Baurecht oder `show3d`.
|
||||
*/
|
||||
export function siteEnvelope3d(project: Project): Float32Array {
|
||||
if (project.siteRules?.show3d !== true) return new Float32Array(0);
|
||||
return documentFor(project).siteEnvelope();
|
||||
}
|
||||
@@ -224,6 +224,11 @@ export class ProjectDocument {
|
||||
return this.handle ? core().doc_drawing_line_verts(this.handle, explode) : new Float32Array(0);
|
||||
}
|
||||
|
||||
/** Zulässige Hülle im 3D ([63]) für render3d `set_ghost`; leer ohne Baurecht oder `siteRules.show3d`. */
|
||||
siteEnvelope(): Float32Array {
|
||||
return this.handle ? core().doc_site_envelope(this.handle) : new Float32Array(0);
|
||||
}
|
||||
|
||||
/** Ansichtsschraffur auf den Flächen (Wände, Decken, Dächer) für render3d `set_pattern_lines`. */
|
||||
surfacePatternLines(explode = 0): Float32Array {
|
||||
return this.handle ? core().doc_surface_pattern_lines(this.handle, explode) : new Float32Array(0);
|
||||
|
||||
@@ -44,6 +44,7 @@ export type { AreaReport, AreaReportOptions } from "../export/areaReport";
|
||||
export { sunPosition, shadowPolygons, shadowOfPrism, projectLatLon } from "../analysis/sun";
|
||||
export type { SunPosition } from "../analysis/sun";
|
||||
export { checkSiteRules, allowedArea, multiPolygonArea, buildingFootprint, modelTop } from "../analysis/siteRules";
|
||||
export { siteEnvelope3d } from "../analysis/siteRules";
|
||||
export { excavationQuantities, type ExcavationQuantity } from "../analysis/excavation";
|
||||
export type { SiteCheck } from "../analysis/siteRules";
|
||||
export { sampleProject } from "../model/sampleProject";
|
||||
|
||||
@@ -2531,6 +2531,14 @@ export const de = {
|
||||
"siteRules.addLine": "Baulinie aus Auswahl",
|
||||
"siteRules.addLine.hint": "Eine Linie wählen; das Gebäude bleibt auf der Seite der Parzelle.",
|
||||
"siteRules.clearLines": "Alle Baulinien entfernen",
|
||||
"siteRules.show3d": "Hülle im 3D",
|
||||
"siteRules.show3d.hint": "Zulässige Hülle (zulässige Fläche bis zur Gesamthöhe) im 3D durchscheinend zeigen, Verstösse rot.",
|
||||
"siteRules.projectionDepth": "Vorsprünge bis",
|
||||
"siteRules.projectionDepth.hint": "Dachüberstände und markierte Vorsprünge (Balkone, Erker) dürfen so weit in den Grenzabstand bzw. über die Baulinie ragen. Leer = keine Vorsprungsregel.",
|
||||
"siteRules.projectionShare": "Vorsprünge max. Anteil Fassade",
|
||||
"siteRules.projectionShare.hint": "Höchstens dieser Anteil der Fassadenlänge je Grenze darf von markierten Vorsprüngen belegt sein (Dachüberstände zählen nicht). Leer = unbegrenzt.",
|
||||
"siteRules.markProjection": "Auswahl ist Vorsprung (Balkon, Erker)",
|
||||
"siteRules.markProjection.hint": "Gewählte Decke oder gewählten Körper als Vorsprung nach der Vorsprungsregel prüfen.",
|
||||
"clash.none": "Keine Kollisionen gefunden.",
|
||||
"clash.run": "Prüfung starten",
|
||||
"clash.running": "Prüfung läuft …",
|
||||
|
||||
@@ -2481,6 +2481,14 @@ export const en: Record<TranslationKey, string> = {
|
||||
"siteRules.addLine": "Building line from selection",
|
||||
"siteRules.addLine.hint": "Select a line; the building stays on the parcel side.",
|
||||
"siteRules.clearLines": "Remove all building lines",
|
||||
"siteRules.show3d": "Envelope in 3D",
|
||||
"siteRules.show3d.hint": "Show the permissible envelope (permissible area up to the total height) translucent in 3D, violations in red.",
|
||||
"siteRules.projectionDepth": "Projections up to",
|
||||
"siteRules.projectionDepth.hint": "Roof overhangs and marked projections (balconies, bay windows) may extend this far into the setback or beyond the building line. Empty = no projection rule.",
|
||||
"siteRules.projectionShare": "Projections max. share of façade",
|
||||
"siteRules.projectionShare.hint": "At most this share of the façade length per boundary may be taken by marked projections (roof overhangs do not count). Empty = unlimited.",
|
||||
"siteRules.markProjection": "Selection is a projection (balcony, bay window)",
|
||||
"siteRules.markProjection.hint": "Check the selected slab or solid as a projection under the projection rule.",
|
||||
"clash.run": "Run check",
|
||||
"clash.running": "Checking …",
|
||||
"clash.clear": "Clear",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { t } from "../i18n";
|
||||
import { usePanelHost } from "./host";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { checkSiteRules, setField } from "../core";
|
||||
import { checkSiteRules, patchItem, setField } from "../core";
|
||||
import type { Project, SiteRules } from "../model/types";
|
||||
import { lineFromDrawing, parcelFromDrawing } from "./siteRulesInput";
|
||||
|
||||
@@ -18,6 +18,28 @@ function parseLen(text: string): number | undefined | null {
|
||||
return Number.isFinite(v) && v >= 0 ? v : null;
|
||||
}
|
||||
|
||||
/** Gewählte Decke/Körper, der als Vorsprung markiert werden kann, samt aktuellem Stand. */
|
||||
function projectionTarget(
|
||||
p: Project,
|
||||
sel: { kind: string; id: string } | null | undefined,
|
||||
): { kind: "ceiling" | "extrudedSolid"; id: string; flag: boolean } | null {
|
||||
if (sel?.kind === "ceiling") {
|
||||
const c = p.ceilings?.find((x) => x.id === sel.id);
|
||||
return c ? { kind: "ceiling", id: c.id, flag: c.siteProjection === true } : null;
|
||||
}
|
||||
if (sel?.kind === "extrudedSolid") {
|
||||
const x = p.extrudedSolids?.find((e) => e.id === sel.id);
|
||||
return x && x.operation !== "subtract" ? { kind: "extrudedSolid", id: x.id, flag: x.siteProjection === true } : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Vorsprung-Markierung setzen (true) oder entfernen (Feld fehlt = normales Bauteil). */
|
||||
function withProjection<T extends { siteProjection?: boolean }>(e: T, on: boolean): T {
|
||||
const { siteProjection: _old, ...rest } = e;
|
||||
return (on ? { ...rest, siteProjection: true } : rest) as T;
|
||||
}
|
||||
|
||||
export function SiteRulesSection() {
|
||||
const host = usePanelHost();
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
@@ -26,6 +48,8 @@ export function SiteRulesSection() {
|
||||
const selDrawing = sel?.kind === "drawing2d" ? host.project.drawings2d.find((d) => d.id === sel.id) : undefined;
|
||||
const selParcel = parcelFromDrawing(selDrawing);
|
||||
const selLine = lineFromDrawing(selDrawing);
|
||||
// Vorsprung markieren: gewählte Decke (Balkon) oder freier Körper (Erker).
|
||||
const selProjection = projectionTarget(host.project, sel);
|
||||
|
||||
const write = (fn: (r: SiteRules) => SiteRules | undefined, key?: string) =>
|
||||
applyChange((p: Project) => {
|
||||
@@ -71,6 +95,14 @@ export function SiteRulesSection() {
|
||||
/>
|
||||
<span>{t("siteRules.show")}</span>
|
||||
</label>
|
||||
<label className="sun-row" title={t("siteRules.show3d.hint")}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={rules.show3d === true}
|
||||
onChange={(e) => write((r) => ({ ...r, show3d: e.target.checked }))}
|
||||
/>
|
||||
<span>{t("siteRules.show3d")}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{check && (
|
||||
@@ -131,6 +163,67 @@ export function SiteRulesSection() {
|
||||
<span>m</span>
|
||||
</label>
|
||||
|
||||
<label className="kz-parcel" title={t("siteRules.projectionDepth.hint")}>
|
||||
<span>{t("siteRules.projectionDepth")}</span>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
step={0.1}
|
||||
className="kz-input kz-num"
|
||||
value={rules.projectionDepth ?? ""}
|
||||
placeholder="–"
|
||||
onChange={(e) => {
|
||||
const v = parseLen(e.target.value);
|
||||
if (v === null) return;
|
||||
write((r) => {
|
||||
const { projectionDepth: _old, ...rest } = r;
|
||||
return v === undefined ? rest : { ...rest, projectionDepth: v };
|
||||
}, "siteRules:projectionDepth");
|
||||
}}
|
||||
/>
|
||||
<span>m</span>
|
||||
</label>
|
||||
{rules.projectionDepth !== undefined && (
|
||||
<label className="kz-parcel" title={t("siteRules.projectionShare.hint")}>
|
||||
<span>{t("siteRules.projectionShare")}</span>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
max={100}
|
||||
step={5}
|
||||
className="kz-input kz-num"
|
||||
value={rules.projectionShare === undefined ? "" : Math.round(rules.projectionShare * 1000) / 10}
|
||||
placeholder="–"
|
||||
onChange={(e) => {
|
||||
const v = parseLen(e.target.value);
|
||||
if (v === null) return;
|
||||
write((r) => {
|
||||
const { projectionShare: _old, ...rest } = r;
|
||||
return v === undefined ? rest : { ...rest, projectionShare: v / 100 };
|
||||
}, "siteRules:projectionShare");
|
||||
}}
|
||||
/>
|
||||
<span>%</span>
|
||||
</label>
|
||||
)}
|
||||
{rules.projectionDepth !== undefined && selProjection && (
|
||||
<label className="sun-row" title={t("siteRules.markProjection.hint")}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selProjection.flag}
|
||||
onChange={(e) => {
|
||||
const v = e.target.checked;
|
||||
applyChange((p: Project) =>
|
||||
selProjection.kind === "ceiling"
|
||||
? patchItem(p, "ceilings", selProjection.id, (c) => withProjection(c, v))
|
||||
: patchItem(p, "extrudedSolids", selProjection.id, (x) => withProjection(x, v)),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<span>{t("siteRules.markProjection")}</span>
|
||||
</label>
|
||||
)}
|
||||
|
||||
<details className="site-rules-edges">
|
||||
<summary>{t("siteRules.edges", { n })}</summary>
|
||||
{rules.parcel.map((p, i) => {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { ContextImage, Project } from "../model/types";
|
||||
import { emitDrawingLineVerts, emitSurfacePatternLines, projectToModel3d } from "../core";
|
||||
import { emitDrawingLineVerts, emitSurfacePatternLines, projectToModel3d, siteEnvelope3d } from "../core";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import { loadEngine3d } from "../engine/engine3d";
|
||||
import { decodeMaterialTextures } from "./materialTextures";
|
||||
@@ -96,6 +96,8 @@ interface WebModelRendererLike {
|
||||
set_drawing_lines?(vertices: Float32Array): void;
|
||||
/** Ansichtsschraffur auf den Flächen (`web::set_pattern_lines`), in den Kanten-Stilen gezeichnet. */
|
||||
set_pattern_lines?(data: Float32Array): void;
|
||||
/** Durchscheinende Körper ([63] zulässige Hülle, `web::set_ghost`): Format von `siteEnvelope3d`; leer löscht. */
|
||||
set_ghost?(data: Float32Array): void;
|
||||
/** Material-Farbkarten (Stil „textured") als Textur-Array hochladen
|
||||
* (`web::set_material_textures`). `rgba` = gepackte RGBA8-Bytes von
|
||||
* `layerCount` 256×256-Ebenen; Ebene 0 bleibt intern das Fallback-Schachbrett,
|
||||
@@ -251,6 +253,13 @@ export function useWasm3dRenderer(
|
||||
console.warn("render3d set_drawing_lines fehlgeschlagen:", e);
|
||||
}
|
||||
}
|
||||
if (typeof r.set_ghost === "function") {
|
||||
try {
|
||||
r.set_ghost(siteEnvelope3d(project));
|
||||
} catch (e) {
|
||||
console.warn("render3d set_ghost fehlgeschlagen:", e);
|
||||
}
|
||||
}
|
||||
if (typeof r.set_pattern_lines === "function") {
|
||||
try {
|
||||
r.set_pattern_lines(emitSurfacePatternLines(project, explode));
|
||||
|
||||
Reference in new issue
Block a user