Skip to content

Commit

Permalink
Merge pull request #2033 from asfadmin/kim/displacement
Browse files Browse the repository at this point in the history
Ascending/Descending Rollout Layer Toggle
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Nov 22, 2024
2 parents 718c7d2 + 9652bd7 commit 681ebea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
</mat-checkbox>

<mat-checkbox (change)="onUpdatePriority($event.checked)">
<mat-checkbox #priorityRollout (change)="onUpdatePriority($event.checked)">
<div class="selector-text">
Rollout
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { SubSink } from 'subsink';

import { MapService } from '@services';
Expand All @@ -7,6 +7,7 @@ import { Store } from '@ngrx/store';
import { AppState } from '@store';
import { getFlightDirections } from '@store/filters';
import { distinctUntilChanged, map } from 'rxjs';
import { MatCheckbox } from '@angular/material/checkbox';


@Component({
Expand All @@ -15,6 +16,7 @@ import { distinctUntilChanged, map } from 'rxjs';
styleUrl: './displacement-layers.component.scss'
})
export class DisplacementLayersComponent implements OnInit, OnDestroy {
@ViewChild("priorityRollout", { static: true }) priorityCheckbox: MatCheckbox;
public flightDir = models.FlightDirection.ASCENDING;
public displacementOverview: models.DisplacementLayerTypes | null = null;

Expand Down Expand Up @@ -44,14 +46,18 @@ export class DisplacementLayersComponent implements OnInit, OnDestroy {
if (!!this.displacementOverview) {
this.setDisplacementLayer(this.flightDir, this.displacementOverview)
}
if (this.priorityCheckbox.checked) {
this.mapService.disablePriority()
this.onUpdatePriority(this.priorityCheckbox.checked)
}
}
)
)
}

public onUpdatePriority(isChecked: boolean): void {
if (isChecked) {
this.mapService.enablePriority();
this.mapService.enablePriority(this.flightDir);
}
else {
this.mapService.disablePriority();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { AppState } from '@store';
import * as mapStore from '@store/map';

import * as models from '@models';
import * as filtersStore from '@store/filters';

import { MapService, ScreenSizeService } from '@services';
import { map } from 'rxjs';

@Component({
selector: 'app-layer-selector',
Expand Down Expand Up @@ -35,6 +38,7 @@ export class LayerSelectorComponent implements OnInit, OnDestroy {
public breakpoint: models.Breakpoints;
public breakpoints = models.Breakpoints;
private coherenceLayerOpacity: number;
private flightDir: models.FlightDirection = models.FlightDirection.ASCENDING;
public priorityEnabled = false;


Expand Down Expand Up @@ -83,6 +87,14 @@ export class LayerSelectorComponent implements OnInit, OnDestroy {
}
)
)

this.subs.add(
this.store$.select(filtersStore.getFlightDirections).pipe(
map(flightDirs => flightDirs[0] ?? models.FlightDirection.ASCENDING)
).subscribe(
flightDir => this.flightDir = flightDir
)
)
}

public onNewLayerType(layerType: models.MapLayerTypes): void {
Expand Down Expand Up @@ -125,7 +137,7 @@ export class LayerSelectorComponent implements OnInit, OnDestroy {
}
public togglePriority(): void {
if(!this.priorityEnabled) {
this.mapService.enablePriority();
this.mapService.enablePriority(this.flightDir);
this.priorityEnabled = true;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="button-display-container">
<label class="button-label">{{"FLIGHT_DIRECTION" | translate}}<br><b>{{flightDirection}}</b></label>
<mat-icon class="control-icon">
{{flightDirection === FlightDirections.ASCENDING ? 'north_east' : 'south_east'}}
{{flightDirection === FlightDirections.ASCENDING ? 'north_west' : 'south_west'}}
</mat-icon>
</div>
</button>
4 changes: 2 additions & 2 deletions src/app/services/map/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,9 @@ export class MapService {
this.hasCoherenceLayer$.next(null);
}

public enablePriority(): void {
public enablePriority(flight_dir: models.FlightDirection): void {
const source = new VectorSource({
url: '/assets/priority_rollout.json',
url: `/assets/priority_rollout_${flight_dir}.geojson`,
format: new GeoJSON({})
},
)
Expand Down

0 comments on commit 681ebea

Please sign in to comment.