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:
62
projects/ng-openlayers/src/lib/sources/osm.component.ts
Normal file
62
projects/ng-openlayers/src/lib/sources/osm.component.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { AfterContentInit, Component, EventEmitter, forwardRef, Host, Input, Optional, Output } from '@angular/core';
|
||||
import { OSM } from 'ol/source';
|
||||
import { AttributionLike } from 'ol/source/Source';
|
||||
import { TileSourceEvent } from 'ol/source/Tile';
|
||||
import { LoadFunction } from 'ol/Tile';
|
||||
import { LayerTileComponent } from '../layers/layertile.component';
|
||||
import { SourceComponent } from './source.component';
|
||||
import { SourceXYZComponent } from './xyz.component';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-source-osm',
|
||||
template: ` <div class="aol-source-osm"></div> `,
|
||||
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceOsmComponent) }],
|
||||
})
|
||||
export class SourceOsmComponent extends SourceXYZComponent implements AfterContentInit {
|
||||
@Input()
|
||||
attributions: AttributionLike;
|
||||
@Input()
|
||||
cacheSize: number;
|
||||
@Input()
|
||||
crossOrigin: string;
|
||||
@Input()
|
||||
maxZoom: number;
|
||||
@Input()
|
||||
opaque: boolean;
|
||||
@Input()
|
||||
reprojectionErrorThreshold: number;
|
||||
@Input()
|
||||
tileLoadFunction: LoadFunction;
|
||||
@Input()
|
||||
url: string;
|
||||
@Input()
|
||||
wrapX: boolean;
|
||||
|
||||
@Output()
|
||||
tileLoadStart = new EventEmitter<TileSourceEvent>();
|
||||
@Output()
|
||||
tileLoadEnd = new EventEmitter<TileSourceEvent>();
|
||||
@Output()
|
||||
tileLoadError = new EventEmitter<TileSourceEvent>();
|
||||
|
||||
instance: OSM;
|
||||
|
||||
constructor(
|
||||
@Optional()
|
||||
@Host()
|
||||
protected layer?: LayerTileComponent
|
||||
) {
|
||||
super(layer);
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
if (this.tileGridXYZ) {
|
||||
this.tileGrid = this.tileGridXYZ.instance;
|
||||
}
|
||||
this.instance = new OSM(this);
|
||||
this.instance.on('tileloadstart', (event: TileSourceEvent) => this.tileLoadStart.emit(event));
|
||||
this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event));
|
||||
this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event));
|
||||
this.register(this.instance);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user