#19 grid automatisch generieren
This commit is contained in:
parent
a2b3f2c5da
commit
b1832da477
@ -46,15 +46,15 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
}
|
||||
MilitaryGridReferenceSystem start = new Coordinate(this.Startloclat, this.Startloclon).MGRS;
|
||||
|
||||
Double left = start.Easting - this.gridradius - ((start.Easting - this.gridradius) % 100);
|
||||
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));
|
||||
Double left = start.Easting - this.gridradius - (start.Easting - this.gridradius) % 100;
|
||||
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 = i + 50) {
|
||||
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));
|
||||
if(i%100 == 0) {
|
||||
@ -85,7 +85,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
||||
});
|
||||
}
|
||||
}
|
||||
for (Double i = bottom; i <= top; i = i + 50) {
|
||||
for (Double i = bottom; i <= top; i += 50) {
|
||||
Coordinate BottomLeft = MilitaryGridReferenceSystem.MGRStoLatLong(new MilitaryGridReferenceSystem(start.LatZone, start.LongZone, start.Digraph, left, i));
|
||||
Coordinate BottomRight = MilitaryGridReferenceSystem.MGRStoLatLong(new MilitaryGridReferenceSystem(start.LatZone, start.LongZone, start.Digraph, right, i));
|
||||
if (i % 100 == 0) {
|
||||
|
@ -342,6 +342,15 @@ var NamesEditor = {
|
||||
|
||||
var Settings = {
|
||||
ParseJson: function (jsonsettings) {
|
||||
if (typeof jsonsettings.StartPos === "undefined") {
|
||||
jsonsettings.StartPos = { lat: 0, lon: 0 };
|
||||
}
|
||||
if (typeof jsonsettings.CellIds === "undefined") {
|
||||
jsonsettings.CellIds = [];
|
||||
}
|
||||
if (typeof jsonsettings.GridRadius === "undefined") {
|
||||
jsonsettings.GridRadius = 1000;
|
||||
}
|
||||
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>";
|
||||
|
@ -40,6 +40,7 @@
|
||||
var json = JSON.parse(getonce.responseText);
|
||||
MapObject._ParseAJAXLayers(json["getlayer"]);
|
||||
MapObject._ParseAJAXGeo(json["getgeo"]);
|
||||
MapObject._ParseAJAXSettings(json["startup"]);
|
||||
}
|
||||
};
|
||||
getonce.open("GET", "/getonce", true);
|
||||
|
@ -2,11 +2,15 @@
|
||||
Map: {},
|
||||
_SpecialMarkers: new Array(),
|
||||
Start: function () {
|
||||
this.Map = L.map('bigmap').setView(["{%START_LOCATION%}"], 16);
|
||||
this.Map = L.map('bigmap').setView([0, 0], 16);
|
||||
this._SetupMapZoomFontsize();
|
||||
this._SetupClickHandler();
|
||||
return this;
|
||||
},
|
||||
_ParseAJAXSettings: function (settings) {
|
||||
this.Map.panTo([settings.Startloclat, settings.Startloclon]);
|
||||
this._GenerateGrid(settings.Grid);
|
||||
},
|
||||
_ParseAJAXLayers: function (maps) {
|
||||
var i = 0;
|
||||
for (var key in maps) {
|
||||
@ -46,6 +50,16 @@
|
||||
L.control.layers(baseMaps).addTo(this.Map);
|
||||
}
|
||||
},
|
||||
_GenerateGrid: function (grid) {
|
||||
for (var i = 0; i < grid.Major.length; i++) {
|
||||
var linemajor = grid.Major[i];
|
||||
L.polyline([[linemajor.from[0], linemajor.from[1]], [linemajor.to[0], linemajor.to[1]]], { color: "red", weight: 1 }).addTo(this.Map);
|
||||
}
|
||||
for (var j = 0; j < grid.Minor.length; j++) {
|
||||
var lineminor = grid.Minor[j];
|
||||
L.polyline([[lineminor.from[0], lineminor.from[1]], [lineminor.to[0], lineminor.to[1]]], { color: "red", weight: 0.7, opacity: 0.5 }).addTo(this.Map);
|
||||
}
|
||||
},
|
||||
_ParseAJAXGeo: function (geo) {
|
||||
if (!(Object.keys(geo).length === 0 && geo.constructor === Object)) {
|
||||
L.geoJSON(geo, {
|
||||
|
Loading…
Reference in New Issue
Block a user