plugins/weather/src/api/weather.js
/**
   * initialize particle systems for Cesium Map
   */
initialize particle systems for Cesium Map
initialize particle systems for Cesium Map
initialize() {
    const activeMap = framework.getActiveMap();
    if (activeMap instanceof vcs.vcm.maps.Cesium) {
      this.scene = activeMap.getScene();
      this.clock = activeMap.getCesiumWidget().clock;
      const clockViewModel = new Cesium.ClockViewModel(this.clock);
      this.animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
      this.scene.globe.depthTestAgainstTerrain = true;
      this.staticHeight(this.scene.camera.position, this.cloudHeight);
      modelMatrix = new Cesium.Matrix4.fromTranslation(this.position);
      const snowParticleSize = this.scene.drawingBufferWidth / 100;
      this.snowSystem = new Cesium.ParticleSystem({
        show: false,
        modelMatrix,
        minimumSpeed: -1.0,
        maximumSpeed: 0.0,
        lifetime: 15.0,
        emitter: new Cesium.SphereEmitter(this.radius),
        startScale: 0.5,
        endScale: 1.0,
        image: 'assets/snowflake_particle.png',
        startColor: Cesium.Color.WHITE.withAlpha(0.0),
        endColor: Cesium.Color.WHITE.withAlpha(1.0),
        minimumImageSize: new Cesium.Cartesian2(snowParticleSize, snowParticleSize),
        maximumImageSize: new Cesium.Cartesian2(snowParticleSize * 2.0, snowParticleSize * 2.0),
        updateCallback: this.snowUpdateFunction.bind(this),
      });
      this.scene.primitives.add(this.snowSystem);
      const rainParticleSize = this.scene.drawingBufferWidth / 80.0;
      this.rainSystem = new Cesium.ParticleSystem({
        show: false,
        modelMatrix,
        speed: -1.0,
        lifetime: 15.0,
        emitter: new Cesium.SphereEmitter(this.radius),
        startScale: 1.0,
        endScale: 0.0,
        image: 'assets/circular_particle.png',
        startColor: new Cesium.Color(0.27, 0.5, 0.70, 0.0),
        endColor: new Cesium.Color(0.27, 0.5, 0.70, 0.98),
        imageSize: new Cesium.Cartesian2(rainParticleSize, rainParticleSize * 2.0),
        updateCallback: this.rainUpdateFunction.bind(this),
      });
      this.scene.primitives.add(this.rainSystem);
    }
  }
initialize ( ) { const activeMap = framework . getActiveMap ( ) ; if ( activeMap instanceof vcs . vcm . maps . Cesium ) { this . scene = activeMap . getScene ( ) ; this . clock = activeMap . getCesiumWidget ( ) . clock ; const clockViewModel = new Cesium . ClockViewModel ( this . clock ) ; this . animationViewModel = new Cesium . AnimationViewModel ( clockViewModel ) ; this . scene . globe . depthTestAgainstTerrain = true ; this . staticHeight ( this . scene . camera . position , this . cloudHeight ) ; modelMatrix = new Cesium . Matrix4 . fromTranslation ( this . position ) ; const snowParticleSize = this . scene . drawingBufferWidth / 100 ; this . snowSystem = new Cesium . ParticleSystem ( { show : false , modelMatrix , minimumSpeed : - 1.0 , maximumSpeed : 0.0 , lifetime : 15.0 , emitter : new Cesium . SphereEmitter ( this . radius ) , startScale : 0.5 , endScale : 1.0 , image : 'assets/snowflake_particle.png' , startColor : Cesium . Color . WHITE . withAlpha ( 0.0 ) , endColor : Cesium . Color . WHITE . withAlpha ( 1.0 ) , minimumImageSize : new Cesium . Cartesian2 ( snowParticleSize , snowParticleSize ) , maximumImageSize : new Cesium . Cartesian2 ( snowParticleSize * 2.0 , snowParticleSize * 2.0 ) , updateCallback : this . snowUpdateFunction . bind ( this ) , } ) ; this . scene . primitives . add ( this . snowSystem ) ; const rainParticleSize = this . scene . drawingBufferWidth / 80.0 ; this . rainSystem = new Cesium . ParticleSystem ( { show : false , modelMatrix , speed : - 1.0 , lifetime : 15.0 , emitter : new Cesium . SphereEmitter ( this . radius ) , startScale : 1.0 , endScale : 0.0 , image : 'assets/circular_particle.png' , startColor : new Cesium . Color ( 0.27 , 0.5 , 0.70 , 0.0 ) , endColor : new Cesium . Color ( 0.27 , 0.5 , 0.70 , 0.98 ) , imageSize : new Cesium . Cartesian2 ( rainParticleSize , rainParticleSize * 2.0 ) , updateCallback : this . rainUpdateFunction . bind ( this ) , } ) ; this . scene . primitives . add ( this . rainSystem ) ; } }
initialize particle systems for Cesium Map
initialize particle systems for Cesium Map
// set position of model matrix // snowSystem properties // rainSystem properties