modules/freifunk: simplify colors in map, add a legend
authorManuel Munz <freifunk@somakoma.de>
Fri, 30 Nov 2012 23:55:35 +0000 (23:55 +0000)
committerManuel Munz <freifunk@somakoma.de>
Fri, 30 Nov 2012 23:55:35 +0000 (23:55 +0000)
modules/freifunk/luasrc/view/freifunk-map/frame.htm
modules/freifunk/luasrc/view/freifunk-map/map.htm

index 909b27065b738544aac1d4adc45bb0d16bc7c316..b2e168363ff194b000bae4ccb23fe4ad92e85dca 100644 (file)
 
 <% if has_latlon then %>
        <iframe style="width:100%; height:640px; border:none" src="<%=luci.dispatcher.build_url("freifunk/map/content")%>"></iframe>
+       <h3><%:Legend%>:</h3>
+       <ul>
+               <li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (ETX < 2)%></li>
+               <li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (2 < ETX < 4)%></li>
+               <li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (4 < ETX < 10)%></li>
+               <li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (ETX > 10)%></li>
+       </ul>
+
 <% else %>
        <h2><%:Map Error%></h2>
        <p><%_The OLSRd service is not configured to capture position data from the network.<br />
                Please make sure that the nameservice plugin is properly configured and that the <em>latlon_file</em> option is enabled.%></p>
 <% end %>
-
 <%+footer%>
+
index f373a7a6b7006cb48f77795e9b6e622f7e98f16f..02b1afdab0bd65fd4f6aae5c6f048251c260593b 100644 (file)
                                if (null != alias[fromip]) fromip = alias[fromip];
                                if (null != points[fromip] && null != points[toip])
                                {
-                                       var w = 1;
-                                       if (etx < 4) w++;
-                                       if (etx < 2) w++;
+                                       var color;
+                                       var red = 240;
+                                       var green = 0;
+                                       var blue = 0;
+                                       var w = 1
+
+                                       if (etx < 100) {red=252;green=102;blue=0;w=2};
+                                       if (etx < 10) {red=255;green=203;blue=5;w=3};
+                                       if (etx < 4) {red=240;green=255;blue=0;w=4};
+                                       if (etx < 2) {red=0;green=204;blue=0;w=5};
+                                       if (etx < 1) {red=80;green=0;blue=0;w=1};
+
                                        map.AddPolyline(new VEPolyline('id'+lineid, [points[fromip], points[toip]],
-                                       new VEColor(102,Math.floor(lq*255.0),Math.floor(nlq*255.0),1.0), w));
+                                       new VEColor(red, green, blue, 0.5), w));
+
+
                                }
                                else
                                {