Updated example delete marker/polygon for map
This commit is contained in:
parent
6b90c7ce21
commit
968f2745a0
File diff suppressed because one or more lines are too long
@ -89,8 +89,8 @@ export function isDefinedAndNotNull(value: any): boolean {
|
|||||||
return typeof value !== 'undefined' && value !== null;
|
return typeof value !== 'undefined' && value !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDefinedAndNotEmptyStr(value: any): boolean {
|
export function isEmptyStr(value: any): boolean {
|
||||||
return typeof value !== 'undefined' && value !== '';
|
return value === '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isFunction(value: any): boolean {
|
export function isFunction(value: any): boolean {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ import {
|
|||||||
safeExecute
|
safeExecute
|
||||||
} from '@home/components/widget/lib/maps/maps-utils';
|
} from '@home/components/widget/lib/maps/maps-utils';
|
||||||
import { WidgetContext } from '@home/models/widget-component.models';
|
import { WidgetContext } from '@home/models/widget-component.models';
|
||||||
import { deepClone, isDefinedAndNotEmptyStr } from '@core/utils';
|
import { deepClone, isDefinedAndNotNull, isEmptyStr, isString } from '@core/utils';
|
||||||
|
|
||||||
export default abstract class LeafletMap {
|
export default abstract class LeafletMap {
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ export default abstract class LeafletMap {
|
|||||||
if (!expression) return null;
|
if (!expression) return null;
|
||||||
const lat = expression[this.options.latKeyName];
|
const lat = expression[this.options.latKeyName];
|
||||||
const lng = expression[this.options.lngKeyName];
|
const lng = expression[this.options.lngKeyName];
|
||||||
if (!isDefinedAndNotEmptyStr(lat) || isNaN(lat) || !isDefinedAndNotEmptyStr(lng) || isNaN(lng)) {
|
if (!isDefinedAndNotNull(lat) || isString(lat) || isNaN(lat) || !isDefinedAndNotNull(lng) || isString(lng) || isNaN(lng)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return L.latLng(lat, lng) as L.LatLng;
|
return L.latLng(lat, lng) as L.LatLng;
|
||||||
@ -644,8 +644,8 @@ export default abstract class LeafletMap {
|
|||||||
const keys: string[] = [];
|
const keys: string[] = [];
|
||||||
this.polygonsData = deepClone(polyData);
|
this.polygonsData = deepClone(polyData);
|
||||||
polyData.forEach((data: FormattedData) => {
|
polyData.forEach((data: FormattedData) => {
|
||||||
if (data && isDefinedAndNotEmptyStr(data[this.options.polygonKeyName])) {
|
if (data && isDefinedAndNotNull(data[this.options.polygonKeyName]) && !isEmptyStr(data[this.options.polygonKeyName])) {
|
||||||
if (typeof (data[this.options.polygonKeyName]) === 'string') {
|
if (isString((data[this.options.polygonKeyName]))) {
|
||||||
data[this.options.polygonKeyName] = JSON.parse(data[this.options.polygonKeyName]);
|
data[this.options.polygonKeyName] = JSON.parse(data[this.options.polygonKeyName]);
|
||||||
}
|
}
|
||||||
data[this.options.polygonKeyName] = this.convertPositionPolygon(data[this.options.polygonKeyName]);
|
data[this.options.polygonKeyName] = this.convertPositionPolygon(data[this.options.polygonKeyName]);
|
||||||
|
|||||||
@ -22,13 +22,12 @@
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
//.leaflet-div-icon,
|
.tb-marker-label,
|
||||||
//.tb-marker-label,
|
.tb-marker-label:before {
|
||||||
//.tb-marker-label:before {
|
border: none;
|
||||||
// border: none;
|
background: none;
|
||||||
// background: none;
|
box-shadow: none;
|
||||||
// box-shadow: none;
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
.leaflet-container{
|
.leaflet-container{
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import { WidgetContext } from '@home/models/widget-component.models';
|
|||||||
import { DataSet, DatasourceType, widgetType } from '@shared/models/widget.models';
|
import { DataSet, DatasourceType, widgetType } from '@shared/models/widget.models';
|
||||||
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
||||||
import { WidgetSubscriptionOptions } from '@core/api/widget-api.models';
|
import { WidgetSubscriptionOptions } from '@core/api/widget-api.models';
|
||||||
import { isDefinedAndNotEmptyStr } from '@core/utils';
|
import { isDefinedAndNotNull, isEmptyStr } from '@core/utils';
|
||||||
|
|
||||||
const maxZoom = 4;// ?
|
const maxZoom = 4;// ?
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ export class ImageMap extends LeafletMap {
|
|||||||
convertPosition(expression): L.LatLng {
|
convertPosition(expression): L.LatLng {
|
||||||
const xPos = expression[this.options.xPosKeyName];
|
const xPos = expression[this.options.xPosKeyName];
|
||||||
const yPos = expression[this.options.yPosKeyName];
|
const yPos = expression[this.options.yPosKeyName];
|
||||||
if (!isDefinedAndNotEmptyStr(xPos) || isNaN(xPos) || !isDefinedAndNotEmptyStr(yPos) || isNaN(yPos)) {
|
if (!isDefinedAndNotNull(xPos) || isEmptyStr(xPos) || isNaN(xPos) || !isDefinedAndNotNull(yPos) || isEmptyStr(yPos) || isNaN(yPos)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Object.assign(expression, this.posFunction(xPos, yPos));
|
Object.assign(expression, this.posFunction(xPos, yPos));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user