AW-6046 Angular 17
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
58
projects/ng-openlayers/src/lib/sources/tilewms.component.ts
Normal file
58
projects/ng-openlayers/src/lib/sources/tilewms.component.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Component, Host, Input, OnChanges, OnInit, forwardRef, SimpleChanges } from '@angular/core';
|
||||
import { LayerTileComponent } from '../layers/layertile.component';
|
||||
import { SourceComponent } from './source.component';
|
||||
import { TileWMS } from 'ol/source';
|
||||
import TileGrid from 'ol/tilegrid/TileGrid';
|
||||
import { LoadFunction } from 'ol/Tile';
|
||||
import { ServerType } from 'ol/source/WMSServerType';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-source-tilewms',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceTileWMSComponent) }],
|
||||
})
|
||||
export class SourceTileWMSComponent extends SourceComponent implements OnChanges, OnInit {
|
||||
@Input()
|
||||
cacheSize: number;
|
||||
@Input()
|
||||
crossOrigin: string;
|
||||
@Input()
|
||||
gutter: number;
|
||||
@Input()
|
||||
hidpi: boolean;
|
||||
@Input()
|
||||
params: { [key: string]: any };
|
||||
@Input()
|
||||
projection: string;
|
||||
@Input()
|
||||
reprojectionErrorThreshold: number;
|
||||
@Input()
|
||||
serverType: ServerType;
|
||||
@Input()
|
||||
tileGrid: TileGrid;
|
||||
@Input()
|
||||
tileLoadFunction: LoadFunction;
|
||||
@Input()
|
||||
url: string;
|
||||
@Input()
|
||||
urls: string[];
|
||||
@Input()
|
||||
wrapX: boolean;
|
||||
|
||||
instance: TileWMS;
|
||||
|
||||
constructor(@Host() layer: LayerTileComponent) {
|
||||
super(layer);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new TileWMS(this);
|
||||
this.host.instance.setSource(this.instance);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (this.instance && changes.hasOwnProperty('params')) {
|
||||
this.instance.updateParams(this.params);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user