首页 / 浏览问题 / 三维GIS / 问题详情
在实现模型属性查询时出现问题
yjw
15EXP 2022年11月23日
HElloworld.vue:
<template>
  <div id="cesiumContainer">
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  mounted() {
    const Cesium = window.Cesium
    var viewer = new Cesium.viewer('cesiumContainer')
    var scene = viewer.scene
    var url = "http://43.139.126.68:8090/iserver/services/3D-fault/rest/realspace"
    var promise = scene.addS3MTilesLayerByScp(url, { name: 'test' })
    var s3mlayer
    Cesium.when(promise, function (layer) {
      scene.camera.setView({
        destination: Cesium.Cartesian3.fromDegrees(106.453557529491158, 29.476442887855072, 100)
      });
      s3mlayer = layer
    })
    $("#query").click(function (evt) {
      s3mlayer.setQueryParameter({
        url: "http://43.139.126.68:8090/iserver/services/data-fault/rest/data",
        dataSourceName: "",
        isMerge: true,
        keyword: 'SmID',
      })
      var infoboxContainer = document.getElementById("bubble");
      viewer.customInfobox = infoboxContainer
      var title = document.getElementById("title");
      var des = document.getElementById("des");
      viewer.pickEvent.addEventListener(function (feature) {
        var ti = Cesium.defaultValue(feature.TYPENAME, '');
        var description = Cesium.defaultValue(feature.SMID, '');
        title.innerText = ti;
        des.innerText = description;
      })
    })
  },
}
</script>
APP.vue

<template>
  <div>
    <HelloWorld></HelloWorld>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
  name: 'App',
  components: {
    HelloWorld
  }
}
</script>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <title>模型查看</title>
  <link href="./Cesium/Widgets/widgets.css" rel="stylesheet">
  <script src="./Cesium/Cesium.js"></script>
  <script src="./jquery.min.js"></script>
  <script type=" text/javascript" src="./require.min.js" data-main="js/main"></script>
</head>

请问实现模型属性查询时报错,我helloworld组件22行¥ 和evt 报错,而且场景也被我整丢了。

1个回答

您好,

属性查询可以参考博客:https://blog.csdn.net/m0_58818139/article/details/124662638

如果有报错,麻烦截图报错信息。是控制台报错还是请求的问题描述清楚。

4,151EXP 2022年11月23日
...