app.component.ts
Application to call static hazard services and plot results.
OnInit
AfterViewInit
selector | app-app |
imports |
NshmpTemplateComponent
NshmpTemplateControlPanelComponent
NshmpTemplateContentContainerComponent
NshmpTemplateMainContentComponent
NshmpTemplateAboutComponent
NshmpTemplateSettingsComponent
ControlPanelComponent
ContentComponent
PlotSettingsPanelComponent
AboutComponent
AsyncPipe
|
templateUrl | ./app.component.html |
styleUrl | ./app.component.scss |
Properties |
|
Methods |
|
constructor(service: AppService, navService: NavigationService, nshmpService: NshmpService, shepherdService: ShepherdService, nshmpTemplateService: NshmpTemplateService, tutorialService: TutorialService, destroyRef: DestroyRef)
|
||||||||||||||||||||||||
Defined in app.component.ts:50
|
||||||||||||||||||||||||
Parameters :
|
Private addSteps |
addSteps()
|
Defined in app.component.ts:80
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Defined in app.component.ts:75
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Defined in app.component.ts:62
|
Returns :
void
|
Public navService |
Type : NavigationService
|
Defined in app.component.ts:54
|
Public nshmpService |
Type : NshmpService
|
Defined in app.component.ts:55
|
title |
Default value : apps().hazard.static.display
|
Defined in app.component.ts:48
|
Application title |
Private tutorialKey |
Type : string
|
Default value : 'hazard-static-show-tutorial'
|
Defined in app.component.ts:50
|
import {AsyncPipe} from '@angular/common';
import {AfterViewInit, Component, DestroyRef, OnInit} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {NshmpService} from '@ghsc/nshmp-lib-ng/nshmp';
import {
NshmpTemplateAboutComponent,
NshmpTemplateComponent,
NshmpTemplateContentContainerComponent,
NshmpTemplateControlPanelComponent,
NshmpTemplateMainContentComponent,
NshmpTemplateService,
NshmpTemplateSettingsComponent,
} 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 {ContentComponent} from './components/content/content.component';
import {ControlPanelComponent} from './components/control-panel/control-panel.component';
import {PlotSettingsPanelComponent} from './components/plot-settings-panel/plot-settings-panel.component';
import {AppService} from './services/app.service';
/**
* Application to call static hazard services and plot results.
*/
@Component({
imports: [
NshmpTemplateComponent,
NshmpTemplateControlPanelComponent,
NshmpTemplateContentContainerComponent,
NshmpTemplateMainContentComponent,
NshmpTemplateAboutComponent,
NshmpTemplateSettingsComponent,
ControlPanelComponent,
ContentComponent,
PlotSettingsPanelComponent,
AboutComponent,
AsyncPipe,
],
selector: 'app-app',
styleUrl: './app.component.scss',
templateUrl: './app.component.html',
})
export class AppComponent implements OnInit, AfterViewInit {
/** Application title */
title = apps().hazard.static.display;
private tutorialKey = 'hazard-static-show-tutorial';
constructor(
private service: AppService,
public navService: NavigationService,
public nshmpService: NshmpService,
private shepherdService: ShepherdService,
private nshmpTemplateService: NshmpTemplateService,
private tutorialService: TutorialService,
private destroyRef: DestroyRef,
) {}
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);
}
private addSteps(): void {
this.shepherdService.addSteps([
// Intro
this.tutorialService.introStep(
this.title,
`
<p>
The static hazard curve application provides access to precomputed
probabilisitic seismic hazard curves for USGS national seismic hazard models (NSHMs).
</p>
`,
),
// Control panel
this.tutorialService.controlPanelStep(),
// Plot settings
this.tutorialService.plotSettingsStep(),
// Settings
this.tutorialService.applicationSettingsStep(),
// Nav menu
this.tutorialService.navigationStep(),
// Model
this.tutorialService.nshmStep(),
// Latitude
this.tutorialService.latitudeStep(),
// Longitude
this.tutorialService.longitudeStep(),
// Select site
this.tutorialService.selectSiteStep(),
// Site class
this.tutorialService.siteClassStep(),
// Return period
this.tutorialService.returnPeriodStep(),
// Truncate curves
this.tutorialService.truncateCurves(),
// Max direction
this.tutorialService.maxDirectionStep(),
// Plot
this.tutorialService.plotStep(),
// Service calls
this.tutorialService.serviceCallsStep(),
// Reset
this.tutorialService.resetControlPanelStep(),
// Plot tab
{
attachTo: {
element: '.plots-tab',
on: 'auto',
},
text: 'Shows the plots',
title: 'Plots Tab',
},
// Curve data tab
{
attachTo: {
element: '.hazard-tab',
on: 'auto',
},
text: 'Show the hazard curve data in tabular form',
title: 'Hazard Curve Data Tab',
},
// Spectra tab
{
attachTo: {
element: '.spectra-tab',
on: 'auto',
},
text: 'Show the response spectrum data in tabular form',
title: 'Response Spectrum Data',
},
// Complete
this.tutorialService.completeStep(this.title),
]);
}
}
<nshmp-template [navigationList]="navService.navigationList()" [title]="title">
<nshmp-template-content-container>
<nshmp-template-control-panel>
<app-control-panel />
</nshmp-template-control-panel>
<nshmp-template-main-content>
<app-content />
</nshmp-template-main-content>
<nshmp-template-settings>
<app-plot-settings-panel />
</nshmp-template-settings>
</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>