美文网首页
cesium 同步多个地图

cesium 同步多个地图

作者: haibalai | 来源:发表于2022-03-02 12:35 被阅读0次

我们经常需要对多个地图进行联动 分别展示,

对于cesium 的多屏联动 我们用typescript 实现

```javascript

export class LinkageMap{

private viewers:Array;

private focusIndex=0;

constructor(_viewers:Array){

super();

this.viewers = _viewers;

}

sync(focusIndex=0){

this.focusIndex= focusIndex;

this.viewers[0].scene.postRender.addEventListener(this.syncMapEventHandle, this);

for(let index =0;index {

this.focusIndex = index;

}

}

}

cancelSync(){

this.viewers[0].scene.postRender.removeEventListener(this.syncMapEventHandle, this);

for(let index =0;index

const viewer= this.viewers[index];

viewer.container.onmouseenter = null;

}

}

private syncMapEventHandle(){

 更多参考 https://xiaozhuanlan.com/topic/3879512640

相关文章

网友评论

      本文标题:cesium 同步多个地图

      本文链接:https://www.haomeiwen.com/subject/msisrrtx.html