- pipeStationMarks · pipe_station_label 물넘이포장 예외 걷음 · 라벨 「물넘이포장」 - B05 withoutFordPavement · B06 pipeStations · 초안 라벨 거름 걷음 · 알약 = 그 측점선 짝 - 시험 test_286_1 새로 · 272_1 · 284_1 · 옛 물넘이 측점 시험 기대값 새 규칙으로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
108 lines
4.0 KiB
JavaScript
108 lines
4.0 KiB
JavaScript
/* 284 알약 고름 헬퍼 — 진짜 `B05_Profile_UI_Profile_Structures.ts`(plantsStation · stationIdAtStructure ·
|
|
* structureIdKeeping)를 Node 로 돌려 표준출력 JSON 한 벌로(요구 178 · 179-1).
|
|
* 등록부 꼴 = 구조물정의.json 의 group · placement · managed_by 그대로.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
|
|
function loadTs(file, stubs = {}) {
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
const localRequire = (request) => {
|
|
if (stubs[request]) return stubs[request];
|
|
throw new Error(`stub 없음: ${request}`);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
const selection = loadTs(path.join(ROOT, "A00_Common", "design", "design_selection.ts"), {
|
|
"../b_page_state": { readState: () => null, writeState() {} },
|
|
});
|
|
const PREFIX = "irregular:";
|
|
const rule = loadTs(path.join(ROOT, "B05_Profile", "B05_Profile_UI_Profile_Structures.ts"), {
|
|
"@ui/ui_template_context_menu": { createMapContextMenu() {} },
|
|
"./B05_Profile_UI_IrregularStations": {
|
|
irregularStationId: (id) => `${PREFIX}${id}`,
|
|
isPipeStation: (station) => station.origin === "pipe",
|
|
},
|
|
"./B05_Profile_Api_Structures": {
|
|
structureAnchorM: (s) => s.chainage_m ?? s.start_m ?? 0,
|
|
},
|
|
"../A00_Common/design/design_selection": selection,
|
|
"../common_util/common_util_structure_station": loadTs(
|
|
path.join(ROOT, "common_util", "common_util_structure_station.ts"),
|
|
),
|
|
});
|
|
|
|
const TYPES = [
|
|
{ type_id: "cross_underdrain", group: "A", placement: "point", managed_by: null },
|
|
{ type_id: "retaining_wall", group: "C", placement: "interval", managed_by: null },
|
|
{ type_id: "ditch_side", group: "B", placement: "interval", managed_by: null },
|
|
{ type_id: "hazard_sign", group: "E", placement: "point", managed_by: null },
|
|
{ type_id: "bed_sill", group: "D", placement: "point", managed_by: null },
|
|
];
|
|
const S = (id, type, at, extra = {}) => ({
|
|
structure_id: id,
|
|
type_id: type,
|
|
chainage_m: at,
|
|
...extra,
|
|
});
|
|
const STRUCTURES = [
|
|
S("drain", "cross_underdrain", 40),
|
|
S("wall", "retaining_wall", 100, { start_m: 90, end_m: 110 }),
|
|
S("ditch", "ditch_side", 80, { start_m: 60, end_m: 100 }),
|
|
S("sign", "hazard_sign", 80), // 관 측점(80)과 같은 m — 측점 없는 구조물
|
|
S("sill", "bed_sill", 140),
|
|
S("unknown", "legacy_x", 160),
|
|
S("pipe-80.00", "pipe", 80),
|
|
S("pipe-120.00", "ford_pavement", 120),
|
|
];
|
|
// 종단도 구조물 측점(관 투영 + 심은 구조물) — 물넘이포장도 측점 심음(286-1)
|
|
const STATIONS = [
|
|
{ id: "drain", chainage_m: 40, origin: "structure" },
|
|
{ id: "pipe-80.00", chainage_m: 80, origin: "pipe" },
|
|
{ id: "wall", chainage_m: 100, origin: "structure" },
|
|
{ id: "pipe-120.00", chainage_m: 120, origin: "pipe" },
|
|
];
|
|
const byId = (id) => STRUCTURES.find((s) => s.structure_id === id);
|
|
|
|
const plants = Object.fromEntries(
|
|
STRUCTURES.map((s) => [s.structure_id, rule.plantsStation(s, TYPES)]),
|
|
);
|
|
const line = Object.fromEntries(
|
|
STRUCTURES.map((s) => [
|
|
s.structure_id,
|
|
rule.stationIdAtStructure(s.structure_id, STATIONS, STRUCTURES, TYPES),
|
|
]),
|
|
);
|
|
// 종류 없이 부르면(옛 부름) 구조물은 옛 길 — 같은 자리 측점선
|
|
const lineNoTypes = rule.stationIdAtStructure("sign", STATIONS, STRUCTURES);
|
|
// 관 측점선(80)을 다시 누름 — 고른 것이 측점 없는 표지면 관 알약으로(표지는 선 짝 아님)
|
|
const keepSign = rule.structureIdKeeping(
|
|
`${PREFIX}pipe-80.00`,
|
|
"sign",
|
|
STATIONS,
|
|
STRUCTURES,
|
|
null,
|
|
TYPES,
|
|
);
|
|
// 고른 것이 관이면 그대로
|
|
const keepPipe = rule.structureIdKeeping(
|
|
`${PREFIX}pipe-80.00`,
|
|
"pipe-80.00",
|
|
STATIONS,
|
|
STRUCTURES,
|
|
null,
|
|
TYPES,
|
|
);
|
|
|
|
process.stdout.write(
|
|
JSON.stringify({ plants, line, lineNoTypes, keepSign, keepPipe, sample: byId("sign") }),
|
|
);
|