From 7f2ab672c29f139b8a1ffb9dab4bf0a0b2711206 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Thu, 26 May 2016 18:39:26 +0200 Subject: [PATCH] [TASK] FixedCenter required --- README.md | 1 + lib/map.js | 41 +++-------------------------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 4d59467..95c39c3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ - Load only german locale from 101 languages from moment.js - Right click open layermenu - Remove ruby dependency +- FixedCenter is required # Screenshots diff --git a/lib/map.js b/lib/map.js index b36ac13..8456d1d 100644 --- a/lib/map.js +++ b/lib/map.js @@ -1,7 +1,7 @@ define(["map/clientlayer", "map/labelslayer", - "d3", "leaflet", "moment", "locationmarker", "rbush", "helper", + "leaflet", "moment", "locationmarker", "rbush", "helper", "leaflet.label", "leaflet.providers", "moment.de"], - function (ClientLayer, LabelsLayer, d3, L, moment, LocationMarker, rbush, helper) { + function (ClientLayer, LabelsLayer, L, moment, LocationMarker, rbush, helper) { var options = { worldCopyJump: true, zoomControl: false @@ -427,41 +427,6 @@ define(["map/clientlayer", "map/labelslayer", } } - function calcBarycenter(nodes) { - nodes = nodes.map(function (d) { - return d.nodeinfo.location; - }); - - if (nodes.length === 0) { - return undefined; - } - - var lats = nodes.map(function (d) { - return d.latitude; - }); - var lngs = nodes.map(function (d) { - return d.longitude; - }); - - var barycenter = L.latLng(d3.median(lats), d3.median(lngs)); - var barycenterDev = [d3.deviation(lats), d3.deviation(lngs)]; - - if (barycenterDev[0] === undefined) { - barycenterDev[0] = 0; - } - - if (barycenterDev[1] === undefined) { - barycenterDev[1] = 0; - } - - var barycenterCircle = L.latLng(barycenter.lat + barycenterDev[0], - barycenter.lng + barycenterDev[1]); - - var r = barycenter.distanceTo(barycenterCircle); - - return L.circle(barycenter, r * config.mapSigmaScale); - } - function mapRTree(d) { var o = [d.nodeinfo.location.latitude, d.nodeinfo.location.longitude, d.nodeinfo.location.latitude, d.nodeinfo.location.longitude]; @@ -499,7 +464,7 @@ define(["map/clientlayer", "map/labelslayer", groupLines = L.featureGroup(lines).addTo(map); if (typeof config.fixedCenter === "undefined") { - barycenter = calcBarycenter(data.nodes.all.filter(has_location)); + console.error('FixedCenter is required'); } else { barycenter = L.circle(L.latLng(new L.LatLng(config.fixedCenter.lat, config.fixedCenter.lng)), config.fixedCenter.radius * 1000); }