File

app.component.ts

Description

Application to call disaggregation services and plot results.

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

Private 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().hazard.disagg.display

Application title

Private tutorialKey
Type : string
Default value : 'hazard-disagg-show-tutorial'
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,
} 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 {AppService} from './services/app.service';

/**
 * Application to call disaggregation services and plot results.
 */
@Component({
  imports: [
    NshmpTemplateComponent,
    NshmpTemplateControlPanelComponent,
    NshmpTemplateContentContainerComponent,
    NshmpTemplateMainContentComponent,
    NshmpTemplateAboutComponent,
    NshmpHazardProvisionalModelComponent,
    ControlPanelComponent,
    ContentComponent,
    AboutComponent,
    AsyncPipe,
  ],
  selector: 'app-app',
  styleUrl: './app.component.scss',
  templateUrl: './app.component.html',
})
export class AppComponent implements OnInit, AfterViewInit {
  /** Application title */
  title = apps().hazard.disagg.display;

  private tutorialKey = 'hazard-disagg-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.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 disaggregation application performs on-demand disaggregation of
            probabilistic seismic hazard for USGS national seismic hazard models
            (NSHMs) at a specified return-period or intensity measure level of interest.
          </p>
        `,
      ),
      // Control panel
      this.tutorialService.controlPanelStep(),
      // 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(),
      // IMT
      this.tutorialService.imtStep(),
      // Return period button
      {
        attachTo: {
          element: '.return-period-button',
          on: 'auto',
        },
        text: 'Calculate disaggregation for a specific return period',
        title: 'Calculate for a Return Period',
      },
      // Return period
      this.tutorialService.returnPeriodStep(),
      // IML button
      {
        attachTo: {
          element: '.iml-button',
          on: 'auto',
        },
        text: 'Calculate disaggregation for a specific Intensity Measure Level (IML).',
        title: 'Calculate for a Intensity Measure Level',
      },
      // IML
      {
        attachTo: {
          element: '.iml-input',
          on: 'auto',
        },
        text: `
          </p>Custom value for selected IMT</p>
          <em>Required: if check button selected</em>
        `,
        title: 'Intensity Measure Level',
      },
      // Max direction
      {
        ...this.tutorialService.maxDirectionStep(),
        text: `
          <p>
            Whether to apply the max direction scale factor for selected IMT to the
            IML value.
          </p>

          ${this.tutorialService.maxDirectionList()}

          <p>
            Note: PGA was changed from 1.0 to 1.2
          </p>
        `,
      },
      // Plot
      this.tutorialService.plotStep(),
      // Service calls
      this.tutorialService.serviceCallsStep(),
      // Reset
      this.tutorialService.resetControlPanelStep(),
      // Complete
      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.usage()?.response?.model?.name" />

      <app-content />
    </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>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""