Adding GPX tags extension
This commit is contained in:
parent
a9e2855e3f
commit
2d73315a9a
|
@ -13,6 +13,7 @@ import {
|
|||
createCachedSignal,
|
||||
destroyCachedSignal,
|
||||
} from '../../workers/cached-signals';
|
||||
import { getTagsFromObj } from '../../lib/tags/tags';
|
||||
|
||||
interface Props {
|
||||
gpxId: string;
|
||||
|
@ -72,6 +73,7 @@ export const Gpx: Component<Props> = ({ map, gpxId }) => {
|
|||
vectorSources={vectorSources}
|
||||
trkId={trkId}
|
||||
context={{ gpx, gpxId }}
|
||||
tags={getTagsFromObj(gpx())}
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
import {
|
||||
Component,
|
||||
createEffect,
|
||||
For,
|
||||
onCleanup,
|
||||
Suspense,
|
||||
} from 'solid-js';
|
||||
|
||||
|
||||
import { Component, createEffect, For, onCleanup, Suspense } from 'solid-js';
|
||||
|
||||
import Trkseg from '../trkseg';
|
||||
import VectorSource from 'ol/source/Vector';
|
||||
|
@ -19,8 +11,14 @@ interface Props {
|
|||
trkId: string;
|
||||
vectorSources: VectorSource[];
|
||||
context: any;
|
||||
tags: any;
|
||||
}
|
||||
export const Trk: Component<Props> = ({ vectorSources, trkId, context }) => {
|
||||
export const Trk: Component<Props> = ({
|
||||
vectorSources,
|
||||
trkId,
|
||||
context,
|
||||
tags,
|
||||
}) => {
|
||||
const params = {
|
||||
id: trkId,
|
||||
method: 'getTrk',
|
||||
|
@ -47,6 +45,7 @@ export const Trk: Component<Props> = ({ vectorSources, trkId, context }) => {
|
|||
vectorSources={vectorSources}
|
||||
trksegId={trksegId}
|
||||
context={{ ...context, trk, trkId }}
|
||||
tags={tags}
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
|
|
|
@ -13,12 +13,14 @@ interface Props {
|
|||
trksegId: string;
|
||||
vectorSources: VectorSource[];
|
||||
context: any;
|
||||
tags: any;
|
||||
}
|
||||
|
||||
export const Trkseg: Component<Props> = ({
|
||||
vectorSources,
|
||||
trksegId,
|
||||
context,
|
||||
tags,
|
||||
}) => {
|
||||
const params = {
|
||||
id: trksegId,
|
||||
|
@ -99,6 +101,7 @@ export const Trkseg: Component<Props> = ({
|
|||
id: trksegId,
|
||||
context: { ...context, trkseg, trksegId },
|
||||
positions: positions(),
|
||||
tags,
|
||||
},
|
||||
id: `${trksegId}/start`,
|
||||
},
|
||||
|
|
|
@ -55,6 +55,7 @@ interface Extensions {
|
|||
endTime?: string;
|
||||
category?: Category;
|
||||
subCategory?: SubCategory;
|
||||
tags?: any;
|
||||
}
|
||||
|
||||
interface Trk {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
export const getTagsFromObj = (obj: any) => {
|
||||
if (!obj) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!obj.extensions) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!obj.extensions.tags) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return obj.extensions.tags;
|
||||
};
|
Loading…
Reference in New Issue