You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 7.6KB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. # DC-SDK
  2. <p>
  3. <img src="https://img.shields.io/github/workflow/status/dvgis/dc-sdk/build"/>
  4. <img src="https://img.shields.io/badge/license-Apache%202-blue"/>
  5. <a href="https://www.npmjs.com/package/@dvgis/dc-sdk" target="_blank">
  6. <img src="https://img.shields.io/npm/v/@dvgis/dc-sdk?color=orange&logo=npm" />
  7. </a>
  8. <a href="https://www.npmjs.com/package/@dvgis/dc-sdk" target="_blank">
  9. <img src="https://img.shields.io/npm/dt/@dvgis/dc-sdk?logo=npm"/>
  10. </a>
  11. <a href="https://resource.dvgis.cn/dc-docs/v2.x" target="_blank">
  12. <img src="https://img.shields.io/badge/docs-online-yellow.svg"/>
  13. </a>
  14. <a href="http://dc.dvgis.cn" target="_blank">
  15. <img src="https://img.shields.io/badge/demo-online-red.svg"/>
  16. </a>
  17. </p>
  18. **_`DC-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.
  19. ```warning
  20. Tips:This SDK is JS+GIS framework package. Developers need to have some front-end technology and GIS related technology
  21. ```
  22. ## Installation
  23. `NPM / YARN` **_`(Recommend)`_**
  24. Installing with NPM or YARN is recommended and it works seamlessly with webpack.
  25. ```shell
  26. yarn add @dvgis/dc-sdk
  27. -------------------------
  28. npm install @dvgis/dc-sdk
  29. ```
  30. ```js
  31. import DC from '@dvgis/dc-sdk/dist/dc.base.min'
  32. import DcCore from '@dvgis/dc-sdk/dist/dc.core.min'
  33. import DcChart from '@dvgis/dc-sdk/dist/dc.chart.min'
  34. import DcMapv from '@dvgis/dc-sdk/dist/dc.mapv.min'
  35. import '@dvgis/dc-sdk/dist/dc.core.min.css'
  36. ```
  37. `NPM / YARN` **_`(On-demand)`_**
  38. ```shell
  39. yarn add @dvgis/dc-base
  40. yarn add @dvgis/dc-core
  41. yarn add @dvgis/dc-chart
  42. yarn add @dvgis/dc-mapv
  43. -------------------------
  44. npm install @dvgis/dc-base
  45. npm install @dvgis/dc-core
  46. npm install @dvgis/dc-chart
  47. npm install @dvgis/dc-mapv
  48. ```
  49. ```js
  50. import DC from '@dvgis/dc-base'
  51. import DcCore from '@dvgis/dc-core'
  52. import DcChart from '@dvgis/dc-chart'
  53. import DcMapv from '@dvgis/dc-mapv'
  54. import '@dvgis/dc-core/dist/dc.core.min.css'
  55. ```
  56. `CDN`
  57. [Resources](https://github.com/dvgis/dc-sdk/releases)
  58. ```html
  59. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.base.min.js"></script>
  60. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.core.min.js"></script>
  61. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.chart.min.js"></script>
  62. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.mapv.min.js"></script>
  63. <link
  64. href="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.core.min.css"
  65. rel="stylesheet"
  66. type="text/css"
  67. />
  68. ```
  69. ```
  70. Please put the resources in the project root directory libs/dc-sdk, if you put it in other directory, the framework will not run properly.
  71. ```
  72. ## Configuration
  73. > The configuration is mainly used in the `NPM / YARN` way
  74. Since the DC framework sets `CESIUM_BASE_URL` to `JSON.stringify('. /libs/dc-sdk/resources/')`, you need to copy `Cesium` static resource files: `Assets`, `Workers`, `ThirdParty` to the `libs/dc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly.
  75. `Webpack`
  76. [Project Template](https://github.com/cavencj/dc-vue-app)
  77. ```js
  78. // webpack.config.js
  79. const path = require('path')
  80. const CopywebpackPlugin = require('copy-webpack-plugin')
  81. const dvgisDist = './node_modules/@dvgis'
  82. module.exports = {
  83. plugins: [
  84. new CopyWebpackPlugin([
  85. {
  86. from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
  87. to: 'libs/dc-sdk/resources',
  88. },
  89. ]),
  90. ],
  91. }
  92. ```
  93. `Vue2.x`
  94. [Project Template](https://github.com/dvgis/dc-vue)
  95. ```js
  96. // vue.config.js
  97. const path = require('path')
  98. const CopywebpackPlugin = require('copy-webpack-plugin')
  99. const dvgisDist = './node_modules/@dvgis'
  100. module.exports = {
  101. chainWebpack: (config) => {
  102. config.plugin('copy').use(CopywebpackPlugin, [
  103. [
  104. {
  105. from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
  106. to: 'libs/dc-sdk/resources',
  107. },
  108. ],
  109. ])
  110. },
  111. }
  112. ```
  113. `Vue3.x`
  114. [Project Template](https://github.com/dvgis/dc-vue-next)
  115. ```js
  116. // vue.config.js
  117. const path = require('path')
  118. const CopywebpackPlugin = require('copy-webpack-plugin')
  119. const dvgisDist = './node_modules/@dvgis'
  120. module.exports = {
  121. chainWebpack: (config) => {
  122. config.plugin('copy').use(CopywebpackPlugin, [
  123. {
  124. patterns: [
  125. {
  126. from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
  127. to: path.join(__dirname, 'dist', 'libs/dc-sdk/resources'),
  128. },
  129. ],
  130. },
  131. ])
  132. },
  133. }
  134. ```
  135. ## Start
  136. ```js
  137. global.DC = DC
  138. DC.use(DcCore) // node
  139. DC.ready(() => {
  140. let viewer = new DC.Viewer(divId) // divId is the Id attribute value of a div node. If it is not passed in, the 3D scene cannot be initialized
  141. })
  142. ```
  143. ## Demo
  144. | ![picture](http://dc.dvgis.cn/examples/images/baselayer/baidu.png?v=3) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/tdt.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/arcgis.png?v=3) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/china.gif) |
  145. | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :------------------------------------------------------------------: | :--------------------------------------------------------------: |
  146. | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/dfmz.gif) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/factory.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/layer/cluster_circle.gif) | ![picture](http://dc.dvgis.cn/examples/images/model/shp_custom_shader.gif) |
  147. | ![picture](http://dc.dvgis.cn/examples/images/overlay/polyline_image_trail.gif) | ![picture](http://dc.dvgis.cn/examples/images/overlay/wall_trail.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/overlay/water.gif?v=2) | ![picture](http://dc.dvgis.cn/examples/images/overlay/plot-overlay.png?v=3) |
  148. [More>>](http://dc.dvgis.cn/#/examples)
  149. ## Ecosystem
  150. | Module | Status | Description |
  151. | :------ | :------: | :------ |
  152. | [dc-chart](https://github.com/dvgis/dc-chart) | <img src="https://img.shields.io/npm/v/@dvgis/dc-chart?logo=npm" /> | dc chart module for adding ECharts functionality in 3d scenes |
  153. | [dc-mapv](https://github.com/dvgis/dc-mapv) | <img src="https://img.shields.io/npm/v/@dvgis/dc-mapv?logo=npm" /> | dc big-data module for adding MAPV functions in 3d scenes |
  154. | [dc-ui](https://github.com/dvgis/dc-ui) | <img src="https://img.shields.io/npm/v/@dvgis/dc-ui?logo=npm" /> | dc components for Vue2.x |
  155. | dc-ui-next | <img src="https://img.shields.io/npm/v/@dvgis/dc-ui-next?logo=npm" /> | dc components for Vue3.x |
  156. ## Copyright
  157. ```warning
  158. 1. The framework is a basic platform, completely open source, which can be modified and reconstructed by any individual or institution without our authorization.
  159. 2. We are not responsible for any problems arising from the modification of the framework by individuals and organizations.
  160. 3. Some industrial plug-ins and tools will be added in the later stage, and the code will be open source appropriately.
  161. 4. The package released by us may be used permanently and free of charge by any person or organization subject to:
  162. 1) complete package reference;
  163. 2) reserve this copyright information in the console output
  164. We reserve the right of final interpretation of this copyright information.
  165. ```
  166. ## Support
  167. > if dc-sdk can bring benefits to you, please support it ~
  168. <p>
  169. <a href="https://www.paypal.com/paypalme/cavencj" target="_blank">
  170. <img src="https://www.paypalobjects.com/images/shared/paypal-logo-129x32.svg" style="margin-top:10px" />
  171. </a>
  172. </p>
  173. ## Thanks