in src/layers/trip-layer/trip-layer.js [178:220]
formatLayerData(datasets, oldLayerData) {
// to-do: parse segment from allData
const {
colorScale,
colorField,
colorDomain,
color,
sizeScale,
sizeDomain,
sizeField,
visConfig
} = this.config;
const {colorRange, sizeRange} = visConfig;
const {allData, gpuFilter} = datasets[this.config.dataId];
const {data} = this.updateData(datasets, oldLayerData);
// color
const cScale =
colorField &&
this.getVisChannelScale(colorScale, colorDomain, colorRange.colors.map(hexToRgb));
// calculate stroke scale - if stroked = true
const sScale = sizeField && this.getVisChannelScale(sizeScale, sizeDomain, sizeRange);
// access feature properties from geojson sub layer
const getDataForGpuFilter = f => allData[f.properties.index];
const getIndexForGpuFilter = f => f.properties.index;
return {
data,
getFilterValue: gpuFilter.filterValueAccessor(getIndexForGpuFilter, getDataForGpuFilter),
getPath: d => d.geometry.coordinates,
getTimestamps: d => this.dataToTimeStamp[d.properties.index],
getColor: d =>
cScale
? this.getEncodedChannelValue(cScale, allData[d.properties.index], colorField)
: d.properties.fillColor || color,
getWidth: d =>
sScale
? this.getEncodedChannelValue(sScale, allData[d.properties.index], sizeField, 0)
: d.properties.lineWidth || defaultWidth
};
}