wangzhibo
2021-09-26 ac8a0efbbe8ae8ccba1bb7ecfb8098b780eca010
统一处理
1个文件已修改
1204 ■■■■■ 已修改文件
js/function.js 1204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
js/function.js
@@ -1,42 +1,6 @@
"use script"; //开发环境建议开启严格模式
//系统 功能入口
var userid = '2';
var Vec_annoTileLayer;
var Img_annoTileLayer;
var queryDataType = 'hour';
var queryDataTStart = '2021-09-08 12:00:00'; //getDefaultDateTime();   // format "yyyy-MM-dd hh:00:00"
var queryDataTEnd = '';
var layer_1001_guokong;
var layer_1002_weizhan;
var layer_1003_jiance;
var layer_1004_taxi;
var layer_1005_roadsection;
var layer_1006_region;
var layer_100600_jichang;
var layer_100601_matou;
var layer_100602_huanxian;
var layer_100603_yuanqu;
var layer_100604_jinbo;
var layer_100605_bianjie;
var layer_100607_quan;
var layer_100610_qu;
var layer_100611_jiedao;
var layer_wind;
var layer_grid_100;
var layer_grid_1000;
var layer_grid_5000;
function getDefaultDateTime() {
  var date = new Date;
  date.setHours(date.getHours() - 2);
@@ -49,66 +13,102 @@
    (day > 9 ? day : ("0" + day)) + " " +
    (hours > 9 ? hours : ("0" + hours)) + ":00:00";
}
console.log(mars3d.globel_variables);
mars3d.globel_variables = { geoserver_url_predix: 'http://58.246.27.194:7011/', userid: 2, queryDataType: 'hour' };
mars3d.globel_variables.queryDataTStart = getDefaultDateTime();
mars3d.globel_variables.queryDataTEnd = getDefaultDateTime();
mars3d.globel_variables.layer100600_conifg = { name: '街道', styleoptions: ['pm25', 'pm10'], selectedstyle: 'pm25' };
console.log(mars3d.globel_variables);
mars3d.reloadLayers = function (layerid){
  if (layerid ==100611) {
    addJiedaoLayer();
  }
};
mars3d.global_variables = { geoserver_url_predix: 'http://58.246.27.194:7011/', nodejs_url_predix: 'http://58.246.27.194:7012/', userid: 2, queryDataType: 'hour' };
mars3d.global_variables.queryDataTStart = getDefaultDateTime();
mars3d.global_variables.queryDataTEnd = getDefaultDateTime();
function addTDTAnnoLayer() {
  Img_annoTileLayer = new mars3d.layer.TdtLayer({
    name: "影像注记",
    layer: "img_z",
    key: mars3d.Token.tiandituArr,
function initLayersByUserid() {
  //addMaskShanghai();
  addTDTAnnoLayer();
  $.getJSON("data/getLayerListByUserid.json", { userid: mars3d.global_variables.userid }, (result) => {
    result.data.forEach((item) => {
      if ([item['type']] == 'wms') {
        addWMSLayer(item);
      } else if ([item['type']] == 'wind') {
        console.log('wind')
        addWindLayer(item);
      } else if ([item['type']] == 'div') {
        addGuokongLayer(item);
      } else if ([item['type']] == 'taxi') {
        addTaxiLayer(item);
      }
    });
  });
  Img_annoTileLayer.show = false;
  Img_annoTileLayer.pid = 50;
  map.addLayer(Img_annoTileLayer);
  Vec_annoTileLayer = new mars3d.layer.TdtLayer({
    name: "矢量图注记",
    layer: "vec_z",
    key: mars3d.Token.tiandituArr,
  });
  Vec_annoTileLayer.show = false;
  Vec_annoTileLayer.pid = 50;
  map.addLayer(Vec_annoTileLayer);
}
function addguokongLayers(datatime) {
function addWMSLayer(item) {
  layer_1001_guokong = new mars3d.layer.DivLayer({
    name: '国控点',
    pid: 99, //图层管理 中使用,父节点id
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co']
  var wmsLyer = new mars3d.layer.WmsLayer({
    id: item.id,
    pid: item.pid,
    name: item.name,
    type: "wms",
    url: mars3d.global_variables.geoserver_url_predix + "/geoserver/konglu_58/wms",
    layers: "konglu_58:" + item.geoname_prefix + mars3d.global_variables.queryDataType,
    crs: "EPSG:4326",
    parameters: {
      "styles": item.style_prefix + item.styleoptions[0],
      "transparent": "true",
      "format": "image/png",
      "viewparams": "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStart
    },
    center: { "lat": 30.487351, "lng": 121.613269, "alt": 54033, "heading": 359, "pitch": -40 },
    noCenter: true,
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: item.show,
    geoname_prefix: item.geoname_prefix,
    style_prefix: item.style_prefix,
    style_options: item.styleoptions,
    flyTo: false
  });
  map.addLayer(layer_1001_guokong);
  //单击事件
  wmsLyer.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(wmsLyer);
}
function addGuokongLayer(item) {
  var guokongLayer = new mars3d.layer.DivLayer({
    id: item.id,
    pid: item.pid, //图层管理 中使用,父节点id
    name: item.name,
    style_options: item.styleoptions
  });
  map.addLayer(guokongLayer);
  layer_1001_guokong.on(mars3d.EventType.click, function (event) {
  guokongLayer.on(mars3d.EventType.click, function (event) {
    console.log("监听layer,单击了矢量对象", event);
    console.log(event.graphic?.attr)
    var item = event.graphic?.attr;
    //haoutil.msg('单击了:' + item['高校名称'])
  });
  layer_1001_guokong.bindPopup(function (event) {
  guokongLayer.bindPopup(function (event) {
    let item = event.graphic?.attr;
    var html =
      "站点名称:" +
@@ -141,8 +141,6 @@
        style: {
          color: clr,
          heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
          // html: '<div class="mars3d-animation-point" style="color:' + clr + ';"><p></p></div>',
          // html: '<div><p><img src="img/marker/mark1.png"></p></div>',
          highlight: {
            type: "divLightPoint",
            diffHeight: 600,
@@ -157,750 +155,22 @@
        show: true,
        attr: item,
      });
      layer_1001_guokong.addGraphic(graphic);
      guokongLayer.addGraphic(graphic);
    }
  });
}
function addWeizhanLayer() {
function addWindLayer(item) {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_1002_weizhan = new mars3d.layer.WmsLayer({
    pid: 99,
    name: "微站",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_weizhan_hour",
    crs: "EPSG:4326",
    parameters: {
      "Styles": "point_weizhan_pm25",
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/point_weizhan_pm25.sld"
    },
    center: { "lat": 30.429987, "lng": 121.590473, "alt": 58635, "heading": 359, "pitch": -40 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "click",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_1002_weizhan.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_1002_weizhan);
}
function addJianceLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_1003_jiance = new mars3d.layer.WmsLayer({
    pid: 99,
    name: "监测点",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_weizhan_hour",
    crs: "EPSG:4326",
    parameters: {
      "Styles": "point_weizhan_pm25",
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/point_weizhan_pm25.sld"
    },
    center: { "lat": 30.429987, "lng": 121.590473, "alt": 58635, "heading": 359, "pitch": -40 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_1003_jiance.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_1003_jiance);
}
function addRoadLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_1005_roadsection = new mars3d.layer.WmsLayer({
    pid: 99,
    name: "上海市道路",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_roadsection_hour",
    crs: "EPSG:4326",
    parameters: {
      "Stayle": "polyline_road_pm25",
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polyline_road_pm25.sld"
    },
    center: { "lat": 30.487351, "lng": 121.613269, "alt": 54033, "heading": 359, "pitch": -40 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_1005_roadsection.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_1005_roadsection);
}
function addJichangLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100600_jichang = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "机场",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100600_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.756467, "lng": 121.614552, "alt": 73242, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100600_jichang.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100600_jichang);
}
function addMatouLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100601_matou = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "码头",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100601_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.577234, "lng": 121.664644, "alt": 84121, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100601_matou.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100601_matou);
}
function addHuanxianLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100602_huanxian = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "环线",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100602_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.687288, "lng": 121.623785, "alt": 88144, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100602_huanxian.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100602_huanxian);
}
function addYuanyuLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100603_yuanqu = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "工业园区",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100603_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.393398, "lng": 121.534777, "alt": 91038, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100603_yuanqu.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100603_yuanqu);
}
function addJinboLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100604_jinbo = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "进博会",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100604_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.839605, "lng": 121.372945, "alt": 52000, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100604_jinbo.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100604_jinbo);
}
function addBianjieLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100605_bianjie = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "边界",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100605_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.880665, "lng": 121.305298, "alt": 69363, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100605_bianjie.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100605_bianjie);
}
function addQuanLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100607_quan = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "宝山圈",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100607_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_co.sld"
    },
    center: { "lat": 30.736361, "lng": 121.566128, "alt": 83811, "heading": 360, "pitch": -56 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100607_quan.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100607_quan);
}
function addXinzhenquLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100610_qu = new mars3d.layer.WmsLayer({
    // id : 10,
    pid: 1006,
    name: "行政区",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100610_hour",
    crs: "EPSG:4326",
    parameters: {
      "Stayle": "polyline_road_pm25",
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/polygon_region_pm25.sld"
    },
    center: { "lat": 30.594533, "lng": 121.581681, "alt": 93405, "heading": 359, "pitch": -61 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
    flyTo: true
  });
  //单击事件
  layer_100610_qu.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100610_qu);
}
function addJiedaoLayer() {
  let tmpLyaer = map.getLayerById(100611);
  if (tmpLyaer) {
    map.removeLayer(tmpLyaer);
  }
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_100611_jiedao = new mars3d.layer.WmsLayer({
    id: 100611,
    pid: 1006,
    name: mars3d.globel_variables.layer100600_conifg.name,
    type: "wms",
    url: mars3d.globel_variables.geoserver_url_predix + "geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100600_" + mars3d.globel_variables.queryDataType,
    crs: "EPSG:4326",
    parameters: {
      "styles": "polygon_region_" + mars3d.globel_variables.layer100600_conifg.selectedstyle,
      "transparent": "true",
      "format": "image/png",
      "viewparams": "userid:" + mars3d.globel_variables.userid + ";datatime:" + mars3d.globel_variables.queryDataTStart
    },
    center: { "lat": 30.466245, "lng": 121.562803, "alt": 107679, "heading": 356, "pitch": -58 },
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: true,
    selectedMapStyleOptions: mars3d.globel_variables.layer100600_conifg.selectedstyle,
    hasMapStyleOptions: mars3d.globel_variables.layer100600_conifg.styleoptions,
    flyTo: false,
    reloadLayers:function(new_style){
      console.log(new_style);
      mars3d.globel_variables.layer100600_conifg.selectedstyle = new_style;
      addJiedaoLayer();
    }
  });
  //单击事件
  layer_100611_jiedao.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_100611_jiedao);
}
/////////
function addMaskShanghai() {
  //geojson 合肥边界线
  geoJsonLayer = new mars3d.layer.GeoJsonLayer({
    url: "//data.mars3d.cn/file/geojson/areas/340100.json",
    mask: true, //标识为遮罩层【重点参数】
    symbol: {
      styleOptions: {
        fill: true,
        color: "rgb(2,26,79)",
        opacity: 0.9,
        outline: false,
        outlineColor: "#39E09B",
        outlineWidth: 8,
        outlineOpacity: 0.8,
        arcType: Cesium.ArcType.GEODESIC,
        clampToGround: true,
      },
    },
  });
  map.addLayer(geoJsonLayer);
}
function addGrid5Layers() {
  layer_grid_5000 = new mars3d.layer.WmsLayer({
    pid: 99,
    name: "网格图层5000",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_grid5000_hour",
    crs: "EPSG:4326",
    parameters: {
      "Stayle": "vis_grid100_1000_5000_co",
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/vis_grid100_1000_5000_co.sld"
    },
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
  });
  map.addLayer(layer_grid_5000);
  layer_grid_5000.reloadLayers = function () {
    layer_grid_5000.options.layers = "konglu_58:vis_grid5000_day";
    layer_grid_5000.options.parameters.sld = "http://127.0.0.1:8080/geoserver/styles/" + layer_grid_5000.options.selectedMapStyleOptions + ".sld";
    layer_grid_5000.options.parameters.viewparams = "id1:0;id2:10";
    console.log(layer_grid_5000);
    layer_grid_5000.reload();
  }
  //单击事件
  layer_grid_5000.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_grid_5000);
}
function addGrid1Layers() {
  layer_grid_1000 = new mars3d.layer.WmsLayer({
    pid: 99,
    name: "网格图层1000",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_grid1000_hour",
    crs: "EPSG:4326",
    parameters: {
      "Stayle": "vis_grid100_1000_5000_co",
      "transparent": "true",
      "format": "image/png",
      "sld": "http://127.0.0.1:8080/geoserver/styles/vis_grid100_1000_5000_co.sld"
    },
    show: false,
    selectedMapStyleOptions: 'pm25',
    hasMapStyleOptions: ['pm25', 'pm10', 'no', 'no2', 'nox', 'co'],
  });
  map.addLayer(layer_grid_1000);
  layer_grid_1000.reloadLayers = function () {
    layer_grid_1000.options.layers = "konglu_58:vis_grid1000_day";
    layer_grid_1000.options.parameters.sld = "http://127.0.0.1:8080/geoserver/styles/" + layer_grid_1000.options.selectedMapStyleOptions + ".sld";
    layer_grid_1000.options.parameters.viewparams = "id1:0;id2:10";
    console.log(layer_grid_1000);
    layer_grid_1000.reload();
  }
  //单击事件
  layer_grid_1000.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_grid_1000);
}
function addFunctionalLayers() {
  // add mask
  //addMaskShanghai();
  addTDTAnnoLayer();
  // 添加业务图层
  addguokongLayers();
  addWeizhanLayer();
  addJianceLayer();
  addRoadLayer();
  // addRegionLayer();
  addJichangLayer();
  addMatouLayer();
  addHuanxianLayer();
  addYuanyuLayer();
  addJinboLayer();
  addBianjieLayer();
  addQuanLayer();
  addXinzhenquLayer();
  addJiedaoLayer();
  addWindLayer();
  addGrid5Layers();
  addGrid1Layers();
}
function addWindLayer(dataTime) {
  //显示高校点
  //getWindParametersByTime(dataTime){
  $.getJSON("data/getWindParametersByTime.json", { datatime: '2021-09-08 12:00:00', qindex: 'pm25' }, (result) => {
  $.getJSON("data/getWindParametersByTime.json", { datatype: mars3d.global_variables.queryDataType, datatime: mars3d.global_variables.queryDataTStart }, (result) => {
    console.log(result);
    layer_wind = new mars3d.layer.CanvasWindLayer({
      id: 2001,
      pid: 99,
      name: "实时风场",
      color: "#ffffff", //颜色
    var layer_wind = new mars3d.layer.CanvasWindLayer({
      id: item.id,
      pid: item.pid,
      name: item.name,
      color: item.color,
      frameRate: 20, //每秒刷新次数
      speedRate: 60, //风前进速率
      particlesNumber: 1000,
@@ -908,7 +178,7 @@
      lineWidth: 1,
      reverseY: true
    });
    layer_wind.show = false;
    layer_wind.show = item.show;
    map.addLayer(layer_wind);
    layer_wind.data = convertWindData(result.data);
@@ -978,6 +248,303 @@
  return count;
}
function addTaxiLayer(item) {
  map.clock.shouldAnimate = true;
  map.clock.startTime = Cesium.JulianDate.fromDate(new Date("2021-07-01 10:00:00"));
  map.clock.currentTime = Cesium.JulianDate.fromDate(new Date("2021-07-01 10:00:00"));
  map.clock.stopTime = Cesium.JulianDate.fromDate(new Date("2021-07-01 10:15:00"));
  map.clock.multiplier = 5.0;
  map.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  var taxi_layer = new mars3d.layer.GraphicLayer({
    id: item.id,
    name: item.name,
    pid: item.pid, //图层管理 中使用,父节点id
    center: { "lat": 30.62156, "lng": 121.44918, "alt": 48716, "heading": 359, "pitch": -40 },
    noCenter: true,
    show: true,
    onWidget: "widgetsTS/taxi_layer_setting/widget.js",
  });
  map.addLayer(taxi_layer);
  taxi_layer.on(mars3d.EventType.click, function (event) {
    console.log("监听layer,单击了矢量对象", event);
    var item = event.graphic?.attr;
  });
  taxi_layer.bindPopup(function (event) {
    let item = event.graphic?.attr;
    var html =
      "<br/>类型:&nbsp;" +
        item["code"].substring(0, 2) == "BS" ? "公交车" : "出租车" +
        "<br />车辆编号:&nbsp;" +
        item["code"] +
        "<br/>数据时间:&nbsp;" +
        item["datatime"] +
        "<br />瞬时车速:&nbsp;&nbsp;&nbsp;" +
        item["speed"] + "&nbsp;(km/h)" +
        "<br />粉尘PM2.5:&nbsp;" +
        item["pm25"] + "&nbsp;(ug/m3)" +
        "<br />粉尘PM10:&nbsp;&nbsp;" +
        item["pm10"] + "&nbsp;(ug/m3)" +
        "<br />NO浓度:&nbsp;&nbsp;&nbsp;" +
        item["no"] + "&nbsp;(ug/m3)" +
        "<br />NO2浓度:&nbsp;&nbsp;" +
        item["no2"] + "&nbsp;(ug/m3)" +
        "<br />NO+NO2浓度:&nbsp;" +
        item["nox"] + "&nbsp;(ug/m3)" +
        "<br />CO浓度值:&nbsp;&nbsp;&nbsp;&nbsp;" +
        item["co"] + "&nbsp;&nbsp;(mg/m3)" +
        "<br /><br /><p><a href='#' onclick='javascript:showDetail(1001,\"" + item["code"] + "\")' ><span style='color:#ff00ff'>历史轨迹回放</span></a></p>";
    return html;
  });
  $.getJSON("http://58.246.27.194:7012/dataapi/Bdata?bid=get_1004_list_by_userid&userid=2", (result) => {
    for (var i = 0, len = result.data.result.length; i < len; i++) {
      let item = result.data.result[i];
      addItemToLayer(item, taxi_layer);
    }
  });
}
function addItemToLayer(item, target_layer) {
  $.getJSON("http://58.246.27.194:7012/dataapi/Bdata?bid=get_1004_single_path&siteid=" + item["code"], {
    datatime1: "2021-07-01 10:00:00",
    datatime2: "2021-07-01 10:15:00"
  }, (result) => {
    if (result.data.result.length > 0) {
      var tmpPositionProperty = new Cesium.SampledPositionProperty();
      for (var i = 0, len = result.data.result.length; i < len; i++) {
        let item = result.data.result[i];
        //console.log(item);
        tmpPositionProperty.addSample(Cesium.JulianDate.fromDate(new Date(item["datatime"])), Cesium.Cartesian3.fromDegrees(item["lon"], item["lat"], 0.2))
      }
      let graphic = new mars3d.graphic.ModelEntity({
        attr: result.data.result[0],
        style: {
          url: "gltf/" + (item["code"]).substring(0, 2) + ".gltf",
          scale: 0.5,
          minimumPixelSize: 20,
          highlight: {
            type: mars3d.EventType.click,
            silhouette: true,
            silhouetteColor: "#ff0000",
            silhouetteSize: 4,
          },
          label: {
            //不需要文字时,去掉label配置即可
            text: item["code"],
            font_size: 16,
            // TODO need to be changed according to qindex color.
            color: "#ff00ff",
            outline: true,
            outlineColor: "#000000",
            pixelOffsetY: -20,
            distanceDisplayCondition: true,
            distanceDisplayCondition_far: 50000,
            distanceDisplayCondition_near: 0,
          },
        },
      });
      graphic.position = tmpPositionProperty;
      target_layer.addGraphic(graphic);
    }
  });
}
function reLoadLayers() {
  var layers = map.getLayers({ layers: true });
  layers.forEach((layer) => {
    console.log(layer.name+":"+layer.type);
    if ([layer.type] == 'wms') {
      layer.options.layers = "konglu_58:" + layer.options.geoname_prefix + mars3d.global_variables.queryDataType;
      layer.options.parameters.viewparams = "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStart;
      layer.reload();
    }
  });
}
function refreshWidgets() {
}
function addTDTAnnoLayer() {
  Img_annoTileLayer = new mars3d.layer.TdtLayer({
    name: "影像注记",
    layer: "img_z",
    key: mars3d.Token.tiandituArr,
  });
  Img_annoTileLayer.show = false;
  Img_annoTileLayer.pid = 50;
  map.addLayer(Img_annoTileLayer);
  Vec_annoTileLayer = new mars3d.layer.TdtLayer({
    name: "矢量图注记",
    layer: "vec_z",
    key: mars3d.Token.tiandituArr,
  });
  Vec_annoTileLayer.show = false;
  Vec_annoTileLayer.pid = 50;
  map.addLayer(Vec_annoTileLayer);
}
function addfunctionLayers() {
  layer_1001_guokong = new mars3d.layer.DivLayer({
    name: '国控点',
    pid: 99, //图层管理 中使用,父节点id
    show: false
  });
  map.addLayer(layer_1001_guokong);
  layer_1001_guokong.on(mars3d.EventType.click, function (event) {
    console.log("监听layer,单击了矢量对象", event);
    console.log(event.graphic?.attr)
    var item = event.graphic?.attr;
    //haoutil.msg('单击了:' + item['高校名称'])
  });
  layer_1001_guokong.bindPopup(function (event) {
    let item = event.graphic?.attr;
    var html =
      "高校名称:" +
      item["高校名称"] +
      "<br />所属地区:" +
      item["地区"] +
      "<br />主管部门:" +
      item["主管部门"] +
      "<br />办学层次:" +
      item["办学层次"] +
      "<br />王牌专业:" +
      item["王牌专业"] +
      "<br /><br /><p><a href='#' onclick='javascript:showDetail(1001,\"" + item["高校名称"] + "\")' >详细信息</a></p>";
    return html;
  });
  // add 国控点
  //显示高校点
  $.getJSON("//data.mars3d.cn/file/apidemo/gaoxiao.json", (result) => {
    var pointColorArr = ["#f33349", "#f79a2c", "#f2fa19", "#95e40c", "#1ffee6"];
    for (var i = 0, len = result.length; i < len; i++) {
      var item = result[i];
      var jwd = item["经纬度"].split(",");
      if (jwd.length !== 2) {
        continue;
      }
      var jd = Number(jwd[0]);
      var wd = Number(jwd[1]);
      var clr = pointColorArr[i % pointColorArr.length];
      var graphic = new mars3d.graphic.DivGraphic({
        position: Cesium.Cartesian3.fromDegrees(jd, wd),
        style: {
          html: '<div class="mars3d-animation-point" style="color:' + clr + ';"><p></p></div>',
          //html: '<div><p><img src="img/marker/mark1.png"></p></div>',
          distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 200000), //按视距距离显示
        },
        attr: item,
      });
      layer_1001_guokong.addGraphic(graphic);
    }
  });
}
function addRoadLayer() {
  //方式2:在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
  layer_1006_roadsection = new mars3d.layer.WmsLayer({
    pid: 99,
    name: "上海市道路",
    type: "wms",
    url: "http://58.246.27.194:7011/geoserver/konglu_58/wms",
    layers: "konglu_58:vis_region_100601_hour",
    crs: "EPSG:4326",
    parameters: {
      "transparent": "true",
      "format": "image/png"
    },
    center: { "lat": 31.162801, "lng": 121.543277, "alt": 50000, "heading": 359.2, "pitch": -39.5 },
    "noCenter": true,
    getFeatureInfoParameters: {
      feature_count: 10
    },
    //单击高亮及其样式
    highlight: {
      type: "wallP",
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
    },
    popup: "all",
    show: false,
    flyTo: false
  });
  //单击事件
  layer_1006_roadsection.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
  });
  map.addLayer(layer_1006_roadsection);
}
function addMaskShanghai() {
  //geojson 合肥边界线
  geoJsonLayer = new mars3d.layer.GeoJsonLayer({
    url: "//data.mars3d.cn/file/geojson/areas/340100.json",
    mask: true, //标识为遮罩层【重点参数】
    symbol: {
      styleOptions: {
        fill: true,
        color: "rgb(2,26,79)",
        opacity: 0.9,
        outline: false,
        outlineColor: "#39E09B",
        outlineWidth: 8,
        outlineOpacity: 0.8,
        arcType: Cesium.ArcType.GEODESIC,
        clampToGround: true,
      },
    },
  });
  map.addLayer(geoJsonLayer);
}
function addFunctionalLayers() {
}
function showDetail(layerid, itemCode) {
  haoutil.msg('单击了:' + layerid + ',' + itemCode);
@@ -993,7 +560,6 @@
    mars3d.widget.activate({
      uri: "widgetsTS/qyDetailsView/widget.js",
      dataQy: itemCode,
      itemcode: itemCode
    });
  }