diff --git a/Lora-Map/Lora-Map.csproj b/Lora-Map/Lora-Map.csproj
index 112ba83..c6dac2c 100644
--- a/Lora-Map/Lora-Map.csproj
+++ b/Lora-Map/Lora-Map.csproj
@@ -45,6 +45,7 @@
+
@@ -66,6 +67,9 @@
PreserveNewest
+
+ PreserveNewest
+
@@ -95,7 +99,12 @@
PreserveNewest
-
+
+ PreserveNewest
+
+
+ Designer
+
PreserveNewest
diff --git a/Lora-Map/Model/Marker.cs b/Lora-Map/Model/Marker.cs
new file mode 100644
index 0000000..962a158
--- /dev/null
+++ b/Lora-Map/Model/Marker.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace Fraunhofer.Fit.IoT.LoraMap.Model {
+ class Marker {
+ private readonly XmlDocument svg = new XmlDocument();
+
+ public Marker(String hash) {
+ this.svg.LoadXml(File.ReadAllText("resources/icons/marker/Marker.svg"));
+ this.ParseParams(hash);
+ }
+
+ private void ParseParams(String hash) {
+ String[] parts = hash.Split('&');
+ foreach(String part in parts) {
+ String[] keyvalue = part.Split('=');
+ if(keyvalue.Length == 2) {
+ switch(keyvalue[0].ToLower()) {
+ case "name":
+ XmlNodeList node = this.svg.DocumentElement.SelectNodes("//*[local-name()='tspan'][@id='marker-name-text']");
+ if(node.Count == 1) {
+ node.Item(0).InnerText = keyvalue[1];
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public override String ToString() => this.svg.OuterXml;
+ }
+}
diff --git a/Lora-Map/Server.cs b/Lora-Map/Server.cs
index 4af7e80..4901f79 100644
--- a/Lora-Map/Server.cs
+++ b/Lora-Map/Server.cs
@@ -15,6 +15,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap {
{
private readonly SortedDictionary locations = new SortedDictionary();
private readonly JsonData marker;
+ private readonly Dictionary markertable = new Dictionary();
public Server(ADataBackend backend, Dictionary settings, InIReader requests) : base(backend, settings, requests) => this.marker = JsonMapper.ToObject(File.ReadAllText("names.json"));
@@ -63,6 +64,18 @@ namespace Fraunhofer.Fit.IoT.LoraMap {
return;
}
}
+ if(cont.Request.Url.PathAndQuery.StartsWith("/icons/marker/Marker.svg") && cont.Request.Url.PathAndQuery.Contains("?")) {
+ String hash = cont.Request.Url.PathAndQuery.Substring(cont.Request.Url.PathAndQuery.IndexOf('?')+1);
+ if(!this.markertable.ContainsKey(hash)) {
+ this.markertable.Add(hash, new Marker(hash));
+ }
+ cont.Response.ContentType = "image/svg+xml";
+ Byte[] buf = Encoding.UTF8.GetBytes(this.markertable[hash].ToString());
+ cont.Response.ContentLength64 = buf.Length;
+ cont.Response.OutputStream.Write(buf, 0, buf.Length);
+ Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery);
+ return;
+ }
base.SendResponse(cont);
}
}
diff --git a/Lora-Map/resources/icons/marker/Marker.svg b/Lora-Map/resources/icons/marker/Marker.svg
index ad598d4..8034f2e 100644
--- a/Lora-Map/resources/icons/marker/Marker.svg
+++ b/Lora-Map/resources/icons/marker/Marker.svg
@@ -1,123 +1,107 @@
-