在哥伦布视图中如何使用 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);
});