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);
        }
  • 相关阅读:
    Exchange调整入站SMTP连接超时时间
    使用WSS和SOFS管理集群存储--Storage
    String构造方法和字符集编码转换
    系统类和数学操作类
    JavaSE——数据类型流、内存流、打印流
    JavaSE——装饰设计模式+简单加密解密工程
    JavaSE——装饰设计模式
    JavaSE——装饰流
    JavaSE —— IO
    JavaSE —— IO简介
  • 原文地址:https://www.cnblogs.com/w2011/p/14954277.html
Copyright © 2011-2022 走看看