Cesium:如何在Columbus View中使用LookAt查看一组坐标?

时间:2014-08-05 22:26:42

标签: javascript coordinates cartesian cesium

如何在Columbus View中使用LookAt查看一组坐标?此方法适用于三维视图或全局视图,但在哥伦布视图中,坐标不能正确转换,因为它应该将我发送到美国,但它实际上将我发送到非洲海岸。如何在哥伦布视图中使其工作?

  

问题可以在这里重新创建   https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html

var viewer = new Cesium.Viewer('cesiumContainer', {
        sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
//Hide the base layer picker
baseLayerPicker : false,
//Use BingMaps
imageryProvider : new Cesium.BingMapsImageryProvider({
        url: '//dev.virtualearth.net',
        mapStyle: Cesium.BingMapsStyle.ROAD
    })
    });
var scene = viewer.scene;
Sandcastle.addDefaultToolbarButton('test', function() {
var center = Cesium.Cartesian3.fromDegrees(-111, 41);
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(center);

// View in east-north-up frame
var camera = scene.camera;
Cesium.Matrix4.clone(transform, camera.transform);
camera.constrainedAxis = Cesium.Cartesian3.UNIT_Z;

// Zoom in
camera.lookAt(
    new Cesium.Cartesian3(-120000.0, -120000.0, 120000.0),
    Cesium.Cartesian3.ZERO,
    Cesium.Cartesian3.UNIT_Z);
});

修复了View Works,但我的视图已修复:

var viewer = new Cesium.Viewer('cesiumContainer', {
        sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
//Hide the base layer picker
baseLayerPicker : false,
//Use BingMaps
imageryProvider : new Cesium.BingMapsImageryProvider({
        url: '//dev.virtualearth.net',
        mapStyle: Cesium.BingMapsStyle.ROAD
    })
    });
var scene = viewer.scene;
Sandcastle.addDefaultToolbarButton('test', function() {
var center = Cesium.Cartesian3.fromDegrees(-111, 41);
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(center);

// View in east-north-up frame
var camera = scene.camera;
Cesium.Matrix4.clone(transform, camera.transform);
camera.constrainedAxis = Cesium.Cartesian3.UNIT_Z;

// Zoom in
camera.lookAt(
    new Cesium.Cartesian3(-120000.0, -120000.0, 120000.0),
    Cesium.Cartesian3.ZERO,
    Cesium.Cartesian3.UNIT_Z);
});

1 个答案:

答案 0 :(得分:0)

这看起来像个错误。我已提交问题here。平均时间可以尝试的一件事是使用持续时间为0的Camera.flyTo