[207] Situation: Kataster-Gebäude/Gewässer als Flächen, Innenhöfe als Löcher, Kataster-Layer auf Klassen, Zahlen-Layer benannt
This commit is contained in:
11 files changed
+652
-10
No files matched your search
@@ -0,0 +1,43 @@
|
||||
// [207] Kataster-DXF: Layer „Gebaeude", „Gewaesser", „Strassen"/„Strassennamen" landen beim Import auf den Kontext-Klassen
|
||||
// „12 Gebäude", „17 Gewässer", „11 Strasse" (statt auf neuen, beliebig benannten Kategorien); der Situationsplan füllt
|
||||
// geschlossene Polylinien dieser Klassen (Kern `plan/situation.rs`).
|
||||
|
||||
import { beforeAll, describe, expect, it } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { parseDxf } from "./dxfParser";
|
||||
import { loadFileioForTests } from "../engine/fileioWasm.testing";
|
||||
import { importInto } from "./importView.testutil";
|
||||
import { emptyProject } from "../model/sampleProject";
|
||||
|
||||
beforeAll(loadFileioForTests);
|
||||
|
||||
const bytes = () => new Uint8Array(readFileSync(new URL("./testdata/kataster.dxf", import.meta.url)));
|
||||
|
||||
describe("[207] Kataster-Layer auf Kontext-Klassen", () => {
|
||||
it("Gebäude, Gewässer und Strassen(-namen) bekommen die Klassen 12, 17, 11", () => {
|
||||
const r = importInto(emptyProject, parseDxf(bytes()), { categoryMode: "byLayer" });
|
||||
const byCode = (code: string) => r.drawings.filter((d) => d.categoryCode === code);
|
||||
expect(byCode("12").filter((d) => d.geom.shape === "polyline" && d.geom.closed)).toHaveLength(5);
|
||||
expect(byCode("17")).toHaveLength(1);
|
||||
expect(byCode("11").filter((d) => d.geom.shape === "text").map((d) => (d.geom.shape === "text" ? d.geom.text : ""))).toEqual(["Bahnhofstrasse"]);
|
||||
expect(byCode("11").filter((d) => d.geom.shape === "line")).toHaveLength(2);
|
||||
const names = new Map<string, string>();
|
||||
const walk = (ls: typeof r.project.layers) => ls.forEach((l) => (names.set(l.code, l.name), walk(l.children ?? [])));
|
||||
walk(r.project.layers);
|
||||
expect(names.get("12")).toBe("Gebäude");
|
||||
expect(names.get("17")).toBe("Gewässer");
|
||||
expect(names.get("11")).toBe("Strasse");
|
||||
});
|
||||
|
||||
it("andere Layer (Parzellen, Gebäudenummer) bleiben eigene Kategorien", () => {
|
||||
const r = importInto(emptyProject, parseDxf(bytes()), { categoryMode: "byLayer" });
|
||||
const codes = new Set(r.drawings.map((d) => d.categoryCode));
|
||||
// Parzellen + Gebäudenummer = zwei weitere Codes ausser 12, 17, 11.
|
||||
expect([...codes].filter((c) => !["12", "17", "11"].includes(c))).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("Modus „aktive Kategorie“ ändert nichts an der Zuordnung", () => {
|
||||
const r = importInto(emptyProject, parseDxf(bytes()), { categoryMode: "active", activeCategoryCode: emptyProject.layers[0].code });
|
||||
expect(new Set(r.drawings.map((d) => d.categoryCode))).toEqual(new Set([emptyProject.layers[0].code]));
|
||||
});
|
||||
});
|
||||
Vendored
+256
@@ -0,0 +1,256 @@
|
||||
0
|
||||
SECTION
|
||||
2
|
||||
ENTITIES
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Parzellen
|
||||
90
|
||||
4
|
||||
70
|
||||
1
|
||||
10
|
||||
10
|
||||
20
|
||||
10
|
||||
10
|
||||
110
|
||||
20
|
||||
10
|
||||
10
|
||||
110
|
||||
20
|
||||
70
|
||||
10
|
||||
10
|
||||
20
|
||||
70
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Gebaeude
|
||||
90
|
||||
4
|
||||
70
|
||||
1
|
||||
10
|
||||
20
|
||||
20
|
||||
20
|
||||
10
|
||||
70
|
||||
20
|
||||
20
|
||||
10
|
||||
70
|
||||
20
|
||||
60
|
||||
10
|
||||
20
|
||||
20
|
||||
60
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Gebaeude
|
||||
90
|
||||
4
|
||||
70
|
||||
1
|
||||
10
|
||||
32
|
||||
20
|
||||
30
|
||||
10
|
||||
58
|
||||
20
|
||||
30
|
||||
10
|
||||
58
|
||||
20
|
||||
50
|
||||
10
|
||||
32
|
||||
20
|
||||
50
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Gebaeude
|
||||
90
|
||||
4
|
||||
70
|
||||
1
|
||||
10
|
||||
42
|
||||
20
|
||||
36
|
||||
10
|
||||
48
|
||||
20
|
||||
36
|
||||
10
|
||||
48
|
||||
20
|
||||
44
|
||||
10
|
||||
42
|
||||
20
|
||||
44
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Gebaeude
|
||||
90
|
||||
6
|
||||
70
|
||||
1
|
||||
10
|
||||
80
|
||||
20
|
||||
20
|
||||
10
|
||||
104
|
||||
20
|
||||
20
|
||||
10
|
||||
104
|
||||
20
|
||||
30
|
||||
10
|
||||
90
|
||||
20
|
||||
30
|
||||
10
|
||||
90
|
||||
20
|
||||
60
|
||||
10
|
||||
80
|
||||
20
|
||||
60
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Gebaeude
|
||||
90
|
||||
4
|
||||
70
|
||||
1
|
||||
10
|
||||
120
|
||||
20
|
||||
20
|
||||
10
|
||||
134
|
||||
20
|
||||
20
|
||||
10
|
||||
134
|
||||
20
|
||||
34
|
||||
10
|
||||
120
|
||||
20
|
||||
34
|
||||
0
|
||||
LWPOLYLINE
|
||||
8
|
||||
Gewaesser
|
||||
90
|
||||
7
|
||||
70
|
||||
1
|
||||
10
|
||||
10
|
||||
20
|
||||
90
|
||||
10
|
||||
60
|
||||
20
|
||||
95
|
||||
10
|
||||
110
|
||||
20
|
||||
88
|
||||
10
|
||||
130
|
||||
20
|
||||
100
|
||||
10
|
||||
100
|
||||
20
|
||||
115
|
||||
10
|
||||
40
|
||||
20
|
||||
112
|
||||
10
|
||||
10
|
||||
20
|
||||
105
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Strassen
|
||||
10
|
||||
0
|
||||
20
|
||||
76
|
||||
30
|
||||
0
|
||||
11
|
||||
140
|
||||
21
|
||||
76
|
||||
31
|
||||
0
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Strassen
|
||||
10
|
||||
0
|
||||
20
|
||||
82
|
||||
30
|
||||
0
|
||||
11
|
||||
140
|
||||
21
|
||||
82
|
||||
31
|
||||
0
|
||||
0
|
||||
TEXT
|
||||
8
|
||||
Strassennamen
|
||||
10
|
||||
30
|
||||
20
|
||||
78
|
||||
40
|
||||
2.5
|
||||
1
|
||||
Bahnhofstrasse
|
||||
50
|
||||
0
|
||||
0
|
||||
TEXT
|
||||
8
|
||||
Gebaeudenummer
|
||||
10
|
||||
45
|
||||
20
|
||||
25
|
||||
40
|
||||
1.5
|
||||
1
|
||||
12
|
||||
50
|
||||
0
|
||||
0
|
||||
ENDSEC
|
||||
0
|
||||
EOF
|
||||
Reference in new issue
Block a user