当前位置:   article > 正文

vue+openlayers实现运动轨迹中遇到的问题_openlayers中vectorcontext 使用时总是报错怎么解决

openlayers中vectorcontext 使用时总是报错怎么解决
  moveFeature(event){
    console.log(event)
    let time = event.frameState.time;
    this.distance = (this.distance + (this.speed * (time - this.lastTime)) / 1000) % 1;
    this.lastTime = time;
    const currentCoordinate = this.route.getCoordinateAt(
      this.distance > 1 ? 2 - this.distance : this.distance
    );
    this.geometryMove.setCoordinates(currentCoordinate);
    const vectorContext = getVectorContext(e);
    vectorContext.setStyle(this.styles.featureMove);
    vectorContext.drawGeometry(this.geometryMove);
    this.map.render();
  },
  startAnimation(){
    this.lastTime = Date.now();
    this.lineLayer.on("postrender",this.moveFeature);
    this.featureMove.setGeometry(null);
  }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

这段代码是在网上看到的,借鉴了一下
运行之后moveFeature这个函数里面的event是undefined不知道怎么回事

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/155754
推荐阅读
相关标签
  

闽ICP备14008679号