app.component.ts
Main entrypoint for magnitude frequency distrinbution (MFD) application.
Plots magnitude vs. rate and logic tree.
OnInit
AfterViewInit
selector | app-app |
imports |
NshmpTemplateComponent
NshmpTemplateContentContainerComponent
NshmpTemplateControlPanelComponent
NshmpTemplateMainContentComponent
NshmpTemplateSettingsComponent
NshmpHazardProvisionalModelComponent
NshmpTemplateAboutComponent
ControlPanelComponent
ContentComponent
PlotSettingsPanelComponent
AboutComponent
AsyncPipe
|
templateUrl | ./app.component.html |
styleUrl | ./app.component.scss |
Properties |
|
Methods |
constructor(nshmpTemplateService: NshmpTemplateService, service: AppService, navService: NavigationService, nshmpService: NshmpService, shepherdService: ShepherdService, tutorialService: TutorialService, destroyRef: DestroyRef)
|
||||||||||||||||||||||||
Defined in app.component.ts:55
|
||||||||||||||||||||||||
Parameters :
|
addSteps |
addSteps()
|
Defined in app.component.ts:85
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Defined in app.component.ts:80
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Defined in app.component.ts:67
|
Returns :
void
|
Public navService |
Type : NavigationService
|
Defined in app.component.ts:60
|
Public nshmpService |
Type : NshmpService
|
Defined in app.component.ts:61
|
Public nshmpTemplateService |
Type : NshmpTemplateService
|
Defined in app.component.ts:58
|
Public service |
Type : AppService
|
Defined in app.component.ts:59
|
title |
Default value : apps().source.mfd.display
|
Defined in app.component.ts:53
|
Application title |
Private tutorialKey |
Type : string
|
Default value : 'source-mfd-show-tutorial'
|
Defined in app.component.ts:55
|
import {AsyncPipe} from '@angular/common';
import {AfterViewInit, Component, DestroyRef, OnInit} 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,
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';
/**
* Main entrypoint for magnitude frequency distrinbution (MFD)
* application.
*
* Plots magnitude vs. rate and logic tree.
*/
@Component({
imports: [
NshmpTemplateComponent,
NshmpTemplateContentContainerComponent,
NshmpTemplateControlPanelComponent,
NshmpTemplateMainContentComponent,
NshmpTemplateSettingsComponent,
NshmpHazardProvisionalModelComponent,
NshmpTemplateAboutComponent,
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().source.mfd.display;
private tutorialKey = 'source-mfd-show-tutorial';
constructor(
public nshmpTemplateService: NshmpTemplateService,
public service: AppService,
public navService: NavigationService,
public nshmpService: NshmpService,
private shepherdService: ShepherdService,
private tutorialService: TutorialService,
private destroyRef: DestroyRef,
) {}
ngOnInit(): void {
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);
}
addSteps(): void {
this.shepherdService.addSteps([
// Intro
this.tutorialService.introStep(
this.title,
`
<p>
This application provides access to the logic trees of magnitude frequency
distributions (MFDs) for each earthquake source in a USGS national seismic
hazard model (NSHM).
</p>
`,
),
this.tutorialService.controlPanelStep(),
this.tutorialService.plotSettingsStep(),
this.tutorialService.applicationSettingsStep(),
this.tutorialService.navigationStep(),
this.tutorialService.nshmStep(),
// Source type
{
attachTo: {
element: `.source-select ${this.tutorialService.matTextField}`,
on: 'auto',
},
text: `
Select which earthquake source type and tectonic settings to filter the source tree
`,
title: 'Source Type',
},
// Source tree
{
attachTo: {
element: `.source-tree-select ${this.tutorialService.matTextField}`,
on: 'auto',
},
text: 'Select which source tree to plot',
title: 'Source Tree',
},
// Cumulative
{
attachTo: {
element: `.cumulative ${this.tutorialService.matFormField}`,
on: 'auto',
},
text: 'Whether or not to plot cumulative values or not',
title: 'Cumulative',
},
// Weighted MFDs
{
attachTo: {
element: `.weighted-mfds ${this.tutorialService.matFormField}`,
on: 'auto',
},
text: 'Whether or not to apply source and mfd branch weights to values',
title: 'Weighted MFDs',
},
this.tutorialService.plotStep(),
this.tutorialService.serviceCallsStep(),
this.tutorialService.resetControlPanelStep(),
// Plot tab
{
attachTo: {
element: '.plots-tab',
on: 'auto',
},
text: 'Shows the plots',
title: 'Plots Tab',
},
// Curve data tab
{
attachTo: {
element: '.logic-tree-tab',
on: 'auto',
},
text: 'Show logic tree plot',
title: 'Logic Tree Tab',
},
// Spectra tab
{
attachTo: {
element: '.data-tab',
on: 'auto',
},
text: 'Show the data in tabular form',
title: 'MFD Data Tab',
},
// 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>
<!-- Provisional model warning -->
<nshmp-hazard-provisional-model [name]="service.usage()?.response?.model?.name" />
<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>