-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
133 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 85 additions & 4 deletions
89
...gular/src/app/components/dashboard-component/widgets/bans-widget/bans-widget.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,93 @@ | ||
import { Component } from "@angular/core" | ||
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnInit } from "@angular/core" | ||
import * as L from 'leaflet' | ||
import { AppConfigService } from "@wf1/core-ui" | ||
import { HttpClient } from "@angular/common/http" | ||
|
||
@Component({ | ||
selector: 'bans-widget', | ||
templateUrl: './bans-widget.component.html', | ||
styleUrls: ['./bans-widget.component.scss'] | ||
}) | ||
export class BansWidget { | ||
export class BansWidget implements OnInit, AfterViewInit { | ||
public startupComplete = false | ||
|
||
constructor() { } | ||
public map: any = null | ||
|
||
constructor(private appConfigService: AppConfigService, private cdr: ChangeDetectorRef, private httpClient: HttpClient, private el: ElementRef) { } | ||
|
||
ngOnInit (): void { | ||
const observer = new ResizeObserver(() => { | ||
if (this.map) { | ||
this.map.invalidateSize() | ||
} | ||
}).observe(this.el.nativeElement) | ||
} | ||
|
||
ngAfterViewInit (): void { | ||
Promise.all([ | ||
this.httpClient.get('assets/js/smk/bans-cat1.sld', {responseType: 'text'}).toPromise(), | ||
this.httpClient.get('assets/js/smk/bans-cat2.sld', {responseType: 'text'}).toPromise(), | ||
this.httpClient.get('assets/js/smk/bans-cat3.sld', {responseType: 'text'}).toPromise() | ||
]).then(([cat1sld, cat2sld, cat3sld]) => { | ||
// set startupComplete to true | ||
this.startupComplete = true | ||
this.cdr.detectChanges() | ||
|
||
console.log(cat1sld, cat2sld, cat3sld) | ||
|
||
// Create map and append data to the map component | ||
const southWest = L.latLng(60.2, -116), | ||
northEast = L.latLng(49, -136.3), | ||
bounds = L.latLngBounds(southWest, northEast), | ||
location = [Number(55), Number(-126)] | ||
|
||
this.map = L.map('bans-map', { | ||
maxBounds: bounds, | ||
attributionControl: false, | ||
zoomControl: false, | ||
dragging: false, | ||
doubleClickZoom: false, | ||
boxZoom: false, | ||
trackResize: false, | ||
scrollWheelZoom: false, | ||
maxZoom: 5 | ||
}).setView(location, 5) | ||
// configure map data | ||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { | ||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | ||
}).addTo(this.map) | ||
|
||
const databcUrl = this.appConfigService.getConfig()['mapServices']['openmapsBaseUrl'].toString() | ||
L.tileLayer.wms(databcUrl, { | ||
layers: 'WHSE_LAND_AND_NATURAL_RESOURCE.PROT_BANS_AND_PROHIBITIONS_SP', | ||
format: 'image/png', | ||
transparent: true, | ||
version: '1.1.1', | ||
sld_body: cat3sld, | ||
cql_filter: 'ACCESS_PROHIBITION_DESCRIPTION LIKE \'%Category 3%\'', | ||
opacity: 0.5 | ||
}).addTo(this.map) | ||
|
||
L.tileLayer.wms(databcUrl, { | ||
layers: 'WHSE_LAND_AND_NATURAL_RESOURCE.PROT_BANS_AND_PROHIBITIONS_SP', | ||
format: 'image/png', | ||
transparent: true, | ||
version: '1.1.1', | ||
sld_body: cat2sld, | ||
cql_filter: 'ACCESS_PROHIBITION_DESCRIPTION LIKE \'%Category 2%\'', | ||
opacity: 0.5 | ||
}).addTo(this.map) | ||
|
||
L.tileLayer.wms(databcUrl, { | ||
layers: 'WHSE_LAND_AND_NATURAL_RESOURCE.PROT_BANS_AND_PROHIBITIONS_SP', | ||
format: 'image/png', | ||
transparent: true, | ||
version: '1.1.1', | ||
sld_body: cat1sld, | ||
cql_filter: 'ACCESS_PROHIBITION_DESCRIPTION LIKE \'%Category 1%\' OR ACCESS_PROHIBITION_DESCRIPTION LIKE \'%Campfire%\'', | ||
opacity: 0.5 | ||
}).addTo(this.map) | ||
|
||
this.cdr.detectChanges() | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.74 KB
client/wfnews-war/src/main/angular/src/assets/images/category1ban.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.58 KB
client/wfnews-war/src/main/angular/src/assets/images/category2ban.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.23 KB
client/wfnews-war/src/main/angular/src/assets/images/category3ban.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.