| /******************************************************************************** |
| * Copyright (c) 2020 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0 |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| ********************************************************************************/ |
| |
| import {Component, EventEmitter, forwardRef, Input, Output} from "@angular/core"; |
| import {NG_VALUE_ACCESSOR} from "@angular/forms"; |
| import {ILeafletBounds} from "../../../leaflet"; |
| import {AbstractControlValueAccessorComponent} from "../../common"; |
| |
| @Component({ |
| selector: "app-map-select", |
| templateUrl: "./map-select.component.html", |
| styleUrls: ["./map-select.component.scss"], |
| providers: [ |
| { |
| provide: NG_VALUE_ACCESSOR, |
| useExisting: forwardRef(() => MapSelectComponent), |
| multi: true |
| } |
| ] |
| }) |
| export class MapSelectComponent extends AbstractControlValueAccessorComponent<string> { |
| |
| @Input() |
| public appCenter: string; |
| |
| @Input() |
| public appSubCaption: string; |
| |
| @Output() |
| public appOpenGis = new EventEmitter<ILeafletBounds>(); |
| |
| public select(value: string) { |
| // Note that this.appValue should not be changed here: |
| // Changing it here can create an infinite loop in which the map position changes without any user input. |
| this.onChange(value); |
| this.onTouch(); |
| this.appValueChange.emit(value); |
| } |
| |
| } |