官方文档wiki:https://github.com/AnalyticalGraphicsInc/cesium/wiki/Architecture
cesium卡是因为很吃内存,可能是加载了大的模型,我用chrome加载800MB的模型,大概会吃掉2G的内存,如果用手机或者平板浏览器打开 在缩放到很近的时候浏览器会崩溃
直接访问连接就能看看到这个json了。
举个例子:
服务器域名+当前路径的父路径(对应..)+"/data/apidemo/tower.json"
(function () {
"use strict";
Cesium.BingMapsApi.defaultKey = 'SHHFsraTruJW1WlBZo4W~Voo0XWCy1Zt2-2iAVLxvFQ~Ai_3AucRsH-FTKgfBT34iPCl128DNCGslmWLM0Hplg9UgMZoftwZFkKbhHu_RAo8'
var viewer = new Cesium.Viewer('cesiumContainer' , {
//关闭地球的2D,就是只用3D
scene3DOnly: true,
baseLayerPicker: false,
sceneModePicker: false,
navigationHelpButton: false,
animation: false,
timeline: false,
allowDataSourcesToSuspendAnimation: false,
//关闭月亮、星星等
skyBox: new Cesium.SkyBox({
show: false
}),
//关闭地球光环
skyAtmosphere: false
});
viewer.imageryLayers.addImageryProvider(new Cesium.SingleTileImageryProvider({
url: 'Source/Images/webwxgetmsgimg1.jpg'
}));
var initialPosition = new Cesium.Cartesian3.fromDegrees(113.42, 34.16, 16000000);
var homeCameraView = {
destination : initialPosition,
};
viewer.scene.camera.setView(homeCameraView);
var x = 113;
window.setInterval(function () {
x = x + 0.3;
if (x >= 178.5) {
x = -180
}
viewer.scene.camera.setView({
destination: new Cesium.Cartesian3.fromDegrees(x, 30, 16000000)
});
}, 16)
viewer.scene.sun.destroy(); //去掉太阳
viewer.scene.sun = undefined; //去掉太阳
viewer.scene.moon.destroy(); //去掉月亮
viewer.scene.moon = undefined; //去掉月亮
viewer.scene.backgroundColor = Cesium.Color.TRANSPARENT;
viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(112.42, 34.16),
ellipse : {
coordinates: Cesium.Rectangle.fromDegrees(112.42, 34.16, 50.0),
semiMinorAxis : 55000.0, //半小轴
semiMajorAxis : 55000.0, //半长轴
material : Cesium.Color.WHITE
}
});
viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(116.42, 40.16),
ellipse : {
semiMinorAxis : 25000.0, //半小轴
semiMajorAxis : 25000.0, //半长轴
material : Cesium.Color.fromAlpha(Cesium.Color.WHITE, 1)
}
});
//viewer.zoomTo(viewer.entities);
})()
怎么搞,我直接禁了scene.screenSpaceCameraController.enableZoom = false;放大缩小,滚轮也就不会放大缩小啦