libs/depiction/src/lib/datasetlist/trajectory-entry/trajectory-entry.component.ts
selector | n52-trajectory-entry |
templateUrl | ./trajectory-entry.component.html |
Properties |
|
Methods |
|
Inputs |
Outputs |
constructor(servicesConnector: HelgolandServicesConnector, internalIdHandler: InternalIdHandler, translateSrvc: TranslateService)
|
||||||||||||
Parameters :
|
datasetOptions | |
Type : DatasetOptions
|
|
datasetId | |
Type : string
|
|
Inherited from
ListEntryComponent
|
|
Defined in
ListEntryComponent:15
|
selected | |
Type : boolean
|
|
Inherited from
ListEntryComponent
|
|
Defined in
ListEntryComponent:18
|
onEditOptions | |
Type : EventEmitter<DatasetOptions>
|
|
onUpdateOptions | |
Type : EventEmitter<DatasetOptions>
|
|
onDeleteDataset | |
Type : EventEmitter<boolean>
|
|
Inherited from
ListEntryComponent
|
|
Defined in
ListEntryComponent:21
|
onSelectDataset | |
Type : EventEmitter<boolean>
|
|
Inherited from
ListEntryComponent
|
|
Defined in
ListEntryComponent:24
|
Public editDatasetOptions | ||||||
editDatasetOptions(options: DatasetOptions)
|
||||||
Parameters :
Returns :
void
|
Protected handleTrajectoryLoadError | ||||||
handleTrajectoryLoadError(error: any)
|
||||||
Parameters :
Returns :
void
|
Protected loadDataset | ||||||
loadDataset(lang?: string)
|
||||||
Parameters :
Returns :
void
|
Protected setTrajectory | ||||||
setTrajectory(trajectory: HelgolandTrajectory)
|
||||||
Parameters :
Returns :
void
|
Public toggleVisibility |
toggleVisibility()
|
Returns :
void
|
Protected Abstract loadDataset | ||||||
loadDataset(lang?: string)
|
||||||
Inherited from
ListEntryComponent
|
||||||
Defined in
ListEntryComponent:64
|
||||||
Parameters :
Returns :
void
|
Public ngOnDestroy |
ngOnDestroy()
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:45
|
Returns :
void
|
Public ngOnInit |
ngOnInit()
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:37
|
Returns :
void
|
Protected onLanguageChanged | ||||||
onLanguageChanged(langChangeEvent: LangChangeEvent)
|
||||||
Inherited from
ListEntryComponent
|
||||||
Defined in
ListEntryComponent:58
|
||||||
Parameters :
Returns :
void
|
Public removeDataset |
removeDataset()
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:49
|
Returns :
void
|
Public toggleSelection |
toggleSelection()
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:53
|
Returns :
void
|
Public dataset |
Type : HelgolandTrajectory
|
Public tempColor |
Type : string
|
Protected internalId |
Type : InternalDatasetId
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:28
|
Private langChangeSubscription |
Type : Subscription
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:30
|
Public loading |
Type : boolean
|
Inherited from
ListEntryComponent
|
Defined in
ListEntryComponent:26
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
import {
DatasetOptions,
DatasetType,
HelgolandParameterFilter,
HelgolandServicesConnector,
HelgolandTrajectory,
InternalIdHandler,
} from '@helgoland/core';
import { TranslateService } from '@ngx-translate/core';
import { ListEntryComponent } from '../list-entry.component';
@Component({
selector: 'n52-trajectory-entry',
templateUrl: './trajectory-entry.component.html'
})
export class TrajectoryEntryComponent extends ListEntryComponent {
@Input()
public datasetOptions: DatasetOptions;
@Output()
public onUpdateOptions: EventEmitter<DatasetOptions> = new EventEmitter();
@Output()
public onEditOptions: EventEmitter<DatasetOptions> = new EventEmitter();
public dataset: HelgolandTrajectory;
public tempColor: string;
constructor(
protected servicesConnector: HelgolandServicesConnector,
protected internalIdHandler: InternalIdHandler,
protected translateSrvc: TranslateService
) {
super(internalIdHandler, translateSrvc);
}
public toggleVisibility() {
this.datasetOptions.visible = !this.datasetOptions.visible;
this.onUpdateOptions.emit(this.datasetOptions);
}
public editDatasetOptions(options: DatasetOptions) {
this.onEditOptions.emit(options);
}
protected loadDataset(lang?: string): void {
const params: HelgolandParameterFilter = {};
if (lang) { params.lang = lang; }
this.loading = true;
this.servicesConnector.getDataset(this.internalId, { ...params, type: DatasetType.Trajectory })
.subscribe(
trajectory => this.setTrajectory(trajectory),
error => this.handleTrajectoryLoadError(error),
);
}
protected handleTrajectoryLoadError(error: any): void {
console.error(error);
this.loading = false;
}
protected setTrajectory(trajectory: HelgolandTrajectory) {
this.dataset = trajectory;
this.loading = false;
}
}
<div style="white-space: nowrap;" (click)="toggleVisibility()">
<span>
<a class="btn btn-light">
<span class="fa fa-plus" [ngClass]="{'fa-eye': !datasetOptions?.visible, 'fa-eye-slash': datasetOptions?.visible}"></span>
</a>
</span>
<span style="padding-left: 10px;" [ngStyle]="{'color': datasetOptions?.color}">{{dataset?.parameters.phenomenon.label}}</span>
<span class="fa fa-pencil" (click)="editDatasetOptions(datasetOptions); $event.stopPropagation();" [ngStyle]="{color: datasetOptions?.color}"></span>
</div>