app.component.ts
Main entrypoint for magnitude frequency distrinbution (MFD) application.
Plots magnitude vs. rate and logic tree.
OnInit
AfterViewInit
| changeDetection | ChangeDetectionStrategy.OnPush |
| host | { |
| selector | app-app |
| imports |
NshmpTemplateComponent
NshmpTemplateContentContainerComponent
NshmpTemplateControlPanelComponent
NshmpTemplateMainContentComponent
NshmpTemplateSettingsComponent
NshmpHazardProvisionalModelComponent
NshmpTemplateAboutComponent
ControlPanelComponent
ContentComponent
PlotSettingsPanelComponent
AboutComponent
|
| templateUrl | ./app.component.html |
| styleUrl | ./app.component.scss |
Properties |
|
Methods |
| 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:69
|
|
Returns :
void
|
| navService |
Default value : inject(NavigationService)
|
|
Defined in app.component.ts:57
|
| nshmpService |
Default value : inject(NshmpService)
|
|
Defined in app.component.ts:58
|
| nshmpTemplateService |
Default value : inject(NshmpTemplateService)
|
|
Defined in app.component.ts:55
|
| service |
Default value : inject(AppService)
|
|
Defined in app.component.ts:56
|
| Private shepherdService |
Default value : inject(ShepherdService)
|
|
Defined in app.component.ts:59
|
| title |
Default value : apps().source.mfd.display
|
|
Defined in app.component.ts:63
|
|
Application title |
| toolboxName |
Default value : TOOLBOX_NAME
|
|
Defined in app.component.ts:64
|
| Private tutorialKey |
Type : string
|
Default value : 'source-mfd-show-tutorial'
|
|
Defined in app.component.ts:67
|
| Private tutorialService |
Default value : inject(TutorialService)
|
|
Defined in app.component.ts:60
|
| versionInfo |
Default value : VERSION_INFO
|
|
Defined in app.component.ts:65
|
import {AfterViewInit, ChangeDetectionStrategy, Component, inject, OnInit} from '@angular/core';
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,
TOOLBOX_NAME,
VERSION_INFO,
} 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({
changeDetection: ChangeDetectionStrategy.OnPush,
host: {id: 'source-mfd'},
imports: [
NshmpTemplateComponent,
NshmpTemplateContentContainerComponent,
NshmpTemplateControlPanelComponent,
NshmpTemplateMainContentComponent,
NshmpTemplateSettingsComponent,
NshmpHazardProvisionalModelComponent,
NshmpTemplateAboutComponent,
ControlPanelComponent,
ContentComponent,
PlotSettingsPanelComponent,
AboutComponent,
],
selector: 'app-app',
styleUrl: './app.component.scss',
templateUrl: './app.component.html',
})
export class AppComponent implements OnInit, AfterViewInit {
nshmpTemplateService = inject(NshmpTemplateService);
service = inject(AppService);
navService = inject(NavigationService);
nshmpService = inject(NshmpService);
private shepherdService = inject(ShepherdService);
private tutorialService = inject(TutorialService);
/** Application title */
title = apps().source.mfd.display;
toolboxName = TOOLBOX_NAME;
versionInfo = VERSION_INFO;
private tutorialKey = 'source-mfd-show-tutorial';
ngOnInit(): void {
this.service.init();
this.nshmpTemplateService.startTutorial();
}
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"
[toolboxName]="toolboxName"
[versionInfo]="versionInfo"
>
<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>
<app-about />
</nshmp-template-about>
</nshmp-template>