[TASK] Configure displayed map with rectangle

This commit is contained in:
Xaver Maierhofer 2017-02-08 21:12:04 +01:00 committed by Geno
parent 10f7183c5b
commit 7cbc4e75d7
3 changed files with 27 additions and 26 deletions

View File

@ -159,21 +159,23 @@ Start a time range to put this mapLayer on first position.
End a time range for first map. Stops sort this mapLayer.
## fixedCenter (array, optional)
## fixedCenter (array[array, array])
This option allows to fix the map at one specific coordinate depending on following case-sensitive parameters:
- `lat` latitude of the center point
- `lng` longitude of the center point
- `radius` visible radius around the center in km
Choose a rectangle that must be displayed on the map. Set 2 Locations and everything between will displayed.
Examples for `fixedCenter`:
"fixedCenter": {
"lat": 50.80,
"lng": 12.07,
"radius": 30
}
// Set a visible frame
"fixedCenter": [
[
49.3522,
11.7752
],
[
48.7480,
12.8917
]
],
## nodeInfos (array, optional)

View File

@ -99,11 +99,19 @@
}
}
],
"fixedCenter": {
"lat": 49.01722,
"lng": 12.0969,
"radius": 45
},
// Set a visible frame
"fixedCenter": [
// Northwest
[
49.3522,
11.7752
],
// Southeast
[
48.7480,
12.8917
]
],
"siteNames": [
{
"site": "ffrgb-bat15",

View File

@ -154,7 +154,6 @@ define(['map/clientlayer', 'map/labelslayer',
return function (config, linkScale, sidebar, router, buttons) {
var self = this;
var barycenter;
var groupOnline;
var groupOffline;
var groupNew;
@ -345,9 +344,7 @@ define(['map/clientlayer', 'map/labelslayer',
}
function resetZoom() {
if (barycenter) {
setView(barycenter.getBounds());
}
setView(config.fixedCenter);
}
function goto(m) {
@ -431,12 +428,6 @@ define(['map/clientlayer', 'map/labelslayer',
var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router);
groupLines = L.featureGroup(lines).addTo(map);
if (typeof config.fixedCenter === 'undefined') {
console.error('FixedCenter is required');
} else {
barycenter = L.circle(L.latLng(new L.LatLng(config.fixedCenter.lat, config.fixedCenter.lng)), config.fixedCenter.radius * 1000);
}
var nodesOnline = helper.subtract(data.nodes.all.filter(helper.online), data.nodes.new);
var nodesOffline = helper.subtract(data.nodes.all.filter(helper.offline), data.nodes.lost);