代码拉取完成,页面将自动刷新
同步操作将从 Cubic/CesiumStudy 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!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>Hello World!</title>
<script src="Build/Cesium/Cesium.js"></script>
<script src="js/jquery.min.js"></script>
<style>
@import url(Build/Cesium/Widgets/widgets.css);
html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script>
alert("有进度,但是不怎么好用,下次试试摊平的方式");
//创建一个基本地球
let viewer = new Cesium.Viewer("cesiumContainer", {
// imageryProvider: new Cesium.WebMapTileServiceImageryProvider({
// url: 'http://t0.tianditu.gov.cn/img\_w/wmts?tk=0702d09e30dca11ed07ba4cec6d6bdac',
// layer: 'img',
// style: 'default',
// tileMatrixSetID: 'w',
// format: 'tiles',
// maximumLevel: 18
// }),
globe: false,//三维球可见性
skyBox: new Cesium.SkyBox({
sources: {
positiveX: '测试辅助文件/Image/天空球/sky2/Sky_Day Sun High SummerSky_Cam_0_Front+Z.png',
negativeX: '测试辅助文件/Image/天空球/sky2/Sky_Day Sun High SummerSky_Cam_2_Back-Z.png',
positiveY: '测试辅助文件/Image/天空球/sky2/Sky_Day Sun High SummerSky_Cam_1_Right+X.png',
negativeY: '测试辅助文件/Image/天空球/sky2/Sky_Day Sun High SummerSky_Cam_2_Back-Z.png',
positiveZ: '测试辅助文件/Image/天空球/sky2/Sky_Day Sun High SummerSky_Cam_4_Top+Y.png',
negativeZ: '测试辅助文件/Image/天空球/sky2/Sky_Day Sun High SummerSky_Cam_5_Down-Y.png'
}
}),
});
viewer.cesiumWidget.creditContainer.style.display = "none";//去cesium logo水印
viewer.scene.debugShowFramesPerSecond = true;//开启帧数
var shadowMap = viewer.shadowMap;
shadowMap.softShadows = true;
shadowMap.maximumDistance = 1300.0;
//添加数据
//添加文字
viewer.entities.add({
name: '文字',
position: new Cesium.Cartesian3(0, 0, 0),
label: {
text: '看这里',
font: '19px Helvetica',
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
fillColor: Cesium.Color.AZURE,
outlineColor: Cesium.Color.BLACK,
outlineWidth: 3,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
}
});
//加载化工装置
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '测试辅助文件/彩版压缩环氧乙烷/tileset.json', //数据路径
// url: '测试辅助文件/催化重整/催化重整.json', //数据路径
maximumScreenSpaceError: 20, //最大的屏幕空间误差,数值越小,显示越精细
maximumNumberOfLoadedTiles: 1000, //最大加载瓦片个数
//minimumPixelSize: 500,
}));
//将3dtiles的位置修改到000点
//平移
var position = new Cesium.Cartesian3(0, 0, 0);
var m = Cesium.Transforms.eastNorthUpToFixedFrame(position);
//旋转、平移矩阵相乘
Cesium.Matrix4.multiply(m, rotationX, m);
Cesium.Matrix4.multiply(m, rotationY, m);
Cesium.Matrix4.multiply(m, rotationZ, m);
//赋值给tileset
tileset._root.transform = m;
viewer.camera.flyTo({
destination: new Cesium.Cartesian3(0, 0, 0),
})
viewer.scene.postProcessStages.fxaa.enabled = true;
var utc = Cesium.JulianDate.fromDate(new Date("2019/10/04 12:30:00"));//UTC
// var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(116.39123, 39.90691, 10), 18.7);
// viewer.camera.flyToBoundingSphere(boundingSphere, { duration: 0 });
///下面是本次代码
viewer.scene.moon = null;
viewer.scene.sun = null;
var redBox = viewer.entities.add({
name: 'Red box with black outline',
// position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
position: new Cesium.Cartesian3(0, 0, 0),
box: {
dimensions: new Cesium.Cartesian3(4000000.0, 3000000.0, 5000000.0),
material: Cesium.Color.RED.withAlpha(0.5),
outline: true,
outlineColor: Cesium.Color.BLACK
}
});
viewer.trackedEntity = redBox;
</script>
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。