如何在Columbus view中使用LookAt查看一组坐标?这个方法可以在3d或全球视图中工作,但是在哥伦布视图中坐标不能正确转换,因为它应该将我发送到美国,但它实际上将我发送到非洲海岸。我如何使它在哥伦布视图中工作?
问题可以在这里重现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);
});
固定视图工作,但我的视图是固定的:
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);
});
这看起来像是一个bug。我在这里提交了一个问题。您可以同时尝试使用持续时间为0的Camera.flyTo
。