mobility-toolbox-js
Version:
Toolbox for JavaScript applications in the domains of mobility and logistics.
41 lines (40 loc) • 1.06 kB
JavaScript
import { Circle, Fill, Stroke, Style } from 'ol/style';
import { getColorForType } from '../../common/utils/realtimeStyleUtils';
const borderStyle = new Style({
image: new Circle({
fill: new Fill({
color: '#000000',
}),
radius: 5,
}),
stroke: new Stroke({
color: '#000000',
width: 6,
}),
zIndex: 2,
});
const fullTrajectorystyle = (feature) => {
const { stroke, type } = feature.getProperties();
let lineColor = stroke || getColorForType(type) || '#000';
if (lineColor && !lineColor.startsWith('#')) {
lineColor = `#${lineColor}`;
}
const style = [
borderStyle,
new Style({
image: new Circle({
fill: new Fill({
color: lineColor,
}),
radius: 4,
}),
stroke: new Stroke({
color: lineColor,
width: 4,
}),
zIndex: 3,
}),
];
return style;
};
export default fullTrajectorystyle;