refactor(server): move the routing heap and the metre helpers out of the paddle domain

The binary heap and the flat-frame distance helpers are not about water;
the piste router needs the same two. They move to src/lib/geo, where any
domain may import them without reaching into paddle-routing. Nothing
changes in what they do.
This commit is contained in:
Maurice
2026-10-20 19:00:25 +02:00
parent d924dcf99d
commit beea4c762b
7 changed files with 8 additions and 8 deletions
@@ -1,4 +1,4 @@
/** Metres per degree of latitude, the figure the paddle code reckons with throughout. */
/** Metres per degree of latitude, the figure the routing code reckons with throughout. */
const M_PER_DEG = 111_195;
export function metresBetween(aLat: number, aLng: number, bLat: number, bLng: number): number {
@@ -1,4 +1,4 @@
import { lineLength, metresBetween, projectOnSegment } from '../engine/geo';
import { lineLength, metresBetween, projectOnSegment } from '../../../lib/geo/geo';
import { Access, EdgeKind, type EdgeKindCode, PortageSource } from '../water-graph';
/** A node while the network is built: where it is, and the lake it opens into (-1 for none). */
@@ -1,4 +1,4 @@
import { LocalFrame } from '../engine/geo';
import { LocalFrame } from '../../../lib/geo/geo';
import type { LakeGrid } from '../water-graph';
import { type BuildEdge, type BuildState, PointGrid } from './build-state';
import type { CollectedArea, CollectedWater } from './collect';
@@ -1,4 +1,4 @@
import { projectOnSegment } from '../engine/geo';
import { projectOnSegment } from '../../../lib/geo/geo';
import { Access, EdgeKind, PortageSource } from '../water-graph';
import { type BarrierSite, type BuildEdge, type BuildState, PointGrid } from './build-state';
import type { CollectedWater } from './collect';
@@ -1,7 +1,7 @@
import { LocalFrame } from '../../../lib/geo/geo';
import { MinHeap } from '../../../lib/geo/min-heap';
import { maskHas } from '../build/lakes';
import type { LakeGrid } from '../water-graph';
import { LocalFrame } from './geo';
import { MinHeap } from './min-heap';
import type { PaddleLakeStyle } from '@trek/shared';
/**
@@ -1,8 +1,8 @@
import { metresBetween, projectOnSegment } from '../../../lib/geo/geo';
import { MinHeap } from '../../../lib/geo/min-heap';
import { LakeIndex } from '../build/lakes';
import { Access, EdgeKind, PortageSource, type WaterGraphData } from '../water-graph';
import { metresBetween, projectOnSegment } from './geo';
import { LakeField, type LakeProfile } from './lake-field';
import { MinHeap } from './min-heap';
import type {
PaddleBoatType,
PaddleLakeStyle,