yxl
2025-01-10 ed837798421340859efca21e46adc17575bdfef8
src/assets/js/map/mapView.js
@@ -36,10 +36,8 @@
        console.log("点击的对象:", pickedObject);
      }
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    // earthCtrl.factory.createTerrainLayer({
    //   sourceType: "ctb",
    //   url: "https://tiles1.geovisearth.com/base/v1/terrain?token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405"
    // });
    //加载全球地形
    this.addTerrain();
    this.addImageLayer();
    // this.addqqmap();
    let now2 = new Date();
@@ -116,6 +114,9 @@
    //   lat: 23.990136825668284,
    //   alt: 150
    // })
    earthCtrl.measure.pickPosition({}, function (e) {
      console.info(e);
    });
  },
  addTetrahedron(res) {
    earthCtrl.factory.addTetrahedron({
@@ -250,14 +251,14 @@
      width: 1.5,
      color: '#87CEFA',
    })
    earthCtrl.factory.createWfsLayer('polyline', {
    const layer1 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarM',
      width: 1.5,
      color: '#de3',
    })
    earthCtrl.factory.createWfsLayer('polyline', {
    const layer2 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarS',
      width: 1.5,
@@ -286,30 +287,36 @@
  },
  addModel() {
    const entity = earthCtrl.viewer.entities.add({
      position: SmartEarth.Cesium.Cartesian3.fromDegrees(
        121.614202387521061,
        23.990136825668284,
        0
      position: Cesium.Cartesian3.fromDegrees(
        121.576830,
        24.006230,
      ),
      model: {
        uri: '/gltf/tank.glb',
        scale: 15,
        heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND,
        disableDepthTestDistance: Number.POSITIVE_INFINITY // 禁用深度测试
        uri: '/gltf/ddc.glb',
        scale: 20,
        heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
        // disableDepthTestDistance: Number.POSITIVE_INFINITY // 禁用深度测试
      },
      label: {
        show: true,
        text: '经度:121.6142023,纬度:23.9901368',
        color: SmartEarth.Cesium.Color.fromCssColorString("#fff"),
        text: '经度:121.576830,纬度:24.006230',
        color: Cesium.Color.fromCssColorString("#fff"),
        font: "normal 14px MicroSoft YaHei",
        showBackground: true,
        outlineColor: SmartEarth.Cesium.Color.WHITE,
        pixelOffset: new SmartEarth.Cesium.Cartesian2(10, -30),
        horizontalOrigin: SmartEarth.Cesium.HorizontalOrigin.CENTER,
        verticalOrigin: SmartEarth.Cesium.VerticalOrigin.BOTTOM,
        heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND,
        outlineColor: Cesium.Color.WHITE,
        pixelOffset: new Cesium.Cartesian2(10, -30),
        horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
        heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
      },
    });
  },
  //加载全球地形
  addTerrain() {
    window.terrain = earthCtrl.factory.createTerrainLayer({
      sourceType: "ctb",
      url:config.terrainUrl
    });
  }
};
export default mapViewer;