Cesium source code compilation process
Article directory
1. Operating environment
NodeJS V12.12.0
Git
Note: There is no need to install gulp globally, the dependency is already included in devDependencies.
2. Main steps
-
Pull the code of the specified version on Github through Git;
- 以tag 1.70.1为例 git clone -b 1.70.1 https://github.com/CesiumGS/cesium.git
Note: It is not recommended to download the compressed package of Release directly. During the compilation process, an error will be reported that some files are missing, and the corresponding files need to be downloaded again, which is troublesome.
-
Install npm dependencies;
npm install
-
Execute the command to compile;
npm run release
3. Reference link
- Remember to compile the Cesium stepping record once
- Cesium source code compilation
- [cesium] satellite radar sensor, radar detection effect
4. Source code extension
Compiling only the source code does not make any sense. Understanding the process of compiling the source code is mainly to expand on the basis of the source code. Take the extension 传感器形状渲染
as an example.
Background introduction:
Cesium was originally an open source project initiated by AGI. In fact, it also has an extended version of Cesium ion SDK . The extended functions are not open source, and you need to contact their sales staff to purchase.
One of the extended functions is the rendering of sensor graphics,
In fact, AGI Company originally open-sourced the code for this function on GitHub. The original address is: https://github.com/AnalyticalGraphicsInc/cesium-sensors. Later, the warehouse disappeared for unknown reasons, but someone forked the warehouse in advance, and has been following along with it. The upgrade of Cesium is being maintained simultaneously, and cesium-sensor
you can find a lot by searching directly. If you use it, you can directly import it through tags <script>
, but because Cesium is introduced in the project through npm dependencies, when you import it, you find that there are indeed more content, but the rendering does not take effect. In the end, you can only try to compile the content in the source code. go.Cesium.js
cesium-sensor.js
cesium-sensor.js
Cesium.CzmlDataSource.updaters
cesium-sensor.js
The source code used can be obtained on Gitee , just put the code file in the corresponding directory, and then npm run release
compile it through the command.
Note: When citing Cesium in React, it actually refers to the files in the Source directory, so if you want to implement sensor rendering, you need to copy the files to the node_modules/cesium/Source folder.