# @hansotech/mfair-wsp-mod-cesium-jssdk

> MFair-JSSDK-Cesium-Launcher

Latest version **0.2.5** (published 2023-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hansotech/mfair-wsp-mod-cesium-jssdk
pnpm add @hansotech/mfair-wsp-mod-cesium-jssdk
yarn add @hansotech/mfair-wsp-mod-cesium-jssdk
bun add @hansotech/mfair-wsp-mod-cesium-jssdk
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2023-07-29 |
| First published | 2023-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 159 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | uptain, budblack |

## Links

- npm: https://www.npmjs.com/package/@hansotech/mfair-wsp-mod-cesium-jssdk
- npm.io page: https://npm.io/package/@hansotech/mfair-wsp-mod-cesium-jssdk

## Dependencies (5)

- [gsap](https://npm.io/package/gsap.md) ^3.12.2
- [cesium](https://npm.io/package/cesium.md) ~1.95.0
- [events](https://npm.io/package/events.md) ^3.3.0
- [@types/events](https://npm.io/package/@types/events.md) ^3.0.0
- [@mfair/comm-tools](https://npm.io/package/@mfair/comm-tools.md) ^0.1.1

## Recent versions

- 0.2.5 (latest) — 2023-07-29
- 0.2.4 — 2023-07-28
- 0.2.3 — 2023-06-14
- 0.2.2 — 2023-06-14
- 0.2.1 — 2023-06-14
- 0.1.9 — 2023-06-14
- 0.1.8 — 2023-06-14
- 0.1.7 — 2023-06-14
- 0.1.6 — 2023-06-14

## README

# Cesium 模飞封装
## 快速上手
#### 引入
```js
import CesiumFair from '@hansotech/mfair-wsp-mod-cesium-jssdk' 
```
## API

#### 初始化
```js
const mapIns = new CesiumFair(container, option);
```

Options 类型参考
```ts
{
  // 切换投影模式（cesium自带）
  sceneModePicker?: boolean; //模式切换按钮

  fullscreenButton?: boolean;//右下角的全屏按钮

  imageryLayers?: Array<ImageryTile | ImageryWms>; // 瓦片

  /** 构建参数: see {@link https://cesium.com/learn/cesiumjs/ref-doc/CesiumTerrainProvider.html} */
  terrain?: any; // 地形

  location?: CesiumLocation; // 初始化位置

  depthTestTerrain?: boolean; // 开启深度缓冲
  globeTransparent?: boolean;  // 地球透明开关
  cameraCollision?: boolean; // 相机和地形碰撞开关

  tiles3d?: Array<Tile3DOption>; // 3dtile 数据

  useBrowserRecommendedResolution?: boolean;

  shouldAnimate?: boolean; // 默认开启动画
}
```

### 使用示例
```js
const config = {
    imageryLayers: [
        {
            type: 'tile',
            option: {
                url: 'http://www.example.com/{z}/{x}/{y}.webp',
                // 这里需要替换成你自己的瓦片地址
                enablePickFeatures: false,
            },
        },
    ],
    terrain: {
        url: 'TERRAIN_URL',
        // 这里需要替换成你自己的地形地址
    },
    depthTestTerrain: true,
    location: {
        center: [113.1433, 23.103, 2500],
        pitch: -90,
    },
    controlAsMapbox: true,
    tiles3d: [
        {
            option: {
                // 这里替换成你的3dtile 地址
                // 3dtile 可一次性加载多个
                url: 'OBLIQUE_URL',
            },
            location: false,
            // 是否聚焦到该图层
        }
    ],
}
const cesiumFair = new CesiumFair(document.getElementById('app'), config);

```


### 销毁
```js
cesiumFair.destroy()
```

### 监听点击事件
```js
cesiumFair.on('click', ({ feature, location }) => {
    // feature为拾取对象
    // location为拾取位置
})
```

---
_Source: https://npm.io/package/@hansotech/mfair-wsp-mod-cesium-jssdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
