Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OwcLeafletViewerComponent

Hierarchy

  • OwcLeafletViewerComponent

Implements

  • OnInit
  • AfterViewInit

Index

Constructors

constructor

Properties

BetterWMS

BetterWMS: any = L.TileLayer.WMS.extend({viewRef: ElementRef,onAdd: function ( map: L.Map ) {// Triggered when the layer is added to a map.// Register a click listener, then do all the upstream WMS thingsL.TileLayer.WMS.prototype.onAdd.call(this, map);map.on('click', this.getFeatureInfo, this);},onRemove: function ( map: L.Map ) {// Triggered when the layer is removed from a map.// Unregister a click listener, then do all the upstream WMS thingsL.TileLayer.WMS.prototype.onRemove.call(this, map);map.off('click', this.getFeatureInfo, this);},getFeatureInfo: function ( evt: any ) {// Make an AJAX request to the server and hope for the bestlet url = this.getFeatureInfoUrl(evt.latlng),showResults = L.Util.bind(this.showGetFeatureInfo, this);// console.log(url);$.ajax({url: url,success: function ( data: any, status: any, xhr: any ) {let err = typeof data === 'string' ? null : data;showResults(err, evt.latlng, data);},error: function ( xhr, status, error ) {showResults(error);}});},getFeatureInfoUrl: function ( latlng: L.LatLng ) {let point = this._map.latLngToContainerPoint(latlng),size = this._map.getSize(),params = {request: 'GetFeatureInfo',service: 'WMS',srs: 'EPSG:4326',styles: this.wmsParams.styles,transparent: this.wmsParams.transparent,version: this.wmsParams.version,format: this.wmsParams.format,bbox: this._map.getBounds().toBBoxString(),height: size.y,width: size.x,layers: this.wmsParams.layers,query_layers: this.wmsParams.layers,info_format: 'text/html'};// params[ params.version === '1.3.0' ? 'i' : 'x' ] = point.x;// params[ params.version === '1.3.0' ? 'j' : 'y' ] = point.y;params[ 'x' ] = point.x;params[ 'y' ] = point.y;// console.log(point);return this._url + L.Util.getParamString(params, this._url, true);},showGetFeatureInfo: function ( err: any, latlng: L.LatLng, content: L.Content ) {if (err) {console.log(err);return;} // do nothing if there's an error// const contentHigh = L.Content(content);let elementRef = this.viewRef.nativeElement;console.log(elementRef.textContent);console.log(content);// Otherwise show the content in a popup, or something.// L.popup({ maxWidth: 600 })// .setLatLng(latlng)// .setContent(content)// .openOn(this._map);}})

Private _location

_location: Location

Private accountService

accountService: AccountService

activeLayers

activeLayers: MapActiveTracker[] = []

Private collectionsService

collectionsService: CollectionsService

featureInfoModal

featureInfoModal: ModalDirective

featureInfoNodes

featureInfoNodes: any[] = []

map

map: Map

myCollection

myCollection: OwcContext

Private notificationService

notificationService: NotificationService

Private route

route: ActivatedRoute

spanRef

spanRef: ElementRef

Methods

backClicked

  • backClicked(): void

eventChangeActive

  • eventChangeActive($event: any, owcResource: OwcResource): void

getAsGeoFeatureCollection

getLeafletCentre

  • getLeafletCentre(bbox: number[]): LatLng

getLeafletOptions

  • getLeafletOptions(owcContext: OwcContext): MapOptions

handleOnShown

  • handleOnShown($event: any): void

ngAfterViewInit

  • ngAfterViewInit(): void

ngOnInit

  • ngOnInit(): void

onMapReady

  • onMapReady(map: Map, owcContext: OwcContext): void

parseLayerUrl

  • parseLayerUrl(urlFragments: string): ParsedUri

parseLayerUrlForWms

Generated using TypeDoc