Change Mqtt-Map a bit

This commit is contained in:
BlubbFish 2018-08-12 17:02:49 +00:00
parent 3a1d3f27cc
commit 2d76fef3cf
6 changed files with 31 additions and 15 deletions

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
</configuration>

View File

@ -69,7 +69,7 @@ namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken {
public Googlelocation(ADataBackend backend, Dictionary<String, String> settings) { public Googlelocation(ADataBackend backend, Dictionary<String, String> settings) {
this.config = settings; this.config = settings;
backend.MessageIncomming += this.Backend_MessageIncomming; backend.MessageIncomming += this.Backend_MessageIncomming;
this._listener.Prefixes.Add("http://"+ this.config["prefix"] + ":8080/"); this._listener.Prefixes.Add(this.config["prefix"]);
this._listener.Start(); this._listener.Start();
this.Run(); this.Run();
} }

View File

@ -7,7 +7,8 @@ using Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken;
namespace mqtt_map { namespace mqtt_map {
class Program { class Program {
static void Main(String[] args) { static void Main(String[] args) {
if(!InIReader.ConfigExist("settings")) { InIReader.SetSearchPath(new List<String>() { "/etc/mqttmap", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mqttmap" });
if (!InIReader.ConfigExist("settings")) {
Console.WriteLine("settings.ini not found!"); Console.WriteLine("settings.ini not found!");
Console.ReadLine(); Console.ReadLine();
return; return;

View File

@ -50,7 +50,6 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" />
<None Include="app.manifest" /> <None Include="app.manifest" />
<None Include="settings.conf.example"> <None Include="settings.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@ -16,19 +16,25 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#title {
position: absolute;
z-index: 10000;
margin-left: 110px;
margin-top: 7px;
color: #e23232;
}
</style> </style>
</head> </head>
<body> <body>
<h1>Google Map</h1> <h1 id="title">Mqtt-Map Monica</h1>
<div id="map"></div> <div id="map"></div>
<script> <script>
var map; var map;
var center_set = false;
function initMap() { function initMap() {
var myLatLng = { lat: 50.784077, lng: 7.228756 };
map = new google.maps.Map(document.getElementById('map'), { map = new google.maps.Map(document.getElementById('map'), {
zoom: 15, zoom: 3,
center: myLatLng center: new google.maps.LatLng(0, 0)
}); });
} }
</script> </script>
@ -77,6 +83,11 @@
infowindow.open(map, m); infowindow.open(map, m);
}); });
m.setMap(map); m.setMap(map);
if (!center_set) {
map.setCenter(new google.maps.LatLng(list[pos]["Latitude"], list[pos]["Longitude"]));
smoothZoom(15, map.getZoom());
center_set = true;
}
j++; j++;
} }
} }
@ -96,6 +107,17 @@
xhttp.send(); xhttp.send();
} }
setInterval(get_elm, 5000); setInterval(get_elm, 5000);
function smoothZoom(max, current) {
if (current >= max) {
return;
} else {
var z = google.maps.event.addListener(map, 'zoom_changed', function (event) {
google.maps.event.removeListener(z);
smoothZoom(max, current + 1);
});
setTimeout(function () { map.setZoom(current) }, 150);
}
}
</script> </script>
</body> </body>

View File

@ -4,4 +4,4 @@ server=127.0.0.1
[google] [google]
api_key=abc api_key=abc
prefix=localhost prefix=http://+:8080/