diff --git a/src/OSFramework/Maps/FileLayer/AbstractFileLayer.ts b/src/OSFramework/Maps/FileLayer/AbstractFileLayer.ts index ec5c5587..091da0eb 100644 --- a/src/OSFramework/Maps/FileLayer/AbstractFileLayer.ts +++ b/src/OSFramework/Maps/FileLayer/AbstractFileLayer.ts @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars namespace OSFramework.Maps.FileLayer { - export abstract class AbstractFileLayer< - W, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - T extends Configuration.IConfigurationFileLayer, - > implements IFileLayer - { + export abstract class AbstractFileLayer implements IFileLayer { /** Configuration reference */ private _config: T; private _map: OSMap.IMap; diff --git a/src/OSFramework/Maps/FileLayer/IFileLayer.ts b/src/OSFramework/Maps/FileLayer/IFileLayer.ts index bc99ffd1..47db59e2 100644 --- a/src/OSFramework/Maps/FileLayer/IFileLayer.ts +++ b/src/OSFramework/Maps/FileLayer/IFileLayer.ts @@ -7,8 +7,7 @@ namespace OSFramework.Maps.FileLayer { fileLayerEvents: Event.FileLayer.FileLayersEventsManager; isReady: boolean; map: OSMap.IMap; //IMap - // eslint-disable-next-line @typescript-eslint/no-explicit-any - provider: any; + provider: unknown; uniqueId: string; widgetId: string; diff --git a/src/OSFramework/Maps/Marker/IMarker.ts b/src/OSFramework/Maps/Marker/IMarker.ts index 7cb11ea8..a97b75a9 100644 --- a/src/OSFramework/Maps/Marker/IMarker.ts +++ b/src/OSFramework/Maps/Marker/IMarker.ts @@ -8,8 +8,7 @@ namespace OSFramework.Maps.Marker { isReady: boolean; map: OSMap.IMap; //IMap markerEvents: Event.Marker.MarkerEventsManager; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - provider: any; + provider: unknown; uniqueId: string; widgetId: string; diff --git a/src/OSFramework/Maps/OSMap/AbstractMap.ts b/src/OSFramework/Maps/OSMap/AbstractMap.ts index 18a151e9..df1eca40 100644 --- a/src/OSFramework/Maps/OSMap/AbstractMap.ts +++ b/src/OSFramework/Maps/OSMap/AbstractMap.ts @@ -80,7 +80,7 @@ namespace OSFramework.Maps.OSMap { return Array.from(this._markersSet); } - public get markersReady(): W[] { + public get markersReady(): unknown[] { // We need to go through all the markers and only get the ones that are ready (or have the provider defined) // Then we need to return the providers inside a list return this.markers.filter((marker) => marker.isReady).map((marker) => marker.provider); diff --git a/src/OutSystems/Maps/MapAPI/MarkerManager.ts b/src/OutSystems/Maps/MapAPI/MarkerManager.ts index 7f8c20ae..dbc1a573 100644 --- a/src/OutSystems/Maps/MapAPI/MarkerManager.ts +++ b/src/OutSystems/Maps/MapAPI/MarkerManager.ts @@ -58,12 +58,16 @@ namespace OutSystems.Maps.MapAPI.MarkerManager { if (map.providerType === OSFramework.Maps.Enum.ProviderType.Google) { // Check if the feature is enabled! if (map.hasMarkerClusterer()) { - const marker = map.markers.find((marker) => marker.provider.location === markerPosition); + const marker = map.markers.find((marker) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (marker.provider as any).location === markerPosition; + }); // Check if there is a marker with the given Position/Location if (marker !== undefined) { map.features.markerClusterer.removeMarker(marker); - marker.provider.setMap(map.provider); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (marker.provider as any).setMap(map.provider); } else { responseObj.isSuccess = false; responseObj.message = `There are not a marker with position:'${markerPosition}' to be removed.`; diff --git a/src/Providers/Maps/Google/DrawingTools/DrawMarker.ts b/src/Providers/Maps/Google/DrawingTools/DrawMarker.ts index 559c9d7f..4bbac68b 100644 --- a/src/Providers/Maps/Google/DrawingTools/DrawMarker.ts +++ b/src/Providers/Maps/Google/DrawingTools/DrawMarker.ts @@ -18,20 +18,22 @@ namespace Provider.Maps.Google.DrawingTools { } private _setOnChangeEvent(_marker: OSFramework.Maps.Marker.IMarker): void { + const markerProvider = _marker.provider as google.maps.Marker; _marker.markerEvents.addHandler( // changing the marker location is only available via the drag-and-drop, so the solution passes by adding the dragend event listener as the marker's OnChanged event 'dragend' as OSFramework.Maps.Event.Marker.MarkerEventType, // Trigger the onDrawingChangeEvent with the extra information (marker uniqueId and flag indicating that the element is not new) - () => + () => { this.triggerOnDrawingChangeEvent( _marker.uniqueId, false, JSON.stringify({ - Lat: _marker.provider.getPosition().lat(), - Lng: _marker.provider.getPosition().lng(), + Lat: markerProvider.getPosition().lat(), + Lng: markerProvider.getPosition().lng(), }), - `${_marker.provider.getPosition().lat()},${_marker.provider.getPosition().lng()}` - ) + `${markerProvider.getPosition().lat()}, ${markerProvider.getPosition().lng()}` + ); + } ); } diff --git a/src/Providers/Maps/Google/Features/GoogleMarkerClusterer.ts b/src/Providers/Maps/Google/Features/GoogleMarkerClusterer.ts index 8d5615f0..b3cd30c8 100644 --- a/src/Providers/Maps/Google/Features/GoogleMarkerClusterer.ts +++ b/src/Providers/Maps/Google/Features/GoogleMarkerClusterer.ts @@ -70,7 +70,9 @@ namespace Provider.Maps.Google.Feature { this._rebuildClusters(); } else { this._markerClusterer.clearMarkers(); - this._map.markers.forEach((marker) => marker.provider.setMap(this._map.provider)); + this._map.markers.forEach((marker) => { + (marker.provider as google.maps.Marker).setMap(this._map.provider); + }); } } diff --git a/src/Providers/Maps/Google/Features/InfoWindow.ts b/src/Providers/Maps/Google/Features/InfoWindow.ts index 6cac314d..5389717d 100644 --- a/src/Providers/Maps/Google/Features/InfoWindow.ts +++ b/src/Providers/Maps/Google/Features/InfoWindow.ts @@ -34,7 +34,7 @@ namespace Provider.Maps.Google.Feature { if (this._popupIsOpened === true) { this.closePopup(); } - this._infoWindow.open(this._map.provider, marker.provider); + this._infoWindow.open(this._map.provider, marker.provider as google.maps.Marker); this._popupIsOpened = true; } diff --git a/src/Providers/Maps/Leaflet/DrawingTools/DrawMarker.ts b/src/Providers/Maps/Leaflet/DrawingTools/DrawMarker.ts index 94ebc213..99b9aea5 100644 --- a/src/Providers/Maps/Leaflet/DrawingTools/DrawMarker.ts +++ b/src/Providers/Maps/Leaflet/DrawingTools/DrawMarker.ts @@ -61,20 +61,22 @@ namespace Provider.Maps.Leaflet.DrawingTools { } private _setOnChangeEvent(_marker: OSFramework.Maps.Marker.IMarker): void { + const markerProvider = _marker.provider as L.Marker; _marker.markerEvents.addHandler( // changing the marker location is only available via the drag-and-drop, so the solution passes by adding the dragend event listener as the marker's OnChanged event 'dragend' as OSFramework.Maps.Event.Marker.MarkerEventType, // Trigger the onDrawingChangeEvent with the extra information (marker uniqueId and flag indicating that the element is not new) - () => + () => { this.triggerOnDrawingChangeEvent( _marker.uniqueId, false, JSON.stringify({ - Lat: _marker.provider.getLatLng().lat, - Lng: _marker.provider.getLatLng().lng, + Lat: markerProvider.getLatLng().lat, + Lng: markerProvider.getLatLng().lng, }), - `${_marker.provider.getLatLng().lat},${_marker.provider.getLatLng().lng}` - ) + `${markerProvider.getLatLng().lat}, ${markerProvider.getLatLng().lng}` + ); + } ); } diff --git a/src/Providers/Maps/Leaflet/Features/InfoWindow.ts b/src/Providers/Maps/Leaflet/Features/InfoWindow.ts index 8a6ffa89..0b046565 100644 --- a/src/Providers/Maps/Leaflet/Features/InfoWindow.ts +++ b/src/Providers/Maps/Leaflet/Features/InfoWindow.ts @@ -2,16 +2,11 @@ namespace Provider.Maps.Leaflet.Feature { export class InfoWindow implements OSFramework.Maps.Feature.IInfoWindow, OSFramework.Maps.Interface.IBuilder { private _infoWindow: L.Popup; - private _map: OSMap.IMapLeaflet; private _popupIsOpened: boolean; - constructor(map: OSMap.IMapLeaflet) { - this._map = map; - } - // This method is a way of getting the options which include the offset. // The offset needs to be acquired dynamically as it should change according to the height of the icon applied to the marker. - private _getOptions(marker: OSFramework.Maps.Marker.IMarkerPopup): L.PopupOptions { + private _getOptions(marker: Marker.MarkerPopup): L.PopupOptions { // Let's use the height of the marker icon as the offsetY. But if the height of the icon is not defined: use the runtime offsetHeight of the marker element const offsetHeight = marker.config.iconHeight > 0 ? marker.config.iconHeight : marker.provider.getElement().offsetHeight; @@ -31,7 +26,7 @@ namespace Provider.Maps.Leaflet.Feature { this._popupIsOpened = false; } - public closePopup(marker: OSFramework.Maps.Marker.IMarkerPopup): void { + public closePopup(marker: Marker.MarkerPopup): void { if (this._popupIsOpened) { marker.provider.closePopup(); // Let's make sure the popup gets unlinked from the Marker @@ -40,7 +35,7 @@ namespace Provider.Maps.Leaflet.Feature { } } - public openPopup(marker: OSFramework.Maps.Marker.IMarkerPopup): void { + public openPopup(marker: Marker.MarkerPopup): void { if (this._popupIsOpened === true) { this.closePopup(marker); } @@ -49,10 +44,10 @@ namespace Provider.Maps.Leaflet.Feature { this._popupIsOpened = true; } - public setPopupContent(content: string, marker: OSFramework.Maps.Marker.IMarkerPopup): void { + public setPopupContent(content: string, marker: Marker.MarkerPopup): void { this._infoWindow.setContent(content); this._infoWindow.update(); - marker.provider.setPopupContent(this._infoWindow.getContent()); + marker.provider.setPopupContent(this._infoWindow.getContent() as L.Content); } } } diff --git a/src/Providers/Maps/Leaflet/Features/Zoom.ts b/src/Providers/Maps/Leaflet/Features/Zoom.ts index c2f4a718..c9c0c788 100644 --- a/src/Providers/Maps/Leaflet/Features/Zoom.ts +++ b/src/Providers/Maps/Leaflet/Features/Zoom.ts @@ -21,7 +21,7 @@ namespace Provider.Maps.Leaflet.Feature { let bounds: L.LatLngBounds; this._map.markers.forEach(function (marker) { if (marker.provider === undefined) return; - const loc: L.LatLng = marker.provider.getLatLng(); + const loc: L.LatLng = (marker.provider as L.Marker).getLatLng(); bounds = bounds ? bounds.extend(loc) : new L.LatLngBounds(loc, loc); }); if (useShapes) { diff --git a/src/Providers/Maps/Leaflet/OSMap/OSMap.ts b/src/Providers/Maps/Leaflet/OSMap/OSMap.ts index 79d6b1b7..6e84d003 100644 --- a/src/Providers/Maps/Leaflet/OSMap/OSMap.ts +++ b/src/Providers/Maps/Leaflet/OSMap/OSMap.ts @@ -269,6 +269,7 @@ namespace Provider.Maps.Leaflet.OSMap { //If there are markers, let's choose the map center accordingly. //Otherwise, the map center will be the one defined in the configs. if (this.markers.length > 0) { + const markerProvider = this.markers[0].provider as L.Marker; if (this.markers.length > 1) { //As the map has more than one marker, let's see if the map //center should be changed. @@ -276,16 +277,16 @@ namespace Provider.Maps.Leaflet.OSMap { //If the user hasn't change zoom, or the developer is ignoring //it (current behavior), then the map will be centered tentatively //in the first marker. - position = this.markers[0].provider.getLatLng(); + position = markerProvider.getLatLng(); } else { //If the user has zoomed and the developer intends to respect user zoom //then the current map center will be used. position = this.provider.getCenter(); } - } else if (this.markers[0].provider !== undefined) { + } else if (markerProvider !== undefined) { //If there's only one marker, and is already created, its location will be //used as the map center. - position = this.markers[0].provider.getLatLng(); + position = markerProvider.getLatLng(); } }