Update Sensor
This commit is contained in:
parent
da34f0566d
commit
1e0690fed1
@ -2,6 +2,7 @@
|
||||
|
||||
## 1.2.10
|
||||
### New Features
|
||||
* Posibility to display sensor data on map
|
||||
### Bugfixes
|
||||
* Parse also all Doublevalues as Int
|
||||
### Changes
|
||||
@ -14,6 +15,7 @@
|
||||
* Display GateCounting Boxes in a line not a collumn
|
||||
* Create Aliases for Camera Count
|
||||
* Filter Fight under level
|
||||
* Refactoring
|
||||
|
||||
## 1.2.9
|
||||
### New Features
|
||||
|
@ -27,6 +27,9 @@
|
||||
padding: 5px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor.alert {
|
||||
border: 2px solid red;
|
||||
}
|
||||
#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor span {
|
||||
display: block;
|
||||
text-align: center;
|
||||
@ -37,6 +40,9 @@
|
||||
#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor .wind {
|
||||
font-size: 18px;
|
||||
}
|
||||
#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor.alert {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* Optional: Makes the sample page fill the window. */
|
||||
html, body {
|
||||
|
@ -255,6 +255,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
MarkerObject.ScaleSensors("zoom");
|
||||
});
|
||||
},
|
||||
_SetupClickHandler: function () {
|
||||
|
@ -98,7 +98,6 @@
|
||||
if (this._SensorSettings.hasOwnProperty(sensorid)) {
|
||||
var sensordata = sensorjson[sensorid];
|
||||
var sensorsettings = this._SensorSettings[sensorid];
|
||||
|
||||
if (!this._Sensors.hasOwnProperty(sensorid)) { //Sensor is not drawn until now
|
||||
var sensor = null;
|
||||
var sensorIcon = L.divIcon({
|
||||
@ -110,15 +109,40 @@
|
||||
'<span class="wind">' + sensordata.Windspeed + ' m/s</span>' +
|
||||
'<span class="hum">' + sensordata.Humidity + ' %rl</span></div>'
|
||||
});
|
||||
sensor = L.marker(sensorsettings.Coordinates, { 'title': sensorsettings.Alias, 'icon': sensorIcon });
|
||||
sensor = L.marker(sensorsettings.Coordinates, { 'title': sensorsettings.Alias, 'icon': sensorIcon, interactive: false });
|
||||
this._Sensors[sensorid] = sensor.addTo(MapObject.Map);
|
||||
this.ScaleSensors(document.getElementById('MapSensor_id_' + sensorid));
|
||||
} else { //Sensor refresh!
|
||||
|
||||
document.getElementById('MapSensor_id_' + sensorid).innerHTML = '<span class="name">' + sensorsettings.Alias + '</span>' +
|
||||
'<span class="temp">' + sensordata.Temperature + ' °C</span>' +
|
||||
'<span class="wind">' + sensordata.Windspeed + ' m/s</span>' +
|
||||
'<span class="hum">' + sensordata.Humidity + ' %rl</span>';
|
||||
}
|
||||
document.getElementById('MapSensor_id_' + sensorid).className = "mapsensor" + (sensordata.Windspeed > sensorsettings.Level ? ' alert' : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
ScaleSensors: function (el) {
|
||||
if (el === "zoom") {
|
||||
for (var sensorid in this._Sensors) {
|
||||
this.ScaleSensors(document.getElementById('MapSensor_id_' + sensorid));
|
||||
}
|
||||
return;
|
||||
}
|
||||
var currentZoom = MapObject.Map.getZoom();
|
||||
var scale = 1;
|
||||
if (currentZoom < 14) {
|
||||
scale = 0;
|
||||
} else if (currentZoom === 14) {
|
||||
scale = 0.2;
|
||||
} else if (currentZoom === 15) {
|
||||
scale = 0.5;
|
||||
} else if (currentZoom >= 16) {
|
||||
scale = 1;
|
||||
}
|
||||
el.style.cssText = "transform: scale(" + scale + ");";
|
||||
},
|
||||
_ParseAJAXSettings: function(json) {
|
||||
this._SensorSettings = json["Sensors"];
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user