AW6241 ng-18 adopt ng-openlayers
This commit is contained in:
43
projects/ng-openlayers/src/lib/tilegrid.component.ts
Normal file
43
projects/ng-openlayers/src/lib/tilegrid.component.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
||||
import { createXYZ } from 'ol/tilegrid';
|
||||
import TileGrid from 'ol/tilegrid/TileGrid';
|
||||
import { Extent } from 'ol/extent';
|
||||
import { Coordinate } from 'ol/coordinate';
|
||||
import { Size } from 'ol/size';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-tilegrid',
|
||||
template: '',
|
||||
})
|
||||
export class TileGridComponent implements OnInit, OnChanges {
|
||||
@Input()
|
||||
extent: Extent;
|
||||
@Input()
|
||||
maxZoom: number;
|
||||
@Input()
|
||||
minZoom: number;
|
||||
@Input()
|
||||
tileSize: number | Size;
|
||||
@Input()
|
||||
origin?: Coordinate;
|
||||
@Input()
|
||||
resolutions: number[];
|
||||
|
||||
instance: TileGrid;
|
||||
|
||||
ngOnInit() {
|
||||
if (!this.resolutions) {
|
||||
this.instance = createXYZ(this);
|
||||
} else {
|
||||
this.instance = new TileGrid(this);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (!this.resolutions) {
|
||||
this.instance = createXYZ(this);
|
||||
} else {
|
||||
this.instance = new TileGrid(this);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user