Update the right symbol type
This commit is contained in:
parent
57ee23da66
commit
9c67e5379f
@ -2,6 +2,8 @@ import {Component, Inject} from "@angular/core";
|
|||||||
import {MapSymbol} from "../../models/mapSymbol";
|
import {MapSymbol} from "../../models/mapSymbol";
|
||||||
import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from "@angular/material/bottom-sheet";
|
import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from "@angular/material/bottom-sheet";
|
||||||
|
|
||||||
|
declare const L;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'edit-symbol',
|
selector: 'edit-symbol',
|
||||||
templateUrl: 'editSymbol.component.html'
|
templateUrl: 'editSymbol.component.html'
|
||||||
@ -19,20 +21,20 @@ export class EditSymbolComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
if(this.mapItem.getRadius) {
|
if(this.mapItem instanceof L.Circle) {
|
||||||
let latlng = this.mapItem.getLatLng();
|
let latlng = this.mapItem.getLatLng();
|
||||||
this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng};
|
this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng};
|
||||||
this.symbol['radius'] = this.mapItem.getRadius();
|
this.symbol['radius'] = this.mapItem.getRadius();
|
||||||
} else if(this.mapItem.getLatLngs) {
|
} else if(this.mapItem instanceof L.Marker) {
|
||||||
|
let latlng = this.mapItem.getLatLng();
|
||||||
|
this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng};
|
||||||
|
} else if(this.mapItem instanceof L.Polygon) {
|
||||||
let path = this.mapItem.getLatLngs();
|
let path = this.mapItem.getLatLngs();
|
||||||
this.symbol.latlng = path[0].map(latlng => ({lat: latlng.lat, lng: latlng.lng}));
|
this.symbol.latlng = path[0].map(latlng => ({lat: latlng.lat, lng: latlng.lng}));
|
||||||
} else if(this.mapItem.getBounds) {
|
} else if(this.mapItem instanceof L.Rectangle) {
|
||||||
let bounds = this.mapItem.getBounds();
|
let bounds = this.mapItem.getBounds();
|
||||||
this.symbol.latlng = {lat: bounds['_northEast'].lat, lng: bounds['_northEast'].lng};
|
this.symbol.latlng = {lat: bounds['_northEast'].lat, lng: bounds['_northEast'].lng};
|
||||||
this.symbol['latlng2'] = {lat: bounds['_southWest'].lat, lng: bounds['_southWest'].lng};
|
this.symbol['latlng2'] = {lat: bounds['_southWest'].lat, lng: bounds['_southWest'].lng};
|
||||||
} else if(this.mapItem.getLatLng) {
|
|
||||||
let latlng = this.mapItem.getLatLng();
|
|
||||||
this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ref.dismiss(this.symbol);
|
this.ref.dismiss(this.symbol);
|
||||||
|
Loading…
Reference in New Issue
Block a user