@kensnzk/koyu 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +2 -2
- package/README.md +3 -3
- package/dist/cli.js +156 -81
- package/dist/cli.js.map +1 -1
- package/dist/core/derive.d.ts +259 -0
- package/dist/core/derive.d.ts.map +1 -0
- package/dist/core/derive.js +570 -0
- package/dist/core/derive.js.map +1 -0
- package/dist/{check.d.ts → core/diagnose.d.ts} +11 -12
- package/dist/core/diagnose.d.ts.map +1 -0
- package/dist/{check.js → core/diagnose.js} +232 -221
- package/dist/core/diagnose.js.map +1 -0
- package/dist/core/diff.d.ts.map +1 -0
- package/dist/{diff.js → core/diff.js} +84 -41
- package/dist/core/diff.js.map +1 -0
- package/dist/{fabric.d.ts → core/fabric.d.ts} +4 -0
- package/dist/core/fabric.d.ts.map +1 -0
- package/dist/{fabric.js → core/fabric.js} +4 -3
- package/dist/core/fabric.js.map +1 -0
- package/dist/{graph.d.ts → core/graph.d.ts} +1 -3
- package/dist/core/graph.d.ts.map +1 -0
- package/dist/{graph.js → core/graph.js} +43 -51
- package/dist/core/graph.js.map +1 -0
- package/dist/core/light.d.ts +24 -0
- package/dist/core/light.d.ts.map +1 -0
- package/dist/{light.js → core/light.js} +15 -10
- package/dist/core/light.js.map +1 -0
- package/dist/{model.d.ts → core/model.d.ts} +124 -13
- package/dist/core/model.d.ts.map +1 -0
- package/dist/{model.js → core/model.js} +186 -49
- package/dist/core/model.js.map +1 -0
- package/dist/core/parse.d.ts.map +1 -0
- package/dist/{parse.js → core/parse.js} +528 -116
- package/dist/core/parse.js.map +1 -0
- package/dist/{poly.d.ts → core/poly.d.ts} +3 -2
- package/dist/core/poly.d.ts.map +1 -0
- package/dist/{poly.js → core/poly.js} +8 -9
- package/dist/core/poly.js.map +1 -0
- package/dist/core/site.d.ts.map +1 -0
- package/dist/core/site.js.map +1 -0
- package/dist/core/tolerance.d.ts +26 -0
- package/dist/core/tolerance.d.ts.map +1 -0
- package/dist/core/tolerance.js +48 -0
- package/dist/core/tolerance.js.map +1 -0
- package/dist/{vertical.d.ts → core/vertical.d.ts} +41 -12
- package/dist/core/vertical.d.ts.map +1 -0
- package/dist/{vertical.js → core/vertical.js} +45 -104
- package/dist/core/vertical.js.map +1 -0
- package/dist/core/vocabulary.d.ts +40 -0
- package/dist/core/vocabulary.d.ts.map +1 -0
- package/dist/core/vocabulary.js +164 -0
- package/dist/core/vocabulary.js.map +1 -0
- package/dist/{axo.d.ts → draw/axo.d.ts} +1 -1
- package/dist/draw/axo.d.ts.map +1 -0
- package/dist/{axo.js → draw/axo.js} +53 -81
- package/dist/draw/axo.js.map +1 -0
- package/dist/draw/index.d.ts +3 -0
- package/dist/draw/index.d.ts.map +1 -0
- package/dist/draw/index.js +11 -0
- package/dist/draw/index.js.map +1 -0
- package/dist/draw/plan.d.ts +10 -0
- package/dist/draw/plan.d.ts.map +1 -0
- package/dist/draw/plan.js +284 -0
- package/dist/draw/plan.js.map +1 -0
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -12
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +71 -40
- package/dist/mcp.js.map +1 -1
- package/dist/parse-file.d.ts +1 -1
- package/dist/parse-file.d.ts.map +1 -1
- package/dist/parse-file.js +1 -1
- package/dist/parse-file.js.map +1 -1
- package/dist/validate/access.d.ts +6 -0
- package/dist/validate/access.d.ts.map +1 -0
- package/dist/validate/access.js +238 -0
- package/dist/validate/access.js.map +1 -0
- package/dist/validate/envelope.d.ts +4 -0
- package/dist/validate/envelope.d.ts.map +1 -0
- package/dist/validate/envelope.js +55 -0
- package/dist/validate/envelope.js.map +1 -0
- package/dist/validate/index.d.ts +60 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +77 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/light.d.ts +6 -0
- package/dist/validate/light.d.ts.map +1 -0
- package/dist/validate/light.js +28 -0
- package/dist/validate/light.js.map +1 -0
- package/dist/validate/runs.d.ts +16 -0
- package/dist/validate/runs.d.ts.map +1 -0
- package/dist/validate/runs.js +60 -0
- package/dist/validate/runs.js.map +1 -0
- package/dist/validate/site.d.ts +6 -0
- package/dist/validate/site.d.ts.map +1 -0
- package/dist/validate/site.js +63 -0
- package/dist/validate/site.js.map +1 -0
- package/editors/vscode/.vscodeignore +2 -0
- package/editors/vscode/README.md +28 -0
- package/editors/vscode/extension.js +150 -0
- package/editors/vscode/language-configuration.json +19 -0
- package/editors/vscode/package.json +57 -0
- package/editors/vscode/syntaxes/koyu.tmLanguage.json +226 -0
- package/examples/basement/main.muro +1 -1
- package/examples/complex/main.muro +1 -1
- package/examples/house/main.muro +2 -2
- package/examples/house.muro +2 -2
- package/examples/mansion.muro +2 -2
- package/examples/office.muro +2 -2
- package/examples/steps/01-one-room.muro +1 -1
- package/examples/steps/02-two-rooms.muro +1 -1
- package/examples/steps/03-door.muro +1 -1
- package/examples/steps/04-exterior.muro +1 -1
- package/examples/steps/05-two-storeys.muro +1 -1
- package/examples/steps/06-finished.muro +2 -2
- package/examples/tower/main.muro +1 -1
- package/examples/twin/main.muro +2 -2
- package/examples/two-rooms.canonical.json +4 -2
- package/examples/two-rooms.muro +2 -2
- package/package.json +16 -1
- package/spec/README.md +28 -0
- package/spec/canonical-json.md +98 -0
- package/spec/composition.md +121 -0
- package/spec/derivation.md +393 -0
- package/spec/en/README.md +30 -0
- package/spec/en/canonical-json.md +101 -0
- package/spec/en/composition.md +121 -0
- package/spec/en/derivation.md +393 -0
- package/spec/en/language.md +164 -0
- package/spec/en/notation-v0.md +145 -0
- package/spec/en/scope.md +229 -0
- package/spec/en/semantics.md +132 -0
- package/spec/en/tools.md +108 -0
- package/spec/en/validation.md +79 -0
- package/spec/en/vocabulary.md +103 -0
- package/spec/language.md +163 -0
- package/spec/notation-v0.md +184 -0
- package/spec/scope.md +229 -0
- package/spec/semantics.md +130 -0
- package/spec/tools.md +106 -0
- package/spec/validation.md +79 -0
- package/spec/vocabulary.md +114 -0
- package/src/cli.ts +165 -80
- package/src/core/derive.ts +852 -0
- package/src/{check.ts → core/diagnose.ts} +260 -229
- package/src/{diff.ts → core/diff.ts} +84 -40
- package/src/{fabric.ts → core/fabric.ts} +4 -3
- package/src/{graph.ts → core/graph.ts} +47 -60
- package/src/core/light.ts +69 -0
- package/src/{model.ts → core/model.ts} +228 -51
- package/src/{parse.ts → core/parse.ts} +584 -116
- package/src/{poly.ts → core/poly.ts} +8 -9
- package/src/core/tolerance.ts +55 -0
- package/src/{vertical.ts → core/vertical.ts} +65 -115
- package/src/core/vocabulary.ts +197 -0
- package/src/{axo.ts → draw/axo.ts} +51 -94
- package/src/draw/index.ts +11 -0
- package/src/draw/plan.ts +344 -0
- package/src/index.ts +181 -35
- package/src/mcp.ts +76 -40
- package/src/parse-file.ts +2 -2
- package/src/validate/access.ts +279 -0
- package/src/validate/envelope.ts +59 -0
- package/src/validate/index.ts +107 -0
- package/src/validate/light.ts +43 -0
- package/src/validate/runs.ts +87 -0
- package/src/validate/site.ts +84 -0
- package/dist/axo.d.ts.map +0 -1
- package/dist/axo.js.map +0 -1
- package/dist/check.d.ts.map +0 -1
- package/dist/check.js.map +0 -1
- package/dist/diff.d.ts.map +0 -1
- package/dist/diff.js.map +0 -1
- package/dist/fabric.d.ts.map +0 -1
- package/dist/fabric.js.map +0 -1
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js.map +0 -1
- package/dist/light.d.ts +0 -15
- package/dist/light.d.ts.map +0 -1
- package/dist/light.js.map +0 -1
- package/dist/model.d.ts.map +0 -1
- package/dist/model.js.map +0 -1
- package/dist/parse.d.ts.map +0 -1
- package/dist/parse.js.map +0 -1
- package/dist/plan.d.ts +0 -10
- package/dist/plan.d.ts.map +0 -1
- package/dist/plan.js +0 -354
- package/dist/plan.js.map +0 -1
- package/dist/poly.d.ts.map +0 -1
- package/dist/poly.js.map +0 -1
- package/dist/site.d.ts.map +0 -1
- package/dist/site.js.map +0 -1
- package/dist/vertical.d.ts.map +0 -1
- package/dist/vertical.js.map +0 -1
- package/src/light.ts +0 -63
- package/src/plan.ts +0 -472
- /package/dist/{diff.d.ts → core/diff.d.ts} +0 -0
- /package/dist/{parse.d.ts → core/parse.d.ts} +0 -0
- /package/dist/{site.d.ts → core/site.d.ts} +0 -0
- /package/dist/{site.js → core/site.js} +0 -0
- /package/src/{site.ts → core/site.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// koyu — 凸片の幾何 (ADR-
|
|
1
|
+
// koyu — 凸片の幾何 (ADR-0022 / spec/derivation.md §1)
|
|
2
2
|
//
|
|
3
3
|
// 空間の形は**凸片の集合** (`Pt[][]`) である (ADR-0022)。矩形はその入口の綴りにすぎない。
|
|
4
4
|
// この層が存在しなかったあいだ、面積・被覆・切り分けの計算が model / graph / fabric /
|
|
@@ -11,11 +11,10 @@
|
|
|
11
11
|
// どの範囲で測り、どの範囲を切るのかを、呼び手が必ず一緒に言う。
|
|
12
12
|
|
|
13
13
|
import type { Pt, Rect } from "./model.js";
|
|
14
|
+
import { AREA_EPS, CROSS_EPS, EPS, POINT_EPS } from "./tolerance.js";
|
|
14
15
|
|
|
15
|
-
/** 幾何の許容 mm
|
|
16
|
-
export
|
|
17
|
-
/** 面積の退化の閾値 mm² — 1mm×1mm 未満の片は捨てる */
|
|
18
|
-
const AREA_EPS = 1;
|
|
16
|
+
/** 幾何の許容 mm — 台帳は tolerance.ts が持つ (ADR-0040) */
|
|
17
|
+
export { EPS };
|
|
19
18
|
|
|
20
19
|
// ---- 基本 ----
|
|
21
20
|
|
|
@@ -79,8 +78,8 @@ export function clipHalf(poly: Pt[], a: Pt, b: Pt, keepLeft: boolean): Pt[] {
|
|
|
79
78
|
const q = poly[(i + 1) % poly.length]!;
|
|
80
79
|
const sp = side(p);
|
|
81
80
|
const sq = side(q);
|
|
82
|
-
if (sp >= -
|
|
83
|
-
if ((sp >
|
|
81
|
+
if (sp >= -CROSS_EPS) out.push(p);
|
|
82
|
+
if ((sp > CROSS_EPS && sq < -CROSS_EPS) || (sp < -CROSS_EPS && sq > CROSS_EPS)) {
|
|
84
83
|
const t = sp / (sp - sq);
|
|
85
84
|
out.push({ x: p.x + t * (q.x - p.x), y: p.y + t * (q.y - p.y) });
|
|
86
85
|
}
|
|
@@ -250,7 +249,7 @@ export function cutsInWindow(pieces: Pt[][], w: Rect, a: Pt, b: Pt): boolean {
|
|
|
250
249
|
// ---- 包含 ----
|
|
251
250
|
|
|
252
251
|
/** 点が多角形の辺の上にあるか */
|
|
253
|
-
export function onEdge(p: Pt, poly: Pt[], eps =
|
|
252
|
+
export function onEdge(p: Pt, poly: Pt[], eps = POINT_EPS): boolean {
|
|
254
253
|
for (let i = 0; i < poly.length; i++) {
|
|
255
254
|
const a = poly[i]!;
|
|
256
255
|
const b = poly[(i + 1) % poly.length]!;
|
|
@@ -266,7 +265,7 @@ export function onEdge(p: Pt, poly: Pt[], eps = 1): boolean {
|
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
/** 点が多角形の内側にあるか (境界上は内側扱い) */
|
|
269
|
-
export function pointIn(p: Pt, poly: Pt[], eps =
|
|
268
|
+
export function pointIn(p: Pt, poly: Pt[], eps = POINT_EPS): boolean {
|
|
270
269
|
if (onEdge(p, poly, eps)) return true;
|
|
271
270
|
let inside = false;
|
|
272
271
|
for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// koyu — 許容値の族 (ADR-0040)
|
|
2
|
+
//
|
|
3
|
+
// **同じ問いに二つの許容値があってはならない。**
|
|
4
|
+
//
|
|
5
|
+
// これらの数は「どれだけ違えば別のものか」を決める。値がモジュールごとに置かれていた
|
|
6
|
+
// あいだ、`poly.ts` の EPS と `graph.ts` の EPS は同じ 0.5 を別々に持ち、`vertical.ts` は
|
|
7
|
+
// 1 を四箇所に直値で書き、`drawnShare` は軸平行の判定に graph の EPS ではなく直値の 0.5 を
|
|
8
|
+
// 使っていた。どれも同じ値なので事故は起きていないが、**一つを動かしたときに何が動くのかを
|
|
9
|
+
// 誰も言えない**状態だった。許容値は導出の規則の一部であり (spec/derivation.md §6)、
|
|
10
|
+
// 規則が消費者ごとに違えば同じ原本から違う建物が出る。
|
|
11
|
+
//
|
|
12
|
+
// 座標は mm の整数が基本である。だから長さの許容は 0.5mm — 「これより細かい差は同一」の線が、
|
|
13
|
+
// 整数の刻みの半分に置かれている。面積の許容 1mm² は 1mm×1mm の破片であり、
|
|
14
|
+
// 半平面で切った残りがこれ以下なら形として数えない。
|
|
15
|
+
|
|
16
|
+
/** 長さ・座標の許容 mm。辺の共線・向かい合わせ・区間の一致・共線マージの隙間 */
|
|
17
|
+
export const EPS = 0.5;
|
|
18
|
+
|
|
19
|
+
/** 面積の退化の閾値 mm²。切った残りがこれ以下なら空、左右の面積差がこれ未満なら偏りなし */
|
|
20
|
+
export const AREA_EPS = 1;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 描かれた線の左右を探る距離 mm。**形の解像度の下限である** —
|
|
24
|
+
* この幅を下回る空間は左右のどちらにも判定できず、境界の線分が一本も出ない
|
|
25
|
+
*/
|
|
26
|
+
export const PROBE = 5;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 区間・切断・枠の一致の許容 mm。切断面と部品の z の比較、可視区間の長さの下限、
|
|
30
|
+
* 上る走りと下りる走りが同じ枠かの判定、外皮の穴の長さの下限
|
|
31
|
+
*/
|
|
32
|
+
export const SPAN_EPS = 1;
|
|
33
|
+
|
|
34
|
+
/** 半平面で切るときの符号の許容 (単位は外積 = 面積の二倍)。頂点を残すか、交点を挿むか */
|
|
35
|
+
export const CROSS_EPS = 1e-6;
|
|
36
|
+
|
|
37
|
+
/** 無限直線と線分の平行判定・線分側パラメータの範囲の許容 (無次元) */
|
|
38
|
+
export const PARALLEL_EPS = 1e-9;
|
|
39
|
+
|
|
40
|
+
/** 点が多角形の辺の上にあるとみなす幅 mm (境界上は内側扱い) */
|
|
41
|
+
export const POINT_EPS = 1;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 許容値の台帳。**spec/derivation.md §6 の表の唯一の出所である** —
|
|
45
|
+
* `test/derive.test.ts` が表とここの一致を縛る。
|
|
46
|
+
*/
|
|
47
|
+
export const TOLERANCES: Readonly<Record<string, number>> = {
|
|
48
|
+
EPS,
|
|
49
|
+
AREA_EPS,
|
|
50
|
+
PROBE,
|
|
51
|
+
SPAN_EPS,
|
|
52
|
+
CROSS_EPS,
|
|
53
|
+
PARALLEL_EPS,
|
|
54
|
+
POINT_EPS,
|
|
55
|
+
};
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// 段数も踏面も勾配も書かれない — 書かないが検査する (RUN06 / RUN07)。
|
|
9
9
|
|
|
10
10
|
import { levelsSorted, type Edge, type Model, type Pt, type Rect, type Space } from "./model.js";
|
|
11
|
+
import { EPS, SPAN_EPS } from "./tolerance.js";
|
|
11
12
|
|
|
12
13
|
/** 装置。トポロジーではなく形の生成規則を選ぶ語 */
|
|
13
14
|
export type RunDevice = "stair" | "ramp" | "escalator" | "lift";
|
|
@@ -19,29 +20,23 @@ export type RunForm = "straight" | "return";
|
|
|
19
20
|
export const RUN_FORMS: readonly RunForm[] = ["straight", "return"];
|
|
20
21
|
|
|
21
22
|
/** 既定の蹴上げ上限 mm (riser: で上書き) */
|
|
22
|
-
const DEFAULT_RISER_MAX = 180;
|
|
23
|
-
/** 踏面がこれを下回ると窮屈 (RUN06) */
|
|
24
|
-
const TREAD_MIN = 240;
|
|
23
|
+
export const DEFAULT_RISER_MAX = 180;
|
|
25
24
|
/** 折返し階段の踊り場を導くときの目標踏面 mm (tread: で上書き) */
|
|
26
|
-
const TREAD_TARGET = 300;
|
|
27
|
-
/** 蹴上げ2倍+踏面 の快適域 (RUN06) */
|
|
28
|
-
const STEP_RULE = { lo: 550, hi: 700 };
|
|
29
|
-
/** エスカレーターの標準勾配 (30度 ≒ 1/1.73) と許容 */
|
|
30
|
-
const ESCALATOR_SLOPE = { lo: 1 / 2.3, hi: 1 / 1.4 };
|
|
25
|
+
export const TREAD_TARGET = 300;
|
|
31
26
|
/** 平面図の切断面 — FLからの高さ mm */
|
|
32
27
|
export const CUT_HEIGHT = 1200;
|
|
33
28
|
/** 踊り場の最小奥行 mm */
|
|
34
|
-
const LANDING_MIN = 1100;
|
|
29
|
+
export const LANDING_MIN = 1100;
|
|
35
30
|
/** 乗り込みの床の既定の奥行 mm (entry: で上書き) — 扉が段板に直接ぶつからないための帯 */
|
|
36
|
-
const ENTRY_LANDING = 1100;
|
|
31
|
+
export const ENTRY_LANDING = 1100;
|
|
37
32
|
/** エスカレーター一台の既定の呼び幅 mm (lane: で上書き) */
|
|
38
|
-
const LANE_ESCALATOR = 1200;
|
|
33
|
+
export const LANE_ESCALATOR = 1200;
|
|
39
34
|
/** 平面のエスカレーターの段の刻みのピッチ mm */
|
|
40
|
-
const STEP_MARK = 400;
|
|
35
|
+
export const STEP_MARK = 400;
|
|
41
36
|
/** 段板の見付け厚 (立体) mm */
|
|
42
|
-
const TREAD_SOLID = 200;
|
|
37
|
+
export const TREAD_SOLID = 200;
|
|
43
38
|
/** 斜路・エスカレーター床版の厚さ mm */
|
|
44
|
-
const SLAB_T = 200;
|
|
39
|
+
export const SLAB_T = 200;
|
|
45
40
|
|
|
46
41
|
/** 走りと踊り場の一区間。局所座標は t (走り方向) と s (進行方向の左からの幅) */
|
|
47
42
|
export interface RunPart {
|
|
@@ -201,7 +196,7 @@ export function verticalRun(
|
|
|
201
196
|
|
|
202
197
|
const z0 = levels[li]!.z;
|
|
203
198
|
const upper = levels[li + 1];
|
|
204
|
-
if (!upper && device !== "lift") return undefined; // 上る先が無い —
|
|
199
|
+
if (!upper && device !== "lift") return undefined; // 上る先が無い — SUF04
|
|
205
200
|
const z1 = upper?.z ?? z0;
|
|
206
201
|
const rise = z1 - z0;
|
|
207
202
|
|
|
@@ -512,23 +507,33 @@ export interface Seg2 {
|
|
|
512
507
|
y2: number;
|
|
513
508
|
}
|
|
514
509
|
|
|
510
|
+
/**
|
|
511
|
+
* 進む向きを指す線分。**文字列は持たない** — "UP" と "DN" は言葉であって形ではない
|
|
512
|
+
* (spec/scope.md §6)。この面で人が上るかどうかを `up` が言い、注記は描画側が組む
|
|
513
|
+
*/
|
|
515
514
|
export interface RunArrow extends Seg2 {
|
|
516
|
-
|
|
515
|
+
/** この面でこの走りを進むと上るか */
|
|
516
|
+
up: boolean;
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
/**
|
|
519
|
+
/**
|
|
520
|
+
* そのレベルで切った縦動線の作図。平面図とビュアーが共有する唯一の答え。
|
|
521
|
+
* **色も線種も注記文字列も持たない** (spec/scope.md §6 / spec/derivation.md §5)
|
|
522
|
+
*/
|
|
520
523
|
export interface RunDraw {
|
|
521
524
|
path: string;
|
|
522
525
|
device: RunDevice;
|
|
526
|
+
/** この面に現れるのは上る走りか、下りる走りか */
|
|
527
|
+
dir: "up" | "down";
|
|
523
528
|
/** 段鼻 (階段) / 段の刻み (エスカレーター) */
|
|
524
529
|
treads: Seg2[];
|
|
525
530
|
/** 輪郭 — 走りの側線・踊り場の縁 */
|
|
526
531
|
outline: Seg2[];
|
|
527
|
-
/**
|
|
532
|
+
/** 走りが切断面を跨ぐ位置を、走りの幅いっぱいに横切る線分。作図慣習の二本の斜線は描画側が引く */
|
|
528
533
|
breaks: Seg2[];
|
|
529
534
|
arrows: RunArrow[];
|
|
530
|
-
/**
|
|
531
|
-
|
|
535
|
+
/** 注記を置く座 (上る走りにだけ、一つ)。**言葉は持たない** — 数は VerticalRun にある */
|
|
536
|
+
anchor?: { x: number; y: number };
|
|
532
537
|
}
|
|
533
538
|
|
|
534
539
|
/**
|
|
@@ -542,11 +547,11 @@ function upWindows(run: VerticalRun, cutZ: number | undefined): Array<[number, n
|
|
|
542
547
|
if (cutZ === undefined) return [p.t0, p.t1] as [number, number];
|
|
543
548
|
const lo = Math.min(p.z0, p.z1);
|
|
544
549
|
const hi = Math.max(p.z0, p.z1);
|
|
545
|
-
if (cutZ >= hi -
|
|
546
|
-
if (cutZ <= lo +
|
|
550
|
+
if (cutZ >= hi - SPAN_EPS) return [p.t0, p.t1] as [number, number]; // 丸ごと切断面より下
|
|
551
|
+
if (cutZ <= lo + SPAN_EPS || hi - lo < SPAN_EPS) return undefined; // 丸ごと上 (踊り場もここ)
|
|
547
552
|
const t = p.t0 + ((cutZ - p.z0) / (p.z1 - p.z0)) * (p.t1 - p.t0);
|
|
548
553
|
const [a, b] = p.z0 < p.z1 ? [p.t0, t] : [t, p.t1];
|
|
549
|
-
return b - a >
|
|
554
|
+
return b - a > SPAN_EPS ? ([a, b] as [number, number]) : undefined;
|
|
550
555
|
});
|
|
551
556
|
}
|
|
552
557
|
|
|
@@ -566,8 +571,8 @@ function downWindows(
|
|
|
566
571
|
if (!w) return [p.t0, p.t1] as [number, number];
|
|
567
572
|
const [a, b] = w;
|
|
568
573
|
// 上りが占めたのが手前側 ([t0,t]) なら残りは奥側、逆なら手前側
|
|
569
|
-
const out: [number, number] = a <= p.t0 +
|
|
570
|
-
return out[1] - out[0] >
|
|
574
|
+
const out: [number, number] = a <= p.t0 + SPAN_EPS ? [b, p.t1] : [p.t0, a];
|
|
575
|
+
return out[1] - out[0] > SPAN_EPS ? out : undefined;
|
|
571
576
|
});
|
|
572
577
|
}
|
|
573
578
|
|
|
@@ -606,10 +611,10 @@ export function runDrawsForLevel(model: Model, level: string, cut = CUT_HEIGHT):
|
|
|
606
611
|
*/
|
|
607
612
|
function sameFrame(a: VerticalRun, b: VerticalRun): boolean {
|
|
608
613
|
return (
|
|
609
|
-
Math.abs(a.rect.x1 - b.rect.x1) <
|
|
610
|
-
Math.abs(a.rect.y1 - b.rect.y1) <
|
|
611
|
-
Math.abs(a.rect.x2 - b.rect.x2) <
|
|
612
|
-
Math.abs(a.rect.y2 - b.rect.y2) <
|
|
614
|
+
Math.abs(a.rect.x1 - b.rect.x1) < SPAN_EPS &&
|
|
615
|
+
Math.abs(a.rect.y1 - b.rect.y1) < SPAN_EPS &&
|
|
616
|
+
Math.abs(a.rect.x2 - b.rect.x2) < SPAN_EPS &&
|
|
617
|
+
Math.abs(a.rect.y2 - b.rect.y2) < SPAN_EPS &&
|
|
613
618
|
a.up === b.up &&
|
|
614
619
|
a.form === b.form &&
|
|
615
620
|
a.device === b.device &&
|
|
@@ -623,7 +628,7 @@ function crossings(run: VerticalRun, cutZ: number): Array<number | undefined> {
|
|
|
623
628
|
if (p.kind !== "flight") return undefined;
|
|
624
629
|
const lo = Math.min(p.z0, p.z1);
|
|
625
630
|
const hi = Math.max(p.z0, p.z1);
|
|
626
|
-
if (cutZ < lo || cutZ > hi || hi - lo <
|
|
631
|
+
if (cutZ < lo || cutZ > hi || hi - lo < SPAN_EPS) return undefined;
|
|
627
632
|
return p.t0 + ((cutZ - p.z0) / (p.z1 - p.z0)) * (p.t1 - p.t0);
|
|
628
633
|
});
|
|
629
634
|
}
|
|
@@ -638,11 +643,11 @@ function drawRun(
|
|
|
638
643
|
const draw: RunDraw = {
|
|
639
644
|
path: run.path,
|
|
640
645
|
device: run.device,
|
|
646
|
+
dir,
|
|
641
647
|
treads: [],
|
|
642
648
|
outline: [],
|
|
643
649
|
breaks: [],
|
|
644
650
|
arrows: [],
|
|
645
|
-
notes: [],
|
|
646
651
|
};
|
|
647
652
|
const { rect, up } = run;
|
|
648
653
|
const seg = (t0: number, s0: number, t1: number, s1: number): Seg2 => {
|
|
@@ -675,12 +680,12 @@ function drawRun(
|
|
|
675
680
|
|
|
676
681
|
if (run.device === "stair") {
|
|
677
682
|
const d = (p.t1 - p.t0) / Math.max(1, (p.risers ?? 2) - 1);
|
|
678
|
-
for (let t = p.t0 + d; t < p.t1 -
|
|
679
|
-
if (t < lo -
|
|
683
|
+
for (let t = p.t0 + d; t < p.t1 - SPAN_EPS; t += d) {
|
|
684
|
+
if (t < lo - EPS || t > hi + EPS) continue;
|
|
680
685
|
draw.treads.push(seg(t, p.s0, t, p.s1));
|
|
681
686
|
}
|
|
682
687
|
} else if (run.device === "escalator") {
|
|
683
|
-
for (let t = lo + STEP_MARK; t < hi -
|
|
688
|
+
for (let t = lo + STEP_MARK; t < hi - SPAN_EPS; t += STEP_MARK) {
|
|
684
689
|
draw.treads.push(seg(t, p.s0, t, p.s1));
|
|
685
690
|
}
|
|
686
691
|
}
|
|
@@ -701,11 +706,12 @@ function drawRun(
|
|
|
701
706
|
const back = flip ? !p.reversed : p.reversed; // t が減る向きに進むか
|
|
702
707
|
const from = back ? hi - 150 : lo + 150;
|
|
703
708
|
const to = back ? lo + 150 : hi - 150;
|
|
704
|
-
draw.arrows.push({ ...seg(from, c, to, c),
|
|
709
|
+
draw.arrows.push({ ...seg(from, c, to, c), up: goUp });
|
|
705
710
|
}
|
|
706
711
|
}
|
|
707
712
|
|
|
708
|
-
// 切断線:
|
|
713
|
+
// 切断線: 走りが切断面を跨ぐ位置を、走りの幅いっぱいに横切る一本の線分として返す。
|
|
714
|
+
// **作図慣習 (平行な二本の斜線・その振り分け寸法) は描画側が持つ** — 形は跨いだ位置だけである
|
|
709
715
|
if (dir === "up" && cross) {
|
|
710
716
|
// 並列の台はどれも同じ高さで切られる。切断線は**跨いだ走りに、その走り自身の
|
|
711
717
|
// 位置で**引く — 一台の位置を全台に配ると、何も無い所に線が乗る
|
|
@@ -713,32 +719,23 @@ function drawRun(
|
|
|
713
719
|
const p = run.parts[i]!;
|
|
714
720
|
const ct = cross[i];
|
|
715
721
|
if (ct === undefined || !windows?.[i]) continue;
|
|
716
|
-
|
|
717
|
-
const off = Math.min(220, g);
|
|
718
|
-
draw.breaks.push(
|
|
719
|
-
seg(ct - g - off, p.s0, ct + g - off, p.s1),
|
|
720
|
-
seg(ct - g + off, p.s0, ct + g + off, p.s1),
|
|
721
|
-
);
|
|
722
|
+
draw.breaks.push(seg(ct, p.s0, ct, p.s1));
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
725
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
x: (rect.x1 + rect.x2) / 2,
|
|
728
|
-
y: (rect.y1 + rect.y2) / 2,
|
|
729
|
-
text:
|
|
730
|
-
run.device === "stair"
|
|
731
|
-
? `${run.risers}段 蹴上${Math.round(run.riser)}/踏面${Math.round(run.tread)}`
|
|
732
|
-
: `${run.lanes > 1 ? `${run.lanes}台 ` : ""}勾配 ${slopeText(run.slope)}`,
|
|
733
|
-
});
|
|
734
|
-
}
|
|
726
|
+
// 注記の座だけを返す。段数も勾配も VerticalRun が持っており、言葉にするのは描画側である
|
|
727
|
+
if (dir === "up") draw.anchor = { x: (rect.x1 + rect.x2) / 2, y: (rect.y1 + rect.y2) / 2 };
|
|
735
728
|
return draw;
|
|
736
729
|
}
|
|
737
730
|
|
|
738
731
|
// ---- 検査の材料 (check.ts が言葉にする) ----
|
|
739
732
|
|
|
740
|
-
/**
|
|
741
|
-
|
|
733
|
+
/**
|
|
734
|
+
* runIssues が出しうる診断コード (ADR-0016 の台帳の部分集合 — check の emit が型で受ける)。
|
|
735
|
+
* SUF04 だけ族が違う — 「形が一つも生成されない」は縦動線の話ではなく充足性の話であり、
|
|
736
|
+
* コードは SUF に属したまま、この走査の順に出る (節の粒度は走査単位である — ADR-0028 / ADR-0034)
|
|
737
|
+
*/
|
|
738
|
+
export type RunCode = "RUN01" | "RUN02" | "RUN03" | "RUN05" | "SUF04";
|
|
742
739
|
|
|
743
740
|
export interface RunIssue {
|
|
744
741
|
code: RunCode;
|
|
@@ -749,21 +746,13 @@ export interface RunIssue {
|
|
|
749
746
|
}
|
|
750
747
|
|
|
751
748
|
/**
|
|
752
|
-
*
|
|
753
|
-
* (
|
|
754
|
-
*
|
|
749
|
+
* 縦動線の構造整合 (RUN01..03 / RUN05 と、形が一つも生成されない SUF04) — **宣言から形が一意に決まるか**だけを見る。
|
|
750
|
+
* 決まった形が登りやすいか (段の窮屈さ・勾配・上下の繋がり) は建築の側の判断で、
|
|
751
|
+
* 検証の面 (src/validate/runs.ts) が持つ。ここは合否を言わない (ADR-0021)。
|
|
755
752
|
*/
|
|
756
753
|
export function runIssues(model: Model): RunIssue[] {
|
|
757
754
|
const out: RunIssue[] = [];
|
|
758
755
|
const levels = levelsSorted(model);
|
|
759
|
-
const stairLinked = new Set<string>();
|
|
760
|
-
for (const b of model.boundaries) {
|
|
761
|
-
if (b.kind === "stair" || b.kind === "shaft") {
|
|
762
|
-
stairLinked.add(b.a);
|
|
763
|
-
stairLinked.add(b.b);
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
|
|
767
756
|
for (const s of model.spaces.values()) {
|
|
768
757
|
const decls = runDecls(s);
|
|
769
758
|
if (decls.length === 0) continue;
|
|
@@ -771,7 +760,7 @@ export function runIssues(model: Model): RunIssue[] {
|
|
|
771
760
|
if (decls.length > 1) {
|
|
772
761
|
out.push({
|
|
773
762
|
code: "RUN01",
|
|
774
|
-
message:
|
|
763
|
+
message: `More than one vertical circulation declaration: ${decls.map((d) => `${d.device}:${d.value}`).join(" ")} (one space carries one)`,
|
|
775
764
|
...at,
|
|
776
765
|
});
|
|
777
766
|
continue;
|
|
@@ -782,8 +771,8 @@ export function runIssues(model: Model): RunIssue[] {
|
|
|
782
771
|
code: "RUN02",
|
|
783
772
|
message:
|
|
784
773
|
device === "lift"
|
|
785
|
-
? `lift
|
|
786
|
-
:
|
|
774
|
+
? `The value of lift is 1: lift:${value}`
|
|
775
|
+
: `The value of ${device} is the direction it rises, N/E/S/W: ${device}:${value}`,
|
|
787
776
|
...at,
|
|
788
777
|
});
|
|
789
778
|
continue;
|
|
@@ -793,21 +782,21 @@ export function runIssues(model: Model): RunIssue[] {
|
|
|
793
782
|
code: "RUN03",
|
|
794
783
|
message:
|
|
795
784
|
s.rects.length === 0
|
|
796
|
-
?
|
|
797
|
-
:
|
|
785
|
+
? `Vertical circulation requires a region: ${s.path}`
|
|
786
|
+
: `The region of vertical circulation is a single rectangle (a union leaves the step division undetermined): ${s.path}`,
|
|
798
787
|
...at,
|
|
799
788
|
});
|
|
800
789
|
continue;
|
|
801
790
|
}
|
|
802
791
|
if (!s.level) {
|
|
803
|
-
out.push({ code: "RUN03", message:
|
|
792
|
+
out.push({ code: "RUN03", message: `The level of the vertical circulation cannot be determined: ${s.path}`, ...at });
|
|
804
793
|
continue;
|
|
805
794
|
}
|
|
806
795
|
const formRaw = String(s.attrs["form"] ?? "straight");
|
|
807
796
|
if (!RUN_FORMS.includes(formRaw as RunForm)) {
|
|
808
797
|
out.push({
|
|
809
798
|
code: "RUN05",
|
|
810
|
-
message: `form
|
|
799
|
+
message: `form is ${RUN_FORMS.join(" / ")}: form:${formRaw} (write a spiral as a succession of turns)`,
|
|
811
800
|
...at,
|
|
812
801
|
});
|
|
813
802
|
continue;
|
|
@@ -815,7 +804,7 @@ export function runIssues(model: Model): RunIssue[] {
|
|
|
815
804
|
if (device !== "stair" && device !== "ramp" && formRaw !== "straight") {
|
|
816
805
|
out.push({
|
|
817
806
|
code: "RUN05",
|
|
818
|
-
message:
|
|
807
|
+
message: `form:${formRaw} may not be written on ${device} (only a stair and a ramp turn back)`,
|
|
819
808
|
...at,
|
|
820
809
|
});
|
|
821
810
|
continue;
|
|
@@ -824,8 +813,8 @@ export function runIssues(model: Model): RunIssue[] {
|
|
|
824
813
|
const li = levels.findIndex((l) => l.name === s.level);
|
|
825
814
|
if (device !== "lift" && (li < 0 || !levels[li + 1])) {
|
|
826
815
|
out.push({
|
|
827
|
-
code: "
|
|
828
|
-
message:
|
|
816
|
+
code: "SUF04",
|
|
817
|
+
message: `No level sits above ${s.level}, so no form is generated for ${s.path}`,
|
|
829
818
|
...at,
|
|
830
819
|
});
|
|
831
820
|
continue;
|
|
@@ -835,50 +824,11 @@ export function runIssues(model: Model): RunIssue[] {
|
|
|
835
824
|
if (!run) {
|
|
836
825
|
out.push({
|
|
837
826
|
code: "RUN05",
|
|
838
|
-
message:
|
|
827
|
+
message: `The form of the vertical circulation is undetermined: ${s.path} (check that the landing does not exceed the full length)`,
|
|
839
828
|
...at,
|
|
840
829
|
});
|
|
841
830
|
continue;
|
|
842
831
|
}
|
|
843
|
-
if (device === "lift") continue;
|
|
844
|
-
|
|
845
|
-
if (!stairLinked.has(s.path)) {
|
|
846
|
-
out.push({
|
|
847
|
-
code: "RUN08",
|
|
848
|
-
message: `${s.path} は縦動線の形を持ちますが、上下を繋ぐ垂直境界がありません (stack か boundary type:stair を書きます — 形はあってもグラフでは通れません)`,
|
|
849
|
-
...at,
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
if (device === "stair") {
|
|
854
|
-
const t = Math.round(run.tread);
|
|
855
|
-
const r = Math.round(run.riser);
|
|
856
|
-
const rule = 2 * r + t;
|
|
857
|
-
if (t < TREAD_MIN || rule < STEP_RULE.lo || rule > STEP_RULE.hi) {
|
|
858
|
-
out.push({
|
|
859
|
-
code: "RUN06",
|
|
860
|
-
message: `導出された段の寸法が窮屈です: ${run.risers}段 蹴上${r}mm / 踏面${t}mm (2×蹴上+踏面 = ${Math.round(rule)}mm、目安 ${STEP_RULE.lo}〜${STEP_RULE.hi}mm)`,
|
|
861
|
-
...at,
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
} else if (device === "ramp") {
|
|
865
|
-
const declared = s.attrs["slope"];
|
|
866
|
-
if (typeof declared === "number" && declared > 0 && run.slope > 1 / declared + 1e-9) {
|
|
867
|
-
out.push({
|
|
868
|
-
code: "RUN07",
|
|
869
|
-
message: `導出された勾配 ${slopeText(run.slope)} が宣言 1/${declared} より急です (走り長を伸ばすか階高を下げます)`,
|
|
870
|
-
...at,
|
|
871
|
-
});
|
|
872
|
-
}
|
|
873
|
-
} else if (device === "escalator") {
|
|
874
|
-
if (run.slope < ESCALATOR_SLOPE.lo || run.slope > ESCALATOR_SLOPE.hi) {
|
|
875
|
-
out.push({
|
|
876
|
-
code: "RUN07",
|
|
877
|
-
message: `導出された勾配 ${slopeText(run.slope)} はエスカレーターの常用域 (約1/1.7 = 30度) から外れています`,
|
|
878
|
-
...at,
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
832
|
}
|
|
883
833
|
return out;
|
|
884
834
|
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// koyu core — 属性の台帳 (spec/vocabulary.md の写しであり、実装の唯一の出所)
|
|
2
|
+
//
|
|
3
|
+
// # 属性の三層 (spec/scope.md §7)
|
|
4
|
+
//
|
|
5
|
+
// 構造 (structure) パス・型・区画・レベル・関係の相手・kind。**必ず見る**。
|
|
6
|
+
// parse が typed field へ持ち上げるので、check の時点では attrs に残らない
|
|
7
|
+
// 解釈 (interpreted) 台帳が値域を定義し、**見る**。h / at / daylight / road / style …
|
|
8
|
+
// 運搬 (carry) **見ない。**運ぶだけ。spec / fire / sound / floor / sill …
|
|
9
|
+
//
|
|
10
|
+
// # なぜ台帳が要るのか — 「見ていない」と「見て問題がない」を区別するため
|
|
11
|
+
//
|
|
12
|
+
// ADR-0028 は解釈される属性の**値**を守った (ATT01/ATT02)。だが**キー**は無防備だった。
|
|
13
|
+
// 実測すると `heigh:2400` は HGT01 を、`sit:1` は敷地の判定を、`stiar:N` は縦動線を
|
|
14
|
+
// 丸ごと無音にし、`--strict` でも終了コード 0 だった。**書いたのに効かない**のに緑である。
|
|
15
|
+
//
|
|
16
|
+
// 塞ぐ道は一つしかない — **台帳に無いキーを拒む**。しかしそれは「語彙は開いている」
|
|
17
|
+
// という koyu の主張を殺す。だから運搬層に**名前空間**を与える (ADR-0033):
|
|
18
|
+
//
|
|
19
|
+
// spec:RC 台帳のキー。名前空間は要らない。core は運ぶだけ
|
|
20
|
+
// acme.sensor:23 名前空間つき。**誰でも書ける。core は絶対に見ない**
|
|
21
|
+
// heigh:2400 台帳に無く名前空間も無い → **ATT03 エラー**
|
|
22
|
+
//
|
|
23
|
+
// 開いていることと信頼できることは、境界が宣言されていれば両立する。
|
|
24
|
+
// 宣言が無ければ、見ていないことと、見て問題がないことが区別できない。
|
|
25
|
+
|
|
26
|
+
/** 属性の層 */
|
|
27
|
+
export type AttrTier = "structure" | "interpreted" | "carry";
|
|
28
|
+
|
|
29
|
+
export interface AttrSpec {
|
|
30
|
+
tier: AttrTier;
|
|
31
|
+
/** 値がこの列挙のどれかでなければ ATT02 */
|
|
32
|
+
of?: Array<string | number>;
|
|
33
|
+
/** 正の数値でなければ ATT01 */
|
|
34
|
+
num?: true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 台帳を読みやすく書くための小道具 */
|
|
38
|
+
const num = (): AttrSpec => ({ tier: "interpreted", num: true });
|
|
39
|
+
const one = (...of: Array<string | number>): AttrSpec => ({ tier: "interpreted", of });
|
|
40
|
+
const free = (): AttrSpec => ({ tier: "interpreted" });
|
|
41
|
+
const carry = (): AttrSpec => ({ tier: "carry" });
|
|
42
|
+
const structure = (): AttrSpec => ({ tier: "structure" });
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 運搬層の名前空間の綴り — **ドット区切り** (`acme.sensor` `bems.temp` `survey.measured`)。
|
|
46
|
+
*
|
|
47
|
+
* この形を選んだのは、属性の字句規則 (最初の `:` の左がキー) を一切変えずに済むからである。
|
|
48
|
+
* 出所ごとの接頭辞 (`bems:temp:22.5`) は値に `:` を持ち込み、一律接頭辞 (`x-`) は
|
|
49
|
+
* 二つの第三者が同じキー名を使ったとき衝突する。
|
|
50
|
+
*
|
|
51
|
+
* 名前空間の中身に core は一切の意味を与えない — 分割の規則すら持たない。
|
|
52
|
+
* 一つでもドットがあれば運搬層である、というだけの規則にしてある。
|
|
53
|
+
*/
|
|
54
|
+
export const CARRY_NAMESPACE = /^[a-z][a-z0-9_-]*(\.[a-z0-9_-]+)+$/;
|
|
55
|
+
|
|
56
|
+
/** そのキーが名前空間つきの運搬層かどうか */
|
|
57
|
+
export function isNamespaced(key: string): boolean {
|
|
58
|
+
return CARRY_NAMESPACE.test(key);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 要素ごとの台帳。**ここに無いキーは名前空間を持たなければならない。**
|
|
63
|
+
*
|
|
64
|
+
* `structure` の印が付いたキーは parse が typed field へ持ち上げるので、
|
|
65
|
+
* check の時点では attrs に残っていない。台帳に載せてあるのは、
|
|
66
|
+
* 「その要素にそのキーを書いてよい」という事実そのものが契約だからである。
|
|
67
|
+
*/
|
|
68
|
+
export const ATTR_LEDGER: Record<string, Record<string, AttrSpec>> = {
|
|
69
|
+
space: {
|
|
70
|
+
// 構造 — parse が持ち上げる
|
|
71
|
+
level: structure(), // 所属レベルの明示 (メゾネット)
|
|
72
|
+
w: structure(), // 帯 (band) の要素の寸法。帯の外には書けない
|
|
73
|
+
|
|
74
|
+
// 解釈 — core が読む
|
|
75
|
+
h: num(), // 天井高 mm。高さ不変量と矩計が読む
|
|
76
|
+
use: free(), // 集計軸。zone から継承
|
|
77
|
+
road: num(), // exterior の幅員 mm。接道の導出
|
|
78
|
+
daylight: free(), // 採光の問いの対象 (ADR-0020)。値域は DAY01 が守るので台帳では重ねない
|
|
79
|
+
ceiling: one(0, 1), // 0 = 天井を張らない (ADR-0024)
|
|
80
|
+
uid: free(), // 永続同一性トークン (ADR-0015)。UID01-03 が守る
|
|
81
|
+
name: free(), // 表示名 — displayName が読むので解釈層である
|
|
82
|
+
|
|
83
|
+
// 縦動線の宣言 (ADR-0021) — キーが装置を名指し、値が上る向き
|
|
84
|
+
stair: free(),
|
|
85
|
+
ramp: free(),
|
|
86
|
+
escalator: free(),
|
|
87
|
+
lift: free(),
|
|
88
|
+
form: free(), // straight / return。RUN05 が守る
|
|
89
|
+
turn: one("R", "L"),
|
|
90
|
+
entry: num(), // 乗り込みの床の奥行 mm
|
|
91
|
+
landing: num(), // 中間踊り場の奥行 mm
|
|
92
|
+
riser: num(), // 蹴上げの上限 mm
|
|
93
|
+
tread: num(), // 目標踏面 mm
|
|
94
|
+
lane: num(), // 一台/一車線の幅 mm
|
|
95
|
+
slope: num(), // 許容勾配の分母 — **検証だけが読む閾値**だが、値域は core が守る
|
|
96
|
+
|
|
97
|
+
// 運搬 — core は運ぶだけ
|
|
98
|
+
floor: carry(), // 床仕上げ。area が区間上書きする
|
|
99
|
+
spec: carry(), // 物の名
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
zone: {
|
|
103
|
+
name: free(),
|
|
104
|
+
use: free(), // 配下へ継承される集計軸
|
|
105
|
+
site: one(0, 1), // 敷地の集約 (ADR-0009)
|
|
106
|
+
area: num(), // 敷地の宣言面積 ㎡ (測量値)
|
|
107
|
+
uid: free(),
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
boundary: {
|
|
111
|
+
// 構造 — parse が持ち上げる (type / t / air / edge)
|
|
112
|
+
type: structure(),
|
|
113
|
+
t: structure(),
|
|
114
|
+
air: structure(),
|
|
115
|
+
edge: structure(),
|
|
116
|
+
|
|
117
|
+
// 解釈
|
|
118
|
+
h: num(), // air:1 の境界の天端高 mm (手すり・腰壁)。軸測図が読む
|
|
119
|
+
name: free(),
|
|
120
|
+
|
|
121
|
+
// 運搬
|
|
122
|
+
spec: carry(), // 物の名 (RC / LGS / カーテンウォール / 手すり…)
|
|
123
|
+
fire: carry(), // 耐火。**core は見ない** — 区画の問いは検証の面に属す
|
|
124
|
+
sound: carry(), // 遮音
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
opening: {
|
|
128
|
+
// 構造 — parse が持ち上げる
|
|
129
|
+
w: structure(),
|
|
130
|
+
h: structure(),
|
|
131
|
+
at: structure(),
|
|
132
|
+
edge: structure(),
|
|
133
|
+
hinge: structure(),
|
|
134
|
+
swing: structure(),
|
|
135
|
+
|
|
136
|
+
// 解釈
|
|
137
|
+
style: one("hinged", "sliding", "auto"), // 平面の建具表現が変わる
|
|
138
|
+
name: free(), // **境界の中で一意な名** — 開口の同一性の鍵 (spec/scope.md §5)
|
|
139
|
+
|
|
140
|
+
// 運搬
|
|
141
|
+
sill: carry(), // 窓台高
|
|
142
|
+
spec: carry(),
|
|
143
|
+
fire: carry(),
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
area: {
|
|
147
|
+
floor: carry(),
|
|
148
|
+
name: free(),
|
|
149
|
+
spec: carry(),
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
seg: {
|
|
153
|
+
// 構造 — parse が持ち上げる
|
|
154
|
+
w: structure(),
|
|
155
|
+
at: structure(),
|
|
156
|
+
edge: structure(),
|
|
157
|
+
|
|
158
|
+
name: free(),
|
|
159
|
+
spec: carry(),
|
|
160
|
+
fire: carry(),
|
|
161
|
+
sound: carry(),
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
column: {
|
|
165
|
+
// 構造 — parse が持ち上げる
|
|
166
|
+
d: structure(),
|
|
167
|
+
x: structure(),
|
|
168
|
+
y: structure(),
|
|
169
|
+
|
|
170
|
+
name: free(),
|
|
171
|
+
spec: carry(),
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
/** level は attrs を持たない (すべて typed field) ので、台帳外のキーは parse が拒む */
|
|
175
|
+
level: {
|
|
176
|
+
h: structure(),
|
|
177
|
+
slab: structure(),
|
|
178
|
+
pitch: structure(),
|
|
179
|
+
underground: structure(),
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/** その要素で、名前空間なしに書いてよいキーか */
|
|
184
|
+
export function known(elem: string, key: string): boolean {
|
|
185
|
+
return ATTR_LEDGER[elem]?.[key] !== undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** その要素・そのキーの契約 (無ければ undefined) */
|
|
189
|
+
export function attrSpec(elem: string, key: string): AttrSpec | undefined {
|
|
190
|
+
return ATTR_LEDGER[elem]?.[key];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* asset は開口の既定値の束なので、開口と同じ台帳で読む (ADR-0010)。
|
|
195
|
+
* 「アセットに書けて開口に書けない属性」を作らないための同一視である。
|
|
196
|
+
*/
|
|
197
|
+
export const ASSET_ELEM = "opening";
|