GUI - topo view: enhancements to allow scaling of bay area map.

Change-Id: Iabd50b529eb3f247463a71d29f7c447806c3afe7
diff --git a/web/gui/src/main/webapp/app/fw/svg/geodata.js b/web/gui/src/main/webapp/app/fw/svg/geodata.js
index 6c54bb4..815937d 100644
--- a/web/gui/src/main/webapp/app/fw/svg/geodata.js
+++ b/web/gui/src/main/webapp/app/fw/svg/geodata.js
@@ -132,7 +132,7 @@
             mfs = settings.mapFillScale,
             path = d3.geo.path().projection(proj);
 
-        rescaleProjection(proj, mfs, dim, path, geoData);
+        rescaleProjection(proj, mfs, dim, path, geoData, opts.adjustScale);
 
         // return the results
         return {
@@ -142,7 +142,8 @@
         };
     }
 
-    function rescaleProjection(proj, mfs, dim, path, geoData) {
+    function rescaleProjection(proj, mfs, dim, path, geoData, adjustScale) {
+        var adj = adjustScale || 1;
         // adjust projection scale and translation to fill the view
         // with the map
 
@@ -161,7 +162,7 @@
             y = (y1 + y2) / 2;
 
         // size map to 95% of minimum dimension to fill space..
-        var s = mfs / Math.min(dx / dim, dy / dim),
+        var s = (mfs / Math.min(dx / dim, dy / dim)) * adj,
             t = [dim / 2 - s * x, dim / 2 - s * y];
 
         // set new scale, translation on the projection..
diff --git a/web/gui/src/main/webapp/app/fw/svg/map.js b/web/gui/src/main/webapp/app/fw/svg/map.js
index f8d40f9..c24fb28 100644
--- a/web/gui/src/main/webapp/app/fw/svg/map.js
+++ b/web/gui/src/main/webapp/app/fw/svg/map.js
@@ -56,11 +56,13 @@
 
             deferredProjection.resolve(gen.settings.projection);
 
-            mapLayer.selectAll('path')
+            var path = mapLayer.selectAll('path')
                 .data(gen.geodata.features)
                 .enter()
                 .append('path')
                 .attr('d', gen.pathgen);
+
+            opts.fill && path.style('fill', opts.fill);
         });
         return deferredProjection.promise;
     }
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.js b/web/gui/src/main/webapp/app/view/topo/topo.js
index 60d4340..a78647d 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -347,24 +347,32 @@
 
 
     function setUpMap($loc) {
-        var s1 = $loc.search().mapid,
-            s2 = ps.getPrefs('topo_mapid'),
-            mapId = s1 || (s2 && s2.id) || 'usa',
+        var qp = $loc.search(),
+            pr = ps.getPrefs('topo_mapid'),
+            mi1 = qp.mapid,
+            mi2 = pr && pr.id,
+            mapId = mi1 || mi2 || 'usa',
+            ms1 = qp.mapscale,
+            ms2 = pr && pr.scale,
+            mapScale = ms1 || ms2 || 1,
             promise,
-            cfilter,
-            opts;
+            cfilter;
 
         mapG = zoomLayer.append('g').attr('id', 'topo-map');
         if (mapId === 'usa') {
             promise = ms.loadMapInto(mapG, '*continental_us');
         } else if (mapId === 'bayarea') {
-            promise = ms.loadMapInto(mapG, '*bayarea', {objectTag: 'bayareaGEO'});
+            // TODO: be consistent about propagating options to other cases
+            promise = ms.loadMapInto(mapG, '*bayarea', {
+                objectTag: 'bayareaGEO',
+                adjustScale: mapScale,
+                fill: 'aliceblue'
+            });
         } else {
             cfilter = countryFilters[mapId] || countryFilters.world;
-            opts = { countryFilter: cfilter };
-            promise = ms.loadMapRegionInto(mapG, opts);
+            promise = ms.loadMapRegionInto(mapG, { countryFilter: cfilter });
         }
-        ps.setPrefs('topo_mapid', {id:mapId});
+        ps.setPrefs('topo_mapid', { id: mapId, scale: mapScale });
         return promise;
     }