GUI2 added method to zoom to map size

Change-Id: I3aa578b78ebe2ab26f72a7535b8b5e9e0a822cb6
diff --git a/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.html b/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.html
index b6f511a..8644ac1 100644
--- a/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.html
+++ b/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.html
@@ -72,7 +72,8 @@
                    [invertVertical]="true" [fit]="'fit1000high'" [aspectRatio]="0.83333"
                    [gridcolor]="'#bfe7fb'">
             </svg:g>
-            <svg:g *ngIf="prefsState.bg" onos-backgroundsvg [map]="mapIdState">
+            <svg:g *ngIf="prefsState.bg"
+                   onos-backgroundsvg [map]="mapIdState" (zoomlevel)="mapExtentsZoom($event)">
                 <svg:desc>The Background SVG component - contains maps</svg:desc>
             </svg:g>
             <svg:g #force onos-forcesvg
@@ -80,6 +81,7 @@
                    [hostLabelToggle]="prefsState.hlbls"
                    [showHosts]="prefsState.hosts"
                    [highlightPorts]="prefsState.porthl"
+                   [scale]="1 / (2 * zoomDirective.zoomCached.sc)"
                    (selectedNodeEvent)="nodeSelected($event)">
                 <svg:desc>The Force SVG component - contains all the devices, hosts and links</svg:desc>
             </svg:g>
diff --git a/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.ts b/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.ts
index 2de3c8b..441bbc6 100644
--- a/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.ts
+++ b/web/gui2/src/main/webapp/app/view/topology/topology/topology.component.ts
@@ -28,6 +28,7 @@
     PrefsService,
     SvgUtilService,
     WebSocketService,
+    TopoZoomPrefs
 } from 'gui2-fw-lib';
 import {InstanceComponent} from '../panel/instance/instance.component';
 import {DetailsComponent} from '../panel/details/details.component';
@@ -552,6 +553,7 @@
 
     protected resetNodeLocation() {
         // TODO: Implement reset locations
+        this.force.resetNodeLocations();
         this.flashMsg = this.lionFn('fl_reset_node_locations');
         this.log.debug('resetting node location');
     }
@@ -624,6 +626,12 @@
         this.log.debug('Map has been changed to ', map);
     }
 
+    mapExtentsZoom(zoomMapExtents: TopoZoomPrefs) {
+        // this.zoomDirective.updateZoomState(zoomPrefs.tx, zoomPrefs.ty, zoomPrefs.sc);
+        this.zoomDirective.changeZoomLevel(zoomMapExtents);
+        this.log.debug('Map zoom prefs updated', zoomMapExtents);
+    }
+
     /**
      * Read the LION bundle for Toolbar and set up the lionFn
      */