mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-03 09:12:30 +00:00
create slope segments
This commit is contained in:
@@ -137,12 +137,16 @@
|
||||
let context = contexts.filter((context) => context.datasetIndex === 0);
|
||||
if (context.length === 0) return;
|
||||
let point = context[0].raw;
|
||||
let slope = point.slope.toFixed(1);
|
||||
let slope = {
|
||||
at: point.slope.at.toFixed(1),
|
||||
segment: point.slope.segment.toFixed(1),
|
||||
length: getDistanceWithUnits(point.slope.length)
|
||||
};
|
||||
let surface = point.surface ? point.surface : 'unknown';
|
||||
|
||||
return [
|
||||
` ${$_('quantities.distance')}: ${getDistanceWithUnits(point.x, false)}`,
|
||||
` ${$_('quantities.slope')}: ${slope} %`,
|
||||
` ${$_('quantities.slope')}: ${slope.at} %${elevationFill === 'slope' ? ` (${slope.length} @${slope.segment} %)` : ''}`,
|
||||
` ${$_('quantities.surface')}: ${$_(`toolbar.routing.surface.${surface}`)}`
|
||||
];
|
||||
}
|
||||
@@ -317,7 +321,11 @@
|
||||
return {
|
||||
x: getConvertedDistance(data.local.distance.total[index]),
|
||||
y: point.ele ? getConvertedElevation(point.ele) : 0,
|
||||
slope: data.local.slope[index],
|
||||
slope: {
|
||||
at: data.local.slope.at[index],
|
||||
segment: data.local.slope.segment[index],
|
||||
length: data.local.slope.length[index]
|
||||
},
|
||||
surface: point.getSurface(),
|
||||
coordinates: point.getCoordinates(),
|
||||
index: index
|
||||
@@ -421,7 +429,7 @@
|
||||
];
|
||||
|
||||
function slopeFillCallback(context) {
|
||||
let slope = context.p0.raw.slope;
|
||||
let slope = context.p0.raw.slope.segment;
|
||||
if (slope <= 1 && slope >= -1) return slopeColors[6];
|
||||
else if (slope > 0) {
|
||||
if (slope <= 3) return slopeColors[7];
|
||||
|
@@ -8,11 +8,10 @@
|
||||
import { Filter } from 'lucide-svelte';
|
||||
import { _ } from 'svelte-i18n';
|
||||
import WithUnits from '$lib/components/WithUnits.svelte';
|
||||
import { ramerDouglasPeucker, type SimplifiedTrackPoint } from '$lib/simplify';
|
||||
import { dbUtils, fileObservers } from '$lib/db';
|
||||
import { map } from '$lib/stores';
|
||||
import { onDestroy } from 'svelte';
|
||||
import { TrackPoint } from 'gpx';
|
||||
import { ramerDouglasPeucker, TrackPoint, type SimplifiedTrackPoint } from 'gpx';
|
||||
import { derived } from 'svelte/store';
|
||||
|
||||
let sliderValue = [50];
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { earthRadius, ramerDouglasPeucker } from "$lib/simplify";
|
||||
import type { GPXFile, TrackSegment } from "gpx";
|
||||
import { ramerDouglasPeucker, type GPXFile, type TrackSegment } from "gpx";
|
||||
|
||||
const earthRadius = 6371008.8;
|
||||
|
||||
export function getZoomLevelForDistance(latitude: number, distance?: number): number {
|
||||
if (distance === undefined) {
|
||||
|
Reference in New Issue
Block a user