智慧城市代码库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. import Map from '../../../src/chart/cityCustom/ChartCityMapCustom/ChartCityMapCustom.js';
  2. import dot from '../../../src/chart/city/ChartCityMapCD/data/dot';
  3. import line from '../../../src/chart/city/ChartCityMapCD/data/line';
  4. import heat from '../../../src/chart/city/ChartCityMapCD/data/heat';
  5. // import area from '../../../src/chart/city/ChartCityMapCD/data/area';
  6. import linkDot from '../../../src/chart/city/ChartCityMapCD/data/linkDot';
  7. import warnDot2 from '../../../src/chart/city/ChartCityMapCD/data/warnDot2';
  8. import shexiang from '../../../src/chart/city/ChartCityMapCD/data/warnDot';
  9. import traffic from '../../../src/chart/city/ChartCityMapCD/data/traffic';
  10. let map = new Map(document.getElementsByClassName('container')[0],{}, {
  11. "coordinateRange":{"min":[117.1732710226342,39.100163520523985],"max":[117.21458452311877,39.13566807062768]},
  12. "resources":{
  13. "building":[{
  14. "id":"building-tegza",
  15. "type":"building",
  16. "url":"http://192.168.1.76/group1/M00/00/8E/wKgBS2JP8j6AcR3iAA3SWzu7XvA93.json",
  17. "name":"building1",
  18. "deleteId":11431}],
  19. "water":[],
  20. "railway":[],
  21. "road":[],
  22. "modle":[]
  23. },
  24. "view":{"zoom":9604,"rotateX":1.5710000000000002,"rotateY":0.9424777960769379,"center":[117.19392777287649,39.11791579557583]},
  25. "theme": {
  26. "building": "#48a8f2",
  27. "road": "#43adff",
  28. "railway": "#00ffa8",
  29. "water": "#0071e9",
  30. "floor": "#012144",
  31. "sky": "#fff"
  32. },
  33. });
  34. setTimeout(()=>{
  35. // console.log(213456789)
  36. // map.setCameraPosition({"zoom":9604,"rotateX":1.5710000000000002,"rotateY":0.9424777960769379,"center":[117.19392777287649,39.11791579557583]})
  37. },8000)
  38. //{"id":"building-tegza","type":"building","url":"http://192.168.1.76/group1/M00/00/8E/wKgBS2JP8j6AcR3iAA3SWzu7XvA93.json","name":"building1","deleteId":11431}
  39. //数据格式处理
  40. dot[0].data.forEach(item=>{
  41. item.name = ["单位类型", "地址"];
  42. item.value = [item.type, item.location];
  43. item.coord = [item.long, item.lat];
  44. })
  45. //摄像头
  46. shexiang[0].data.forEach(item=>{
  47. item.title = item.name;
  48. })
  49. //道路状态
  50. traffic[0].data.forEach(item=>{
  51. item.trafficJam = item.jam;
  52. item.roadGrade = ["primary", "secondary", "trunk"];
  53. })
  54. setTimeout(()=>{
  55. //打点
  56. // map.setOption(dot);
  57. //热力
  58. // map.setOption(heat);
  59. //飞线
  60. // map.setOption(line);
  61. //摄像头
  62. // map.setOption(shexiang);
  63. //事故地点
  64. // map.setOption(warnDot2);
  65. //救援单位
  66. // map.setOption(linkDot);
  67. //道路状态
  68. // map.setOption(traffic);
  69. },8000)
  70. // let opt1=mapStyle.concat(line,area);
  71. // let map = new Map(document.getElementsByClassName('container')[0],{getConfig:true});
  72. // map.canCameraMove(false)
  73. // let dotData=JSON.parse(JSON.stringify(dot));
  74. // setTimeout(()=>{
  75. // map.setOption(JSON.parse(JSON.stringify(dotData)));
  76. // setTimeout(()=>{
  77. // dotData[0].data.length = 1;
  78. // dotData[0].style.color = ["#f00","#f00","#f00","#f00","#f00","#f00","#f00"]
  79. // dotData[0].style.size = 200;
  80. // map.setOption(dotData);
  81. // },4000);
  82. // },4000);
  83. // setTimeout(() => {
  84. // map.map.upload("http://192.168.1.76/group1/M00/00/88/wKgBS2GdqgGAHG0nABKwQDNRloU527.FBX", "fbx", 'abc')
  85. // map.addModel({key:'abx', src:'http://192.168.1.76/group1/M00/00/88/wKgBS2GdqgGAHG0nABKwQDNRloU527.FBX'}, ()=>{
  86. // map.setModel('abx', {
  87. // "scale": 0.8,
  88. // "rotation": { "x": 0, "y": 0 },
  89. // "height": 100,
  90. // "color": "#f00"
  91. // })
  92. // })
  93. // },3300);
  94. // setTimeout(()=>{
  95. // console.log('start');
  96. // map.setModel('abx', {
  97. // "scale": 0.8,
  98. // "rotation": { "x": 0, "y": 0 },
  99. // "height": 100,
  100. // "color": "#f00"
  101. // })
  102. // },3000)
  103. // var btn = document.createElement('button');
  104. // btn.innerHTML = "按钮"
  105. // btn.style.position = "absolute";
  106. // btn.style.zIndex = 999;
  107. // btn.style.left = '100px';
  108. // btn.style.top = '100px';
  109. // btn.onclick = function(){
  110. // map.moveModel('abx', (key, coord)=>{
  111. // console.log(123, key, coord);
  112. // })
  113. // }
  114. // document.body.appendChild(btn)
  115. // let lineData=JSON.parse(JSON.stringify(line));
  116. // setTimeout(()=>{
  117. // map.setOption(JSON.parse(JSON.stringify(lineData)));
  118. // },4000);
  119. window.addEventListener('resize', () => {
  120. map.resize();
  121. });