- analysis/siteRules.ts: zulaessige Flaeche = Parzelle minus Abstandsstreifen je Kante (auch konkav), begrenzt durch Baulinien (Seite des Parzellen-Schwerpunkts); Pruefung von Grundflaeche (Waende aller Geschosse, freie Koerper) und Gesamthoehe - Grundriss (Geschoss naechst +-0.00): Parzellengrenze strichpunktiert, zulaessige Flaeche gestrichelt, Verstoesse rot ueber dem Gebaeude; Planbegrenzung umfasst die Parzelle - Lage-Panel: Parzelle und Baulinien aus der Auswahl, Grenzabstand pauschal und je Kante, Gesamthoehe, Ergebnis - Kennzahlen: Parzellenflaeche aus der Grenze, wenn keine Zahl gesetzt ist; CLI kennzahlen liefert baurecht - Tests Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
21 lines
1.2 KiB
TypeScript
21 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { lineFromDrawing, parcelFromDrawing } from "./siteRulesInput";
|
|
import type { Drawing2D, Drawing2DGeom } from "../model/types";
|
|
|
|
const d = (geom: Drawing2DGeom): Drawing2D => ({ id: "d", type: "drawing2d", levelId: "eg", categoryCode: "20", geom }) as Drawing2D;
|
|
|
|
describe("Parzelle und Baulinie aus der Auswahl", () => {
|
|
it("Rechteck und geschlossene Polylinie (doppelter Schlusspunkt entfällt)", () => {
|
|
expect(parcelFromDrawing(d({ shape: "rect", min: { x: 0, y: 0 }, max: { x: 2, y: 1 } }))).toHaveLength(4);
|
|
const pts = [{ x: 0, y: 0 }, { x: 3, y: 0 }, { x: 3, y: 2 }, { x: 0, y: 2 }, { x: 0, y: 0 }];
|
|
expect(parcelFromDrawing(d({ shape: "polyline", pts, closed: true }))).toHaveLength(4);
|
|
});
|
|
it("offene Polylinie ist keine Parzelle, aber zweipunktig eine Baulinie", () => {
|
|
const pts = [{ x: 0, y: 0 }, { x: 3, y: 0 }];
|
|
expect(parcelFromDrawing(d({ shape: "polyline", pts, closed: false }))).toBeNull();
|
|
expect(lineFromDrawing(d({ shape: "polyline", pts, closed: false }))).toEqual({ a: pts[0], b: pts[1] });
|
|
expect(lineFromDrawing(d({ shape: "line", a: pts[0], b: pts[1] }))).toEqual({ a: pts[0], b: pts[1] });
|
|
expect(lineFromDrawing(undefined)).toBeNull();
|
|
});
|
|
});
|