Adding context properties to OL features.
This commit is contained in:
1 parent
91916fca88
commit
b14db11938
5 files changed
+76
-20
No files matched your search
@@ -7,9 +7,14 @@ import GeoJSON from 'ol/format/GeoJSON';
|
||||
interface Props {
|
||||
trksegId: string;
|
||||
vectorSource: VectorSource;
|
||||
context: any;
|
||||
}
|
||||
|
||||
export const Trkseg: Component<Props> = ({ vectorSource, trksegId }) => {
|
||||
export const Trkseg: Component<Props> = ({
|
||||
vectorSource,
|
||||
trksegId,
|
||||
context,
|
||||
}) => {
|
||||
const [trkseg, setTrkseg] = createSignal<Trkseg>();
|
||||
const [dispatchId, setDispatchId] = createSignal<number>(-1);
|
||||
|
||||
@@ -61,7 +66,11 @@ export const Trkseg: Component<Props> = ({ vectorSource, trksegId }) => {
|
||||
type: 'Point',
|
||||
coordinates: [trkseg().trkpt[0].$.lon, trkseg().trkpt[0].$.lat],
|
||||
},
|
||||
properties: { type: 'trkseg-start', id: trksegId },
|
||||
properties: {
|
||||
type: 'trkseg-start',
|
||||
id: trksegId,
|
||||
context: { ...context, trkseg, trksegId },
|
||||
},
|
||||
id: `${trksegId}/start`,
|
||||
},
|
||||
{
|
||||
@@ -73,7 +82,11 @@ export const Trkseg: Component<Props> = ({ vectorSource, trksegId }) => {
|
||||
trkpt.$.lat,
|
||||
]),
|
||||
},
|
||||
properties: { type: 'trkseg', id: trksegId },
|
||||
properties: {
|
||||
type: 'trkseg',
|
||||
id: trksegId,
|
||||
context: { ...context, trkseg, trksegId },
|
||||
},
|
||||
id: trksegId,
|
||||
},
|
||||
{
|
||||
@@ -85,7 +98,11 @@ export const Trkseg: Component<Props> = ({ vectorSource, trksegId }) => {
|
||||
trkseg().trkpt.at(-1).$.lat,
|
||||
],
|
||||
},
|
||||
properties: { type: 'trkseg-finish', id: trksegId },
|
||||
properties: {
|
||||
type: 'trkseg-finish',
|
||||
id: trksegId,
|
||||
context: { ...context, trkseg, trksegId },
|
||||
},
|
||||
id: `${trksegId}/end`,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user