# dc-sdk **Repository Path**: xujunyf917/dc-sdk ## Basic Information - **Project Name**: dc-sdk - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-07 - **Last Updated**: 2023-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DC-SDK
[**🇨🇳 中文**](./README_zh.md) | [**🇬🇧English**](./README.md) > `DC-SDK` 是基于开源项目 `Cesium` 进行二次开发的二三维一体的 `WebGis` 应用框架,该框架优化了部分 `Cesium` 的使用方式和增添一些通用功能,旨在为开发者快速构建 `WebGis` 应用。 ```warning Tips:本框架是 JS+GIS 的框架包。开发者需要有一定的前端技术和 GIS 相关技术 ``` ## 运行示例 ```shell yarn run build yarn run server ``` ## 安装 `NPM / YARN` **_`(推荐使用)`_** NPM / YARN 的方式安装,它能更好地和 `webpack` 打包工具配合使用。 ```shell yarn add @dvgis/dc-sdk ------------------------- npm install @dvgis/dc-sdk ``` ```js import * as DC from '@dvgis/dc-sdk/' import '@dvgis/dc-sdk/dist/dc.min.css' ``` `CDN` [Resources 下载链接](https://github.com/dvgis/dc-sdk/releases) ```html ``` ``` 请将 resources 放置工程根目录 libs/dc-sdk 下,如果放置到其他目录下,框架将无法正常运行 ``` ## 配置 > 配置主要用于 `NPM / YARN` 的方式 由于框架将Cesium静态资源默认路径设置为 `./libs/dc-sdk/resources/`,这样需将 `Cesium` 相关的静态资源文件: `Assets`、`Workers` 、`ThirdParty` 复制到工程的 `libs/dc-sdk/resources` 目录下以保证三维场景能够正常呈现,也可通过全局函数进行 `Cesium` 相关的静态资源路基设置 `Webpack` [工程模板](https://github.com/cavencj/dc-vue-app) ```js // webpack.config.js const path = require('path') const CopywebpackPlugin = require('copy-webpack-plugin') const dvgisDist = './node_modules/@dvgis' module.exports = { plugins: [ new CopyWebpackPlugin([ { from: path.join(dvgisDist, 'dc-sdk/dist/resources'), to: 'libs/dc-sdk/resources', }, ]), ], } ``` `Vue2.x` [工程模板](https://github.com/dvgis/dc-vue) ```js // vue.config.js const path = require('path') const CopywebpackPlugin = require('copy-webpack-plugin') const dvgisDist = './node_modules/@dvgis' module.exports = { // 其他配置 chainWebpack: (config) => { config.plugin('copy').use(CopywebpackPlugin, [ [ { from: path.join(dvgisDist, 'dc-sdk/dist/resources'), to: 'libs/dc-sdk/resources', }, ], ]) }, } ``` `Vue3.x` [工程模板](https://github.com/dvgis/dc-vue-next) ```js // vue.config.js const path = require('path') const CopywebpackPlugin = require('copy-webpack-plugin') const dvgisDist = './node_modules/@dvgis' module.exports = { // 其他配置 chainWebpack: (config) => { config.plugin('copy').use(CopywebpackPlugin, [ { patterns: [ { from: path.join(dvgisDist, 'dc-sdk/dist/resources'), to: path.join(__dirname, 'dist', 'libs/dc-sdk/resources'), }, ], }, ]) }, } ``` `vite` [Project Template](https://github.com/dvgis/dc-vite) ```js // vite.config.js import { defineConfig } from 'vite' import DC from '@dvgis/vite-plugin-dc' export default defineConfig({ plugins: [DC()], }) ``` ## 开始 ```js DC.ready().then(() => { let viewer = new DC.Viewer(divId) }) ``` ## 示例 |  |  |  |  | |:------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------:| |  |  |  |  | |  |  |  |  | [更多>>](http://dc.dvgis.cn/#/examples) ## 支持 > 如果dc-sdk能够给您带来效益,请支持一下呗~