File

components/connected-applications/connected-applications.component.ts

Metadata

Index

Properties
Methods

Methods

Private geophysicalParams
geophysicalParams()
Returns : Params
Private rtgmParams
rtgmParams()
Returns : Params

Properties

connectedApplications
Type : ConnectedApplication[]
Default value : [ { application: apps().designMaps.rtgm, description: 'Open the RTGM application using the current control panel inputs', queryParams: () => this.rtgmParams(), }, { application: apps().ncm.geophysicalProfiles, description: 'Open the NCM geophysical profiles applications using the current location', queryParams: () => this.geophysicalParams(), }, ]
Private formGroup
Default value : this.service.formGroup
Private service
Default value : inject(AppService)
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
import {Params} from '@angular/router';
import {ConnectedApplication, NshmpConnectedApplicationsComponent} from '@ghsc/nshmp-lib-ng/nshmp';
import {NehrpSiteClass} from '@ghsc/nshmp-utils-ts/libs/nshmp-lib/gmm';
import {ControlType} from 'projects/nshmp-apps/src/app/designmaps/rtgm/models/control-type.model';
import {RtgmStaticHazardQuery} from 'projects/nshmp-apps/src/app/designmaps/rtgm/models/rtgm-query.model';
import {GeophysicalQuery} from 'projects/nshmp-apps/src/app/ncm/geophysical-profiles/models/geophysical-query.model';
import {apps} from 'projects/nshmp-apps/src/shared/utils/applications.utils';

import {AppService} from '../../services/app.service';

@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [NshmpConnectedApplicationsComponent],
  selector: 'app-connected-applications',
  styleUrl: './connected-applications.component.scss',
  templateUrl: './connected-applications.component.html',
})
export class ConnectedApplicationsComponent {
  private service = inject(AppService);

  private formGroup = this.service.formGroup;

  connectedApplications: ConnectedApplication[] = [
    {
      application: apps().designMaps.rtgm,
      description: 'Open the RTGM application using the current control panel inputs',
      queryParams: () => this.rtgmParams(),
    },
    {
      application: apps().ncm.geophysicalProfiles,
      description: 'Open the NCM geophysical profiles applications using the current location',
      queryParams: () => this.geophysicalParams(),
    },
  ];

  private geophysicalParams(): Params {
    const values = this.formGroup.getRawValue();

    const queryParams: GeophysicalQuery = {
      location: `${values.latitude}, ${values.longitude}`,
    };

    return queryParams;
  }

  private rtgmParams(): Params {
    const values = this.formGroup.getRawValue();

    const params: Partial<RtgmStaticHazardQuery> = {
      controlType: ControlType.STATIC_HAZARD,
      latitude: values.latitude?.toString(),
      longitude: values.longitude?.toString(),
      maxDirection: values.maxDirection?.toString(),
      model: values.model,
      returnPeriod: values.returnPeriod?.toString(),
      siteClass: values.siteClass as NehrpSiteClass,
      truncate: values.truncate?.toString(),
    };

    return params;
  }
}
<nshmp-connected-applications [applications]="connectedApplications" />
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""