Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascending/Descending Rollout Layer Toggle #2033

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading