Skip to content

Commit

Permalink
fix(layer): add tile-watcher to vectortile-layer (#595)
Browse files Browse the repository at this point in the history
* tile watcher added to vectortile layer

* fix export network-ionic

* remove networkionic import
  • Loading branch information
mbarbeau committed May 11, 2020
1 parent 36bb5d0 commit b3cb8b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion packages/geo/src/lib/layer/utils/tile-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit b3cb8b3

Please sign in to comment.