[TASK] Configure displayed map with rectangle
This commit is contained in:
parent
10f7183c5b
commit
7cbc4e75d7
24
README.md
24
README.md
@ -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.
|
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:
|
Choose a rectangle that must be displayed on the map. Set 2 Locations and everything between will displayed.
|
||||||
|
|
||||||
- `lat` latitude of the center point
|
|
||||||
- `lng` longitude of the center point
|
|
||||||
- `radius` visible radius around the center in km
|
|
||||||
|
|
||||||
Examples for `fixedCenter`:
|
Examples for `fixedCenter`:
|
||||||
|
|
||||||
"fixedCenter": {
|
// Set a visible frame
|
||||||
"lat": 50.80,
|
"fixedCenter": [
|
||||||
"lng": 12.07,
|
[
|
||||||
"radius": 30
|
49.3522,
|
||||||
}
|
11.7752
|
||||||
|
],
|
||||||
|
[
|
||||||
|
48.7480,
|
||||||
|
12.8917
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
## nodeInfos (array, optional)
|
## nodeInfos (array, optional)
|
||||||
|
|
||||||
|
18
config.json
18
config.json
@ -99,11 +99,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fixedCenter": {
|
// Set a visible frame
|
||||||
"lat": 49.01722,
|
"fixedCenter": [
|
||||||
"lng": 12.0969,
|
// Northwest
|
||||||
"radius": 45
|
[
|
||||||
},
|
49.3522,
|
||||||
|
11.7752
|
||||||
|
],
|
||||||
|
// Southeast
|
||||||
|
[
|
||||||
|
48.7480,
|
||||||
|
12.8917
|
||||||
|
]
|
||||||
|
],
|
||||||
"siteNames": [
|
"siteNames": [
|
||||||
{
|
{
|
||||||
"site": "ffrgb-bat15",
|
"site": "ffrgb-bat15",
|
||||||
|
11
lib/map.js
11
lib/map.js
@ -154,7 +154,6 @@ define(['map/clientlayer', 'map/labelslayer',
|
|||||||
|
|
||||||
return function (config, linkScale, sidebar, router, buttons) {
|
return function (config, linkScale, sidebar, router, buttons) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var barycenter;
|
|
||||||
var groupOnline;
|
var groupOnline;
|
||||||
var groupOffline;
|
var groupOffline;
|
||||||
var groupNew;
|
var groupNew;
|
||||||
@ -345,9 +344,7 @@ define(['map/clientlayer', 'map/labelslayer',
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetZoom() {
|
function resetZoom() {
|
||||||
if (barycenter) {
|
setView(config.fixedCenter);
|
||||||
setView(barycenter.getBounds());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function goto(m) {
|
function goto(m) {
|
||||||
@ -431,12 +428,6 @@ define(['map/clientlayer', 'map/labelslayer',
|
|||||||
var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router);
|
var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router);
|
||||||
groupLines = L.featureGroup(lines).addTo(map);
|
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 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);
|
var nodesOffline = helper.subtract(data.nodes.all.filter(helper.offline), data.nodes.lost);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user