- OpenLayers(ol) 패키지 제거 (미사용, import 0건) - common/ 디렉토리 생성: components, hooks, services, store, types, utils - 17개 공통 파일을 common/으로 이동 (git mv, blame 이력 보존) - MainTab 타입을 App.tsx에서 common/types/navigation.ts로 분리 - tsconfig path alias (@common/*, @tabs/*) + vite resolve.alias 설정 - 42개 import 경로를 @common/ alias 또는 상대경로로 수정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
876 B
TypeScript
Executable File
29 lines
876 B
TypeScript
Executable File
// 십진법(DD)을 도분초(DMS)로 변환
|
|
export function decimalToDMS(decimal: number, isLatitude: boolean): string {
|
|
const absolute = Math.abs(decimal)
|
|
const degrees = Math.floor(absolute)
|
|
const minutesDecimal = (absolute - degrees) * 60
|
|
const minutes = Math.floor(minutesDecimal)
|
|
const seconds = ((minutesDecimal - minutes) * 60).toFixed(2)
|
|
|
|
let direction = ''
|
|
if (isLatitude) {
|
|
direction = decimal >= 0 ? 'N' : 'S'
|
|
} else {
|
|
direction = decimal >= 0 ? 'E' : 'W'
|
|
}
|
|
|
|
return `${degrees}° ${minutes}' ${seconds}" ${direction}`
|
|
}
|
|
|
|
// 도분초를 십진법으로 변환
|
|
export function dmsToDecimal(degrees: number, minutes: number, seconds: number, direction: 'N' | 'S' | 'E' | 'W'): number {
|
|
let decimal = degrees + minutes / 60 + seconds / 3600
|
|
|
|
if (direction === 'S' || direction === 'W') {
|
|
decimal = -decimal
|
|
}
|
|
|
|
return decimal
|
|
}
|