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.

пре 2 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. ---
  2. sidebar: auto
  3. ---
  4. # Tutorials 🌎
  5. ## Introduction
  6. ### What is DC-SDK
  7. **_`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.
  8. ### What DC-SDK can do
  9. - `Two and three dimensional scene visualization`
  10. Support seamless switching between two and three dimensions, a set of code with multiple styles. The framework allows you to add maps, all kinds of vector data and models to the scene, making the scene closer to the real world.
  11. - `Map management of major manufacturers`
  12. Support Gaode, Baidu, Tencent, Sky Map, Google, MapBox and other manufacturers' map access, for some domestic maps can be offset processing.
  13. - `Uniform management of various types of data`
  14. The framework provides overlays corresponding to the layer management operation, through the layer can be targeted screening and overall control of the overlay.
  15. - `All kinds of data animation and special effects`
  16. Provide lines, surfaces, circles, models and other material effects and detailed animation, so that the material of the overlay can change over time.
  17. - `Special effects for post 3D scenes`
  18. Provide weather functions such as clouds, rain, snow, fog, etc. and some animations including surround around point, surround around ground, scan circle (radar), video fusion, floodlight, night vision, etc. and post effects.
  19. - `Path roaming and fixed-point cruising`
  20. Provide automatic roaming and cruising function according to the set route, which is convenient to locate and view multiple key areas.
  21. - `Spatial analysis capability`
  22. Provide various measurement functions such as distance, area and height, as well as 3D scene analysis functions such as view-shed and through-view.
  23. - `Compatible with third-party map tool libraries`
  24. Provide functional access to turf, heatmap, mapv, echarts and other common visualization libraries and open source libraries to avoid repeated learning and cost investment by users.
  25. ## Preparation
  26. `Running Env`
  27. DC-SDK is a development platform that relies on [`WebGL`](#webgl), which requires a `discrete graphics card` and a browser that supports `WebGL` on the development or running terminal. Recommended to use **_Chrome_**、**_Firefox_**
  28. `Static File Server`
  29. Static file servers are mainly used to publish map tiles, terrain, model data and other data services, such as: **_Apache Http Sever_**、**_Tomcat_** 、**_Nginx_**. Recommended to use **_Nginx_**
  30. `Hardware Configuration`
  31. > Hardware configuration description, the following hardware configuration is recommended for 3D scene viewing and development.
  32. <table style="width:100%">
  33. <tr><td colspan=3 style="text-align:center;background:#3eaf7c;">PC Side</td></tr>
  34. <tr><td>Project</td><td>Standard</td><td>Recommended</td></tr>
  35. <tr><td>CPU</td><td>2.6GHz 64-bit processor</td><td>3.0GHz 64-bit processor</td></tr>
  36. <tr><td>RAM</td><td>8GB</td><td>32GB</td></tr>
  37. <tr><td>Graphics card model</td><td>NVIDIA GTX 1660 (or equivalent)</td><td>NVIDIA RTX 2080 (or equivalent)</td></tr>
  38. <tr><td>Video Memory</td><td>4GB</td><td>16G</td></tr>
  39. <tr><td>Optimal Resolution</td><td>FHD - 1920 * 1080</td><td>4K QFHD - 3840 * 2160</td></tr>
  40. <tr><td>Operating System</td><td colspan=2>64-bit Windows 8/10/11 or 64-bit Linux desktop distribution, or macOS 10.12.1 or higher</td></tr>
  41. <tr><td>Browser</td><td colspan=2>Google Chrome or Firefox latest version</td></tr>
  42. </table
  43. <table style="width:70%">
  44. <tr><td colspan=3 style="text-align:center;background:#3eaf7c;">Mobile devices</td></tr>
  45. <tr><td width="16%">Platform</td><td>Android</td><td>Apple</td></tr>
  46. <tr><td>Devices</td><td>Mobile devices compatible with Android OS, 2019 and up for mid-range and high-end models</td><td>IPhone 11 and above, IPad Pro 2019 and above</td></tr>
  47. <tr><td>OS</td><td>Android</td><td>IOS or IPadOS</td></tr>
  48. <tr><td>Browser</td><td colspan=2>WebGL-enabled browsers</td></tr>
  49. </table>
  50. ### Installation
  51. `NPM / YARN` **_`(Recommend)`_**
  52. Installing with NPM or YARN is recommended and it works seamlessly with webpack.
  53. ```shell
  54. yarn add @dvgis/dc-sdk
  55. -------------------------
  56. npm install @dvgis/dc-sdk
  57. ```
  58. ```js
  59. import DC from '@dvgis/dc-sdk/dist/dc.base.min'
  60. import DcCore from '@dvgis/dc-sdk/dist/dc.core.min'
  61. import DcChart from '@dvgis/dc-sdk/dist/dc.chart.min'
  62. import DcMapv from '@dvgis/dc-sdk/dist/dc.mapv.min'
  63. import '@dvgis/dc-sdk/dist/dc.core.min.css'
  64. ```
  65. `NPM / YARN` **_`(On-demand)`_**
  66. ```shell
  67. yarn add @dvgis/dc-base
  68. yarn add @dvgis/dc-core
  69. yarn add @dvgis/dc-chart
  70. yarn add @dvgis/dc-mapv
  71. -------------------------
  72. npm install @dvgis/dc-base
  73. npm install @dvgis/dc-core
  74. npm install @dvgis/dc-chart
  75. npm install @dvgis/dc-mapv
  76. ```
  77. ```js
  78. import DC from '@dvgis/dc-base'
  79. import DcCore from '@dvgis/dc-core'
  80. import DcChart from '@dvgis/dc-chart'
  81. import DcMapv from '@dvgis/dc-mapv'
  82. import '@dvgis/dc-core/dist/dc.core.min.css'
  83. ```
  84. `CDN`
  85. [Resources](https://github.com/dvgis/dc-sdk/releases)
  86. ```html
  87. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.base.min.js"></script>
  88. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.core.min.js"></script>
  89. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.chart.min.js"></script>
  90. <script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.mapv.min.js"></script>
  91. <link
  92. href="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.core.min.css"
  93. rel="stylesheet"
  94. type="text/css"
  95. />
  96. ```
  97. ::: danger
  98. 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.
  99. :::
  100. ### Configuration
  101. Since the DC framework sets `CESIUM_BASE_URL` to `. /libs/dc-sdk/resources/`, you need to copy `Cesium` related static resources files: `Assets`, `Workers`, `ThirdParty` to `libs/dc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly. You can also use `DC.baseUrl` to set the static resource base related to `Cesium`.
  102. > `NPM / YARN`
  103. `Webpack` [Project Template](https://github.com/cavencj/dc-vue-app)
  104. ```js
  105. // webpack.config.js
  106. const path = require('path')
  107. const CopywebpackPlugin = require('copy-webpack-plugin')
  108. const dvgisDist = './node_modules/@dvgis'
  109. module.exports = {
  110. plugins: [
  111. new CopyWebpackPlugin([
  112. {
  113. from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
  114. to: 'libs/dc-sdk/resources',
  115. },
  116. ]),
  117. ],
  118. }
  119. ```
  120. `Vue2.x` [Project Template](https://github.com/dvgis/dc-vue)
  121. ```js
  122. // vue.config.js
  123. const path = require('path')
  124. const CopywebpackPlugin = require('copy-webpack-plugin')
  125. const dvgisDist = './node_modules/@dvgis'
  126. module.exports = {
  127. chainWebpack: (config) => {
  128. config.plugin('copy').use(CopywebpackPlugin, [
  129. [
  130. {
  131. from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
  132. to: 'libs/dc-sdk/resources',
  133. },
  134. ],
  135. ])
  136. },
  137. }
  138. ```
  139. `Vue3.x` [Project Template](https://github.com/dvgis/dc-vue-next)
  140. ```js
  141. // vue.config.js
  142. const path = require('path')
  143. const CopywebpackPlugin = require('copy-webpack-plugin')
  144. const dvgisDist = './node_modules/@dvgis'
  145. module.exports = {
  146. chainWebpack: (config) => {
  147. config.plugin('copy').use(CopywebpackPlugin, [
  148. {
  149. patterns: [
  150. {
  151. from: path.join(dvgisDist, 'dc-sdk/dist/resources'),
  152. to: path.join(__dirname, 'dist', 'libs/dc-sdk/resources'),
  153. },
  154. ],
  155. },
  156. ])
  157. },
  158. }
  159. ```
  160. `CDN`
  161. Download the current version of the resource file directly through the [website](https://github.com/dvgis/dc-sdk/releases)
  162. ### Code hinting
  163. By installing the code hinting toolkit, you can prompt and automate the framework's internal interfaces during development to better improve development efficiency
  164. ```shell
  165. npm install @dvgis/types -D
  166. -------------------------
  167. yarn add @dvgis/types -D
  168. ```
  169. ### Get Started
  170. > [Installation](#installation) and [Configuration](#configuration), then you can develop your own **_`WebGis`_** application
  171. `Create container`
  172. ```html
  173. <div class="viewer-container" id="viewer-container"></div>
  174. <!-- The id attribute must be assigned a value, otherwise the 3D scene cannot be created -->
  175. ```
  176. `Create viewer`
  177. ```js
  178. global.DC = DC
  179. DC.use(DcCore) // install core package
  180. DC.use(DcChart) // install chart package
  181. DC.use(DcMapv) // install mapv package
  182. //The above code is not needed when using CDN method, it will be installed automatically.
  183. DC.ready(() => {
  184. let viewer = new DC.Viewer('viewer-container')
  185. })
  186. ```
  187. `Result` [more](http://dc.dvgis.cn/#/examples)
  188. <iframe src="https://dc.dvgis.cn/#/editor?type=info&example=start" frameborder="0" height="500px" width="100%" >
  189. </iframe>
  190. ## Structure
  191. > DC structure, it is recommended to be familiar with the overall structure diagram before use so that you can use it quickly.[view image](http://dc.dvgis.cn/examples/images/base/dc2.x.png)
  192. <img src="http://dc.dvgis.cn/examples/images/base/dc2.x.png" style="width:100%;height:800px">
  193. ## Technology
  194. ### WebGL
  195. WebGL is a JavaScript API for rendering interactive 2D and 3D graphics in any compatible web browser without the use of plug-ins. WebGL is fully integrated into all web standards of the browser and allows for the use of GPU acceleration of image processing and effects as part of the web Canvas. WebGL elements can be added to other HTML elements and blended with other parts of the web page or web page background. WebGL programs consist of handles written in JavaScript and shader code written in OpenGL Shading Language (**`GLSL`**).
  196. ### 3D Data Format
  197. **`glb/gltf`**
  198. GLTF stands for Graphics Language Transmission Format. This cross-platform format has become the standard for 3D objects on the Web. It was defined by Khronos, the 3D graphics standards organization behind OpenGL and Vulkan, making GLTF essentially a JPG format for 3D models: a common standard for Web exports.
  199. **`OSGB`**
  200. Open Scene Gragh Binary is the full name of OSGB, where Binary means binary. These data files are fragmented, numerous, and have large high-level pyramid files, making it difficult to form an efficient and standard web publishing scheme, and thus impossible to share data between different geographic regions and departments.
  201. **`3dtiles`**
  202. 3D Tiles is an open specification for streaming large scale heterogeneous 3D geospatial datasets. 3D Tiles data can be generated from shp, osgb (oblique photography), 3dmax, and other data.
  203. **`geojson`**
  204. GeoJSON is a format for encoding various geographic data structures, based on the Javascript object representation of geospatial information data interchange format.
  205. GeoJSON objects can represent geometry, features or feature collections.GeoJSON supports the following geometry types: point, line, surface, multipoint, polyline, polysurface and geometry collections. A feature in GeoJSON contains a geometric object and other attributes, and a feature set represents a set of features.
  206. **`kml/czml`**
  207. KML/CZML is a JSON format data describing time-dynamic graphic scenes, which describes lines, points, billboards (markers), models, and other graphic primitives, and specifies how they change over time.
  208. :::tip
  209. Data conversion can be done with the help of [CesiumLab](http://www.cesiumlab.com) or some other conversion tools.[view image](http://dc.dvgis.cn/examples/images/base/data_transform.png)
  210. :::
  211. <img src="http://dc.dvgis.cn/examples/images/base/data_transform.png" style="width:100%;height:500px">
  212. ### Coordinates
  213. **`World coordinates (Cartesian3)`**
  214. Cartesian coordinates, the coordinates of a point in a right-angle coordinate system in space with the center of the ellipsoid as the origin.
  215. **`Geographic coordinates(Cartographic)`**
  216. Geographical coordinate system with the origin of the coordinates at the center of mass of the ellipsoid.
  217. Longitude: The two-sided angle between the geodetic meridian plane and the prime meridian plane at a point on the reference ellipsoid. East positive and west negative.
  218. Latitude : The angle between the normal and the equatorial plane at a point on the reference ellipsoid. North positive and south negative.
  219. **`Position`**
  220. The geographic coordinate system with the origin of the coordinates at the center of mass of the ellipsoid. `DC extension`
  221. Longitude: The angle between the geodetic meridian plane and the prime meridian plane at a point on the reference ellipsoid. East is positive and west is negative.
  222. Latitude : The angle between the normal and the equatorial plane at a point on the reference ellipsoid. North is positive and south is negative.
  223. Altitude : The distance from the surface of the Earth.
  224. **`Screen coordinates (Cartesian2)`**
  225. Browser window coordinates or windowPosition in mouse events
  226. :::tip
  227. The framework can use `DC.T` for all kinds of coordinate conversions
  228. :::
  229. ### CRS
  230. `WGS84`
  231. An internationally adopted geocentric coordinate system. The coordinate origin is the center of mass of the Earth, and the Z-axis of its geocentric space-rectangular coordinate system points to the direction of the agreed Earth pole (CTP) defined by BIH (International Time Service) 1984.O. The X-axis points to the intersection of the zero meridian plane of BIH 1984.0 and the CTP equator, and the Y-axis is perpendicular to the Z-axis and X-axis to form a right-handed coordinate system, which is called the 1984 World Geodetic Coordinate System.
  232. `CGCS2000`
  233. 2000 China Geodetic Coordinate System 2000 (CGCS2000), also called 2000 National Geodetic Coordinate System, is a new generation of geodetic coordinate system in China, which has been officially implemented in China at the beginning of 21st century. It is not much different from `WGS84`, which is used in domestic sky maps.
  234. `GCJ02`
  235. GCJ-02 is a coordinate system for GIS developed by the State Bureau of Surveying and Mapping of China (G for Guojia State, C for Cehui Surveying and Mapping, and J for Ju Bureau). It is actually an artificial bias processing of the real coordinate system, which encrypts the real coordinates into false coordinates according to a special algorithm, and this bias is not a linear bias, so the bias will be different from place to place. The encrypted coordinates are often called "Mars coordinate system".
  236. `BD09`
  237. BD09 latitude and longitude projection belongs to Baidu coordinate system, which is based on the standard latitude and longitude with GCJ-02 bias and Baidu's own bias algorithm, that is, it is biased twice on top of the standard latitude and longitude.
  238. [ref](http://www.rivermap.cn/docs/show-1829.html)
  239. :::tip
  240. The framework can use `DC.CoordTransform` for all kinds of coordinate system conversion
  241. :::
  242. ## Support
  243. > If dc-sdk can bring you benefits, please support it!
  244. <p style="display:flex">
  245. <a href="https://www.paypal.com/paypalme/cavencj" target="_blank">
  246. <img src="https://www.paypalobjects.com/images/shared/paypal-logo-129x32.svg" style="margin-top:10px;margin-right:20px" />
  247. </a>
  248. <img src="http://dc.dvgis.cn/examples/images/base/sponsor.jpg?v=2" title="数字视觉"/>
  249. </p>