# e-ngx-cesium
基于Angular的三维地球组件,依赖三维框架:[cesium](https://cesiumjs.org/)
![示例图](./example/assets/images/示例图.png)
**如果该组件出现typescript编译错误,有可能是cesium-typings不是最新的,你可以执行`npm uninstall e-ngx-cesium --save`之后再执行`npm install e-ngx-cesium --save`**
## Usage
1. Install
```shell
npm install --save e-ngx-cesium@latest
```
2. Set in the `.angular-cli.json(@angular/cli)`
```json
"assets": [
{
"glob": "**/*",
"input": "../node_modules/cesium/Build/Cesium",
"output": "./assets/scripts/cesium"
}
],
"styles": [
"../node_modules/cesium/Build/Cesium/Widgets/widgets.css"
],
"scripts": [
"../node_modules/cesium/Build/Cesium/Cesium.js",
"../node_modules/e-ngx-cesium/dist/components/navigation/viewerCesiumNavigationMixin.js"
]
```
3. Add `cesium-typings` to `typings.d.ts`
```typescript
/// <reference path="../node_modules/cesium-typings/index.d.ts" />
```
4. Set `CESIUM_BASE_URL` in main.ts
```typescript
window['CESIUM_BASE_URL'] = './assets/scripts/cesium'; // 设置cesium请求资源的基本路径
// window['CESIUM_BASE_URL']需在应用启动之前设置
platformBrowserDynamic().bootstrapModule(AppModule);
```
5. Add the `ENgxCesiumModule`
```typescript
import { ENgxCesiumModule } from "e-ngx-cesium";
@NgModule({
imports: [
ENgxCesiumModule
]
})
```
6. Use in Template
```html
<e-ngx-cesium [viewerOptions]="viewerOptions" (viewerReady)="onViewerReady($event)"></e-ngx-cesium>
```
7. Use in Component
```typescript
viewerOptions: ViewerOptions;
viewer: Viewer;
constructor() {
this.viewerOptions = {
scene3DOnly: true,
selectionIndicator: false,
baseLayerPicker: false
};
}
onViewerReady(evt: any) {
this.viewer = evt.viewer;
}
```
## API
### Inputs
- `viewerOptions`(`any`) - 创建Cesium.Viewer的属性配置,默认配置:
```typescript
private defaultViewerOptions: ViewerOptions = {
timeline: false,
animation: false,
baseLayerPicker: false,
geocoder: false,
homeButton: false,
navigationHelpButton: false,
sceneModePicker: false,
fullscreenButton: false,
fullscreenElement: this.globeContainer // 设置viewer所在元素为全屏的元素
};
```
- `accessToken`(`string`) - cesium ion 令牌。要访问 cesium 提供的影像或地形服务,需要去 [cesium ion](https://cesium.com/ion) 注册申请
- `proxy`(`string`) - 设置代理路径,可使用esri提供的[几个平台的代理文件](https://github.com/Esri/resource-proxy)
- `rectangle`(`Rectangle`) - 初始范围,默认中国
- `enablePosition`(`boolean?=false`) - 启用位置信息部件
- `enableSetting`(`boolean?=false`) - 启用效果设置部件
- `enableCompass`(`boolean?=true`) - 启用罗盘部件
- `enableZoomControls`(`boolean?=true`) - 启用缩放部件
- `enableDistanceLegend`(`boolean?=false`) - 启用比例尺部件
- `enableRollerShutters`(`boolean?=false`) - 启用卷帘对比
- `contrastImageryLayers`(`ImageryProvider[]`) - 卷帘对比的图层。图层显示顺序:左-右-左-右
### Outputs
- `viewerReady` - Cesium.Viewer创建完成后会触发该事件,参数$event为`{viewer: Cesium.Viewer, scene: Cesium.Scene, globe: Cesium.Globe, ellipsoid: Cesium.Ellipsoid}`
- `sliderChange` - 卷帘对比滑块位置变化事件,参数$event为当前ImageryLayer.splitDirection的值
### Custom ImageryProvider
- GoogleMapsImageryProvider(谷歌)
- GaodeMapsImageryProvider(高德)
- TiandituMapsImageryProvider(天地图)
## Develop
```shell
npm install // 安装依赖包
npm start // 启动项目
```
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
三维-基于Angular的三维地球组件-依赖于三维框架cesium-优质项目实战.zip (117个子文件)
splash.css 984B
Pan.cur 2KB
Hold.cur 2KB
.editorconfig 257B
动态水域.gif 11.57MB
e-ngx-cesium.component.html 2KB
position-info.component.html 2KB
measurement.component.html 911B
frame.component.html 875B
czml.component.html 800B
dynamic-water.component.html 706B
mode-switch.component.html 596B
roller-shutters.component.html 478B
tdt.component.html 471B
index.html 463B
gaode.component.html 456B
google.component.html 435B
render-effect.component.html 389B
image.component.html 363B
bing.component.html 252B
arcgis.component.html 251B
under-ground.component.html 239B
onlineMap.component.html 82B
measure.component.html 79B
scene.component.html 78B
app.component.html 75B
favicon.ico 5KB
waterNormals.jpg 287KB
worldimage.jpg 242KB
BlackMarble_2012.jpg 132KB
BlackMarble_2016.jpg 132KB
earthspec1k.jpg 114KB
worldimage_black.jpg 9KB
viewerCesiumNavigationMixin.js 425KB
gulpfile.js 2KB
layer_6.json 1.53MB
layer_5.json 1.22MB
layer_4.json 1.08MB
layer_3.json 1.02MB
layer_1.json 1.02MB
layer_2.json 1.01MB
tslint.json 2KB
package.json 2KB
.angular-cli.json 1KB
tsconfig.json 515B
tsconfig.json 319B
proxy.config.json 79B
.stylelintrc.json 55B
README.md 4KB
CHANGELOG.md 2KB
.npmignore 109B
示例图.png 1.39MB
e-ngx-cesium.component.scss 8KB
frame.component.scss 4KB
styles.scss 541B
position-info.component.scss 324B
dynamic-water.component.scss 165B
image.component.scss 1B
google.component.scss 1B
tdt.component.scss 1B
czml.component.scss 1B
onlineMap.component.scss 0B
bing.component.scss 0B
gaode.component.scss 0B
arcgis.component.scss 0B
measurement.component.scss 0B
measure.component.scss 0B
render-effect.component.scss 0B
mode-switch.component.scss 0B
roller-shutters.component.scss 0B
under-ground.component.scss 0B
scene.component.scss 0B
app.component.scss 0B
e-ngx-cesium.component.ts 17KB
czml.component.ts 10KB
dynamic-water.component.ts 6KB
tdt.component.ts 3KB
position-info.component.ts 3KB
measurement.component.ts 2KB
polyfills.ts 2KB
TiandituMapsStyle.ts 2KB
frame.component.ts 2KB
google.component.ts 2KB
GaodeMapsImageryProvider.ts 2KB
TiandituMapsImageryProvider.ts 2KB
scene.routes.ts 2KB
mode-switch.component.ts 1KB
gaode.component.ts 1KB
scene.module.ts 1KB
onlineMap.routes.ts 1KB
under-ground.component.ts 1KB
GoogleMapsStyle.ts 1KB
onlineMap.module.ts 1KB
roller-shutters.component.ts 972B
bing.component.ts 887B
arcgis.component.ts 824B
GoogleMapsImageryProvider.ts 816B
image.component.ts 791B
index.ts 774B
frame.routes.ts 754B
共 117 条
- 1
- 2
资源评论
极智视界
- 粉丝: 2w+
- 资源: 1425
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- video_20240515_132356_edit.mp4
- (python源码)(基于torch框架)基于LSTM的时间序列预测算法实现
- Java 实现CRC码算法(含实现原理和步骤)
- Screenshot_2024-05-15-15-51-23-937_com.tencent.mm.jpg
- gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner
- content_1715761104170.m3u8
- 202391630110 贾增林.zip
- (python源码)基于症状的心脏病预测算法实现
- c# 反编译工具ILSpy 新版
- ESP8266-01模块继电器制作手机APP远程遥控智能开关
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功