From b3cb8b301528d08bdea3bd6bb4a8395662c263fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Barbeau?= Date: Wed, 4 Mar 2020 14:51:41 -0500 Subject: [PATCH] fix(layer): add tile-watcher to vectortile-layer (#595) * tile watcher added to vectortile layer * fix export network-ionic * remove networkionic import --- packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts | 5 +++++ packages/geo/src/lib/layer/utils/tile-watcher.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts b/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts index d950cca00e..836bdb7c8c 100644 --- a/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts +++ b/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts @@ -5,14 +5,19 @@ import { MVTDataSource } from '../../../datasource/shared/datasources/mvt-dataso import { Layer } from './layer'; import { VectorTileLayerOptions } from './vectortile-layer.interface'; +import { TileWatcher } from '../../utils'; export class VectorTileLayer extends Layer { public dataSource: MVTDataSource; public options: VectorTileLayerOptions; public ol: olLayerVectorTile; + private watcher: TileWatcher; + constructor(options: VectorTileLayerOptions) { super(options); + this.watcher = new TileWatcher(this); + this.status$ = this.watcher.status$; } protected createOlLayer(): olLayerVectorTile { diff --git a/packages/geo/src/lib/layer/utils/tile-watcher.ts b/packages/geo/src/lib/layer/utils/tile-watcher.ts index 651c18fc8f..008d53a10c 100644 --- a/packages/geo/src/lib/layer/utils/tile-watcher.ts +++ b/packages/geo/src/lib/layer/utils/tile-watcher.ts @@ -2,6 +2,7 @@ import olSourceTile from 'ol/source/Tile'; import { uuid, Watcher, SubjectStatus } from '@igo2/utils'; import { TileLayer } from '../shared/layers/tile-layer'; +import { VectorTileLayer } from '../shared/layers/vectortile-layer'; export class TileWatcher extends Watcher { private id: string; @@ -10,7 +11,7 @@ export class TileWatcher extends Watcher { private source: olSourceTile; - constructor(layer: TileLayer) { + constructor(layer: TileLayer | VectorTileLayer) { super(); this.source = layer.options.source.ol; this.id = uuid();