Cesium source code compilation process

Cesium source code compilation process

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

  1. 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.

  2. Install npm dependencies;

    npm install
    
  3. Execute the command to compile;

    npm run release
    

3. Reference link

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.

2021-07-18_222104.png

One of the extended functions is the rendering of sensor graphics,

2021-07-18_233744.pngIn 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-sensoryou 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.jscesium-sensor.jscesium-sensor.jsCesium.CzmlDataSource.updaterscesium-sensor.js

The source code used can be obtained on Gitee , just put the code file in the corresponding directory, and then npm run releasecompile 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.

Guess you like

Origin blog.csdn.net/wml00000/article/details/118885766