# BC-SDK

<p>
<img src="https://img.shields.io/github/workflow/status/dvgis/bc-sdk/build"/>
<img src="https://img.shields.io/badge/license-Apache%202-blue"/>
<a href="https://www.npmjs.com/package/miniearth/bc-sdk" target="_blank">
 <img src="https://img.shields.io/npm/v/miniearth/bc-sdk?color=orange&logo=npm" />
</a>
<a href="https://www.npmjs.com/package/miniearth/bc-sdk" target="_blank">
 <img src="https://img.shields.io/npm/dt/miniearth/bc-sdk?logo=npm"/>
</a>
<a href="https://resource.dvgis.cn/bc-docs/v2.x" target="_blank">
 <img src="https://img.shields.io/badge/docs-online-yellow.svg"/>
</a>
<a href="http://bc.dvgis.cn" target="_blank">
 <img src="https://img.shields.io/badge/demo-online-red.svg"/>
</a>
</p>

**_`BC-SDK`_** is based on the open source project **_`Cesium`_** for the second development of two three-dimensional **_`WebGis`_** application framework , the framework optimizes the use of **_`Cesium`_** and adds some additional features , designed for developers to quickly build **_`WebGis`_** application.

```warning
Tips：This SDK is JS+GIS framework package. Developers need to have some front-end technology and GIS related technology
```

## Installation

`NPM / YARN` **_`(Recommend)`_**

Installing with NPM or YARN is recommended and it works seamlessly with webpack.

```shell
yarn add miniearth/bc-sdk
-------------------------
npm install miniearth/bc-sdk
```

```js
import BC from 'miniearth/bc-sdk/dist/bc.base.min'
import BcCore from 'miniearth/bc-sdk/dist/bc.core.min'
import BcChart from 'miniearth/bc-sdk/dist/bc.chart.min'
import BcMapv from 'miniearth/bc-sdk/dist/bc.mapv.min'
import 'miniearth/bc-sdk/dist/bc.core.min.css'
```

`NPM / YARN` **_`(On-demand)`_**

```shell
yarn add miniearth/bc-base
yarn add miniearth/bc-core
yarn add miniearth/bc-chart
yarn add miniearth/bc-mapv
-------------------------
npm install miniearth/bc-base
npm install miniearth/bc-core
npm install miniearth/bc-chart
npm install miniearth/bc-mapv
```

```js
import BC from 'miniearth/bc-base'
import BcCore from 'miniearth/bc-core'
import BcChart from 'miniearth/bc-chart'
import BcMapv from 'miniearth/bc-mapv'
import 'miniearth/bc-core/dist/bc.core.min.css'
```

`CDN`

[Resources](https://github.com/dvgis/bc-sdk/releases)

```html
<script src="https://cdn.jsdelivr.net/npm/miniearth/bc-sdk/dist/bc.base.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/miniearth/bc-sdk/dist/bc.core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/miniearth/bc-sdk/dist/bc.chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/miniearth/bc-sdk/dist/bc.mapv.min.js"></script>
<link
  href="https://cdn.jsdelivr.net/npm/miniearth/bc-sdk/dist/bc.core.min.css"
  rel="stylesheet"
  type="text/css"
/>
```

```
Please put the resources in the project root directory libs/bc-sdk, if you put it in other directory, the framework will not run properly.
```

## Configuration

> The configuration is mainly used in the `NPM / YARN` way

Since the BC framework sets `CESIUM_BASE_URL` to `JSON.stringify('. /libs/bc-sdk/resources/')`, you need to copy `Cesium` static resource files: `Assets`, `Workers`, `ThirdParty` to the `libs/bc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly.

`Webpack`

[Project Template](https://github.com/cavencj/bc-vue-app)

```js
// webpack.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const dvgisDist = './node_modules/miniearth'

module.exports = {
  plugins: [
    new CopyWebpackPlugin([
      {
        from: path.join(dvgisDist, 'bc-sdk/dist/resources'),
        to: 'libs/bc-sdk/resources',
      },
    ]),
  ],
}
```

`Vue2.x`

[Project Template](https://github.com/dvgis/bc-vue)

```js
// vue.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const dvgisDist = './node_modules/miniearth'
module.exports = {
  chainWebpack: (config) => {
    config.plugin('copy').use(CopywebpackPlugin, [
      [
        {
          from: path.join(dvgisDist, 'bc-sdk/dist/resources'),
          to: 'libs/bc-sdk/resources',
        },
      ],
    ])
  },
}
```

`Vue3.x`

[Project Template](https://github.com/dvgis/bc-vue-next)

```js
// vue.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const dvgisDist = './node_modules/miniearth'
module.exports = {
  chainWebpack: (config) => {
    config.plugin('copy').use(CopywebpackPlugin, [
      {
        patterns: [
          {
            from: path.join(dvgisDist, 'bc-sdk/dist/resources'),
            to: path.join(__dirname, 'dist', 'libs/bc-sdk/resources'),
          },
        ],
      },
    ])
  },
}
```


## Start

```js
global.BC = BC
BC.use(BcCore) // node
BC.ready(() => {
  let viewer = new BC.Viewer(divId) // divId is the Id attribute value of a div node. If it is not passed in, the 3D scene cannot be initialized
})
```

## Demo

|  ![picture](http://bc.dvgis.cn/examples/images/baselayer/baidu.png?v=2) | ![picture](http://bc.dvgis.cn/examples/images/baselayer/tdt.png?v=1) | ![picture](http://bc.dvgis.cn/examples/images/baselayer/arcgis.png?v=2) | ![picture](http://bc.dvgis.cn/examples/images/mini-scene/china.gif) |
|  :-----------------------------------------------------------: | :-----------------------------------------------------------: | :------------------------------------------------------------------: | :--------------------------------------------------------------: |
|  ![picture](http://bc.dvgis.cn/examples/images/mini-scene/dfmz.gif) | ![picture](http://bc.dvgis.cn/examples/images/mini-scene/factory.gif?v=1) | ![picture](http://bc.dvgis.cn/examples/images/layer/cluster_circle.gif) | ![picture](http://bc.dvgis.cn/examples/images/model/shp_custom_shader.gif) |
|  ![picture](http://bc.dvgis.cn/examples/images/overlay/polyline_image_trail.gif) | ![picture](http://bc.dvgis.cn/examples/images/overlay/wall_trail.gif?v=1) | ![picture](http://bc.dvgis.cn/examples/images/overlay/water.gif?v=2)  |  ![picture](http://bc.dvgis.cn/examples/images/overlay/plot-overlay.png)   |

[More>>](http://bc.dvgis.cn/#/examples)

## Ecosystem

|  Module | Status | Description | 
|  :------ | :------: | :------ |
|  [bc-chart](https://github.com/dvgis/bc-chart) | <img src="https://img.shields.io/npm/v/miniearth/bc-chart?logo=npm" /> | bc chart module for adding ECharts functionality in 3d scenes | 
|  [bc-mapv](https://github.com/dvgis/bc-mapv) | <img src="https://img.shields.io/npm/v/miniearth/bc-mapv?logo=npm" /> | bc big-data module for adding MAPV functions in 3d scenes |  
|  [bc-ui](https://github.com/dvgis/bc-ui) | <img src="https://img.shields.io/npm/v/miniearth/bc-ui?logo=npm" /> | bc components for Vue2.x | 
|  bc-ui-next | <img src="https://img.shields.io/npm/v/miniearth/bc-ui-next?logo=npm" /> | bc components for Vue3.x |

## Copyright

```warning
1. The framework is a basic platform, completely open source, which can be modified and reconstructed by any individual or institution without our authorization.
2. We are not responsible for any problems arising from the modification of the framework by individuals and organizations.
3. Some industrial plug-ins and tools will be added in the later stage, and the code will be open source appropriately.
4. The package released by us may be used permanently and free of charge by any person or organization subject to:
  1) complete package reference;
  2) reserve this copyright information in the console output
We reserve the right of final interpretation of this copyright information.
```

## Support

> if bc-sdk can bring benefits to you, please support it ~

<p>
<a href="https://www.paypal.com/paypalme/cavencj" target="_blank">
<img src="https://www.paypalobjects.com/images/shared/paypal-logo-129x32.svg" style="margin-top:10px" />
</a>
</p>

## Thanks
