{"version":3,"file":"ngx-ol-library-source-ogc-map-tile.mjs","sources":["../../../src/source/ogc-map-tile/ogc-map-tile-source.component.ts","../../../src/source/ogc-map-tile/ogc-map-tile-source.module.ts","../../../src/source/ogc-map-tile/ngx-ol-library-source-ogc-map-tile.ts"],"sourcesContent":["import {\n  ChangeDetectionStrategy,\n  Component,\n  DestroyRef,\n  EventEmitter,\n  InjectOptions,\n  Input,\n  OnChanges,\n  OnDestroy,\n  OnInit,\n  Output,\n  SimpleChanges,\n  inject\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\nimport { ObjectEvent } from 'ol/Object';\nimport { TileSourceEvent } from 'ol/source/Tile';\nimport { LoadFunction } from 'ol/Tile';\nimport { AttributionLike } from 'ol/source/Source';\nimport { ProjectionLike } from 'ol/proj';\nimport BaseEvent from 'ol/events/Event';\nimport OGCMapTile, { Options } from 'ol/source/OGCMapTile';\nimport { NolPrefixedOptions, NolSafeAny } from 'ngx-ol-library/core';\nimport { useTileImageSourceHost } from 'ngx-ol-library/source/core';\n\n/**\n * Layer source component for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) \n * service that provides \"map\" type tiles.\n * @name nol-ogc-map-tile-source\n * @order 1\n */\n@Component({\n  selector: 'nol-ogc-map-tile-source',\n  exportAs: 'nolOGCMapTileSource',\n  standalone: true,\n  template: `<ng-content></ng-content>`,\n  changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NolOGCMapTileSourceComponent implements NolPrefixedOptions<Options>, OnInit, OnChanges, OnDestroy {\n\n  @Input() nolUrl!: string;\n  @Input() nolContext?: Record<string, NolSafeAny>;\n  @Input() nolMediaType?: string;\n  @Input() nolProjection?: ProjectionLike;\n  @Input() nolAttributions?: AttributionLike;\n  @Input() nolCacheSize?: number;\n  @Input() nolCrossOrigin?: string | null;\n  @Input() nolInterpolate?: boolean;\n  @Input() nolReprojectionErrorThreshold?: number;\n  @Input() nolTileLoadFunction?: LoadFunction;\n  @Input() nolWrapX?: boolean;\n  @Input() nolTransition?: number;\n  @Input() nolProperties?: Record<string, NolSafeAny>;\n\n  @Output() nolChange = new EventEmitter<BaseEvent>();\n  @Output() nolError = new EventEmitter<BaseEvent>();\n  @Output() nolPropertychange = new EventEmitter<ObjectEvent>();\n  @Output() nolTileloadend = new EventEmitter<TileSourceEvent>();\n  @Output() nolTileloaderror = new EventEmitter<TileSourceEvent>();\n  @Output() nolTileloadstart = new EventEmitter<TileSourceEvent>();\n\n  private readonly destroyRef = inject(DestroyRef);\n  private readonly host = useTileImageSourceHost('nol-ogc-map-tile-source');\n  private instance!: OGCMapTile;\n\n  getInstance() {\n    return this.instance;\n  }\n\n  ngOnInit(): void {\n    this.instance = new OGCMapTile({\n      url: this.nolUrl,\n      context: this.nolContext,\n      mediaType: this.nolMediaType,\n      projection: this.nolProjection,\n      attributions: this.nolAttributions,\n      cacheSize: this.nolCacheSize,\n      crossOrigin: this.nolCrossOrigin,\n      interpolate: this.nolInterpolate,\n      reprojectionErrorThreshold: this.nolReprojectionErrorThreshold,\n      tileLoadFunction: this.nolTileLoadFunction,\n      wrapX: this.nolWrapX,\n      transition: this.nolTransition,\n    });\n\n    if (this.nolProperties) {\n      this.instance.setProperties(this.nolProperties);\n    }\n\n    fromEvent<BaseEvent>(this.instance, 'change')\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(evt => {\n        this.nolChange.emit(evt);\n      });\n\n    fromEvent<BaseEvent>(this.instance, 'error')\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(evt => {\n        this.nolError.emit(evt);\n      });\n\n    fromEvent<ObjectEvent>(this.instance, 'propertychange')\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(evt => {\n        this.nolPropertychange.emit(evt);\n      });\n\n    fromEvent<TileSourceEvent>(this.instance, 'tileloadend')\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(evt => {\n        this.nolTileloadend.emit(evt);\n      });\n\n    fromEvent<TileSourceEvent>(this.instance, 'tileloaderror')\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(evt => {\n        this.nolTileloaderror.emit(evt);\n      });\n\n    fromEvent<TileSourceEvent>(this.instance, 'tileloadstart')\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(evt => {\n        this.nolTileloadstart.emit(evt);\n      });\n\n    this.host.addSource(this.instance);\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    if (!this.instance) return;\n\n    const {\n      nolUrl,\n      nolAttributions,\n      nolProperties,\n      nolTileLoadFunction\n    } = changes;\n\n    if (nolUrl) {\n      this.instance.setUrl(nolUrl.currentValue);\n    }\n\n    if (nolAttributions) {\n      this.instance.setAttributions(nolAttributions.currentValue);\n    }\n\n    if (nolProperties) {\n      this.instance.setProperties(nolProperties.currentValue);\n    }\n\n    if (nolTileLoadFunction) {\n      this.instance.setTileLoadFunction(nolTileLoadFunction.currentValue);\n    }\n  }\n\n  ngOnDestroy(): void {\n    this.host.removeSource(this.instance);\n  }\n}\n\nexport function useOGCMapTileSource(): NolOGCMapTileSourceComponent;\nexport function useOGCMapTileSource(options: InjectOptions & {optional?: false}): NolOGCMapTileSourceComponent;\nexport function useOGCMapTileSource(options: InjectOptions): NolOGCMapTileSourceComponent | null;\nexport function useOGCMapTileSource(options?: InjectOptions): NolOGCMapTileSourceComponent | null  {\n  return inject(NolOGCMapTileSourceComponent, options || {}) || null;\n}\n","import { NgModule } from '@angular/core';\nimport { NolOGCMapTileSourceComponent } from './ogc-map-tile-source.component';\n\n\n\n@NgModule({\n  imports: [NolOGCMapTileSourceComponent],\n  exports: [NolOGCMapTileSourceComponent]\n})\nexport class NolOGCMapTileSourceModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0BA;;;;;AAKG;MAQU,4BAA4B,CAAA;AAPzC,IAAA,WAAA,GAAA;AAuBY,QAAA,IAAA,CAAA,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