Cesium 中的缩放不清晰
the zoom is not clear in Cesium
我创建了缩放到特定国家/地区的按钮。但是,当我单击该按钮时,它会导航到新加坡,但我无法确切地看到新加坡国家/地区。
所以我想要一个更好的图像。
下面是我的代码...
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>My Work</title>
<script src="../Build/Cesium/Cesium.js">
</script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 98%; height: 98%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer">
<button type="button" class="cesium-button" onclick = "zoomToSingapore();" data-toggle="tooltip" data-placement="bottom" title="Please click me if you want to zoom to Singapore">Zoom To Singapore</button>
<button type="button" class="cesium-button" onclick = "zoomToMalaysia();" data-toggle="tooltip" data-placement="bottom" title="Please click me if you want to zoom to Malaysia">Zoom To Malaysia</button>
</div>
<div id="cesiumContainer" style="position:absolute;top:24px;right:24px;width:38px;height:38px;"></div>
<script>
viewer = new Cesium.Viewer('cesiumContainer', {
timeline: false,
navigationHelpButton: false,
infoBox: false
});
function zoomToSingapore()
{
var singapore = Cesium.Cartesian3.fromDegrees(103.851959, 1.290270);
viewer.camera.lookAt(singapore, new Cesium.Cartesian3(0.0, 0.0, 4200000.0));
}
function zoomToMalaysia()
{
var malaysia = Cesium.Cartesian3.fromDegrees(101.9758, 4.2105);
viewer.camera.lookAt(malaysia, new Cesium.Cartesian3(0.0, 0.0, 4200000.0));
}
</script>
</body>
</html>
我的问题,如果我点击新加坡,它会像我附在这个问题上的第二张图片一样缩放到新加坡。我需要像最后一张图片一样缩放什么???你能帮忙吗我??谢谢
看来你的身高太高了。尝试将 4200000.0
更改为 42000.0
.
编辑: 这是一个更完整的代码示例。这个打开标签,所以你可以看到边界。使用 F8 将此代码粘贴到 Sandcastle 和 运行 中。
var imagery = Cesium.createDefaultImageryProviderViewModels();
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProviderViewModels: imagery,
selectedImageryProviderViewModel: imagery[1]
});
var height = 50000;
var singapore = Cesium.Cartesian3.fromDegrees(103.85, 1.33, height);
viewer.camera.flyTo({
destination: singapore,
duration: 0
});
在上面,我得到了默认的图像提供者列表,并且 select 预先打开了标签。然后我飞到新加坡上空 50 公里的地方,使用 duration: 0
在那里拍摄相机。
我创建了缩放到特定国家/地区的按钮。但是,当我单击该按钮时,它会导航到新加坡,但我无法确切地看到新加坡国家/地区。
所以我想要一个更好的图像。
下面是我的代码...
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>My Work</title>
<script src="../Build/Cesium/Cesium.js">
</script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 98%; height: 98%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer">
<button type="button" class="cesium-button" onclick = "zoomToSingapore();" data-toggle="tooltip" data-placement="bottom" title="Please click me if you want to zoom to Singapore">Zoom To Singapore</button>
<button type="button" class="cesium-button" onclick = "zoomToMalaysia();" data-toggle="tooltip" data-placement="bottom" title="Please click me if you want to zoom to Malaysia">Zoom To Malaysia</button>
</div>
<div id="cesiumContainer" style="position:absolute;top:24px;right:24px;width:38px;height:38px;"></div>
<script>
viewer = new Cesium.Viewer('cesiumContainer', {
timeline: false,
navigationHelpButton: false,
infoBox: false
});
function zoomToSingapore()
{
var singapore = Cesium.Cartesian3.fromDegrees(103.851959, 1.290270);
viewer.camera.lookAt(singapore, new Cesium.Cartesian3(0.0, 0.0, 4200000.0));
}
function zoomToMalaysia()
{
var malaysia = Cesium.Cartesian3.fromDegrees(101.9758, 4.2105);
viewer.camera.lookAt(malaysia, new Cesium.Cartesian3(0.0, 0.0, 4200000.0));
}
</script>
</body>
</html>
我的问题,如果我点击新加坡,它会像我附在这个问题上的第二张图片一样缩放到新加坡。我需要像最后一张图片一样缩放什么???你能帮忙吗我??谢谢
看来你的身高太高了。尝试将 4200000.0
更改为 42000.0
.
编辑: 这是一个更完整的代码示例。这个打开标签,所以你可以看到边界。使用 F8 将此代码粘贴到 Sandcastle 和 运行 中。
var imagery = Cesium.createDefaultImageryProviderViewModels();
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProviderViewModels: imagery,
selectedImageryProviderViewModel: imagery[1]
});
var height = 50000;
var singapore = Cesium.Cartesian3.fromDegrees(103.85, 1.33, height);
viewer.camera.flyTo({
destination: singapore,
duration: 0
});
在上面,我得到了默认的图像提供者列表,并且 select 预先打开了标签。然后我飞到新加坡上空 50 公里的地方,使用 duration: 0
在那里拍摄相机。