我的个人博客

人生三境界:昨夜西风凋碧树,独上高楼,望尽天涯路。 衣带渐宽终不悔,为伊消得人憔悴。 众里寻他千百度,蓦然回首,那人却在灯火阑珊处。

用Angular部署Cesium

用到的集成开发环境是WebStrom,Cesium版本是1.50.0,Angular版本是6.2.4

 1.首先我们安装cesium,在webstorm中的Termianl中输入

npm install --save cesium

2.再安装类型描述文件,让TypeScript认识Cesium

npm install @types/cesium --save

3.在项目中引用cesium

打开angular.json文件,添加如下路径:

4.在main.ts中配置Cesium的环境路径

main.ts中添加以下语句

window['CESIUM_BASE_URL'] = 'node_modules/cesium/Build/Cesium';

5.然后在我们的项目ts文件中引用

6.在我们项目html文件中添加Cesium的容器,在css文件中添加修饰文件

<div id="cesiumContainer"></div>
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}

7.运行项目,查看效果

 

posted on 2018-10-07 10:45  把子肉爱上热干面  阅读(1721)  评论(0编辑  收藏  举报

导航