arcgis 与 pixi.js 实现大数据量渲染 ( 二 )

对于pixi的容器选择 我最初选择的是PIXI 最常用的Container ,而且事件什么都好说 有pointdown 事件 pixi.js 能够支持点击事件
但是后面我发现 还有一个叫ParticleContainer 这个支持大数据量渲染 但是牺牲了很多东西 最多也就调整下位置 缩放之类的
但是带来的问题就是事件没有。。。。

首先我们先顶一下数据结构 其中renderer 就像arcgis 的symbol data 就是geometry集合

  • let option = {
  • renderer: {
  • type: "simple",
  • symbol: {
  • url: './static/images/排水户.svg',
  • scaleX: 1,
  • scaleY: 1,
  • }
  • },
  • data: [
  • {
  • geometry: [12697872.012783196, 2577456.5937789795],
  • attributes: {
  • name: "深圳"
  • }
  • },
  • {
  • geometry: [12956152.73135875, 4855356.473704897],
  • attributes: {
  • name: "北京"
  • }
  • },
  • ]
  • };

我们构建ParticleContainer 构建sprite 添加到粒子容器
```

  • let data = this.options.data;
  • let view = this.mapView
  •  
  • const texture = new PIXI.Texture.from(this.options.renderer.symbol.url);
  • const sprites = new PIXI.ParticleContainer(this.options.renderer.symbol.maxSize, {
  • scale: true,
  • position: true,
  • });
posted @ 2022-01-20 16:43  haibalai  阅读(149)  评论(0编辑  收藏  举报