Update the right symbol type

This commit is contained in:
Zakary Timson 2019-09-08 20:29:52 -04:00
parent 57ee23da66
commit 9c67e5379f

View File

@ -2,6 +2,8 @@ import {Component, Inject} from "@angular/core";
import {MapSymbol} from "../../models/mapSymbol";
import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from "@angular/material/bottom-sheet";
declare const L;
@Component({
selector: 'edit-symbol',
templateUrl: 'editSymbol.component.html'
@ -19,20 +21,20 @@ export class EditSymbolComponent {
}
close() {
if(this.mapItem.getRadius) {
if(this.mapItem instanceof L.Circle) {
let latlng = this.mapItem.getLatLng();
this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng};
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();
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();
this.symbol.latlng = {lat: bounds['_northEast'].lat, lng: bounds['_northEast'].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);