mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 17:03:15 +00:00
feat(tours): bike tours in the planner, CyclOSM, and the planned cards' last points (BIK-01 to BIK-06, RTE-01, IO-01, LIB-02)
The tour type is a dropdown; a bike tour picks its profile, routes for it, says when a point lies off every way, and shows what it runs on: surfaces, kinds of way and, for a mountain bike, the trail grades, each pointed at on the map. A type's own map (OpenHikingMap for a hike, CyclOSM for a bike tour) is offered while a tour of that type is open, with an admin switch each. From the planned cards: a hike avoids steep climbs, steps or ferries, nothing else; a saved tour can be shared where the platform takes GPX files; and the tours rail adds a tour from one menu: plan new, import GPX, or take one over from another trip.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/** The router's line as it sends it: Google's polyline encoding at the given precision. */
|
||||
export function encodePolyline(points: [number, number][], precision: number): string {
|
||||
const factor = 10 ** precision;
|
||||
let last = [0, 0];
|
||||
return points
|
||||
.map((point) => {
|
||||
const scaled = point.map((value) => Math.round(value * factor));
|
||||
const deltas = scaled.map((value, i) => value - last[i]);
|
||||
last = scaled;
|
||||
return deltas
|
||||
.map((delta) => {
|
||||
let value = delta < 0 ? ~(delta << 1) : delta << 1;
|
||||
let chunk = '';
|
||||
while (value >= 0x20) {
|
||||
chunk += String.fromCharCode((0x20 | (value & 0x1f)) + 63);
|
||||
value >>= 5;
|
||||
}
|
||||
return chunk + String.fromCharCode(value + 63);
|
||||
})
|
||||
.join('');
|
||||
})
|
||||
.join('');
|
||||
}
|
||||
@@ -60,5 +60,7 @@ export const UNRESET_STORES: Record<string, string> = {
|
||||
useTourFerrataCrossingStore: 'set by the tour map stage; the tests that read it reset it in their own beforeEach',
|
||||
useTourPlaceToolStore: 'reset in the tour tests themselves to initialTourPlaceToolState()',
|
||||
useTourPoiStore: 'the places found along a tour; the tests that read it clear it in their own beforeEach',
|
||||
useTourRouteHighlightStore:
|
||||
'the stretches a bike card points at; the tests that read it clear it in their own beforeEach',
|
||||
useTripJournalLinkStore: 'the journal link per trip; the tests that read it reset it in their own beforeEach',
|
||||
};
|
||||
|
||||
@@ -10,6 +10,10 @@ export function hikePlannerDefaults() {
|
||||
tourType: 'hike' as const,
|
||||
setTourType: vi.fn(),
|
||||
isPaddle: false,
|
||||
isBike: false,
|
||||
bikeProfile: 'touring' as const,
|
||||
setBikeProfile: vi.fn(),
|
||||
unreachable: null,
|
||||
paddle: {
|
||||
boatType: null,
|
||||
waterContext: null,
|
||||
|
||||
Reference in New Issue
Block a user