diff --git a/B04_PreProcess/B04_PreProcess_UI_MapRender.ts b/B04_PreProcess/B04_PreProcess_UI_MapRender.ts index 00aa2b95..7921d46e 100644 --- a/B04_PreProcess/B04_PreProcess_UI_MapRender.ts +++ b/B04_PreProcess/B04_PreProcess_UI_MapRender.ts @@ -438,6 +438,33 @@ function isVisible(feature: PreparedFeature, affine: Affine, view: ViewState): b ); } +/** 레이어가 차지하는 **화면 사각형**(px). 피처가 없으면 null. + * + * LAS 등고선처럼 도엽보다 좁은 자료 위에 다른 레이어를 겹칠 때, 그 자료가 있는 데까지만 + * 그리려고 쓴다(계획서 0-9 ⑮ — 세류선이 등고선 밖까지 뻗던 자리). */ +export function layerScreenBounds( + layer: PreparedLayer, + view: ViewState, +): { x: number; y: number; width: number; height: number } | null { + if (layer.features.length === 0) return null; + const affine = affineOf(view); + let minX = Infinity; + let minY = Infinity; + let maxX = -Infinity; + let maxY = -Infinity; + for (const feature of layer.features) { + minX = Math.min(minX, feature.minX); + minY = Math.min(minY, feature.minY); + maxX = Math.max(maxX, feature.maxX); + maxY = Math.max(maxY, feature.maxY); + } + const x0 = minX * affine.ax + affine.bx; + const x1 = maxX * affine.ax + affine.bx; + const y0 = minY * affine.ay + affine.by; + const y1 = maxY * affine.ay + affine.by; + return { x: x0, y: y0, width: x1 - x0, height: y1 - y0 }; +} + /** 등고선을 몇 m 마다 낼지 고를 때 훑는 배수. 성긴 쪽으로 한 칸씩 물러난다. */ const LEVEL_STEP_MULTIPLES = [1, 2, 5, 10, 20, 50, 100]; /** 한 화면에 둘 등고선 가닥 수의 어림 상한 — 이보다 많으면 한 칸 성글게 간다. */ diff --git a/B05_Profile/B05_Profile_UI_RouteEdit.ts b/B05_Profile/B05_Profile_UI_RouteEdit.ts index 99c76a89..dd517a27 100644 --- a/B05_Profile/B05_Profile_UI_RouteEdit.ts +++ b/B05_Profile/B05_Profile_UI_RouteEdit.ts @@ -45,6 +45,7 @@ import { stationAtScreen, } from "./B05_Profile_UI_RouteEdit_Input"; import { createCrossPreview } from "./B05_Profile_UI_RouteEdit_Cross"; +import { createMapRotation } from "./B05_Profile_UI_RouteEdit_Rotate"; import { createMeasureTool } from "./B05_Profile_UI_RouteEdit_Measure"; import { createCurveBar } from "./B05_Profile_UI_RouteEdit_CurveBar"; import { @@ -98,30 +99,40 @@ export async function openRouteEditModal(