/* Copyright (c) 2015 Jean-Marc VIGLINO, released under the CeCILL-B license (French BSD license) (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt). */ import ol from 'ol' import ol_control_Control from 'ol/control/control' import ol_layer_Tile from 'ol/layer/tile' import ol_layer_Vector from 'ol/layer/vector' import ol_layer_VectorTile from 'ol/layer/vectortile' import ol_layer_Image from 'ol/layer/image' import ol_layer_Heatmap from 'ol/layer/heatmap' /** * @classdesc OpenLayers 3 Layer Switcher Control. * @require jQuery * * @constructor * @extends {ol_control_Control} * @param {Object=} Control options. * @param {boolean} options.show_progress show a progress bar on tile layers, default false * - mouseover {boolean} show the panel on mouseover, default false * - reordering {boolean} allow layer reordering, default true * - trash {boolean} add a trash button to delete the layer, default false * - oninfo {function} callback on click on info button, if none no info button is shown * - extent {boolean} add an extent button to zoom to the extent of the layer * - onextent {function} callback when click on extent, default fits view to extent * * Layers attributes that control the switcher * - allwaysOnTop {boolean} true to force layer stay on top of the others while reordering, default false * - displayInLayerSwitcher {boolean} display in switcher, default true * - noSwitcherDelete {boolean} to prevent layer deletion (w. trash option), default false */ var ol_control_LayerSwitcher = function(opt_options) { var options = opt_options || {}; var self = this; this.dcount = 0; this.show_progress = options.show_progress; this.oninfo = (typeof (options.oninfo) == "function" ? options.oninfo: null); this.onextent = (typeof (options.onextent) == "function" ? options.onextent: null); this.hasextent = options.extent || options.onextent; this.hastrash = options.trash; this.reordering = (options.reordering!==false); var element; if (options.target) { element = $("
").addClass(options.switcherClass || "ol-layerswitcher"); } else { element = $("
").addClass((options.switcherClass || 'ol-layerswitcher') +' ol-unselectable ol-control ol-collapsed'); this.button = $("