File

app.component.ts

Description

Main entrypoint for ground motion vs. magnitude.

Plots GM vs. magnitude using GMM service.

See https://earthquake.usgs.gov/ws/nshmp/data/gmm/magnitude

Implements

OnInit AfterViewInit

Metadata

Index

Properties
Methods

Constructor

constructor(service: AppService, navService: NavigationService, nshmpService: NshmpService, shepherdService: ShepherdService, nshmpTemplateService: NshmpTemplateService, tutorialService: TutorialService, destroyRef: DestroyRef)
Parameters :
Name Type Optional
service AppService No
navService NavigationService No
nshmpService NshmpService No
shepherdService ShepherdService No
nshmpTemplateService NshmpTemplateService No
tutorialService TutorialService No
destroyRef DestroyRef No

Methods

addSteps
addSteps()
Returns : void
ngAfterViewInit
ngAfterViewInit()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

Public navService
Type : NavigationService
Public nshmpService
Type : NshmpService
Public service
Type : AppService
title
Default value : apps().gmm.magnitude.display

Application title

Private tutorialKey
Type : string
Default value : 'gmm-magnitude-show-tutorial'
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';

/**
 * Main entrypoint for ground motion vs. magnitude.
 *
 * Plots GM vs. magnitude using GMM service.
 *
 * @see https://earthquake.usgs.gov/ws/nshmp/data/gmm/magnitude
 */
@Component({
  imports: [
    NshmpTemplateComponent,
    NshmpTemplateControlPanelComponent,
    NshmpTemplateContentContainerComponent,
    NshmpTemplateMainContentComponent,
    NshmpTemplateSettingsComponent,
    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().gmm.magnitude.display;

  private tutorialKey = 'gmm-magnitude-show-tutorial';

  constructor(
    public service: AppService,
    public navService: NavigationService,
    public nshmpService: NshmpService,
    private shepherdService: ShepherdService,
    private nshmpTemplateService: NshmpTemplateService,
    private tutorialService: TutorialService,
    private destroyRef: DestroyRef,
  ) {}

  ngOnInit(): void {
    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([
      this.tutorialService.introStep(
        this.title,
        `
          <p>
            This application computes ground motions as a function of earthquake magnitude
            for all GMMs supported by USGS hazard software.
          </p>
        `,
      ),
      this.tutorialService.controlPanelStep(),
      this.tutorialService.plotSettingsStep(),
      this.tutorialService.applicationSettingsStep(),
      this.tutorialService.navigationStep(),
      this.tutorialService.gmmMultiSelectableStep(),
      this.tutorialService.gmmTectonicSettingStep(),
      this.tutorialService.gmmMenuStep(),
      this.tutorialService.imtStep(),
      // this.tutorialService.magnitudeStep(),
      // Min Mw
      {
        attachTo: {
          element: `.mmin-input ${this.tutorialService.matTextField}`,
          on: 'auto',
        },
        text: `
          <p>Minimum moment magnitude to plot</p>
          <em>Required: yes</em>
        `,
        title: 'Minimum Magnitude',
      },
      // Max Mw
      {
        attachTo: {
          element: `.mmax-input ${this.tutorialService.matTextField}`,
          on: 'auto',
        },
        text: `
          <p>Maximum moment magnitude to plot</p>
          <em>Required: yes</em>
        `,
        title: 'Maximum Magnitude',
      },
      // Mw Steo
      {
        attachTo: {
          element: `.mstep-input ${this.tutorialService.matTextField}`,
          on: 'auto',
        },
        text: `
          <p>Moment magnitude step for plotting</p>
          <em>Required: yes</em>
        `,
        title: 'Magnitude Step',
      },
      this.tutorialService.zTorStep(),
      this.tutorialService.dipStep(),
      this.tutorialService.widthStep(),
      // Distance
      {
        attachTo: {
          element: `.distance-input ${this.tutorialService.matTextField}`,
          on: 'auto',
        },
        text: `
          <p>Distance from fault (km)</p>
          <em>Required: yes</em>
        `,
        title: 'Distance',
      },
      this.tutorialService.vs30Step(),
      this.tutorialService.z1p0Step(),
      this.tutorialService.z2p5Step(),
      this.tutorialService.zSedStep(),
      this.tutorialService.epistemicUncertaintyStep(),
      this.tutorialService.plotStep(),
      this.tutorialService.serviceCallsStep(),
      this.tutorialService.resetControlPanelStep(),
      // Plot tab
      {
        attachTo: {
          element: '.plots-tab',
          on: 'auto',
        },
        text: 'Shows the plots',
        title: 'Plots Tab',
      },
      // Medians tab
      {
        attachTo: {
          element: '.medians-tab',
          on: 'auto',
        },
        text: 'Show the median curves data in tabular form',
        title: 'Medians Tab',
      },
      // Sigmas tab
      {
        attachTo: {
          element: '.sigmas-tab',
          on: 'auto',
        },
        text: 'Show the sigmas in tabular form',
        title: 'Sigmas Tab',
      },
      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>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""