AW-6526 update angular 21
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
2026-01-19 12:19:09 +01:00
parent c35114b2d3
commit 9cc581dd3d
102 changed files with 3287 additions and 4023 deletions

View File

@@ -1,108 +1,101 @@
import {
Component,
Host,
Input,
forwardRef,
AfterContentInit,
Component,
ContentChild,
SimpleChanges,
EventEmitter,
forwardRef,
Input,
OnChanges,
Output,
EventEmitter,
SimpleChanges,
inject,
} from '@angular/core';
import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component';
import { TileGridWMTSComponent } from '../tilegridwmts.component';
import { WMTS as SourceWMTS } from 'ol/source';
import WMTS from 'ol/tilegrid/WMTS';
import { ProjectionLike } from 'ol/proj';
import { LoadFunction } from 'ol/Tile';
import { WMTS } from 'ol/source';
import { TileSourceEvent } from 'ol/source/Tile';
import { RequestEncoding } from 'ol/source/WMTS';
import { LayerTileComponent } from '../layers/layertile.component';
import { TileGridWMTSComponent } from '../tilegridwmts.component';
import { SourceComponent } from './source.component';
import { Options } from 'ol/source/WMTS';
import BaseObject from 'ol/Object';
@Component({
selector: 'aol-source-tilewmts',
template: ` <ng-content></ng-content> `,
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceTileWMTSComponent) }],
standalone: false
selector: 'aol-source-tilewmts',
template: ` <ng-content></ng-content> `,
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceTileWMTSComponent) }],
standalone: true,
})
export class SourceTileWMTSComponent extends SourceComponent implements AfterContentInit, OnChanges {
@Input()
cacheSize?: number;
cacheSize?: Options['cacheSize'];
@Input()
crossOrigin?: string;
crossOrigin?: Options['crossOrigin'];
@Input()
tileGrid: WMTS;
tileGrid: Options['tileGrid'];
@Input()
projection: ProjectionLike;
projection: Options['projection'];
@Input()
reprojectionErrorThreshold?: number;
reprojectionErrorThreshold?: Options['reprojectionErrorThreshold'];
@Input()
requestEncoding?: RequestEncoding | undefined;
requestEncoding?: Options['requestEncoding'];
@Input()
layer: string;
layer: Options['layer'];
@Input()
style: string;
style: Options['style'];
@Input()
tileClass?: any;
tileClass?: Options['tileClass'];
@Input()
tilePixelRatio?: number;
tilePixelRatio?: Options['tilePixelRatio'];
@Input()
version?: string;
version?: Options['version'];
@Input()
format?: string;
format?: Options['format'];
@Input()
matrixSet: string;
matrixSet: Options['matrixSet'];
@Input()
dimensions?: any;
dimensions?: Options['dimensions'];
@Input()
url?: string;
url?: Options['url'];
@Input()
tileLoadFunction?: LoadFunction;
tileLoadFunction?: Options['tileLoadFunction'];
@Input()
urls?: string[];
urls?: Options['urls'];
@Input()
wrapX?: boolean;
wrapX?: Options['wrapX'];
@Output()
tileLoadStart = new EventEmitter<TileSourceEvent>();
tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output()
tileLoadEnd = new EventEmitter<TileSourceEvent>();
tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output()
tileLoadError = new EventEmitter<TileSourceEvent>();
tileLoadError: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@ContentChild(TileGridWMTSComponent, { static: false })
@ContentChild(TileGridWMTSComponent)
tileGridWMTS: TileGridWMTSComponent;
instance: SourceWMTS;
instance: WMTS;
host = inject(LayerTileComponent, { host: true });
constructor(@Host() layer: LayerTileComponent) {
super(layer);
}
ngOnChanges(changes: SimpleChanges) {
const properties: { [index: string]: any } = {};
ngOnChanges(changes: SimpleChanges): void {
if (!this.instance) {
return;
}
const properties: Parameters<BaseObject['setProperties']>[0] = {};
for (const key in changes) {
if (changes.hasOwnProperty(key)) {
switch (key) {
case 'url':
this.url = changes[key].currentValue;
this.setLayerSource();
break;
default:
break;
}
properties[key] = changes[key].currentValue;
switch (key) {
case 'url':
this.url = changes[key].currentValue;
this.setLayerSource();
break;
default:
break;
}
properties[key] = changes[key].currentValue;
}
this.instance.setProperties(properties, false);
}
setLayerSource(): void {
this.instance = new SourceWMTS(this);
this.instance = new WMTS(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));