diff --git a/CHANGELOG b/CHANGELOG index 8791eca..762705a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ * #24 Add information about weather/warning * #28 Fightdedection Plygon on Map * #27 Draw Camera-Desity bock on map +* #16 filter nach kategorien/tracker einbauen ### Bugfixes * Add Correct Dispose Handling * TimeCalculation now handle negative values correct diff --git a/Lora-Map/Model/PositionItem.cs b/Lora-Map/Model/PositionItem.cs index 64e4e46..9149ba6 100644 --- a/Lora-Map/Model/PositionItem.cs +++ b/Lora-Map/Model/PositionItem.cs @@ -34,6 +34,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { } else { this.Name = id; this.Icon = null; + this.Group = null; } } public static Boolean CheckJson(JsonData json) => json.ContainsKey("Rssi") && json["Rssi"].IsDouble diff --git a/Lora-Map/resources/admin/js/menu.js b/Lora-Map/resources/admin/js/menu.js index 8a25847..1a61b29 100644 --- a/Lora-Map/resources/admin/js/menu.js +++ b/Lora-Map/resources/admin/js/menu.js @@ -210,6 +210,9 @@ var NamesEditor = { var name = el.children[1].children[0].value; var url = null; var gfilter = el.children[3].children[0].selectedOptions[0].value; + if (gfilter === "---") { + gfilter = "no"; + } if (el.children[2].children.length === 2) { url = el.children[2].children[1].data; } diff --git a/Lora-Map/resources/css/global.css b/Lora-Map/resources/css/global.css index 02e9a0f..3a8d345 100644 --- a/Lora-Map/resources/css/global.css +++ b/Lora-Map/resources/css/global.css @@ -96,7 +96,11 @@ object { display: none; } #pannels #pannels_pos .item { -margin: 4px; + margin: 4px; +} +#pannels #pannels_pos .item.filter { + opacity: 0.4; + background-color: rgba(1,1,1,0.2); } #pannels #pannels_pos .item .color { float: left; diff --git a/Lora-Map/resources/index.html b/Lora-Map/resources/index.html index a8ca4c2..0c26246 100644 --- a/Lora-Map/resources/index.html +++ b/Lora-Map/resources/index.html @@ -23,7 +23,7 @@

Angezeigte Gruppen

- diff --git a/Lora-Map/resources/js/marker.js b/Lora-Map/resources/js/marker.js index d18311f..44dd496 100644 --- a/Lora-Map/resources/js/marker.js +++ b/Lora-Map/resources/js/marker.js @@ -2,6 +2,7 @@ _Markers: {}, PanicData: {}, LocationData: {}, + VisibleMarkers: {}, Start: function () { return this; }, @@ -48,17 +49,21 @@ } } } - var lasttime = FunctionsObject.TimeCalculation(positionItem['Recievedtime'], "diffraw"); - if (lasttime <= 5 * 60) { - this._Markers[key]._icon.style.opacity = 1; - } else if (lasttime > 5 * 60 && lasttime <= 15 * 60) { - this._Markers[key]._icon.style.opacity = 0.9 - (lasttime - 5 * 60) / (15 * 60 - 5 * 60) * (0.9 - 0.7); - } else if (lasttime > 15 * 60 && lasttime <= 30 * 60) { - this._Markers[key]._icon.style.opacity = 0.7 - (lasttime - 15 * 60) / (30 * 60 - 15 * 60) * (0.7 - 0.5); - } else if (lasttime > 30 * 60 && lasttime <= 60 * 60) { - this._Markers[key]._icon.style.opacity = 0.5 - (lasttime - 30 * 60) / (30 * 60 - 30 * 60) * (0.5 - 0.25); - } else if (lasttime > 60 * 60) { - this._Markers[key]._icon.style.opacity = 0.25; + if (positionItem.Group !== null && this.VisibleMarkers.hasOwnProperty("___isset") && !this.VisibleMarkers.hasOwnProperty(positionItem.Group)) { + this._Markers[key]._icon.style.opacity = 0; + } else { + var lasttime = FunctionsObject.TimeCalculation(positionItem['Recievedtime'], "diffraw"); + if (lasttime <= 5 * 60) { + this._Markers[key]._icon.style.opacity = 1; + } else if (lasttime > 5 * 60 && lasttime <= 15 * 60) { + this._Markers[key]._icon.style.opacity = 0.9 - (lasttime - 5 * 60) / (15 * 60 - 5 * 60) * (0.9 - 0.7); + } else if (lasttime > 15 * 60 && lasttime <= 30 * 60) { + this._Markers[key]._icon.style.opacity = 0.7 - (lasttime - 15 * 60) / (30 * 60 - 15 * 60) * (0.7 - 0.5); + } else if (lasttime > 30 * 60 && lasttime <= 60 * 60) { + this._Markers[key]._icon.style.opacity = 0.5 - (lasttime - 30 * 60) / (30 * 60 - 30 * 60) * (0.5 - 0.25); + } else if (lasttime > 60 * 60) { + this._Markers[key]._icon.style.opacity = 0.25; + } } } } @@ -73,14 +78,27 @@ var alertItem = this.PanicData[id]; if (this._Markers.hasOwnProperty(id)) { var marker = this._Markers[id]; - if (FunctionsObject.TimeCalculation(alertItem["Recievedtime"], "diffraw") <= 10 && marker._icon.className.indexOf(" marker-alert") === -1) { - marker._icon.className += " marker-alert"; - MenuObject.ShowMarkerInfoPerId(id); - } else if (FunctionsObject.TimeCalculation(alertItem["Recievedtime"], "diffraw") > 10 && marker._icon.className.indexOf(" marker-alert") !== -1) { - marker._icon.className = marker._icon.className.replace(" marker-alert", ""); + if (!(this.LocationData[id].Group !== null && this.VisibleMarkers.hasOwnProperty("___isset") && !this.VisibleMarkers.hasOwnProperty(this.LocationData[id].Group))) { + if (FunctionsObject.TimeCalculation(alertItem["Recievedtime"], "diffraw") <= 10 && marker._icon.className.indexOf(" marker-alert") === -1) { + marker._icon.className += " marker-alert"; + MenuObject.ShowMarkerInfoPerId(id); + } else if (FunctionsObject.TimeCalculation(alertItem["Recievedtime"], "diffraw") > 10 && marker._icon.className.indexOf(" marker-alert") !== -1) { + marker._icon.className = marker._icon.className.replace(" marker-alert", ""); + } } } } } + }, + ChangeFilter: function (select) { + this.VisibleMarkers = {}; + if (select.selectedOptions.length > 0) { + for (var i = 0; i < select.selectedOptions.length; i++) { + this.VisibleMarkers[select.selectedOptions[i].value] = true; + } + this.VisibleMarkers["no"] = true; + this.VisibleMarkers["___isset"] = true; + } + this._ParseAJAXLoc(this.LocationData); } }.Start(); \ No newline at end of file diff --git a/Lora-Map/resources/js/menu.js b/Lora-Map/resources/js/menu.js index 325a1c7..a72cf85 100644 --- a/Lora-Map/resources/js/menu.js +++ b/Lora-Map/resources/js/menu.js @@ -40,6 +40,15 @@ this._overviewStatus[id] = this._CreateOverviewElement(positionItem, id); document.getElementById("pannels_pos").appendChild(this._overviewStatus[id]); } + if (positionItem.Group !== null && MarkerObject.VisibleMarkers.hasOwnProperty("___isset") && !MarkerObject.VisibleMarkers.hasOwnProperty(positionItem.Group)) { + if (this._overviewStatus[id].className.indexOf("filter") === -1) { + this._overviewStatus[id].className = "item filter"; + } + } else { + if (this._overviewStatus[id].className.indexOf("filter") !== -1) { + this._overviewStatus[id].className = "item"; + } + } this._UpdateOverviewElement(positionItem, id); } } @@ -172,7 +181,7 @@ html += "
" + "" + walert.Headline + "" + "" + walert.Location + "" + - "" + walert.Body + (walert.Instructions != "" ? "

" + walert.Instructions : "") + "
" + + "" + walert.Body + (walert.Instructions !== "" ? "

" + walert.Instructions : "") + "
" + "Von: "; if (FunctionsObject.TimeCalculation(walert.From, "diffraw") < 0) { html += "in " + FunctionsObject.TimeCalculation(walert.From, "difftextn");