app.component.ts
Main entrypoint for the data mapping application.
Show vairous layers associated with a NSHM using ArcGIS
See https://developers.arcgis.com/javascript/latest/
OnInit
AfterViewInit
OnDestroy
encapsulation | ViewEncapsulation.None |
selector | app-app |
imports |
NshmpTemplateComponent
NshmpTemplateContentContainerComponent
NshmpTemplateControlPanelComponent
NshmpTemplateMainContentComponent
NshmpHazardProvisionalModelComponent
NshmpTemplateAboutComponent
ControlPanelComponent
MapComponent
AboutComponent
AsyncPipe
|
templateUrl | ./app.component.html |
styleUrl | ./app.component.scss |
Properties |
|
Methods |
addSteps |
addSteps()
|
Defined in app.component.ts:93
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Defined in app.component.ts:84
|
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Defined in app.component.ts:89
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Defined in app.component.ts:71
|
Returns :
void
|
Private destroyRef |
Default value : inject(DestroyRef)
|
Defined in app.component.ts:64
|
navService |
Default value : inject(NavigationService)
|
Defined in app.component.ts:59
|
nshmpService |
Default value : inject(NshmpService)
|
Defined in app.component.ts:61
|
nshmpTemplateService |
Default value : inject(NshmpTemplateService)
|
Defined in app.component.ts:60
|
service |
Default value : inject(AppService)
|
Defined in app.component.ts:58
|
Private shepherdService |
Default value : inject(ShepherdService)
|
Defined in app.component.ts:62
|
title |
Default value : apps().source.modelMaps.display
|
Defined in app.component.ts:67
|
Application title |
Private tutorialKey |
Type : string
|
Default value : 'source-model-maps-show-tutorial'
|
Defined in app.component.ts:69
|
Private tutorialService |
Default value : inject(TutorialService)
|
Defined in app.component.ts:63
|
import {AsyncPipe} from '@angular/common';
import {
AfterViewInit,
Component,
DestroyRef,
inject,
OnDestroy,
OnInit,
ViewEncapsulation,
} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {NshmpHazardProvisionalModelComponent} from '@ghsc/nshmp-lib-ng/hazard';
import {NshmpService} from '@ghsc/nshmp-lib-ng/nshmp';
import {
NshmpTemplateAboutComponent,
NshmpTemplateComponent,
NshmpTemplateContentContainerComponent,
NshmpTemplateControlPanelComponent,
NshmpTemplateMainContentComponent,
NshmpTemplateService,
} from '@ghsc/nshmp-template';
import {ShepherdService} from 'angular-shepherd';
import {NavigationService} from 'projects/nshmp-apps/src/shared/services/navigation.service';
import {TutorialService} from 'projects/nshmp-apps/src/shared/services/tutorial.service';
import {apps} from 'projects/nshmp-apps/src/shared/utils/applications.utils';
import {AboutComponent} from './components/about/about.component';
import {ControlPanelComponent} from './components/control-panel/control-panel.component';
import {MapComponent} from './components/map/map.component';
import {AppService} from './services/app.service';
/**
* Main entrypoint for the data mapping application.
*
* Show vairous layers associated with a NSHM using ArcGIS
*
* @see https://developers.arcgis.com/javascript/latest/
*/
@Component({
encapsulation: ViewEncapsulation.None,
imports: [
NshmpTemplateComponent,
NshmpTemplateContentContainerComponent,
NshmpTemplateControlPanelComponent,
NshmpTemplateMainContentComponent,
NshmpHazardProvisionalModelComponent,
NshmpTemplateAboutComponent,
ControlPanelComponent,
MapComponent,
AboutComponent,
AsyncPipe,
],
selector: 'app-app',
styleUrl: './app.component.scss',
templateUrl: './app.component.html',
})
export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
service = inject(AppService);
navService = inject(NavigationService);
nshmpTemplateService = inject(NshmpTemplateService);
nshmpService = inject(NshmpService);
private shepherdService = inject(ShepherdService);
private tutorialService = inject(TutorialService);
private destroyRef = inject(DestroyRef);
/** Application title */
title = apps().source.modelMaps.display;
private tutorialKey = 'source-model-maps-show-tutorial';
ngOnInit() {
this.nshmpService.applicationTitle = this.title;
this.service.init();
this.nshmpTemplateService.showTutorialInMenu = true;
this.nshmpTemplateService
.startTutorial()
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => {
this.shepherdService.start();
});
}
ngAfterViewInit(): void {
this.addSteps();
this.tutorialService.start(this.tutorialKey);
}
ngOnDestroy(): void {
this.service.state().view.destroy();
}
addSteps(): void {
this.shepherdService.addSteps([
this.tutorialService.introStep(
this.title,
`
<p>
This application provides graphic representations of USGS national
seismic hazard model (NSHM) components.
</p>
`,
),
this.tutorialService.controlPanelStep(),
this.tutorialService.applicationSettingsStep(),
this.tutorialService.navigationStep(),
// Map style
{
attachTo: {
element: '.map-style-select',
on: 'auto',
},
text: 'Change between 2D and 3D map style',
title: 'Map Style',
},
this.tutorialService.nshmStep(),
// Layer toggles
{
attachTo: {
element: '.nshm-boundary-toggle',
on: 'auto',
},
text: 'Toggle layers to view on map',
title: 'Layers',
},
// Base layers
this.tutorialService.arcgisBaseMapStep(),
// Legend
this.tutorialService.arcgisLegendStep(),
this.tutorialService.completeStep(this.title),
]);
}
}
<nshmp-template [navigationList]="navService.navigationList()" [title]="title">
<nshmp-template-content-container [showSettingsPanel]="false">
<nshmp-template-control-panel>
<app-control-panel />
</nshmp-template-control-panel>
<nshmp-template-main-content>
<!-- Provisional model warning -->
<nshmp-hazard-provisional-model
[name]="service.treesUsageResponse()?.response?.model?.name"
/>
<app-map />
</nshmp-template-main-content>
</nshmp-template-content-container>
<!-- About page -->
<nshmp-template-about
[applicationName]="nshmpService.applicationName$ | async"
[applicationVersion]="(nshmpService.versionInfo$ | async)?.version ?? ''"
>
<app-about />
</nshmp-template-about>
</nshmp-template>