Commit c6e3881b authored by ninglx's avatar ninglx

wj-smartcity信号评价同比环比图表tooltip浮框添加对应日期及时间 wj-manage-web态势监测部分代码逻辑修改

parent 217b3753
......@@ -335,8 +335,59 @@ export function addOrUpdateWave(map, geo) {
});
}
}
export function convertPointsToGeo(arr){
let features = []
for(let item of arr){
features.push(turf.point([item.longitude,item.latitude],item))
}
return turf.featureCollection(features)
}
export function convertPointsLocationToGeo(arr){
let features = []
for(let item of arr){
features.push(turf.point(item.location.split(','),item))
}
return turf.featureCollection(features)
}
export function convertPointsLngLatToGeo(arr){
let features = []
for(let item of arr){
features.push(turf.point([item.lng,item.lat],item))
}
return turf.featureCollection(features)
}
export function convertPointsWktToGeo(arr){
let features = [];
for (let item of arr) {
if (item.wkt) {
if (item.wkt.split(",").length === 2) {
features.push(
turf.point(
item.wkt.split(",").map((item) => Number(item)),
item
)
);
}
}
}
return turf.featureCollection(features);
}
export function convertToLineWithWkt(json) {
let features = [];
for (let item of json) {
if (item.wkt) {
let lnglats = item.wkt.split(";");
for (let i = 0; i < lnglats.length; i++) {
lnglats[i] = lnglats[i].split(",").map((j) => Number(j));
}
features.push(turf.lineString(lnglats, item));
}
}
return turf.featureCollection(features);
}
// type 4 种颜色 对应 4种告警信息
export function addOrUpdateWarningWave(map, geo, id) {
export function addOrUpdateWarningWave(map, arr, id) {
let geo = convertPointsToGeo(arr)
if (map.getSource(id)) {
map.getSource(id).setData(geo);
} else {
......@@ -374,7 +425,8 @@ export function addOrUpdateWarningWave(map, geo, id) {
}
// 更新zoom值较小时的车辆轨迹point
export function addOrUpdateVehicle(map, geo) {
export function addOrUpdateVehicle(map, arr) {
let geo = convertPointsToGeo(arr)
if (!map.getSource("vehicle")) {
map.addSource("vehicle", {
type: "geojson",
......@@ -500,8 +552,9 @@ export function addOrUpdateCrossName(map, geo) {
}
// 交通事件热力图
export function addOrUpdateEventHeat(map, geo, callback) {
export function addOrUpdateEventHeat(map, arr, callback) {
console.log(geo, 7777777777777777777);
let geo = convertPointsLngLatToGeo(arr)
if (!map.getSource("eventHeat")) {
map.addSource("eventHeat", {
type: "geojson",
......@@ -544,7 +597,8 @@ export function addOrUpdateEventHeat(map, geo, callback) {
}
// 交通事件点图
export function addOrUpdateEventPoint(map, geo, callback) {
export function addOrUpdateEventPoint(map, arr, callback) {
let geo = convertPointsLngLatToGeo(arr)
if (!map.getSource("eventPoint")) {
map.addSource("eventPoint", {
type: "geojson",
......@@ -789,7 +843,8 @@ export function addOrUpdateLicense(map, geo) {
}
// 中间层级车辆图片图层
export function addOrUpdateVehiclePic(map, geo) {
export function addOrUpdateVehiclePic(map, arr) {
let geo = convertPointsToGeo(arr)
if (!map.getSource("vehiclePic")) {
map.addSource("vehiclePic", {
type: "geojson",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment