From 85979c4ce78dc955f20eb32a217b3ef73b894669 Mon Sep 17 00:00:00 2001 From: Alejandro Rodriguez Date: Tue, 26 Sep 2017 15:59:53 +0200 Subject: [PATCH] Add BikeHireDockingStation support --- src/js/main.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/js/main.js b/src/js/main.js index 987daa2..0ef1f8e 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1197,6 +1197,55 @@ return infoWindow; }; + var renderBikeHireDockingStation = function renderBikeHireDockingStation(entity, coordinates) { + var icon; + icon = { + anchor: [0.5, 1], + scale: 0.4, + src: internalUrl('images/bikestation/icon.png') + }; + var poi = { + id: entity.id, + icon: icon, + tooltip: entity.id, + data: entity, + title: entity.name, + infoWindow: buildBikeHireDockingStationWindow.call(this, entity), + currentLocation: coordinates, + location: entity.location + }; + + return poi; + }; + + var buildBikeHireDockingStationWindow = function buildBikeHireDockingStationWindow(entity) { + var infoWindow = "
"; + + if (entity.description != null) { + infoWindow += '

' + entity.description + '

'; + } + + if (entity.status) { + infoWindow += '

Status: ' + entity.status + '

'; + } + + if (entity.availableBikeNumber) { + infoWindow += '

Availabel bikes: ' + entity.availableBikeNumber + '

'; + } + + if (entity.freeSlotNumber) { + infoWindow += '

Free slots: ' + entity.freeSlotNumber + '

'; + } + + if (entity.openingHours) { + infoWindow += '

Open hours: ' + entity.openingHours + '

'; + } + + infoWindow += "
"; + + return infoWindow; + }; + var builders = { "AirQualityObserved": renderAirQualityObserved, "WaterQualityObserved": renderWaterQualityObserved, @@ -1224,7 +1273,8 @@ "Garden": renderGarden, - "Vehicle": renderVehicle + "Vehicle": renderVehicle, + "BikeHireDockingStation": renderBikeHireDockingStation }; })();