48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
/* 509-1 노선 편집 — 잘라 받은 도엽이 지금 노선 띠를 덮나(`sheetCoversBand`) 헬퍼.
|
|
* 무거운 import(보관함 · 그리기 · 배수유역 칸)는 빈 값으로 갈음 — 이 함수는 안 씀.
|
|
*/
|
|
const path = require("path");
|
|
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const STUBS = {
|
|
b_asset_cache: {},
|
|
B04_PreProcess_UI_MapRender: {},
|
|
B04_PreProcess_UI_MapRender_Prepare: {},
|
|
B05_Profile_UI_Drainage_Parts: {},
|
|
B05_Profile_UI_RouteEdit_Render: { CONTOUR_BAND_M: 300 },
|
|
};
|
|
const { load } = makeLoader({ root: ROOT, stubs: STUBS });
|
|
const { sheetCoversBand } = load("B05_Profile", "B05_Profile_UI_RouteEdit_Contour.ts");
|
|
|
|
// 서버 시험과 같은 메타 — 1 m = 0.00001 도.
|
|
const META = {
|
|
x_min: 0,
|
|
y_min: 0,
|
|
width_meters: 10000,
|
|
height_meters: 10000,
|
|
lon_min: 127,
|
|
lon_max: 127.1,
|
|
lat_min: 37,
|
|
lat_max: 37.1,
|
|
};
|
|
// 노선 (5000,5000)~(5500,5200) + 600 m → 4400 ~ 6100 · 4400 ~ 5800.
|
|
const CLIP = { clip_lonlat: [127.044, 37.044, 127.061, 37.058] };
|
|
const line = [
|
|
[5000, 5000],
|
|
[5500, 5200],
|
|
];
|
|
const shifted = (dx, dy) => line.map(([x, y]) => [x + dx, y + dy]);
|
|
|
|
console.log(
|
|
JSON.stringify({
|
|
saved: sheetCoversBand(CLIP, META, line, 300),
|
|
within: sheetCoversBand(CLIP, META, shifted(250, -250), 300),
|
|
beyondEast: sheetCoversBand(CLIP, META, shifted(400, 0), 300),
|
|
beyondSouth: sheetCoversBand(CLIP, META, shifted(0, -400), 300),
|
|
noClip: sheetCoversBand({ features: [] }, META, shifted(5000, 0), 300),
|
|
noSheet: sheetCoversBand(null, META, line, 300),
|
|
noLine: sheetCoversBand(CLIP, META, [], 300),
|
|
}),
|
|
);
|