/* 
 * Copyright (C) 2019 B3Partners B.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


/* global Ext, ol */

Ext.define("viewer.viewercontroller.ol.tools.OlDefaultTool", {
    extend: "viewer.viewercontroller.ol.tools.OlIdentifyTool",
    map: null,
    navigationControl: null,
    mapClick: null,

    constructor: function (conf) {

        var controlOptions = {
            displayClass: "olControlDefault",
            type: "default",
            title: conf.tooltip
        };
        var olTool = new ol.control.Control(controlOptions);

        viewer.viewercontroller.ol.tools.OlIdentifyTool.superclass.constructor.call(this, conf, olTool);

        this.setType(viewer.viewercontroller.controller.Tool.DEFAULT);

        this.map = this.config.viewerController.mapComponent.getMap();

        this.mapClick = new viewer.viewercontroller.ol.ToolMapClick({
            id: "mapclick_" + this.id,
            viewerController: this.config.viewerController,
            handler: {
                fn: this.handleClick,
                scope: this
            }
        });

        var layers = this.getViewerController().mapComponent.getMap().getLayers();
        for (var i = 0; i < layers.length; i++) {
            this.onAddLayer(null, {layer: layers[i]});
        }

        this.getViewerController().mapComponent.getMap().addListener(viewer.viewercontroller.controller.Event.ON_LAYER_ADDED, this.onAddLayer, this);
        this.getViewerController().mapComponent.getMap().addListener(viewer.viewercontroller.controller.Event.ON_LAYER_REMOVED, this.onRemoveLayer, this);




        return this;
    },

    activate: function () {
        this.active = true;
        this.mapClick.activateTool();

    },

    deactivate: function () {
        this.active = false;
        this.mapClick.deactivateTool();
    }




});
@@ -959,16 +959,38 @@
 conf) %7B%0A
+        var me = this;
 %0A       
@@ -1017,54 +1017,8 @@
 = %7B%0A
-            displayClass: %22olControlDefault%22,%0A
     
@@ -1146,16 +1146,63 @@
 tions);%0A
+        conf.displayClass = %22olControlDefault%22;
 %0A       
@@ -1656,20 +1656,18 @@
     fn: 
-this
+me
 .handleC
@@ -1695,20 +1695,18 @@
  scope: 
-this
+me
 %0A       
@@ -2231,16 +2231,57 @@
 his);%0A%0A%0A
+        this.useWMSGetFeatureInfo = true;
 %0A%0A      
@@ -2401,113 +2401,469 @@
 ();%0A
-%0A    %7D,%0A%0A    deactivate: function () %7B%0A        this.active = false;%0A        this.mapClick.deactivateTool(
+        viewer.viewercontroller.ol.tools.OlIdentifyTool.superclass.overwriteStyle.call(this, %7B%0A            active: true,%0A            displayClass: %22olControlDefault%22%0A        %7D);%0A    %7D,%0A%0A    deactivate: function () %7B%0A        this.active = false;%0A        this.mapClick.deactivateTool();%0A        viewer.viewercontroller.ol.tools.OlIdentifyTool.superclass.overwriteStyle.call(this, %7B%0A            active: false,%0A            displayClass: %22olControlDefault%22%0A        %7D
 );%0A 

Fix for google navigation