import Map from '../../../src/chart/city/ChartCityMapGY/ChartCityMapGY.js';

import dot from '../../../src/chart/city/ChartCityMapGY/data/dot';
import line from '../../../src/chart/city/ChartCityMapGY/data/line';
import heat from '../../../src/chart/city/ChartCityMapGY/data/heat';
// import area from '../../../src/chart/city/ChartCityMapGY/data/area';
import linkDot from '../../../src/chart/city/ChartCityMapGY/data/linkDot';
import warnDot2 from '../../../src/chart/city/ChartCityMapGY/data/warnDot2';
import shexiang from '../../../src/chart/city/ChartCityMapGY/data/warnDot';
import traffic from '../../../src/chart/city/ChartCityMapGY/data/traffic';

let map = new Map(document.getElementsByClassName('container')[0],{});

//数据格式处理
dot[0].data.forEach(item=>{
    item.name = ["单位类型", "地址"];
    item.value = [item.type, item.location];
    item.coord = [item.long, item.lat];
})

//摄像头
shexiang[0].data.forEach(item=>{
    item.title = item.name;
})


//道路状态
traffic[0].data.forEach(item=>{
    item.trafficJam = item.jam;
    item.roadGrade = ["primary", "secondary", "trunk"];
})





setTimeout(()=>{


    //打点
    map.setOption(dot);

    //热力
    map.setOption(heat);

    //飞线
    map.setOption(line);

    //摄像头
    map.setOption(shexiang);
    

    //事故地点
    map.setOption(warnDot2);

    //救援单位
    map.setOption(linkDot);
    
    //道路状态
    map.setOption(traffic);
    
},4000)










// let opt1=mapStyle.concat(line,area);
// let map = new Map(document.getElementsByClassName('container')[0],{getConfig:true});
// map.canCameraMove(false)
// let dotData=JSON.parse(JSON.stringify(dot));
// setTimeout(()=>{
//     map.setOption(JSON.parse(JSON.stringify(dotData)));

//     setTimeout(()=>{
//         dotData[0].data.length = 1;
//         dotData[0].style.color = ["#f00","#f00","#f00","#f00","#f00","#f00","#f00"]
//         dotData[0].style.size = 200;
//         map.setOption(dotData);
//     },4000);
// },4000);

// setTimeout(() => {
    console.log('upload', map.map);
    // map.map.upload("http://192.168.1.76/group1/M00/00/88/wKgBS2GdqgGAHG0nABKwQDNRloU527.FBX", "fbx", 'abc')
// map.addModel({key:'abx', src:'http://192.168.1.76/group1/M00/00/88/wKgBS2GdqgGAHG0nABKwQDNRloU527.FBX'}, ()=>{
//     map.setModel('abx', {
//                 "scale": 0.8, 
//                 "rotation": { "x": 0, "y": 0 }, 
//                 "height": 100, 
//                 "color": "#f00" 
//         })
// })

// },3300);

    // setTimeout(()=>{
    //     console.log('start');
    //     map.setModel('abx', {
    //             "scale": 0.8, 
    //             "rotation": { "x": 0, "y": 0 }, 
    //             "height": 100, 
    //             "color": "#f00" 
    //     })
    // },3000)

// var btn = document.createElement('button');
// btn.innerHTML = "按钮"
// btn.style.position = "absolute";
// btn.style.zIndex = 999;
// btn.style.left = '100px';
// btn.style.top = '100px';
// btn.onclick = function(){
//     map.moveModel('abx', (key, coord)=>{
//         console.log(123, key, coord);
//     })
// }
// document.body.appendChild(btn)

// let lineData=JSON.parse(JSON.stringify(line));
// setTimeout(()=>{
//     map.setOption(JSON.parse(JSON.stringify(lineData)));
    

// },4000);






window.addEventListener('resize', () => {
    map.resize();
});