zoukankan      html  css  js  c++  java
  • Supermap IClient3D 加载3DTiles倾斜摄影数据

    由于倾斜摄影数据默认的地理坐标系与超图的坐标系不一样。

      var obj = [6378137.0, 6378137.0, 6356752.3142451793];
      Cesium.Ellipsoid.WGS84 = Object.freeze(new Cesium.Ellipsoid(obj[0], obj[1], obj[2]));
    var viewer, url;
       viewer = new Cesium.Viewer('cesiumContainer');
       var scene = viewer.scene;
    //模型地址 url
    = "http://172.23.50.51:8090/iserver/services/3D-CeShi2/rest/realspace"; var promise = scene.open(url); Cesium.when(promise, function (layer) { //设置相机位置、视角,便于观察场景 scene.camera.setView({ destination: new Cesium.Cartesian3.fromDegrees(cameraPosition.longitude, cameraPosition.latitude, cameraPosition.altitude), orientation: { heading: cameraPosition.heading, pitch: tilt, roll: 0 } }); if (!scene.pickPositionSupported) { alert('不支持深度纹理,无法拾取位置!'); } }, function (e) { if (widget._showRenderLoopErrors) { var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; widget.showErrorPanel(title, undefined, e); } });

    3DTiles倾斜摄影模型

       try {
            var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ url: 'https://localhost:5001/cl/tileset.json' }));
            // 修复偏移量
            tileset.readyPromise.then(function (tileset) {
                viewer.scene.primitives.add(tileset);
    
                var heightOffset = -220;  //高度
                var boundingSphere = tileset.boundingSphere;
                var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
                var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
                var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
                var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
              //  tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
                viewer.zoomTo(tileset);
            }).otherwise(function (e) {
                throw e
            });
    
        } catch (e) {
            console.log(e);
        }
  • 相关阅读:
    Larval API 跨域问题解决
    php常用接口
    phpstudy+nigix+larval伪静态配置
    js、jquery让滚动条到底部
    JS 数组转json和json转数组
    python 基础(十七)内置函数
    python 基础(十六)生成器用法举例
    python 基础(十五)生成器
    python 基础(十四)装饰器
    python基础(十三)模块的定义、导入
  • 原文地址:https://www.cnblogs.com/w2011/p/14954277.html
Copyright © 2011-2022 走看看