@kensnzk/koyu 0.22.0 → 0.24.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/dist/cli.js +51 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/bodies.d.ts +26 -0
- package/dist/core/bodies.d.ts.map +1 -0
- package/dist/core/bodies.js +67 -0
- package/dist/core/bodies.js.map +1 -0
- package/dist/core/model.d.ts +20 -1
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/model.js +27 -1
- package/dist/core/model.js.map +1 -1
- package/dist/core/parse.d.ts.map +1 -1
- package/dist/core/parse.js +11 -13
- package/dist/core/parse.js.map +1 -1
- package/dist/core/poly.d.ts +35 -0
- package/dist/core/poly.d.ts.map +1 -1
- package/dist/core/poly.js +67 -0
- package/dist/core/poly.js.map +1 -1
- package/dist/core/section.d.ts +88 -0
- package/dist/core/section.d.ts.map +1 -0
- package/dist/core/section.js +247 -0
- package/dist/core/section.js.map +1 -0
- package/dist/draw/axo.d.ts.map +1 -1
- package/dist/draw/axo.js +13 -31
- package/dist/draw/axo.js.map +1 -1
- package/dist/draw/index.d.ts +4 -0
- package/dist/draw/index.d.ts.map +1 -1
- package/dist/draw/index.js +4 -0
- package/dist/draw/index.js.map +1 -1
- package/dist/draw/marks.d.ts +126 -0
- package/dist/draw/marks.d.ts.map +1 -0
- package/dist/draw/marks.js +227 -0
- package/dist/draw/marks.js.map +1 -0
- package/dist/draw/plan.d.ts.map +1 -1
- package/dist/draw/plan.js +117 -133
- package/dist/draw/plan.js.map +1 -1
- package/dist/draw/scene.d.ts +133 -0
- package/dist/draw/scene.d.ts.map +1 -0
- package/dist/draw/scene.js +251 -0
- package/dist/draw/scene.js.map +1 -0
- package/dist/draw/section.d.ts +23 -0
- package/dist/draw/section.d.ts.map +1 -0
- package/dist/draw/section.js +168 -0
- package/dist/draw/section.js.map +1 -0
- package/dist/draw/sheet.d.ts +40 -0
- package/dist/draw/sheet.d.ts.map +1 -0
- package/dist/draw/sheet.js +93 -0
- package/dist/draw/sheet.js.map +1 -0
- package/dist/draw/written.d.ts +27 -0
- package/dist/draw/written.d.ts.map +1 -0
- package/dist/draw/written.js +50 -0
- package/dist/draw/written.js.map +1 -0
- package/dist/form.d.ts +1 -0
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +4 -0
- package/dist/form.js.map +1 -1
- package/dist/mcp.js +67 -3
- package/dist/mcp.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +57 -1
- package/src/core/bodies.ts +90 -0
- package/src/core/model.ts +32 -1
- package/src/core/parse.ts +13 -12
- package/src/core/poly.ts +76 -0
- package/src/core/section.ts +311 -0
- package/src/draw/axo.ts +13 -29
- package/src/draw/index.ts +24 -0
- package/src/draw/marks.ts +315 -0
- package/src/draw/plan.ts +111 -130
- package/src/draw/scene.ts +389 -0
- package/src/draw/section.ts +224 -0
- package/src/draw/sheet.ts +102 -0
- package/src/draw/written.ts +64 -0
- package/src/form.ts +18 -0
- package/src/mcp.ts +75 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../../src/draw/marks.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAQ,KAAK,IAAI,EAAoB,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,QAAQ;AAClB,uCAAuC;AACrC,OAAO;AACT,yDAAyD;GACvD,oBAAoB;AACtB,2CAA2C;GACzC,YAAY;AACd,iGAAiG;GAC/F,YAAY;AACd,gDAAgD;GAC9C,MAAM;AACR,kEAAkE;GAChE,MAAM;AACR,8EAA8E;GAC5E,MAAM;AACR,gDAAgD;GAC9C,KAAK;AACP,sCAAsC;GACpC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ACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,sEAAsE;IACtE,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;;OAKG;IACH,OAAO,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,qDAAqD;IACrD,IAAI,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAsBD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,CAkK/E"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// koyu — the marks of a plan (`@kensnzk/koyu/draw`)
|
|
2
|
+
//
|
|
3
|
+
// **This copies `Form`'s 2D entities into marks. Not one rule of geometry lives here.** Wall
|
|
4
|
+
// thickness, the intervals an opening splits a wall into, a door swing's centre and radius and
|
|
5
|
+
// sweep, where a run is cut, the projection of the void above — all of it is already in the `Form`
|
|
6
|
+
// that `derive(model)` returns (ADR-0040). What is decided here is *which* of those entities
|
|
7
|
+
// becomes a mark and what the mark stands for.
|
|
8
|
+
//
|
|
9
|
+
// **A plan is not a pure section.** Door swings, the projection of the void above, break lines and
|
|
10
|
+
// the descending run do not fall out of cutting a solid, however exactly it is cut. So `Form` hands
|
|
11
|
+
// the plan over as entities carrying a class (cut / below / above / swing / anchor), and this page
|
|
12
|
+
// reads that class rather than re-deciding it.
|
|
13
|
+
//
|
|
14
|
+
// **No words and no style.** `Form` carries no colour, no line type and no annotation wording
|
|
15
|
+
// (docs/reference/scope.md), and neither does a mark. "UP", "DN", 「上部吹抜け」 and 「12段
|
|
16
|
+
// 蹴上180/踏面240」 are the consumer's — three consumers spell three different sets of them today,
|
|
17
|
+
// and a mark that carried one would make koyu's language mix everyone's. A mark carries the seat
|
|
18
|
+
// (`at`) and the unrounded facts (`note`); the words are put on at the far end.
|
|
19
|
+
import { band } from "../core/derive.js";
|
|
20
|
+
import { polyBounds } from "../core/model.js";
|
|
21
|
+
/**
|
|
22
|
+
* Setback of a sliding door's pocket panel from the wall face, mm.
|
|
23
|
+
*
|
|
24
|
+
* **A drafting convention, not a derivation default.** It is not in the ledger of derivation
|
|
25
|
+
* constants because no shape of the building depends on it; all three implementations spell 110.
|
|
26
|
+
*/
|
|
27
|
+
export const SLIDE_POCKET = 110;
|
|
28
|
+
const unit = (from, to, len) => ({
|
|
29
|
+
x: (to.x - from.x) / (len || 1),
|
|
30
|
+
y: (to.y - from.y) / (len || 1),
|
|
31
|
+
});
|
|
32
|
+
/** A sliding or automatic door: no swing trace — a panel set back on the hinge side, and its tail. */
|
|
33
|
+
function slideMarks(o, pocket, base) {
|
|
34
|
+
const sw = o.swing;
|
|
35
|
+
if (!sw)
|
|
36
|
+
return [];
|
|
37
|
+
const { hinge } = sw;
|
|
38
|
+
const u = unit(hinge, sw.leaf, o.w); // towards the side it opens onto
|
|
39
|
+
const a = unit(hinge, sw.jamb, o.w); // along the segment
|
|
40
|
+
const s1 = { x: hinge.x - a.x * o.w + u.x * pocket, y: hinge.y - a.y * o.w + u.y * pocket };
|
|
41
|
+
const s2 = { x: hinge.x + u.x * pocket, y: hinge.y + u.y * pocket };
|
|
42
|
+
return [
|
|
43
|
+
{ ...base, role: "slide-panel", lines: [{ x1: s1.x, y1: s1.y, x2: s2.x, y2: s2.y }] },
|
|
44
|
+
{ ...base, role: "slide-tail", lines: [{ x1: s2.x, y1: s2.y, x2: hinge.x, y2: hinge.y }] },
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The marks drawn on one level's plan, from `Form`.
|
|
49
|
+
*
|
|
50
|
+
* **The model is not read.** Grid lines, `area` frames, space names, the north arrow and the sheet
|
|
51
|
+
* title are written givens, and the consumer draws them separately from what it wrote. Returns an
|
|
52
|
+
* empty list where the level has no plan.
|
|
53
|
+
*/
|
|
54
|
+
export function planMarks(form, level, opts) {
|
|
55
|
+
const plan = form.plans.find((p) => p.level === level);
|
|
56
|
+
if (!plan)
|
|
57
|
+
return [];
|
|
58
|
+
const pocket = opts?.slidePocket ?? SLIDE_POCKET;
|
|
59
|
+
const marks = [];
|
|
60
|
+
const S = new Map(form.spaces.map((s) => [s.path, s]));
|
|
61
|
+
const B = new Map(form.boundaries.map((b) => [b.ref, b]));
|
|
62
|
+
const O = new Map(form.openings.map((o) => [o.ref, o]));
|
|
63
|
+
const R = new Map(form.runs.map((r) => [r.path, r]));
|
|
64
|
+
// ---- spaces ----
|
|
65
|
+
for (const e of plan.entities) {
|
|
66
|
+
if (e.of !== "space" || e.class !== "cut" || !e.polygon)
|
|
67
|
+
continue;
|
|
68
|
+
const s = S.get(e.ref);
|
|
69
|
+
// A void is a **declaration** (`void:1`), not a word in the type vocabulary (ADR-0051), and
|
|
70
|
+
// `Form` carries that fact through as `FormSpace.void`.
|
|
71
|
+
if (s?.void) {
|
|
72
|
+
const r = polyBounds(e.polygon);
|
|
73
|
+
marks.push({ role: "space-void", of: "space", ref: e.ref, class: "cut", polygon: e.polygon });
|
|
74
|
+
marks.push({
|
|
75
|
+
role: "void-hatch",
|
|
76
|
+
of: "space",
|
|
77
|
+
ref: e.ref,
|
|
78
|
+
class: "cut",
|
|
79
|
+
lines: [
|
|
80
|
+
{ x1: r.x1, y1: r.y1, x2: r.x2, y2: r.y2 },
|
|
81
|
+
{ x1: r.x1, y1: r.y2, x2: r.x2, y2: r.y1 },
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
marks.push({
|
|
87
|
+
role: s?.semiOutdoor ? "space-semi-outdoor" : "space",
|
|
88
|
+
of: "space",
|
|
89
|
+
ref: e.ref,
|
|
90
|
+
class: "cut",
|
|
91
|
+
polygon: e.polygon,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// ---- boundaries ----
|
|
95
|
+
// **What says a boundary has matter is the presence of `polygon`, not a lookup on the boundary.**
|
|
96
|
+
// Read `lines` first and every wall falls into the `open` branch — the whole drawing turns to
|
|
97
|
+
// dashes with not one black band in it. That regression is real; it has happened.
|
|
98
|
+
//
|
|
99
|
+
// The order matters as much. Asking "is this class dropped?" before "is this a rail?" draws no
|
|
100
|
+
// handrail at all: a rail stands 1100 high and the plane cuts at 1200, so every rail interval is
|
|
101
|
+
// classified `below` and a class-first branch discards the lot in silence.
|
|
102
|
+
for (const e of plan.entities) {
|
|
103
|
+
if (e.of !== "boundary")
|
|
104
|
+
continue;
|
|
105
|
+
const b = B.get(e.ref);
|
|
106
|
+
const base = {
|
|
107
|
+
of: "boundary",
|
|
108
|
+
ref: e.ref,
|
|
109
|
+
...(b ? { written: { boundary: b.boundary }, pair: { a: b.a, b: b.b } } : {}),
|
|
110
|
+
};
|
|
111
|
+
if (!e.polygon) {
|
|
112
|
+
if (e.lines)
|
|
113
|
+
marks.push({ ...base, role: "open", class: e.class, lines: e.lines });
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (b?.air) {
|
|
117
|
+
// Something that does not enclose is drawn as its axis, not as a body — that the space is
|
|
118
|
+
// not shut is readable from the drawing. `Form` carries the axis, so it is never recovered
|
|
119
|
+
// from the footprint.
|
|
120
|
+
if (e.class !== "above" && e.lines)
|
|
121
|
+
marks.push({ ...base, role: "rail", class: e.class, lines: e.lines });
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (e.class === "cut")
|
|
125
|
+
marks.push({ ...base, role: "wall", class: "cut", polygon: e.polygon });
|
|
126
|
+
}
|
|
127
|
+
// ---- segments that do not count — no area, no graph, but a derived position ----
|
|
128
|
+
for (const g of form.segs) {
|
|
129
|
+
if (g.level !== level)
|
|
130
|
+
continue;
|
|
131
|
+
marks.push({
|
|
132
|
+
role: "seg",
|
|
133
|
+
of: "seg",
|
|
134
|
+
ref: g.ref,
|
|
135
|
+
class: "cut",
|
|
136
|
+
polygon: band(g.segment, g.cx, g.cy, g.w, g.t),
|
|
137
|
+
written: { boundary: g.boundary, index: g.index },
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// ---- openings ----
|
|
141
|
+
for (const e of plan.entities) {
|
|
142
|
+
if (e.of !== "opening")
|
|
143
|
+
continue;
|
|
144
|
+
const o = O.get(e.ref);
|
|
145
|
+
if (!o)
|
|
146
|
+
continue;
|
|
147
|
+
const base = {
|
|
148
|
+
of: "opening",
|
|
149
|
+
ref: e.ref,
|
|
150
|
+
written: { boundary: o.boundary, index: o.index },
|
|
151
|
+
pair: { a: o.a, b: o.b },
|
|
152
|
+
};
|
|
153
|
+
if (e.class === "swing") {
|
|
154
|
+
if (o.sliding) {
|
|
155
|
+
marks.push(...slideMarks(o, pocket, { ...base, class: "swing" }));
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (e.lines)
|
|
159
|
+
marks.push({ ...base, role: "door-leaf", class: "swing", lines: e.lines });
|
|
160
|
+
if (e.arc)
|
|
161
|
+
marks.push({ ...base, role: "door-arc", class: "swing", arc: e.arc });
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
// No class filter, so a clerestory above the cut arrives as a `window` too. `Mark.class` puts
|
|
165
|
+
// that fact in the consumer's hand instead of hiding it.
|
|
166
|
+
if (o.kind !== "door" && e.lines)
|
|
167
|
+
marks.push({ ...base, role: "window", class: e.class, lines: e.lines });
|
|
168
|
+
}
|
|
169
|
+
// ---- columns (written nowhere — they appear where grid lines meet a floor) ----
|
|
170
|
+
for (const e of plan.entities) {
|
|
171
|
+
if (e.of === "column" && e.polygon) {
|
|
172
|
+
marks.push({ role: "column", of: "column", ref: e.ref, class: e.class, polygon: e.polygon });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// ---- vertical circulation — the ascending run is cut, and beyond it the descending run shows ----
|
|
176
|
+
for (const e of plan.entities) {
|
|
177
|
+
if (e.of !== "run")
|
|
178
|
+
continue;
|
|
179
|
+
const base = { of: "run", ref: e.ref };
|
|
180
|
+
if (e.role === "outline" && e.lines)
|
|
181
|
+
marks.push({ ...base, role: "run-outline", class: e.class, lines: e.lines });
|
|
182
|
+
else if (e.role === "tread" && e.lines)
|
|
183
|
+
marks.push({ ...base, role: "run-tread", class: e.class, lines: e.lines });
|
|
184
|
+
else if (e.role === "break" && e.lines)
|
|
185
|
+
marks.push({ ...base, role: "run-break", class: "cut", lines: e.lines });
|
|
186
|
+
else if (e.role === "arrow" && e.lines) {
|
|
187
|
+
marks.push({
|
|
188
|
+
...base,
|
|
189
|
+
role: "run-arrow",
|
|
190
|
+
class: e.class,
|
|
191
|
+
lines: e.lines,
|
|
192
|
+
...(e.anchor ? { at: { x: e.anchor.x, y: e.anchor.y } } : {}),
|
|
193
|
+
note: { of: "direction", up: e.anchor?.up === true },
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
else if (e.class === "anchor" && e.anchor) {
|
|
197
|
+
const r = R.get(e.ref);
|
|
198
|
+
if (!r)
|
|
199
|
+
continue;
|
|
200
|
+
marks.push({
|
|
201
|
+
...base,
|
|
202
|
+
role: "run-note",
|
|
203
|
+
class: "anchor",
|
|
204
|
+
at: { x: e.anchor.x, y: e.anchor.y },
|
|
205
|
+
note: r.device === "stair"
|
|
206
|
+
? { of: "stair", risers: r.risers, riser: r.riser, tread: r.tread, going: r.going, rise: r.rise }
|
|
207
|
+
: { of: "incline", device: r.device, lanes: r.lanes, slope: r.slope, rise: r.rise },
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// ---- the void above, dropped onto the plan below ----
|
|
212
|
+
for (const e of plan.entities) {
|
|
213
|
+
if (e.class !== "above" || e.of !== "space" || !e.polygon)
|
|
214
|
+
continue;
|
|
215
|
+
const r = polyBounds(e.polygon);
|
|
216
|
+
marks.push({
|
|
217
|
+
role: "void-above",
|
|
218
|
+
of: "space",
|
|
219
|
+
ref: e.ref,
|
|
220
|
+
class: "above",
|
|
221
|
+
polygon: e.polygon,
|
|
222
|
+
at: { x: (r.x1 + r.x2) / 2, y: (r.y1 + r.y2) / 2 },
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return marks;
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=marks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marks.js","sourceRoot":"","sources":["../../src/draw/marks.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,6FAA6F;AAC7F,+FAA+F;AAC/F,mGAAmG;AACnG,6FAA6F;AAC7F,+CAA+C;AAC/C,EAAE;AACF,mGAAmG;AACnG,oGAAoG;AACpG,mGAAmG;AACnG,+CAA+C;AAC/C,EAAE;AACF,8FAA8F;AAC9F,mFAAmF;AACnF,8FAA8F;AAC9F,iGAAiG;AACjG,gFAAgF;AAChF,OAAO,EAAE,IAAI,EAAgE,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,UAAU,EAAW,MAAM,kBAAkB,CAAC;AA6FvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAOhC,MAAM,IAAI,GAAG,CAAC,IAAQ,EAAE,EAAM,EAAE,GAAW,EAAM,EAAE,CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/B,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,sG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AAS,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;aACxF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO;YAAE,SAAS;QACpE,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,YAAY;YAClB,EAAE,EAAE,OAAO;YACX,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;SACnD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/draw/plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/draw/plan.ts"],"names":[],"mappings":"AAYA,OAAO,
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/draw/plan.ts"],"names":[],"mappings":"AAYA,OAAO,EAA2B,KAAK,KAAK,EAAW,MAAM,kBAAkB,CAAC;AAMhF,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,WAAgB,GAAG,MAAM,CA0QpE"}
|
package/dist/draw/plan.js
CHANGED
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
// 形と見た目の線引きはこうである。境界線分の座標・壁の厚み・開口で割られた区間・
|
|
9
9
|
// 扉の軌跡の中心と半径と掃き方向・切断面を跨ぐ位置は Form が持つ。1/4円を破線で描くか、
|
|
10
10
|
// 切断線を平行な二本の斜線として引くか、矢印に "UP" と書くかは、ここが決める。
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { derive } from "../core/derive.js";
|
|
12
|
+
import { displayName, polyBounds } from "../core/model.js";
|
|
13
13
|
import { slopeText } from "../core/vertical.js";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const GRID = "#b5aa94";
|
|
18
|
-
const FAINT = "#b3ab9c";
|
|
14
|
+
import { planMarks } from "./marks.js";
|
|
15
|
+
import { esc, Extent, FAINT, GRID, INK, openSheet, PAPER, ROOM } from "./sheet.js";
|
|
16
|
+
import { writtenOf } from "./written.js";
|
|
19
17
|
export function svgPlan(model, opts = {}) {
|
|
20
18
|
const level = opts.level ?? Object.keys(model.levels)[0];
|
|
21
19
|
if (!level)
|
|
@@ -34,10 +32,18 @@ export function svgPlan(model, opts = {}) {
|
|
|
34
32
|
const modelRooms = [...model.spaces.values()].filter((s) => s.rects.length > 0 && s.level === level);
|
|
35
33
|
const allRects = modelRooms.flatMap((s) => s.rects);
|
|
36
34
|
const polyPts = [...sitePolys.flatMap((p) => p.points), ...rooms.flatMap((s) => s.outline.flat())];
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
35
|
+
// **畳んで取る** (Extent) — 引数を展開すると、大きな階では点の数がスタックの限界に当たる
|
|
36
|
+
const ext = new Extent();
|
|
37
|
+
for (const r of allRects) {
|
|
38
|
+
ext.see(r.x1, r.y1);
|
|
39
|
+
ext.see(r.x2, r.y2);
|
|
40
|
+
}
|
|
41
|
+
for (const p of polyPts)
|
|
42
|
+
ext.see(p.x, p.y);
|
|
43
|
+
const minX = ext.min0;
|
|
44
|
+
const maxX = ext.max0;
|
|
45
|
+
const minY = ext.min1;
|
|
46
|
+
const maxY = ext.max1;
|
|
41
47
|
const M = 84; // 余白 px (通り芯記号ぶん)
|
|
42
48
|
const W = (maxX - minX) * scale + M * 2;
|
|
43
49
|
const H = (maxY - minY) * scale + M * 2;
|
|
@@ -46,9 +52,7 @@ export function svgPlan(model, opts = {}) {
|
|
|
46
52
|
const path2d = (poly) => poly.map((p, i) => `${i === 0 ? "M" : "L"} ${sx(p.x)} ${sy(p.y)}`).join(" ") + " Z";
|
|
47
53
|
const line = (g, stroke, w, dash = "") => `<line x1="${sx(g.x1)}" y1="${sy(g.y1)}" x2="${sx(g.x2)}" y2="${sy(g.y2)}" stroke="${stroke}" stroke-width="${w}"${dash ? ` stroke-dasharray="${dash}"` : ""}/>`;
|
|
48
54
|
const fill = (poly, c) => `<path d="${path2d(poly)}" fill="${c}"/>`;
|
|
49
|
-
const parts =
|
|
50
|
-
parts.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" font-family="'Hiragino Sans','Noto Sans JP',sans-serif">`);
|
|
51
|
-
parts.push(`<rect width="${W}" height="${H}" fill="${PAPER}"/>`);
|
|
55
|
+
const parts = openSheet(W, H);
|
|
52
56
|
// 敷地境界線 (一点二点鎖線 — 作図慣習)。所与の形をそのまま引く
|
|
53
57
|
for (const poly of sitePolys) {
|
|
54
58
|
parts.push(`<path d="${path2d(poly.points)}" fill="none" stroke="#8a8171" stroke-width="1.1" stroke-dasharray="14 3 2.5 3 2.5 3"/>`);
|
|
@@ -90,119 +94,103 @@ export function svgPlan(model, opts = {}) {
|
|
|
90
94
|
continue;
|
|
91
95
|
parts.push(`<line x1="${M - 26}" y1="${sy(y)}" x2="${W - M + 26}" y2="${sy(y)}" stroke="${GRID}" stroke-width="0.8" stroke-dasharray="7 3 1.5 3"/>`, `<circle cx="${M - 40}" cy="${sy(y)}" r="11" fill="none" stroke="${GRID}" stroke-width="1"/>`, `<text x="${M - 40}" y="${sy(y) + 3.5}" text-anchor="middle" font-size="10" fill="${GRID}">${model.grid.Y.names[i]}</text>`);
|
|
92
96
|
}
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
// 印 — 形の写しは `planMarks` にある。**この頁が足すのは色・線幅・線種・記号・注記の言葉だけ**
|
|
98
|
+
// である。ugatsu も architype も同じ印から別の見た目を引く。
|
|
99
|
+
const marks = planMarks(form, level);
|
|
100
|
+
const written = writtenOf(model);
|
|
101
|
+
const segByRef = new Map(form.segs.map((g) => [g.ref, g]));
|
|
102
|
+
for (const k of marks) {
|
|
103
|
+
switch (k.role) {
|
|
104
|
+
// 空間の面と分節の帯は下 (`rooms` / `form.segs`) から引く — 切られた面ではなく外形を塗り、
|
|
105
|
+
// 分節には Form しか持たない座と向きが要るため。上部吹抜けは空間ラベルより後ろに置く
|
|
106
|
+
case "space":
|
|
107
|
+
case "space-semi-outdoor":
|
|
108
|
+
case "space-void":
|
|
109
|
+
case "void-hatch":
|
|
110
|
+
case "void-above":
|
|
111
|
+
break;
|
|
112
|
+
// 数えない分節 (seg): 壁材が途中から変わる区間 — 色調を変えて示す。
|
|
113
|
+
// ここから引くのは注記の言葉 (`spec`) だけで、それは形ではないので Form には載らない。
|
|
114
|
+
// **`written.boundary` は正準順の添字である** — 宣言順の配列を引くと、並べ替えただけで
|
|
115
|
+
// 注記が別の境界のものになる
|
|
116
|
+
case "seg": {
|
|
117
|
+
parts.push(fill(k.polygon, "#77716a"));
|
|
118
|
+
const spec = written.segSpec(k.written.boundary, k.written.index);
|
|
119
|
+
const g = segByRef.get(k.ref);
|
|
120
|
+
if (typeof spec === "string" && g) {
|
|
121
|
+
const h = g.segment.horizontal;
|
|
122
|
+
parts.push(`<text x="${sx(g.cx) + (h ? 0 : 8)}" y="${sy(g.cy) + (h ? -7 : 3)}" text-anchor="${h ? "middle" : "start"}" font-size="8" fill="#77716a">${esc(spec)}</text>`);
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
101
126
|
// 物を持たない境界 (open): 構成の線として破線で示す (基本計画の抽象度)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (e.class === "above")
|
|
107
|
-
continue; // 垂れ壁は切断面より上 — 平面には出ない
|
|
108
|
-
if (b?.air) {
|
|
127
|
+
case "open":
|
|
128
|
+
for (const g of k.lines ?? [])
|
|
129
|
+
parts.push(line(g, FAINT, 1, "6 4"));
|
|
130
|
+
break;
|
|
109
131
|
// 遮蔽しない物 (手すり・柵): 細実線 — 「囲われていない」ことが図から読めるように。
|
|
110
|
-
// 切断面より上でも下でも一本の線で描く (厚みを持たない作図表現)。
|
|
111
132
|
// **芯線は Form が持つ** — 足あとの四辺形から復元しない
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const h = g.segment.horizontal;
|
|
134
|
-
parts.push(`<text x="${sx(g.cx) + (h ? 0 : 8)}" y="${sy(g.cy) + (h ? -7 : 3)}" text-anchor="${h ? "middle" : "start"}" font-size="8" fill="#77716a">${esc(spec)}</text>`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// 開口 — 窓は芯線一本、扉は葉と軌跡 (1/4円の破線)
|
|
138
|
-
const openings = new Map(form.openings.map((o) => [o.ref, o]));
|
|
139
|
-
for (const e of plan.entities) {
|
|
140
|
-
if (e.of !== "opening")
|
|
141
|
-
continue;
|
|
142
|
-
const o = openings.get(e.ref);
|
|
143
|
-
if (!o)
|
|
144
|
-
continue;
|
|
145
|
-
if (e.class === "swing") {
|
|
146
|
-
if (o.sliding) {
|
|
147
|
-
// 引戸・自動ドア: 開き軌跡ではなく吊元側の控え (戸袋側) にパネルを描く
|
|
148
|
-
const off = 110; // 壁面からの控え mm (作図表現)
|
|
149
|
-
const sw = o.swing;
|
|
150
|
-
const ux = (sw.leaf.x - sw.hinge.x) / o.w;
|
|
151
|
-
const uy = (sw.leaf.y - sw.hinge.y) / o.w;
|
|
152
|
-
const ax = (sw.jamb.x - sw.hinge.x) / o.w;
|
|
153
|
-
const ay = (sw.jamb.y - sw.hinge.y) / o.w;
|
|
154
|
-
const s1 = { x: sw.hinge.x - ax * o.w + ux * off, y: sw.hinge.y - ay * o.w + uy * off };
|
|
155
|
-
const s2 = { x: sw.hinge.x + ux * off, y: sw.hinge.y + uy * off };
|
|
156
|
-
parts.push(line({ x1: s1.x, y1: s1.y, x2: s2.x, y2: s2.y }, INK, 2), line({ x1: s2.x, y1: s2.y, x2: sw.hinge.x, y2: sw.hinge.y }, INK, 0.7));
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
if (e.lines)
|
|
160
|
-
for (const g of e.lines)
|
|
133
|
+
case "rail":
|
|
134
|
+
for (const g of k.lines ?? [])
|
|
135
|
+
parts.push(line(g, INK, 1.4));
|
|
136
|
+
break;
|
|
137
|
+
// 切断面が切った区間と柱を黒帯にする。腰壁は開口の下なので印にならない —
|
|
138
|
+
// **これが「欠き取り」の代わりである**。紙の色で塗り潰す操作はもう無い
|
|
139
|
+
case "wall":
|
|
140
|
+
case "column":
|
|
141
|
+
parts.push(fill(k.polygon, INK));
|
|
142
|
+
break;
|
|
143
|
+
// 引戸・自動ドア: 開き軌跡ではなく吊元側の控え (戸袋側) にパネルを描く
|
|
144
|
+
case "slide-panel":
|
|
145
|
+
for (const g of k.lines ?? [])
|
|
146
|
+
parts.push(line(g, INK, 2));
|
|
147
|
+
break;
|
|
148
|
+
case "slide-tail":
|
|
149
|
+
for (const g of k.lines ?? [])
|
|
150
|
+
parts.push(line(g, INK, 0.7));
|
|
151
|
+
break;
|
|
152
|
+
case "door-leaf":
|
|
153
|
+
for (const g of k.lines ?? [])
|
|
161
154
|
parts.push(line(g, INK, 1.4));
|
|
162
|
-
|
|
163
|
-
|
|
155
|
+
break;
|
|
156
|
+
case "door-arc": {
|
|
157
|
+
const a = k.arc;
|
|
158
|
+
const r = a.r * scale;
|
|
164
159
|
// 掃引方向: 世界の反時計回りは、y を反転した紙の上では時計回りになる
|
|
165
|
-
const sweep =
|
|
166
|
-
parts.push(`<path d="M ${sx(
|
|
160
|
+
const sweep = a.ccw ? 0 : 1;
|
|
161
|
+
parts.push(`<path d="M ${sx(a.from.x)} ${sy(a.from.y)} A ${r} ${r} 0 0 ${sweep} ${sx(a.to.x)} ${sy(a.to.y)}" fill="none" stroke="${INK}" stroke-width="0.7" stroke-dasharray="3 2.5"/>`);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
case "window":
|
|
165
|
+
for (const g of k.lines ?? [])
|
|
166
|
+
parts.push(line(g, INK, 1));
|
|
167
|
+
break;
|
|
168
|
+
case "run-outline":
|
|
169
|
+
for (const g of k.lines ?? [])
|
|
170
|
+
parts.push(line(g, INK, 1.1));
|
|
171
|
+
break;
|
|
172
|
+
case "run-tread":
|
|
173
|
+
for (const g of k.lines ?? [])
|
|
174
|
+
parts.push(line(g, INK, 0.7));
|
|
175
|
+
break;
|
|
176
|
+
case "run-break":
|
|
177
|
+
for (const g of k.lines ?? [])
|
|
178
|
+
parts.push(...breakMark(g, line));
|
|
179
|
+
break;
|
|
180
|
+
case "run-arrow":
|
|
181
|
+
parts.push(...arrow(k, line, sx, sy));
|
|
182
|
+
break;
|
|
183
|
+
// 注記の言葉と丸めはここで初めて生まれる — 印が運ぶのは丸めない事実だけである
|
|
184
|
+
case "run-note": {
|
|
185
|
+
const n = k.note;
|
|
186
|
+
if (!n || n.of === "direction")
|
|
187
|
+
break; // 座の注記は向きではない
|
|
188
|
+
const text = n.of === "stair"
|
|
189
|
+
? `${n.risers}段 蹴上${Math.round(n.riser)}/踏面${Math.round(n.tread)}`
|
|
190
|
+
: `${n.lanes > 1 ? `${n.lanes}台 ` : ""}勾配 ${slopeText(n.slope)}`;
|
|
191
|
+
parts.push(`<text x="${sx(k.at.x)}" y="${sy(k.at.y) + 42}" text-anchor="middle" font-size="8" fill="#8a8171">${esc(text)}</text>`);
|
|
192
|
+
break;
|
|
167
193
|
}
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
if (o.kind !== "door" && e.lines) {
|
|
171
|
-
// 窓: 芯線一本
|
|
172
|
-
for (const g of e.lines)
|
|
173
|
-
parts.push(line(g, INK, 1));
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
// 柱 (ADR-0023) — 位置はどこにも書かれていない。通り芯の交点と床の交わりから現れる
|
|
177
|
-
for (const e of plan.entities) {
|
|
178
|
-
if (e.of === "column" && e.polygon)
|
|
179
|
-
parts.push(fill(e.polygon, INK));
|
|
180
|
-
}
|
|
181
|
-
// 縦動線 (ADR-0021) — そのレベルで切った姿。上る走りは切断線で切れ、
|
|
182
|
-
// その先には下りる走り (下階の走りを上から見たもの) が現れる
|
|
183
|
-
const runs = new Map(form.runs.map((r) => [r.path, r]));
|
|
184
|
-
for (const e of plan.entities) {
|
|
185
|
-
if (e.of !== "run")
|
|
186
|
-
continue;
|
|
187
|
-
if (e.role === "outline")
|
|
188
|
-
for (const g of e.lines ?? [])
|
|
189
|
-
parts.push(line(g, INK, 1.1));
|
|
190
|
-
else if (e.role === "tread")
|
|
191
|
-
for (const g of e.lines ?? [])
|
|
192
|
-
parts.push(line(g, INK, 0.7));
|
|
193
|
-
else if (e.role === "break")
|
|
194
|
-
for (const g of e.lines ?? [])
|
|
195
|
-
parts.push(...breakMark(g, line));
|
|
196
|
-
else if (e.role === "arrow")
|
|
197
|
-
parts.push(...arrow(e, line, sx, sy));
|
|
198
|
-
else if (e.class === "anchor" && e.anchor) {
|
|
199
|
-
const r = runs.get(e.ref);
|
|
200
|
-
if (!r)
|
|
201
|
-
continue;
|
|
202
|
-
const text = r.device === "stair"
|
|
203
|
-
? `${r.risers}段 蹴上${Math.round(r.riser)}/踏面${Math.round(r.tread)}`
|
|
204
|
-
: `${r.lanes > 1 ? `${r.lanes}台 ` : ""}勾配 ${slopeText(r.slope)}`;
|
|
205
|
-
parts.push(`<text x="${sx(e.anchor.x)}" y="${sy(e.anchor.y) + 42}" text-anchor="middle" font-size="8" fill="#8a8171">${esc(text)}</text>`);
|
|
206
194
|
}
|
|
207
195
|
}
|
|
208
196
|
// 空間ラベル (最大の凸片の中心に置く)
|
|
@@ -217,12 +205,11 @@ export function svgPlan(model, opts = {}) {
|
|
|
217
205
|
: `${s.type ? `${esc(s.type)} · ` : ""}${s.areaM2} m2${s.semiOutdoor ? " · semi-outdoor" : ""}`;
|
|
218
206
|
parts.push(`<text x="${cx}" y="${cy - 4}" text-anchor="middle" font-size="14" fill="${INK}">${esc(displayName(space))}</text>`, `<text x="${cx}" y="${cy + 13}" text-anchor="middle" font-size="10" fill="#8a8171">${sub}</text>`, `<text x="${cx}" y="${cy + 27}" text-anchor="middle" font-size="8.5" fill="${FAINT}">${esc(s.path)}</text>`);
|
|
219
207
|
}
|
|
220
|
-
// 切断面より上のものの投影 (上部吹抜け — 作図慣習)
|
|
221
|
-
for (const
|
|
222
|
-
if (
|
|
208
|
+
// 切断面より上のものの投影 (上部吹抜け — 作図慣習)。空間ラベルの後に置く
|
|
209
|
+
for (const k of marks) {
|
|
210
|
+
if (k.role !== "void-above")
|
|
223
211
|
continue;
|
|
224
|
-
|
|
225
|
-
parts.push(`<path d="${path2d(e.polygon)}" fill="none" stroke="${FAINT}" stroke-width="0.8" stroke-dasharray="6 4"/>`, `<text x="${sx((r.x1 + r.x2) / 2)}" y="${sy((r.y1 + r.y2) / 2) + 40}" text-anchor="middle" font-size="9" fill="${FAINT}">void above</text>`);
|
|
212
|
+
parts.push(`<path d="${path2d(k.polygon)}" fill="none" stroke="${FAINT}" stroke-width="0.8" stroke-dasharray="6 4"/>`, `<text x="${sx(k.at.x)}" y="${sy(k.at.y) + 40}" text-anchor="middle" font-size="9" fill="${FAINT}">void above</text>`);
|
|
226
213
|
}
|
|
227
214
|
// 北矢印 (ADR-0057) — azimuth が書かれているときだけ描く。**表現であって形ではない**ので
|
|
228
215
|
// Form には無く、紙の座標に直接置く。これがある理由は装飾ではない — 方位の 180度違い・
|
|
@@ -250,7 +237,7 @@ export function svgPlan(model, opts = {}) {
|
|
|
250
237
|
}
|
|
251
238
|
// 表題
|
|
252
239
|
const title = `${model.name ?? "Untitled"} — ${level} plan`;
|
|
253
|
-
parts.push(`<text x="${M - 62}" y="${H - 18}" font-size="12" fill="${INK}">${esc(title)}</text
|
|
240
|
+
parts.push(`<text x="${M - 62}" y="${H - 18}" font-size="12" fill="${INK}">${esc(title)}</text>`);
|
|
254
241
|
parts.push("</svg>");
|
|
255
242
|
return parts.join("\n") + "\n";
|
|
256
243
|
}
|
|
@@ -276,8 +263,8 @@ function breakMark(g, line) {
|
|
|
276
263
|
return [line(at(-s - off, s - off), INK, 1.4), line(at(-s + off, s + off), INK, 1.4)];
|
|
277
264
|
}
|
|
278
265
|
/** 矢印 — 三角の頭と "UP"/"DN" の言葉は、どちらも見た目である */
|
|
279
|
-
function arrow(
|
|
280
|
-
const g =
|
|
266
|
+
function arrow(k, line, sx, sy) {
|
|
267
|
+
const g = k.lines?.[0];
|
|
281
268
|
if (!g)
|
|
282
269
|
return [];
|
|
283
270
|
const dx = g.x2 - g.x1;
|
|
@@ -290,7 +277,7 @@ function arrow(e, line, sx, sy) {
|
|
|
290
277
|
return [
|
|
291
278
|
line(g, INK, 1),
|
|
292
279
|
`<path d="M ${sx(g.x2)} ${sy(g.y2)} L ${sx(g.x2 - hx + px)} ${sy(g.y2 - hy + py)} L ${sx(g.x2 - hx - px)} ${sy(g.y2 - hy - py)} Z" fill="${INK}"/>`,
|
|
293
|
-
`<text x="${sx(g.x1) + 4}" y="${sy(g.y1) + 4}" font-size="9" fill="${INK}">${
|
|
280
|
+
`<text x="${sx(g.x1) + 4}" y="${sy(g.y1) + 4}" font-size="9" fill="${INK}">${k.note?.of === "direction" && k.note.up ? "UP" : "DN"}</text>`,
|
|
294
281
|
];
|
|
295
282
|
}
|
|
296
283
|
function polyArea(poly) {
|
|
@@ -302,7 +289,4 @@ function polyArea(poly) {
|
|
|
302
289
|
}
|
|
303
290
|
return Math.abs(s / 2);
|
|
304
291
|
}
|
|
305
|
-
function esc(s) {
|
|
306
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
307
|
-
}
|
|
308
292
|
//# sourceMappingURL=plan.js.map
|