qinbo
2021-09-28 6ef0b98edd9915b321566801a17376a45ef145c4
js/function.js
@@ -45,6 +45,9 @@
mars3d.global_variables.queryDataTStart = getDefaultDateTime();
mars3d.global_variables.queryDataTStartGeo = getDefaultDateTimeGeo();
mars3d.global_variables.queryDataTEnd = getDefaultDateTimeEnd();
// for tmp hight light graphic and
//mars3d.global_variables.tmpHighlightGraphic;
//mars3d.global_variables.tmpHighlightGraphicLayer;
@@ -52,6 +55,8 @@
  //addMaskShanghai();
  addTDTAnnoLayer();
  addHighlightLayerClearButton();
  addTmpHighlightGraphicLayer();
  //TODO
  $.getJSON("data/getLayerListByUserid.json", { userid: mars3d.global_variables.userid }, (result) => {
@@ -71,71 +76,7 @@
}
function addWMSLayer(item) {
  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.style_selected,
      "transparent": "true",
      "format": "image/png",
      "viewparams": "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStartGeo
    },
    center: { "lat": 30.487351, "lng": 121.613269, "alt": 54033, "heading": 359, "pitch": -40 },
    noCenter: true,
    maxLength: 35000,
    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_selected:item.style_selected,
    style_options: item.styleoptions,
    flyTo: false
  });
  //单击事件
  wmsLyer.on(mars3d.EventType.click, function (event) {
    console.log("单击了矢量数据,共" + event.features.length + "条", event);
    console.log(event.layer.options.style_selected);
    console.log(event.graphic);
    /*
    event.graphic.style.diffHeight =
      diffHeight: 300,
      material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
        image: "img/textures/fence.png",
        color: "#ffff00",
        speed: 10, //速度,建议取值范围1-100
        axisY: true,
      }),
      */
  });
  map.addLayer(wmsLyer);
}
function reLoadLayers() {
  var layers = map.getLayers({ layers: true });
@@ -156,8 +97,8 @@
      var tmpTaxi = map.getLayerById(1004);
      tmpTaxi.clear(true);
      setTaxiLayerMapClock();
      for (var i = 0, len = taxi_data_list.length; i < len; i++) {
        addTaxiPathToLayer(taxi_data_list[i], tmpTaxi);
      for (var i = 0, len = data_list_1004.length; i < len; i++) {
        getTaxiPathFromServerbySN(data_list_1004[i], tmpTaxi);
      }
    }
@@ -168,7 +109,22 @@
function refreshWidgets() {
}
function addGraphictoHighlightLayer() {
  mars3d.global_variables.tmpHighlightGraphicLayer.addGraphic(mars3d.global_variables.tmpHighlightGraphic);
}
function addHighlightLayerClearButton() {
  let clearButton = new mars3d.control.ToolButton({
    title: "clearHighlightLayer",
    icon: "fa fa-crop",
    insertIndex: 1, //插入的位置顺序, 1是home按钮后面
    click: (event) => {
      mars3d.global_variables.tmpHighlightGraphicLayer.clear(true);
    },
  });
  map.addControl(clearButton);
}
function showDetail(layerid, itemCode) {
  haoutil.msg('单击了:' + layerid + ',' + itemCode);