Showing
7 changed files
with
24 additions
and
21 deletions
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | import L, { |
18 | 18 | FeatureGroup, |
19 | 19 | Icon, |
20 | - LatLngBounds, LatLngExpression, | |
20 | + LatLngBounds, | |
21 | 21 | LatLngTuple, |
22 | 22 | markerClusterGroup, |
23 | 23 | MarkerClusterGroup, |
... | ... | @@ -50,8 +50,6 @@ import { |
50 | 50 | } from '@home/components/widget/lib/maps/maps-utils'; |
51 | 51 | import { WidgetContext } from '@home/models/widget-component.models'; |
52 | 52 | import { deepClone, isDefinedAndNotEmptyStr } from '@core/utils'; |
53 | -import {newArray} from "@angular/compiler/src/util"; | |
54 | -import {isArray} from "rxjs/internal-compatibility"; | |
55 | 53 | |
56 | 54 | export default abstract class LeafletMap { |
57 | 55 | |
... | ... | @@ -186,9 +184,9 @@ export default abstract class LeafletMap { |
186 | 184 | let mousePositionOnMap: L.LatLng[]; |
187 | 185 | let addPolygon: L.Control; |
188 | 186 | this.map.on('mousemove', (e: L.LeafletMouseEvent) => { |
189 | - let latlng1 = e.latlng; | |
190 | - let latlng2 = L.latLng(e.latlng.lat, e.latlng.lng + 10); | |
191 | - let latlng3 = L.latLng(e.latlng.lat-10, e.latlng.lng); | |
187 | + const latlng1 = e.latlng; | |
188 | + const latlng2 = L.latLng(e.latlng.lat, e.latlng.lng + 10); | |
189 | + const latlng3 = L.latLng(e.latlng.lat-10, e.latlng.lng); | |
192 | 190 | mousePositionOnMap = [latlng1,latlng2, latlng3 ]; |
193 | 191 | }); |
194 | 192 | const dragListener = (e: L.DragEndEvent) => { |
... | ... | @@ -207,7 +205,6 @@ export default abstract class LeafletMap { |
207 | 205 | this.savePolygonLocation(updatedEnttity).subscribe(() => { |
208 | 206 | this.map.removeLayer(newPolygon); |
209 | 207 | this.deletePolygon(ds.entityName); |
210 | - // this.createPolygon(ds, this.datasources, this.options); | |
211 | 208 | }); |
212 | 209 | } |
213 | 210 | datasourcesList.append(dsItem); |
... | ... | @@ -673,7 +670,7 @@ export default abstract class LeafletMap { |
673 | 670 | } |
674 | 671 | |
675 | 672 | dragPolygonVertex = (e?, data = {} as FormattedData) => { |
676 | - if (e == undefined || (e.type !== 'editable:vertex:dragend' && e.type !== 'editable:vertex:deleted')) return; | |
673 | + if (e === undefined || (e.type !== 'editable:vertex:dragend' && e.type !== 'editable:vertex:deleted')) return; | |
677 | 674 | this.savePolygonLocation({ ...data, ...this.convertPolygonToCustomFormat(e.layer._latlngs) }).subscribe(); |
678 | 675 | } |
679 | 676 | ... | ... |
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | |
17 | 17 | import L, { LatLngExpression, LeafletMouseEvent } from 'leaflet'; |
18 | 18 | import { createTooltip, functionValueCalculator, parseWithTranslation, safeExecute } from './maps-utils'; |
19 | -import "leaflet-editable/src/Leaflet.Editable"; | |
19 | +import 'leaflet-editable/src/Leaflet.Editable'; | |
20 | 20 | import { FormattedData, PolygonSettings } from './map-models'; |
21 | 21 | |
22 | 22 | export class Polygon { |
... | ... | @@ -41,8 +41,8 @@ export class Polygon { |
41 | 41 | if (settings.editablePolygon) { |
42 | 42 | this.leafletPoly.enableEdit(this.map); |
43 | 43 | if (onDragendListener) { |
44 | - this.leafletPoly.on("editable:vertex:dragend", e => onDragendListener(e, this.data)); | |
45 | - this.leafletPoly.on("editable:vertex:deleted", e => onDragendListener(e, this.data)); | |
44 | + this.leafletPoly.on('editable:vertex:dragend', e => onDragendListener(e, this.data)); | |
45 | + this.leafletPoly.on('editable:vertex:deleted', e => onDragendListener(e, this.data)); | |
46 | 46 | } |
47 | 47 | } |
48 | 48 | ... | ... |
... | ... | @@ -20,7 +20,6 @@ import LeafletMap from '../leaflet-map'; |
20 | 20 | import { UnitedMapSettings } from '../map-models'; |
21 | 21 | import 'leaflet.gridlayer.googlemutant'; |
22 | 22 | import { ResourcesService } from '@core/services/resources.service'; |
23 | -import { Injector } from '@angular/core'; | |
24 | 23 | import { WidgetContext } from '@home/models/widget-component.models'; |
25 | 24 | |
26 | 25 | const gmGlobals: GmGlobal = {}; |
... | ... | @@ -37,7 +36,10 @@ export class GoogleMap extends LeafletMap { |
37 | 36 | this.resource = ctx.$injector.get(ResourcesService); |
38 | 37 | super.initSettings(options); |
39 | 38 | this.loadGoogle(() => { |
40 | - const map = L.map($container, {attributionControl: false, editable: !!options.editablePolygon}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
39 | + const map = L.map($container, { | |
40 | + attributionControl: false, | |
41 | + editable: !!options.editablePolygon | |
42 | + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
41 | 43 | (L.gridLayer as any).googleMutant({ |
42 | 44 | type: options?.gmDefaultMapType || 'roadmap' |
43 | 45 | }).addTo(map); | ... | ... |
... | ... | @@ -22,7 +22,9 @@ import { WidgetContext } from '@home/models/widget-component.models'; |
22 | 22 | export class HEREMap extends LeafletMap { |
23 | 23 | constructor(ctx: WidgetContext, $container, options: UnitedMapSettings) { |
24 | 24 | super(ctx, $container, options); |
25 | - const map = L.map($container, {editable: !!options.editablePolygon}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
25 | + const map = L.map($container, { | |
26 | + editable: !!options.editablePolygon | |
27 | + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
26 | 28 | const tileLayer = (L.tileLayer as any).provider(options.mapProviderHere || 'HERE.normalDay', options.credentials); |
27 | 29 | tileLayer.addTo(map); |
28 | 30 | super.initSettings(options); | ... | ... |
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | /// limitations under the License. |
15 | 15 | /// |
16 | 16 | |
17 | -import L, {LatLngBounds, LatLngExpression, LatLngLiteral, LatLngTuple} from 'leaflet'; | |
17 | +import L, { LatLngBounds, LatLngLiteral, LatLngTuple } from 'leaflet'; | |
18 | 18 | import LeafletMap from '../leaflet-map'; |
19 | 19 | import { MapImage, PosFuncton, UnitedMapSettings } from '../map-models'; |
20 | 20 | import { Observable, ReplaySubject } from 'rxjs'; |
... | ... | @@ -24,9 +24,7 @@ import { WidgetContext } from '@home/models/widget-component.models'; |
24 | 24 | import { DataSet, DatasourceType, widgetType } from '@shared/models/widget.models'; |
25 | 25 | import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; |
26 | 26 | import { WidgetSubscriptionOptions } from '@core/api/widget-api.models'; |
27 | -import { isDefinedAndNotNull, isDefinedAndNotEmptyStr, isNumber } from '@core/utils'; | |
28 | -import "leaflet-editable/src/Leaflet.Editable"; | |
29 | -import {isArray} from "rxjs/internal-compatibility"; | |
27 | +import { isDefinedAndNotEmptyStr } from '@core/utils'; | |
30 | 28 | |
31 | 29 | const maxZoom = 4;// ? |
32 | 30 | |
... | ... | @@ -260,7 +258,7 @@ export class ImageMap extends LeafletMap { |
260 | 258 | if (point.length) { |
261 | 259 | return this.convertToPolygonFormat(point); |
262 | 260 | } else { |
263 | - let pos = this.latLngToPoint(point); | |
261 | + const pos = this.latLngToPoint(point); | |
264 | 262 | return [calculateNewPointCoordinate(pos.x, this.width), calculateNewPointCoordinate(pos.y, this.height)]; |
265 | 263 | } |
266 | 264 | }) | ... | ... |
... | ... | @@ -22,7 +22,9 @@ import { WidgetContext } from '@home/models/widget-component.models'; |
22 | 22 | export class OpenStreetMap extends LeafletMap { |
23 | 23 | constructor(ctx: WidgetContext, $container, options: UnitedMapSettings) { |
24 | 24 | super(ctx, $container, options); |
25 | - const map = L.map($container, {editable: !!options.editablePolygon}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
25 | + const map = L.map($container, { | |
26 | + editable: !!options.editablePolygon | |
27 | + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
26 | 28 | let tileLayer; |
27 | 29 | if (options.useCustomProvider) |
28 | 30 | tileLayer = L.tileLayer(options.customProviderTileUrl); | ... | ... |
... | ... | @@ -24,7 +24,9 @@ export class TencentMap extends LeafletMap { |
24 | 24 | constructor(ctx: WidgetContext, $container, options: UnitedMapSettings) { |
25 | 25 | super(ctx, $container, options); |
26 | 26 | const txUrl = 'http://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0'; |
27 | - const map = L.map($container, {editable: !!options.editablePolygon}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
27 | + const map = L.map($container, { | |
28 | + editable: !!options.editablePolygon | |
29 | + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); | |
28 | 30 | const txLayer = L.tileLayer(txUrl, { |
29 | 31 | subdomains: '0123', |
30 | 32 | tms: true, | ... | ... |