Create Aliases for Camera Count
Filter Fight under level
This commit is contained in:
parent
286f931e59
commit
6b1fca9109
@ -11,6 +11,8 @@
|
||||
* Search in Description of Polygons
|
||||
* Change Sani to Rettungsdienst
|
||||
* Display GateCounting Boxes in a line not a collumn
|
||||
* Create Aliases for Camera Count
|
||||
* Filter Fight under level
|
||||
|
||||
## 1.2.9
|
||||
### New Features
|
||||
|
@ -12,7 +12,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
public Double Startloclat { get; private set; }
|
||||
public Double Startloclon { get; private set; }
|
||||
public Dictionary<String, List<Dictionary<String, List<Double>>>> Grid { get; private set; }
|
||||
public Dictionary<String, List<List<Double>>> FightDedection { get; private set; }
|
||||
public Dictionary<String, Fight> FightDedection { get; private set; }
|
||||
public Dictionary<String, Density> DensityArea { get; private set; }
|
||||
|
||||
public Settings() => this.ParseJson();
|
||||
@ -39,9 +39,11 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
}
|
||||
}
|
||||
if(json.ContainsKey("FightDedection") && json["FightDedection"].IsObject) {
|
||||
Dictionary<String, List<List<Double>>> fight = new Dictionary<String, List<List<Double>>>();
|
||||
Dictionary<String, Fight> fights = new Dictionary<String, Fight>();
|
||||
foreach (KeyValuePair<String, JsonData> entry in json["FightDedection"]) {
|
||||
List<List<Double>> poly = new List<List<Double>>();
|
||||
Fight fight = new Fight {
|
||||
Polygon = new List<List<Double>>()
|
||||
};
|
||||
if(entry.Value.ContainsKey("Poly") && entry.Value["Poly"].IsArray) {
|
||||
foreach (JsonData coord in entry.Value["Poly"]) {
|
||||
List<Double> coords = new List<Double>();
|
||||
@ -49,18 +51,25 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
coords.Add((Double)coord["Lat"]);
|
||||
coords.Add((Double)coord["Lon"]);
|
||||
}
|
||||
poly.Add(coords);
|
||||
fight.Polygon.Add(coords);
|
||||
}
|
||||
}
|
||||
fight.Add(entry.Key, poly);
|
||||
if (entry.Value.ContainsKey("Level") && (entry.Value["Level"].IsDouble)) {
|
||||
fight.Level = (Double)entry.Value["Level"];
|
||||
}
|
||||
if (entry.Value.ContainsKey("Alias") && entry.Value["Alias"].IsString) {
|
||||
fight.Alias = (String)entry.Value["Alias"];
|
||||
}
|
||||
fights.Add(entry.Key, fight);
|
||||
}
|
||||
this.FightDedection = fight;
|
||||
this.FightDedection = fights;
|
||||
}
|
||||
if (json.ContainsKey("CrwodDensity") && json["CrwodDensity"].IsObject) {
|
||||
Dictionary<String, Density> densitys = new Dictionary<String, Density>();
|
||||
foreach (KeyValuePair<String, JsonData> entry in json["CrwodDensity"]) {
|
||||
Density density = new Density();
|
||||
density.Polygon = new List<List<Double>>();
|
||||
Density density = new Density {
|
||||
Polygon = new List<List<Double>>()
|
||||
};
|
||||
if (entry.Value.ContainsKey("Poly") && entry.Value["Poly"].IsArray) {
|
||||
foreach (JsonData coord in entry.Value["Poly"]) {
|
||||
List<Double> coords = new List<Double>();
|
||||
@ -74,6 +83,9 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
if(entry.Value.ContainsKey("Count") && (entry.Value["Count"].IsInt || entry.Value["Count"].IsDouble)) {
|
||||
density.Maximum = (Int32)entry.Value["Count"];
|
||||
}
|
||||
if(entry.Value.ContainsKey("Alias") && entry.Value["Alias"].IsString) {
|
||||
density.Alias = (String)entry.Value["Alias"];
|
||||
}
|
||||
densitys.Add(entry.Key, density);
|
||||
}
|
||||
this.DensityArea = densitys;
|
||||
@ -83,7 +95,11 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
}
|
||||
|
||||
private void GenerateGrid() {
|
||||
if(this.Startloclat == 0 || this.Startloclon == 0 || this.gridradius == 0) {
|
||||
this.Grid = new Dictionary<String, List<Dictionary<String, List<Double>>>> {
|
||||
{ "Major", new List<Dictionary<String, List<Double>>>() },
|
||||
{ "Minor", new List<Dictionary<String, List<Double>>>() }
|
||||
};
|
||||
if (this.Startloclat == 0 || this.Startloclon == 0 || this.gridradius == 0) {
|
||||
return;
|
||||
}
|
||||
MilitaryGridReferenceSystem start = new Coordinate(this.Startloclat, this.Startloclon).MGRS;
|
||||
@ -92,10 +108,6 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
Double bottom = start.Northing - this.gridradius - (start.Northing - this.gridradius) % 100;
|
||||
Double right = start.Easting + this.gridradius + (100 - (start.Easting + this.gridradius) % 100);
|
||||
Double top = start.Northing + this.gridradius + (100 - (start.Northing + this.gridradius) % 100);
|
||||
this.Grid = new Dictionary<String, List<Dictionary<String, List<Double>>>> {
|
||||
{ "Major", new List<Dictionary<String, List<Double>>>() },
|
||||
{ "Minor", new List<Dictionary<String, List<Double>>>() }
|
||||
};
|
||||
for (Double i = left; i <= right; i += 50) {
|
||||
Coordinate TopLeft = MilitaryGridReferenceSystem.MGRStoLatLong(new MilitaryGridReferenceSystem(start.LatZone, start.LongZone, start.Digraph, i, top));
|
||||
Coordinate BottomLeft = MilitaryGridReferenceSystem.MGRStoLatLong(new MilitaryGridReferenceSystem(start.LatZone, start.LongZone, start.Digraph, i, bottom));
|
||||
@ -165,6 +177,13 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
public struct Density {
|
||||
public List<List<Double>> Polygon { get; set; }
|
||||
public Int32 Maximum { get; set; }
|
||||
public String Alias { get; set; }
|
||||
}
|
||||
|
||||
public struct Fight {
|
||||
public List<List<Double>> Polygon { get; set; }
|
||||
public Double Level { get; set; }
|
||||
public String Alias { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -372,6 +372,9 @@ var Settings = {
|
||||
if (typeof jsonsettings.CrwodDensity === "undefined") {
|
||||
jsonsettings.CrwodDensity = [];
|
||||
}
|
||||
if (typeof jsonsettings.Counting === "undefined") {
|
||||
jsonsettings.Counting = [];
|
||||
}
|
||||
var html = "<div id='settingseditor'><div class='title'>Einstellungen</div>";
|
||||
html += "<div class='startloc'>Startpunkt: <input value='" + jsonsettings.StartPos.lat + "' id='startlat'> Lat, <input value='" + jsonsettings.StartPos.lon + "' id='startlon'> Lon</div>";
|
||||
html += "<div class='wetterwarnings'>CellId's für DWD-Wetterwarnungen: <input value='" + jsonsettings.CellIds.join(";") + "' id='wetterids'> (Trennen durch \";\", <a href='https://www.dwd.de/DE/leistungen/opendata/help/warnungen/cap_warncellids_csv.html'>cap_warncellids_csv</a>)</div>";
|
||||
@ -403,7 +406,7 @@ var Settings = {
|
||||
var coord = coords[j].split(";");
|
||||
polyjson[j] = { "Lat": this._filterFloat(coord[0]), "Lon": this._filterFloat(coord[1]) };
|
||||
}
|
||||
fightjson[id] = { "Poly": polyjson };
|
||||
fightjson[id] = { "Poly": polyjson, "Alias": rowsf[i].children[2].innerText, "Level": this._filterFloat(rowsf[i].children[3].innerText) };
|
||||
}
|
||||
ret.FightDedection = fightjson;
|
||||
|
||||
@ -425,7 +428,8 @@ var Settings = {
|
||||
}
|
||||
crowdjson[id] = {
|
||||
"Poly": polyjson,
|
||||
"Count": num
|
||||
"Count": num,
|
||||
"Alias": rowsc[i].children[3].innerText
|
||||
};
|
||||
}
|
||||
ret.CrwodDensity = crowdjson;
|
||||
@ -442,11 +446,11 @@ var Settings = {
|
||||
};
|
||||
savesettings.open("POST", "/admin/set_json_settings", true);
|
||||
savesettings.send(JSON.stringify(ret));
|
||||
},
|
||||
},
|
||||
_renderFightDedection: function (json) {
|
||||
var ret = "";
|
||||
ret += "<table id='fighttable' class='settingstable'>";
|
||||
ret += "<thead><tr><th width='150'>ID</th><th width='250'>Koordinaten</th><th width='50'></th></tr></thead>";
|
||||
ret += "<thead><tr><th width='150'>ID</th><th width='250'>Koordinaten</th><th width='150'>Alias</th><th width='150'>Alertlimit</th><th width='50'></th></tr></thead>";
|
||||
ret += "<tbody>";
|
||||
for (var id in json) {
|
||||
var coords = [];
|
||||
@ -456,18 +460,20 @@ var Settings = {
|
||||
ret += "<tr>" +
|
||||
"<td>" + id + "</td>" +
|
||||
"<td>" + coords.join("<br>") + "</td>" +
|
||||
"<td>" + json[id].Alias + "</td>" +
|
||||
"<td>" + json[id].Level + "</td>" +
|
||||
"<td><img src='../icons/general/edit.png' onclick='Settings.EditFight(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.Delete(this.parentNode.parentNode)' class='pointer'></td>" +
|
||||
"</tr>";
|
||||
}
|
||||
ret += "</tbody>";
|
||||
ret += "<tfoot><tr><td></td><td></td><td><img src='../icons/general/add.png' onclick='Settings.AddFight()' class='pointer'></td></tr></tfoot>";
|
||||
ret += "<tfoot><tr><td></td><td></td><td></td><td></td><td><img src='../icons/general/add.png' onclick='Settings.AddFight()' class='pointer'></td></tr></tfoot>";
|
||||
ret += "</table>";
|
||||
return ret;
|
||||
},
|
||||
_renderCrowdDensity: function (json) {
|
||||
var ret = "";
|
||||
ret += "<table id='crowdtable' class='settingstable'>";
|
||||
ret += "<thead><tr><th width='150'>ID</th><th width='200'>Personenanzahl</th><th width='250'>Koordinaten</th><th width='50'></th></tr></thead>";
|
||||
ret += "<thead><tr><th width='150'>ID</th><th width='200'>Personenanzahl</th><th width='250'>Koordinaten</th><th width='150'>Alias</th><th width='50'></th></tr></thead>";
|
||||
ret += "<tbody>";
|
||||
for (var id in json) {
|
||||
var coords = [];
|
||||
@ -478,11 +484,12 @@ var Settings = {
|
||||
"<td>" + id + "</td>" +
|
||||
"<td>" + json[id].Count + "</td>" +
|
||||
"<td>" + coords.join("<br>") + "</td>" +
|
||||
"<td>" + json[id].Alias + "</td>" +
|
||||
"<td><img src='../icons/general/edit.png' onclick='Settings.EditDensity(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.Delete(this.parentNode.parentNode)' class='pointer'></td>" +
|
||||
"</tr>";
|
||||
}
|
||||
ret += "</tbody>";
|
||||
ret += "<tfoot><tr><td></td><td></td><td></td><td><img src='../icons/general/add.png' onclick='Settings.AddDensity()' class='pointer'></td></tr></tfoot>";
|
||||
ret += "<tfoot><tr><td></td><td></td><td></td><td></td><td><img src='../icons/general/add.png' onclick='Settings.AddDensity()' class='pointer'></td></tr></tfoot>";
|
||||
ret += "</table>";
|
||||
return ret;
|
||||
},
|
||||
@ -490,6 +497,8 @@ var Settings = {
|
||||
var newrow = document.createElement("tr");
|
||||
newrow.innerHTML = "<td><input style='width: 145px;'/></td>";
|
||||
newrow.innerHTML += "<td><textarea style='width: 240px;height: 60px;'></textarea></td>";
|
||||
newrow.innerHTML = "<td><input style='width: 145px;'/></td>";
|
||||
newrow.innerHTML = "<td><input style='width: 145px;'/></td>";
|
||||
newrow.innerHTML += "<td><img src='../icons/general/save.png' onclick='Settings.SaveRowfight(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.Abort(this.parentNode.parentNode)' class='pointer'></td>";
|
||||
document.getElementById("fighttable").children[1].appendChild(newrow);
|
||||
},
|
||||
@ -498,6 +507,7 @@ var Settings = {
|
||||
newrow.innerHTML = "<td><input style='width: 145px;'/></td>";
|
||||
newrow.innerHTML += "<td><input style='width: 195px;'/></td>";
|
||||
newrow.innerHTML += "<td><textarea style='width: 240px;height: 60px;'></textarea></td>";
|
||||
newrow.innerHTML = "<td><input style='width: 145px;'/></td>";
|
||||
newrow.innerHTML += "<td><img src='../icons/general/save.png' onclick='Settings.SaveRowdensity(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.Abort(this.parentNode.parentNode)' class='pointer'></td>";
|
||||
document.getElementById("crowdtable").children[1].appendChild(newrow);
|
||||
},
|
||||
@ -519,12 +529,18 @@ var Settings = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isNaN(this._filterFloat(el.children[3].children[0].value))) {
|
||||
alert("Die Eingabe des Alertlevel erwartet einen Float");
|
||||
return;
|
||||
}
|
||||
if (fail) {
|
||||
alert("Die Eingabe der Koordinaten ist nicht Korrekt!\n\nBeispiel:\n50.7;7.8\n50.6;7.9");
|
||||
return;
|
||||
}
|
||||
el.innerHTML = "<td>" + el.children[0].children[0].value + "</td>" +
|
||||
"<td>" + coords + "</td>" +
|
||||
"<td>" + el.children[2].children[0].value + "</td>" +
|
||||
"<td>" + this._filterFloat(el.children[3].children[0].value) + "</td>" +
|
||||
"<td><img src='../icons/general/edit.png' onclick='Settings.EditFight(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.DeleteFight(this.parentNode.parentNode)' class='pointer'></td>";
|
||||
},
|
||||
SaveRowdensity: function (el) {
|
||||
@ -553,6 +569,7 @@ var Settings = {
|
||||
el.innerHTML = "<td>" + el.children[0].children[0].value + "</td>" +
|
||||
"<td>" + el.children[1].children[0].value + "</td>" +
|
||||
"<td>" + coords + "</td>" +
|
||||
"<td>" + el.children[3].children[0].value + "</td>" +
|
||||
"<td><img src='../icons/general/edit.png' onclick='Settings.EditDensity(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.DeleteFight(this.parentNode.parentNode)' class='pointer'></td>";
|
||||
},
|
||||
Delete: function (el) {
|
||||
@ -564,12 +581,15 @@ var Settings = {
|
||||
EditFight: function (el) {
|
||||
el.innerHTML = "<td><input style='width: 145px;' value='" + el.children[0].innerText + "'/></td>" +
|
||||
"<td><textarea style='width: 240px;height: 60px;'>" + el.children[1].innerText + "</textarea></td>" +
|
||||
"<td><input style='width: 145px;' value='" + el.children[2].innerText + "'/></td>" +
|
||||
"<td><input style='width: 145px;' value='" + el.children[3].innerText + "'/></td>" +
|
||||
"<td><img src='../icons/general/save.png' onclick='Settings.SaveRowfight(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.Abort(this.parentNode.parentNode)' class='pointer'></td>";
|
||||
},
|
||||
EditDensity: function (el) {
|
||||
el.innerHTML = "<td><input style='width: 145px;' value='" + el.children[0].innerText + "'/></td>" +
|
||||
"<td><input style='width: 195px;' value='" + el.children[1].innerText + "'/></td>" +
|
||||
"<td><textarea style='width: 240px;height: 60px;'>" + el.children[2].innerText + "</textarea></td>" +
|
||||
"<td><input style='width: 145px;' value='" + el.children[3].innerText + "'/></td>" +
|
||||
"<td><img src='../icons/general/save.png' onclick='Settings.SaveRowdensity(this.parentNode.parentNode)' class='pointer'> <img src='../icons/general/remove.png' onclick='Settings.Abort(this.parentNode.parentNode)' class='pointer'></td>";
|
||||
},
|
||||
_filterFloat: function (value) {
|
||||
@ -586,7 +606,6 @@ var ExImport = {
|
||||
html += "<div class='names'>names.json (Namen und Icons)<br/><textarea id='ex_names'></textarea> <img src='../icons/general/save.png' onclick='ExImport.SaveNames()' class='pointer'></div>";
|
||||
html += "<div class='names'>geo.json (Layer on the MAP) <a href='https://mapbox.github.io/togeojson/'>Kml Konverter</a><br/><textarea id='ex_geo'></textarea> <img src='../icons/general/save.png' onclick='ExImport.SaveGeo()' class='pointer'></div>";
|
||||
html += "<div class='names'>settings.json (Settings of the Map)<br/><textarea id='ex_settings'></textarea> <img src='../icons/general/save.png' onclick='ExImport.SaveSettings()' class='pointer'></div>";
|
||||
|
||||
html += "</div>";
|
||||
document.getElementById("content").innerHTML = html;
|
||||
document.getElementById("ex_names").value = jsonnames;
|
||||
|
@ -44,6 +44,7 @@
|
||||
MapObject._ParseAJAXLayers(json["getlayer"]);
|
||||
MapObject._ParseAJAXGeo(json["getgeo"]);
|
||||
MapObject._ParseAJAXSettings(json["startup"]);
|
||||
OverlayObject._ParseAJAXSettings(json["startup"]);
|
||||
}
|
||||
};
|
||||
getonce.open("GET", "/getonce", true);
|
||||
|
@ -67,26 +67,30 @@
|
||||
},
|
||||
_GenerateFightBoxes: function (fightdedection) {
|
||||
for (var cameraid in fightdedection) {
|
||||
this._FightDedection[cameraid] = L.polygon(fightdedection[cameraid], { color: 'black', weight: 1 }).addTo(this.Map);
|
||||
this._FightDedection[cameraid].bindPopup("Fightdedection für Kamera: " + cameraid);
|
||||
this._FightDedection[cameraid] = {};
|
||||
this._FightDedection[cameraid].Box = L.polygon(fightdedection[cameraid].Polygon, { color: 'black', weight: 1 }).addTo(this.Map);
|
||||
this._FightDedection[cameraid].Box.bindPopup("Fightdedection " + fightdedection[cameraid].Alias);
|
||||
this._FightDedection[cameraid].Level = fightdedection[cameraid].Level;
|
||||
}
|
||||
},
|
||||
_ParseAJAXFightDedection: function (json) {
|
||||
for (var cameraid in json) {
|
||||
if (this._FightDedection.hasOwnProperty(cameraid)) {
|
||||
var fight = json[cameraid];
|
||||
var box = this._FightDedection[cameraid];
|
||||
var box = this._FightDedection[cameraid].Box;
|
||||
var diff = FunctionsObject.TimeCalculation(fight["LastUpdate"], "diffraw");
|
||||
if (diff <= 10 && box.options.color === "black") {
|
||||
box.setStyle({ color: 'rgb(' + fight["FightProbability"] * 255 + ',0,0)' });
|
||||
} else if (diff <= 10 && box.options.color !== "black") {
|
||||
if (diff % 2 === 0) {
|
||||
if (fight["FightProbability"] > this._FightDedection[cameraid].Level) {
|
||||
if (diff <= 10 && box.options.color === "black") {
|
||||
box.setStyle({ color: 'rgb(' + fight["FightProbability"] * 255 + ',0,0)' });
|
||||
} else {
|
||||
box.setStyle({ color: 'green' });
|
||||
} else if (diff <= 10 && box.options.color !== "black") {
|
||||
if (diff % 2 === 0) {
|
||||
box.setStyle({ color: 'rgb(' + fight["FightProbability"] * 255 + ',0,0)' });
|
||||
} else {
|
||||
box.setStyle({ color: 'green' });
|
||||
}
|
||||
} else if (diff > 10 && box.options.color !== "black") {
|
||||
box.setStyle({ color: 'black' });
|
||||
}
|
||||
} else if (diff > 10 && box.options.color !== "black") {
|
||||
box.setStyle({ color: 'black' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
var OverlayObject = {
|
||||
_DensitySettings: {},
|
||||
Start: function () {
|
||||
return this;
|
||||
},
|
||||
@ -22,14 +23,19 @@
|
||||
var densystext = "";
|
||||
for (var densyid in cameradensy) {
|
||||
if (cameradensy.hasOwnProperty(densyid)) {
|
||||
var densy = cameradensy[densyid];
|
||||
var densytext = "<div class='camera'>";
|
||||
densytext += "<span class='name'>" + densyid + "</span>";
|
||||
densytext += "<span class='count'>" + densy["DensityCount"] + "</span>";
|
||||
densytext += "</div>";
|
||||
densystext += densytext;
|
||||
if (this._DensitySettings.hasOwnProperty(densyid)) {
|
||||
var densy = cameradensy[densyid];
|
||||
var densytext = "<div class='camera'>";
|
||||
densytext += "<span class='name'>" + this._DensitySettings[densyid].Alias + "</span>";
|
||||
densytext += "<span class='count'>" + densy["DensityCount"] + "</span>";
|
||||
densytext += "</div>";
|
||||
densystext += densytext;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.getElementById("crwoddensy").innerHTML = densystext;
|
||||
},
|
||||
_ParseAJAXSettings: function (json) {
|
||||
this._DensitySettings = json["DensityArea"];
|
||||
}
|
||||
}.Start();
|
Loading…
Reference in New Issue
Block a user