航次统计地图增加按年份筛选显示相应轨迹
This commit is contained in:
parent
9085ad60aa
commit
21949e6057
|
|
@ -241,11 +241,22 @@ export default {
|
|||
// 航次统计
|
||||
gitShipVoyage(params = {}) {
|
||||
shipVoyage(params).then(res => {
|
||||
if (params.start || params.end) {
|
||||
// 按年份筛选数据,先隐藏所有图层,再根据筛选结果显示对应图层
|
||||
const layers = Vue.config.maps['voyageMap_ship'].getStyle().layers;
|
||||
layers.forEach(layer => {
|
||||
// 跳过底图
|
||||
if (layer.id !== '影像地图' && layer.type !== 'raster') {
|
||||
Vue.config.maps['voyageMap_ship'].setLayoutProperty(layer.id, 'visibility', 'none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let i = 0
|
||||
const colors = ColorGenerator.generateDivergingColors(res.array.length)
|
||||
// 添加轨迹图层
|
||||
res.array.forEach(item => {
|
||||
// 加载轨迹图层
|
||||
// 加载轨迹图层(已存在则设置为可见)
|
||||
loadVectorLayer(item.voyage_name, ['line', 'symbol'], [colors[i], '#FFFFFF'], 'visible', 'voyageMap_ship', 'dsds')
|
||||
i++
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue