import { Circle, Fill, Icon, Stroke, Style } from 'ol/style'; import startIcon from '../../icons/flag-start-b-svgrepo-com-green.svg'; import finishIcon from '../../icons/flag-finish-b-o-svgrepo-com-red.svg'; import wptIcon from '../../icons/location-pin-svgrepo-com.svg'; import { Feature } from 'ol'; const trackStrokeStyle = new Stroke({ color: 'blue', width: 2, }); const trtksegStartImageStyle = new Icon({ src: startIcon, scale: 0.2, opacity: 0.6, anchor: [0.5, 1], }); const trtksegFinishImageStyle = new Icon({ src: finishIcon, scale: 0.2, opacity: 0.6, anchor: [0.5, 1], }); const wptImageStyle = new Icon({ src: wptIcon, scale: 0.1, opacity: 0.8, anchor: [0.5, 1], }); const trtksegStyle = new Style({ stroke: trackStrokeStyle }); const trtksegStartStyle = new Style({ image: trtksegStartImageStyle }); const trtksegFinishStyle = new Style({ image: trtksegFinishImageStyle }); const wptStyle = new Style({ image: wptImageStyle }); export const style = (feature: Feature, resolution: number) => { const type = feature.get('type'); if (type === 'trkseg') { return trtksegStyle; } if (type === 'trkseg-start') { return trtksegStartStyle; } if (type === 'trkseg-finish') { return trtksegFinishStyle; } if (type === 'wpt') { return wptStyle; } }; export default style;