Browse Source

-links with backbone=true are visualized in blue
-details for links now contain a backbone field

Florian Rittmeier 8 years ago
parent
commit
31c2850f2b
5 changed files with 14 additions and 5 deletions
  1. 3 1
      lib/forcegraph.js
  2. 2 1
      lib/gui.js
  3. 1 0
      lib/infobox/link.js
  4. 3 0
      lib/infobox/node.js
  5. 5 3
      lib/map.js

+ 3 - 1
lib/forcegraph.js

@@ -3,7 +3,7 @@ define(["d3"], function (d3) {
   var NODE_RADIUS = 15
   var LINE_RADIUS = 12
 
-  return function (config, linkScale, sidebar, router) {
+  return function (config, linkScale, linkScaleBackbone, sidebar, router) {
     var self = this
     var canvas, ctx, screenRect
     var nodesDict, linksDict
@@ -625,6 +625,8 @@ define(["d3"], function (d3) {
 
         if (d.vpn)
           e.color = "rgba(255, 255, 255, " + (0.6 / d.tq) + ")"
+	else if(d.backbone)
+          e.color = linkScaleBackbone(d.tq).hex()
         else
           e.color = linkScale(d.tq).hex()
 

+ 2 - 1
lib/gui.js

@@ -11,6 +11,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend,
     var contentDiv
 
     var linkScale = chroma.scale(chroma.interpolate.bezier(["#04C714", "#FF5500", "#F02311"])).domain([1, 5])
+    var linkScaleBackbone = chroma.scale(chroma.interpolate.bezier(["#0414C7", "#FF0055", "#F01123"])).domain([1, 5])
     var sidebar
 
     var buttons = document.createElement("div")
@@ -35,7 +36,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend,
     function addContent(K) {
       removeContent()
 
-      content = new K(config, linkScale, sidebar.getWidth, router, buttons)
+      content = new K(config, linkScale, linkScaleBackbone, sidebar.getWidth, router, buttons)
       content.render(contentDiv)
 
       fanout.add(content)

+ 1 - 0
lib/infobox/link.js

@@ -20,6 +20,7 @@ define(function () {
     attributeEntry(attributes, "TQ", showTq(d))
     attributeEntry(attributes, "Entfernung", showDistance(d))
     attributeEntry(attributes, "VPN", d.vpn ? "ja" : "nein")
+    attributeEntry(attributes, "Wireless Backbone", d.backbone ? "ja" : "nein")
     var hw1 = dictGet(d.source.node.nodeinfo, ["hardware", "model"])
     var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"])
     attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt"))

+ 3 - 0
lib/infobox/node.js

@@ -281,6 +281,9 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
         if (d.link.vpn)
           td1.appendChild(document.createTextNode(" (VPN)"))
 
+        if (d.link.backbone)
+          td1.appendChild(document.createTextNode(" (Wireless Backbone)"))
+
         if (has_location(d.node)) {
           var span = document.createElement("span")
           span.classList.add("icon")

+ 5 - 3
lib/map.js

@@ -102,7 +102,7 @@ define(["map/clientlayer", "map/labelslayer",
       }
     }
 
-    function addLinksToMap(dict, linkScale, graph, router) {
+    function addLinksToMap(dict, linkScale, linkScaleBackbone, graph, router) {
       graph = graph.filter( function (d) {
         return "distance" in d && !d.vpn
       })
@@ -113,6 +113,8 @@ define(["map/clientlayer", "map/labelslayer",
                      opacity: 0.5,
                      dashArray: "none"
                    }
+        if ( d.backbone )
+          opts.color = linkScaleBackbone(d.tq).hex()
 
         var line = L.polyline(d.latlngs, opts)
 
@@ -137,7 +139,7 @@ define(["map/clientlayer", "map/labelslayer",
     var iconAlert   = iconLost
     var iconNew     = { color: "#1566A9", fillColor: "#93E929", radius: 6, fillOpacity: 1.0, opacity: 0.5, weight: 2 }
 
-    return function (config, linkScale, sidebar, router, buttons) {
+    return function (config, linkScale, linkScaleBackbone, sidebar, router, buttons) {
       var self = this
       var barycenter
       var groupOnline, groupOffline, groupNew, groupLost, groupLines
@@ -378,7 +380,7 @@ define(["map/clientlayer", "map/labelslayer",
         if (groupLines)
           groupLines.clearLayers()
 
-        var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router)
+        var lines = addLinksToMap(linkDict, linkScale, linkScaleBackbone, data.graph.links, router)
         groupLines = L.featureGroup(lines).addTo(map)
 
         barycenter = calcBarycenter(data.nodes.all.filter(has_location))