From 9e49fab172b1ec952d9213daef458e6fdb2adf0a Mon Sep 17 00:00:00 2001 From: Daniel Pulido Date: Mon, 10 Jun 2019 20:14:45 -0400 Subject: [PATCH] Fix control lint issues. --- dist/olexp.js | 32 ++++++++++++++++---------------- dist/olexp.min.js | 2 +- src/js/control.js | 16 ++++++++-------- src/js/explorer.js | 16 ++++++++-------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/dist/olexp.js b/dist/olexp.js index 06b3036..7aad28b 100644 --- a/dist/olexp.js +++ b/dist/olexp.js @@ -1618,7 +1618,7 @@ * @return {external:jQuery.fn.w2toolbar.properties} EditSettings toolbar * control */ - olexp.control.EditSettings = function(explorer, options) { + olexp.control.editSettings = function(explorer, options) { const control = new EditSettings(explorer.map, options.settings); return { @@ -1747,7 +1747,7 @@ * @return {external:jQuery.fn.w2toolbar.properties} ExportMap toolbar * control */ - olexp.control.ExportMap = function(explorer, options) { + olexp.control.exportMap = function(explorer, options) { const control = new ExportMap(explorer.map, options.settings); return { @@ -1963,7 +1963,7 @@ * @return {external:jQuery.fn.w2toolbar.properties} Graticule toolbar * control */ - olexp.control.Graticule = function(explorer, options) { + olexp.control.graticule = function(explorer, options) { if (options === undefined) { options = {}; } @@ -2290,7 +2290,7 @@ * @public * @return {array} Array of w2toolbar properties */ - olexp.control.LayerControl = function(explorer, options) { + olexp.control.layerControl = function(explorer, options) { if (options === undefined) { options = {}; } @@ -2545,7 +2545,7 @@ * @public * @return {array} Array of external:jQuery.fn.w2toolbar.properties */ - olexp.control.LayerManager = function(explorer, manager, options) { + olexp.control.layerManager = function(explorer, manager, options) { if (options === undefined) { options = {}; } @@ -2766,7 +2766,7 @@ * @return {external:jQuery.fn.w2toolbar.properties} LayerMenu toolbar * control */ - olexp.control.LayerMenu = function(explorer, manager, menu, options) { + olexp.control.layerMenu = function(explorer, manager, menu, options) { const control = new LayerMenu(explorer, manager, menu, options.settings); explorer.toolbar.on('click', function(event) { @@ -2924,7 +2924,7 @@ * @public * @return {array} Array of w2toolbar properties */ - olexp.control.Measure = function(explorer, options) { + olexp.control.measure = function(explorer, options) { if (options === undefined) { options = {}; } @@ -3064,7 +3064,7 @@ * @return {external:jQuery.fn.w2toolbar.properties} ToolbarHide toolbar * control */ - olexp.control.ToolbarHide = function(explorer, options) { + olexp.control.toolbarHide = function(explorer, options) { const control = new ToolbarHide(explorer, options); return { @@ -6202,7 +6202,7 @@ // -------------------------------------------------- if (this.options.controls.toolbarhide) { - this.toolbar.add(olexp.control.ToolbarHide(this.api, { + this.toolbar.add(olexp.control.toolbarHide(this.api, { hidden: this.options.toolbar.hidden, settings: this.options.settings, })); @@ -6210,7 +6210,7 @@ } if (this.options.controls.layermanager) { - this.toolbar.add(olexp.control.LayerManager(this.api, this.manager, { + this.toolbar.add(olexp.control.layerManager(this.api, this.manager, { details: {checked: !this.options.details.hidden}, navigation: {checked: !this.options.navigation.hidden}, settings: this.options.settings, @@ -6219,41 +6219,41 @@ } if (this.options.controls.layermenu) { - this.toolbar.add(olexp.control.LayerMenu(this.api, this.manager, + this.toolbar.add(olexp.control.layerMenu(this.api, this.manager, this.menu, {settings: this.options.settings})); this.toolbar.add({id: 'break-item-menu', type: 'break'}); } if (this.options.controls.layercontrol) { - this.toolbar.add(olexp.control.LayerControl(this.api, { + this.toolbar.add(olexp.control.layerControl(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-layer-control', type: 'break'}); } if (this.options.controls.graticule) { - this.toolbar.add(olexp.control.Graticule(this.api, { + this.toolbar.add(olexp.control.graticule(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-graticule', type: 'break'}); } if (this.options.controls.measure) { - this.toolbar.add(olexp.control.Measure(this.api, { + this.toolbar.add(olexp.control.measure(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-measure', type: 'break'}); } if (this.options.controls.exportmap) { - this.toolbar.add(olexp.control.ExportMap(this.api, { + this.toolbar.add(olexp.control.exportMap(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-export-map', type: 'break'}); } if (this.options.controls.editsettings) { - this.toolbar.add(olexp.control.EditSettings(this.api, { + this.toolbar.add(olexp.control.editSettings(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-edit-settings', type: 'break'}); diff --git a/dist/olexp.min.js b/dist/olexp.min.js index e8c5dc1..37c4a7c 100644 --- a/dist/olexp.min.js +++ b/dist/olexp.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).olexp=e()}(this,function(){"use strict";const t={measure:{}};!function(t){t.measure.properties={area:"olexp-measure-property-area",length:"olexp-measure-property-length"};const e=function(t){ol.Overlay.call(this,t)};e.prototype=Object.create(ol.Overlay.prototype);const o=function(t,e,o){const n=$.extend(!0,{measure:{Tool:{continueLineMsg:"Click to continue drawing the line",continuePolygonMsg:"Click to continue drawing the polygon",helpTooltipOffset:[20,0],helpTooltipPositioning:"center-left",measuredStyle:new ol.style.Style({fill:new ol.style.Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new ol.style.Stroke({color:"#ffcc33",width:2}),image:new ol.style.Circle({radius:7,fill:new ol.style.Fill({color:"#ffcc33"})})}),measuringStyle:new ol.style.Style({fill:new ol.style.Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new ol.style.Stroke({color:"rgba(0, 0, 0, 0.5)",lineDash:[10,10],width:2}),image:new ol.style.Circle({radius:5,stroke:new ol.style.Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new ol.style.Fill({color:"rgba(255, 255, 255, 0.2)"})})}),measureTooltipOffset:[0,-20],measureTooltipPositioning:"bottom-center",messageStart:"Click to start drawing. Double click to stop."}}},o);this.settings=n.measure.Tool,this.continueLineMsg=this.settings.continueLineMsg,this.continuePolygonMsg=this.settings.continuePolygonMsg,this.count=0,this.draw=null,this.drawing=!1,this.geodesic=!1,this.helpTooltip=null,this.helpTooltipElement=null,this.map=t,this.measureTooltip=null,this.measureTooltipElement=null,this.pointerMoveCallback=this.onPointerMove.bind(this),this.sketch=null,this.source=null,this.sphere=new ol.Sphere(6378137),this.type=e,this.vector=null};o.prototype.createHelpTooltip=function(){this.helpTooltipElement&&this.helpTooltipElement.parentNode.removeChild(this.helpTooltipElement),this.helpTooltipElement=document.createElement("div"),this.helpTooltipElement.className="olexp-measure olexp-measure-hidden",this.helpTooltip=new t.measure.Overlay({element:this.helpTooltipElement,offset:this.settings.helpTooltipOffset,positioning:this.settings.helpTooltipPositioning}),this.map.addOverlay(this.helpTooltip)},o.prototype.createMeasureVector=function(){this.vector=new ol.layer.Vector({source:this.source,style:this.settings.measuredStyle}),this.vector.set("name","Measurement #"+(this.count+1)),this.map.addLayer(this.vector)},o.prototype.createMeasureTooltip=function(){this.measureTooltipElement&&this.measureTooltipElement.parentNode.removeChild(this.measureTooltipElement),this.measureTooltipElement=document.createElement("div"),this.measureTooltipElement.className="olexp-measure olexp-measure-active",this.measureTooltip=new t.measure.Overlay({element:this.measureTooltipElement,offset:this.settings.measureTooltipOffset,positioning:this.settings.measureTooltipPositioning}),this.measureTooltip.set("name","Measurement #"+(this.count+1)),this.map.addOverlay(this.measureTooltip)},o.prototype.formatArea=function(t){let e=0;if(this.geodesic){const o=this.map.getView().getProjection(),n=t.clone().transform(o,"EPSG:4326").getLinearRing(0).getCoordinates();e=Math.abs(this.sphere.geodesicArea(n))}else e=t.getArea();let o="";return o=e>1e4?Math.round(e/1e6*100)/100+" km2":Math.round(100*e)/100+" m2"},o.prototype.formatLength=function(t){let e,o=0;if(this.geodesic){let e=0,n=0,i=0;const s=this.map.getView().getProjection(),r=t.getCoordinates(),l=r.length;for(e=0;e100?Math.round(o/1e3*100)/100+" km":Math.round(100*o)/100+" m"},o.prototype.onPointerMove=function(t){if(t.dragging)return;let e=this.settings.messageStart;if(this.sketch){const t=this.sketch.getGeometry();t instanceof ol.geom.Polygon?e=this.continuePolygonMsg:t instanceof ol.geom.LineString&&(e=this.continueLineMsg)}this.helpTooltipElement.innerHTML=e,this.helpTooltip.setPosition(t.coordinate),$(this.helpTooltipElement).removeClass("olexp-measure-hidden")},o.prototype.setEnable=function(t){t?this.map.on("pointermove",this.pointerMoveCallback):this.map.un("pointermove",this.pointerMoveCallback),this.setInteraction(t)},o.prototype.setInteraction=function(e){void 0===e&&(e=!0);const o=this;if(this.draw&&this.map.removeInteraction(this.draw),!e)return $(this.helpTooltipElement).addClass("olexp-measure-hidden"),void(this.drawing&&(this.map.removeLayer(this.vector),this.vector=null,this.measureTooltipElement.parentNode.removeChild(this.measureTooltipElement),this.measureTooltipElement=null,this.drawing=!1));$(this.helpTooltipElement).removeClass("olexp-measure-hidden"),this.source=new ol.source.Vector,this.draw=new ol.interaction.Draw({source:this.source,type:this.type,style:this.settings.measuringStyle}),this.map.addInteraction(this.draw),this.createMeasureTooltip(),this.createHelpTooltip();let n=null;this.draw.on("drawstart",function(t){o.drawing=!0,o.createMeasureVector();let e=t.coordinate;o.sketch=t.feature,n=o.sketch.getGeometry().on("change",function(t){let n="";const i=t.target;i instanceof ol.geom.Polygon?(n=o.formatArea(i),e=i.getInteriorPoint().getCoordinates()):i instanceof ol.geom.LineString&&(n=o.formatLength(i),e=i.getLastCoordinate()),o.measureTooltipElement.innerHTML=n,o.measureTooltip.setPosition(e)})},this),this.draw.on("drawend",function(){o.drawing=!1,o.count+=1;const e=o.sketch.getGeometry(),i={};e instanceof ol.geom.Polygon?(i[t.measure.properties.area]=o.formatArea(e),o.vector.setProperties(i)):e instanceof ol.geom.LineString&&(i[t.measure.properties.length]=o.formatLength(e),o.vector.setProperties(i)),o.sketch=null,o.measureTooltipElement.parentNode.removeChild(o.measureTooltipElement),o.measureTooltipElement=null,o.createMeasureTooltip(),ol.Observable.unByKey(n),o.setInteraction(!0)},this)},o.prototype.setType=function(t){this.type=t},t.measure.Tool=function(e,n){void 0===n&&(n={}),void 0===n.type&&(n.type=t.measure.Type.LINE),void 0===n.settings&&(n.settings={});const i=new o(e,n.type,n.settings);return{setEnable:function(t){i.setEnable(t)},setType:function(t){i.setType(t)}}},t.measure.Type={AREA:"Polygon",LINE:"LineString"},t.measure.Overlay=e}(t||{});var e=t.measure;const o={ol:{}};!function(t){const e=function(t,e){const o=$.extend(!0,{ol:{ToolbarShow:{html:"T",title:"Show toolbar"}}},e);this.settings=o.ol.ToolbarShow,this.explorer=t;const n=document.createElement("button");n.innerHTML=this.settings.html,n.title=this.settings.title,n.addEventListener("click",this.show.bind(this),!1),n.addEventListener("touchstart",this.show.bind(this),!1);const i=document.createElement("div");i.id=e.prefix+"-ol-toolbar-show",i.className="olexp-ol-toolbar-show ol-unselectable ol-control",i.appendChild(n),ol.control.Control.call(this,{element:i})};ol.inherits(e,ol.control.Control),e.prototype.show=function(){this.explorer.layout.show(this.explorer.options.toolbar.type),this.setMap(null)},t.ol.toolbarShow=function(t,o){const n=$.extend({hidden:!1},o),i=new e(t,n.settings);return n.hidden&&i.setMap(t.map),i}}(o||{});var n=o.ol;const i={util:{}};!function(t){const e=function(t){const e=$.extend(!0,{util:{Util:{cluster:function(t){return[new ol.style.Style({image:new ol.style.Circle({radius:10,stroke:new ol.style.Stroke({color:"#ffffff"}),fill:new ol.style.Fill({color:"#3399CC"})}),text:new ol.style.Text({text:t.toString(),fill:new ol.style.Fill({color:"#ffffff"})})})]},Point:[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,255,0,0.5)"}),radius:5,stroke:new ol.style.Stroke({color:"#ff0",width:1})})})],LineString:[new ol.style.Style({stroke:new ol.style.Stroke({color:"#f00",width:3})})],Polygon:[new ol.style.Style({fill:new ol.style.Fill({color:"rgba(0,255,255,0.5)"}),stroke:new ol.style.Stroke({color:"#0ff",width:1})})],MultiPoint:[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,0,255,0.5)"}),radius:5,stroke:new ol.style.Stroke({color:"#f0f",width:1})})})],MultiLineString:[new ol.style.Style({stroke:new ol.style.Stroke({color:"#0f0",width:3})})],MultiPolygon:[new ol.style.Style({fill:new ol.style.Fill({color:"rgba(0,0,255,0.5)"}),stroke:new ol.style.Stroke({color:"#00f",width:1})})]}}},t);this.settings=e.util.Util,this.defaultStyle={Point:this.settings.Point,LineString:this.settings.LineString,Polygon:this.settings.Polygon,MultiPoint:this.settings.MultiPoint,MultiLineString:this.settings.MultiLineString,MultiPolygon:this.settings.MultiPolygon},this.clusterStyleCache={}};e.prototype.addLayerVector=function(t,e,o,n){void 0===n&&(n=!0);const i=this;o.forEach(function(t){if(!1===n)return;const e=t.getGeometry();void 0!==e&&"Point"===e.getType()||(n=!1)});let s=new ol.source.Vector({features:o});n&&(s=new ol.source.Cluster({source:s}));let r=function(t,e){const o=t.getStyleFunction();return o?o.call(t,e):i.defaultStyle[t.getGeometry().getType()]};n&&(r=function(t){return i.getClusterStyle(t)});const l=new ol.layer.Vector({source:s,style:r});l.set("name",e),t.getLayers().push(l)},e.prototype.getClusterStyle=function(t){const e=t.get("features").length;let o=this.clusterStyleCache[e];return o||(o=this.settings.cluster(e),this.clusterStyleCache[e]=o),o},e.prototype.getControls=function(){return{fullscreen:new ol.control.FullScreen,mouseposition:new ol.control.MousePosition({coordinateFormat:ol.coordinate.createStringXY(6),projection:"EPSG:4326"}),overviewmap:new ol.control.OverviewMap,rotate:new ol.control.Rotate,scaleline:new ol.control.ScaleLine,zoom:new ol.control.Zoom,zoomslider:new ol.control.ZoomSlider,zoomtoextent:new ol.control.ZoomToExtent}},e.prototype.getDragAndDrop=function(e){const o=this,n=new ol.interaction.DragAndDrop({formatConstructors:$.map(t.util.FileTypes,function(t){return t.Format})});return n.on("addfeatures",function(n){const i=t.util.setExtension(n.file.name,"");o.addLayerVector(e,i,n.features)}),n},e.prototype.getGraticule=function(t,e){const o=$.extend($.extend({},e),{color:"#"+e.color}),n=new ol.Graticule({map:t,strokeStyle:new ol.style.Stroke(o)});return n.olexpRecord=$.extend({enable:null!==t},e),n},e.prototype.getInteractions=function(t){return{draganddrop:this.getDragAndDrop(t)}},e.prototype.getTileTypes=function(){const t={};return t.osm={class:ol.source.OSM,name:"OpenStreetMap",settings:{}},t.stamenTerrain={class:ol.source.Stamen,name:"Stamen (Terrain)",settings:{layer:"terrain"}},t.stamenToner={class:ol.source.Stamen,name:"Stamen (Toner)",settings:{layer:"toner"}},t.stamenWater={class:ol.source.Stamen,name:"Stamen (Water Color)",settings:{layer:"watercolor"}},t},t.util.FileTypes={gpx:{extensions:["gpx"],Format:ol.format.GPX,name:"GPX"},igc:{extensions:["igc"],Format:ol.format.IGC,name:"IGC"},json:{extensions:["json","geojson"],Format:ol.format.GeoJSON,name:"GeoJSON"},kml:{extensions:["kml"],Format:ol.format.KML,name:"KML"}},t.util.getReader=function(e){const o=e.substring(e.lastIndexOf(".")+1).toLowerCase();let n=null;return Object.keys(t.util.FileTypes).forEach(function(e){if(null!==n)return;const i=t.util.FileTypes[e];i.extensions.forEach(function(t){null===n&&o===t&&(n=new i.Format)})}),n},t.util.indexOf=function(t,e){let o=0;const n=t.getLength();for(o=0;o',onOpen:function(e){e.onComplete=function(){$("#w2ui-popup #"+t).w2render(i)}},onToggle:function(t){const e=w2ui[i];$(e.box).hide(),t.onComplete=function(){$(e.box).show(),e.resize()}}}))},t.util.setExtension=function(t,e){const o=t.split(".");return 1===o.length?o[0]:(o.pop(),o.join(".")+e)},t.util.toProperties=function(t){let e=t.getProperties();if(e.hasOwnProperty("features")){const t=e.features;if(t instanceof Array)if(1===t.length)t[0]instanceof ol.Feature&&(e=t[0].getProperties());else{let o=0;t.forEach(function(t){t instanceof ol.Feature&&(o+=1,e["Cluster Size"]=o)})}}return e},t.util.toRecords=function(t){const e=[];let o=0;return Object.keys(t).forEach(function(n){const i=t[n];o+=1,e.push({recid:o,property:n,value:i})}),e},t.util.Util=function(t){const o=new e(t);return{addLayerVector:o.addLayerVector.bind(o),getControls:o.getControls.bind(o),getGraticule:o.getGraticule.bind(o),getInteractions:o.getInteractions.bind(o),getTileTypes:o.getTileTypes.bind(o)}}}(i||{});var s=i.util;const r={control:{},measure:e,ol:n,util:s};!function(t){const e=function(t,e){const o=$.extend(!0,{control:{EditSettings:{form:{header:"",style:"border: 0px; background-color: transparent;"},hint:"Edit Controls",popup:{height:380,style:"width: 100%; height: 100%;",title:"Edit Controls",width:225},span:6}}},e);this.settings=o.control.EditSettings,this.button=e.prefix+"-control-edit-settings-button",this.icon="olexp-control-edit-settings",this.id=e.prefix+"-control-edit-settings-form",this.map=t,this.name=e.prefix+"-control-edit-settings-form"};e.prototype.display=function(){const e=this,o=[{html:{caption:"Full Screen",span:this.settings.span},name:"fullscreen",type:"checkbox"},{html:{caption:"Mouse Position",span:this.settings.span},name:"mouseposition",type:"checkbox"},{html:{caption:"Overview Map",span:this.settings.span},name:"overviewmap",type:"checkbox"},{html:{caption:"Rotate",span:this.settings.span},name:"rotate",type:"checkbox"},{html:{caption:"Scale Line",span:this.settings.span},name:"scaleline",type:"checkbox"},{html:{caption:"Zoom",span:this.settings.span},name:"zoom",type:"checkbox"},{html:{caption:"Zoom Slider",span:this.settings.span},name:"zoomslider",type:"checkbox"},{html:{caption:"Zoom To Extent",span:this.settings.span},name:"zoomtoextent",type:"checkbox"}],n={fullscreen:this.isControlActive("fullscreen"),mouseposition:this.isControlActive("mouseposition"),overviewmap:this.isControlActive("overviewmap"),rotate:this.isControlActive("rotate"),scaleline:this.isControlActive("scaleline"),zoom:this.isControlActive("zoom"),zoomslider:this.isControlActive("zoomslider"),zoomtoextent:this.isControlActive("zoomtoextent")},i=$.extend(this.settings.form,{fields:o,name:this.name,record:n}),s=this.settings.popup;t.util.popup(this.id,function(t){Object.keys(t).forEach(function(o){const n=t[o];e.setControl(o,n)})},i,s)},e.prototype.getControl=function(t){const e=this.map.getControls().getArray();let o=null;return e.forEach(function(e){null===o&&("fullscreen"===t&&e instanceof ol.control.FullScreen?o=e:"mouseposition"===t&&e instanceof ol.control.MousePosition?o=e:"overviewmap"===t&&e instanceof ol.control.OverviewMap?o=e:"rotate"===t&&e instanceof ol.control.Rotate?o=e:"scaleline"===t&&e instanceof ol.control.ScaleLine?o=e:"zoom"===t&&e instanceof ol.control.Zoom?o=e:"zoomslider"===t&&e instanceof ol.control.ZoomSlider?o=e:"zoomtoextent"===t&&e instanceof ol.control.ZoomToExtent&&(o=e))}),o},e.prototype.isControlActive=function(t){const e=this.getControl(t);return null!==e&&null!==e.getMap()},e.prototype.setControl=function(t,e){const o=this.getControl(t);if(null===o)return;const n=e?this.map:null;o.setMap(n)},t.control.EditSettings=function(t,o){const n=new e(t.map,o.settings);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.display()},type:"button"}}}(r||{}),function(t){const e=function(t,e){const o=$.extend(!0,{control:{ExportMap:{filename:"map.png",hint:"Export map"}}},e);this.settings=o.control.ExportMap,this.anchor=e.prefix+"-control-export-map-anchor",this.button=e.prefix+"-control-export-map-button",this.filename=this.settings.filename,this.icon="olexp-control-export-map",this.map=t};e.prototype.toImage=function(){const t=this.anchor,e=this.filename;$("body").append('');const o=document.getElementById(t),n=this;o.addEventListener("click",function(){n.map.once("postcompose",function(t){o.href=t.context.canvas.toDataURL("image/png")}),n.map.renderSync()}.bind(this),!1),$("#"+t)[0].click(),$("#"+t).remove()},t.control.ExportMap=function(t,o){const n=new e(t.map,o.settings);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.toImage()},type:"button"}}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{Graticule:{enable:!1,form:{header:"",style:"border: 0px; background-color: transparent;"},hint:"Edit Grid Lines",options:{color:"000000",lineDash:[.5,4],width:2},popup:{height:225,style:"border: 0px; background-color: transparent;",title:"Edit Grid Lines",width:300},span:3}}},o);this.settings=n.control.Graticule,this.button=o.prefix+"-control-graticule-button",this.icon="olexp-control-graticule",this.id=o.prefix+"-control-graticule",this.map=e,this.name=o.prefix+"-control-graticule-form",this.util=new t.util.Util(n),this.graticule=this.util.getGraticule(this.settings.enable?this.map:null,$.extend({},this.settings.options))};e.prototype.display=function(){const e=this,o=[{html:{caption:"Enable",span:this.settings.span},name:"enable",required:!0,type:"checkbox"},{html:{caption:"Color",span:this.settings.span},name:"color",options:{silent:!1},required:!0,type:"color"},{html:{caption:"Width",span:this.settings.span},name:"width",options:{arrows:!0,max:4,min:.25,placeholder:"0.25 - 4",silent:!1,step:.25},required:!0,type:"float"}],n=this.graticule.olexpRecord,i=$.extend(this.settings.form,{fields:o,name:this.name,record:n}),s=this.settings.popup;t.util.popup(this.id,function(t){Object.keys(t).forEach(function(e){n[e]=t[e]});const o=$.extend({},n);delete o.enable,e.graticule.setMap(null),e.graticule=e.util.getGraticule(n.enable?e.map:null,o)},i,s)},t.control.Graticule=function(t,o){void 0===o&&(o={}),void 0===o.settings&&(o.settings={});const n=new e(t.map,o.settings);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.display()},type:"button"}}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{LayerControlTile:{form:{header:"",style:"border: 0px; background-color: transparent;"},hint:"Add Tile Layer",popup:{height:165,style:"border: 0px; background-color: transparent;",title:"Add Tile Layer",width:290},span:3},LayerControlVector:{form:{header:"File Types: "+$.map(t.util.FileTypes,function(t){return" "+t.name}),style:"border: 0px; background-color: transparent;"},hint:"Add Vector Layer",popup:{height:195,style:"border: 0px; background-color: transparent;",title:"Add Vector Layer",width:350},span:4}}},o);this.settingsTile=n.control.LayerControlTile,this.settingsVector=n.control.LayerControlVector,this.icons={tile:"olexp-control-layer-control-add-tile",vector:"olexp-control-layer-control-add-vector"},this.buttons={tile:o.prefix+"-control-layer-control-add-tile-button",vector:o.prefix+"-control-layer-control-add-vector-button"},this.ids={tile:o.prefix+"-control-layer-control-add-tile",vector:o.prefix+"-control-layer-control-add-vector"},this.map=e,this.names={tile:o.prefix+"-control-tile-form",vector:o.prefix+"-control-vector-form"},this.util=new t.util.Util(this.map)};e.prototype.tile=function(){const e=this,o=this.util.getTileTypes(),n=$.map(o,function(t){return t.name}),i=[{field:"tile_source",html:{caption:"Source",span:this.settingsTile.span},options:{items:n},required:!0,type:"list"}],s={};s[i[0].field]=null;const r=$.extend(this.settingsTile.form,{fields:i,name:this.names.tile,record:s}),l=this.settingsTile.popup;t.util.popup(this.ids.tile,function(t){Object.keys(t).forEach(function(n){if(n!==i[0].field)return;const s=t[n].id;Object.keys(o).forEach(function(t){if(s!==o[t].name)return;const n=o[t],i=n.class,r=new ol.layer.Tile({source:new i(n.settings)});r.set("name",s),e.map.addLayer(r)})})},r,l)},e.prototype.vector=function(){const e=this,o=[{field:"vector_source",html:{caption:"Source",span:this.settingsVector.span},options:{placeholder:"Click to add file",silent:!1},required:!0,type:"file"}],n={};n[o[0].field]=null;const i=$.extend(this.settingsVector.form,{fields:o,name:this.names.vector,record:n}),s=this.settingsVector.popup;t.util.popup(this.ids.vector,function(n){Object.keys(n).forEach(function(i){i===o[0].field&&Object.keys(n[i]).forEach(function(o){const s=n[i][o].content;if(null==s)return;const r=n[i][o].name,l=t.util.setExtension(r,""),a=t.util.getReader(r);if(null===a)return void w2alert("Unable to open file "+r,"Error");const c=atob(s),p={featureProjection:e.map.getView().getProjection()},h=a.readFeatures(c,p);e.util.addLayerVector(e.map,l,h)})})},i,s)},t.control.LayerControl=function(t,o){void 0===o&&(o={}),void 0===o.tile&&(o.tile=!0),void 0===o.vector&&(o.vector=!0),void 0===o.settings&&(o.settings={});const n=new e(t.map,o.settings),i=[];return o.tile&&i.push({hint:n.settingsTile.hint,id:n.buttons.tile,img:n.icons.tile,onClick:function(){n.tile()},type:"button"}),o.vector&&i.push({hint:n.settingsVector.hint,id:n.buttons.vector,img:n.icons.vector,onClick:function(){n.vector()},type:"button"}),i}}(r||{}),function(t){const e=function(t,e,o){const n=$.extend(!0,{control:{LayerManager:{hintDetailsHide:"Hide details",hintDetailsShow:"Show details",hintMoveDown:"Move item down",hintMoveUp:"Move item up",hintOutlineHide:"Hide outline",hintOutlineShow:"Show outline"}}},o);this.buttons={details:o.prefix+"-control-layer-manager-button-details",down:o.prefix+"-control-layer-manager-button-down",navigation:o.prefix+"-control-layer-manager-button-navigation",up:o.prefix+"-control-layer-manager-button-up"},this.explorer=t,this.icons={details:"olexp-control-layer-manager-details",down:"olexp-control-layer-manager-down",navigation:"olexp-control-layer-manager-navigation",up:"olexp-control-layer-manager-up"},this.manager=e,this.settings=n.control.LayerManager,this.manager.on("remove:item",this.onItemRemoved,this),this.manager.on("select:item",this.onItemSelected,this)};e.prototype.details=function(){const t=this.explorer.options.details.type;this.explorer.navigation.toggle(t);const e=this.explorer.navigation.get(t);this.explorer.toolbar.get(this.buttons.details).hint=this.hintDetails(e.hidden),this.explorer.toolbar.refresh()},e.prototype.down=function(){this.manager.moveDown()},e.prototype.hintDetails=function(t){return t?this.settings.hintDetailsShow:this.settings.hintDetailsHide},e.prototype.hintNavigation=function(t){return t?this.settings.hintOutlineShow:this.settings.hintOutlineHide},e.prototype.navigation=function(){const t=this.explorer.options.navigation.type;this.explorer.layout.toggle(t);const e=this.explorer.layout.get(t);this.explorer.toolbar.get(this.buttons.navigation).hint=this.hintNavigation(e.hidden),this.explorer.toolbar.refresh()},e.prototype.onItemRemoved=function(t){this.manager.isSelected(t.id)&&(this.explorer.toolbar.disable(this.buttons.up),this.explorer.toolbar.disable(this.buttons.down))},e.prototype.onItemSelected=function(t){if(void 0===t)return;const e=this.manager.getById(t);null!==e&&(this.manager.getNode(e.id).disabled?(this.explorer.toolbar.disable(this.buttons.up),this.explorer.toolbar.disable(this.buttons.down)):(this.explorer.toolbar.enable(this.buttons.up),this.explorer.toolbar.enable(this.buttons.down)))},e.prototype.up=function(){this.manager.moveUp()},t.control.LayerManager=function(t,o,n){void 0===n&&(n={}),void 0===n.details&&(n.details={}),void 0===n.details.enabled&&(n.details.enabled=!0),void 0===n.details.checked&&(n.details.checked=!0),void 0===n.down&&(n.down=!0),void 0===n.navigation&&(n.navigation={}),void 0===n.navigation.enabled&&(n.navigation.enabled=!0),void 0===n.navigation.checked&&(n.navigation.checked=!0),void 0===n.up&&(n.up=!0);const i=new e(t,o,n.settings),s=[];return n.navigation.enabled&&s.push({checked:n.navigation.checked,hint:i.hintNavigation(!n.navigation.checked),id:i.buttons.navigation,img:i.icons.navigation,onClick:function(){i.navigation()},type:"check"}),n.details.enabled&&s.push({checked:n.details.checked,hint:i.hintDetails(!n.details.checked),id:i.buttons.details,img:i.icons.details,onClick:function(){i.details()},type:"check"}),n.up&&s.push({disabled:!0,hint:i.settings.hintMoveUp,id:i.buttons.up,img:i.icons.up,onClick:function(){i.up()},type:"button"}),n.down&&s.push({disabled:!0,hint:i.settings.hintMoveDown,id:i.buttons.down,img:i.icons.down,onClick:function(){i.down()},type:"button"}),s}}(r||{}),function(t){const e=function(t,e,o,n){const i=$.extend(!0,{control:{LayerMenu:{arrow:!0,hint:"Item Options",text:""}}},n);this.button=n.prefix+"-control-layer-menu",this.explorer=t,this.icon="olexp-control-layer-menu",this.manager=e,this.menu=o,this.settings=i.control.LayerMenu,this.manager.on("remove:item",this.onItemRemoved,this),this.manager.on("select:item",this.onItemSelected,this)};e.prototype.onItemRemoved=function(t){this.manager.isSelected(t.id)&&this.explorer.toolbar.disable(this.button)},e.prototype.onItemSelected=function(t){if(void 0===t)return;const e=this.manager.getById(t);null!==e&&(this.manager.getNode(e.id).disabled?this.explorer.toolbar.disable(this.button):this.explorer.toolbar.enable(this.button))},t.control.LayerMenu=function(t,o,n,i){const s=new e(t,o,n,i.settings);return t.toolbar.on("click",function(e){if(null===t.outline.selected)return;const o=s.button+":";if(e.target.indexOf(o)<0)return;const i=e.target.replace(o,"");void 0!==n.callbacks[i]&&n.callbacks[i]({target:t.outline.selected})}),{arrow:s.settings.arrow,disabled:!0,hint:s.settings.hint,id:s.button,img:s.icon,items:s.menu.items,text:s.settings.text,type:"menu"}}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{Measurement:{hintArea:"Measure area",hintLength:"Measure length"}}},o);this.explorer=e,this.icons={area:"olexp-control-measure-area",length:"olexp-control-measure-length"},this.ids={area:o.prefix+"-control-measure-area-button",length:o.prefix+"-control-measure-length-button"},this.settings=n.control.Measurement,this.tool=new t.measure.Tool(e.map,{type:t.measure.Type.LINE,settings:o})};e.prototype.area=function(){const e=!this.explorer.toolbar.get(this.ids.area).checked;this.measure(t.measure.Type.AREA,e)},e.prototype.length=function(){const e=!this.explorer.toolbar.get(this.ids.length).checked;this.measure(t.measure.Type.LINE,e)},e.prototype.measure=function(t,e){this.tool.setEnable(!1),e&&(this.tool.setType(t),this.tool.setEnable(!0))},t.control.Measure=function(t,o){void 0===o&&(o={}),void 0===o.area&&(o.area=!0),void 0===o.length&&(o.length=!0),void 0===o.settings&&(o.settings={});const n=new e(t,o.settings),i=[];return o.area&&i.push({hint:n.settings.hintArea,id:n.ids.area,img:n.icons.area,onClick:function(){o.length&&t.toolbar.uncheck(n.ids.length),n.area()},type:"check"}),o.length&&i.push({hint:n.settings.hintLength,id:n.ids.length,img:n.icons.length,onClick:function(){o.area&&t.toolbar.uncheck(n.ids.area),n.length()},type:"check"}),i}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{ToolbarHide:{hint:"Hide toolbar"}}},o.settings);this.button=o.settings.prefix+"-control-toolbar-hide-button",this.explorer=e,this.icon="olexp-control-toolbar-hide",this.settings=n.control.ToolbarHide,this.show=t.ol.toolbarShow(this.explorer,o)};e.prototype.hide=function(){this.explorer.layout.hide(this.explorer.options.toolbar.type),this.show.setMap(this.explorer.map)},t.control.ToolbarHide=function(t,o){const n=new e(t,o);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.hide()},type:"button"}}}(r||{});var l=r.control;const a={event:{}};!function(t){const e=function(t){this.listeners=$.extend({},t)};e.prototype.on=function(t,e,o){if(void 0===this.listeners[t])return;let n=e;void 0!==o&&(n=e.bind(o)),this.listeners[t].push(n)},e.prototype.register=function(t){void 0===this.listeners[t]&&(this.listeners[t]=[])},e.prototype.trigger=function(t,...e){if(void 0===this.listeners[t])return;const o=this;this.listeners[t].forEach(function(t){t.apply(o,e)})},e.prototype.unregister=function(t){if(void 0===this.listeners[t])return[];const e=this.listeners[t];return delete this.listeners[t],e},e.prototype.off=function(t,e,o){if(void 0===this.listeners[t])return;let n=e;void 0!==o&&(n=e.bind(o));const i=this.listeners[t].indexOf(n);i>-1&&this.listeners[t].splice(i,1)},t.event.Event=function(t){return new e(t)}}(a||{});var c=a.event;const p={item:{},measure:e,util:s};!function(t){t.item.icons={group:"olexp-item-group",heatmap:"olexp-item-heatmap",image:"olexp-item-image",overlay:"olexp-item-overlay",tile:"olexp-item-tile",vector:"olexp-item-vector"};const e=function(t,o,n){this.id=t,this.layer=n,this.moving=!1,this.name=o,this.type=e.getType(this.layer),this.icon=e.getIcon(this.type)};e.prototype.getDetails=function(){const e={};e.Name=this.name;const o=this.layer.getProperties();if(o.hasOwnProperty(t.measure.properties.area)?e.Area=o[t.measure.properties.area]:o.hasOwnProperty(t.measure.properties.length)&&(e.Length=o[t.measure.properties.length]),this.type===t.item.Type.GROUP){const t=this.layer.getLayers();e["Layer Count"]=t.getLength()}if(this.type===t.item.Type.VECTOR){const t=this.layer.getSource().getFeatures();e["Feature Count"]=t.length}return t.util.toRecords(e)},e.prototype.getExtent=function(){if(this.type===t.item.Type.OVERLAY)return null;if(this.type===t.item.Type.GROUP){let t=null;return this.layer.getLayers().forEach(function(o){const n=e.getLayerExtent(o);null===t&&null!==n?t=n:null!==t&&null!==n&&(t=ol.extent.extend(t,n))},this),t}return e.getLayerExtent(this.layer)},e.getIcon=function(e){return e===t.item.Type.GROUP?t.item.icons.group:e===t.item.Type.HEATMAP?t.item.icons.heatmap:e===t.item.Type.IMAGE?t.item.icons.image:e===t.item.Type.OVERLAY?t.item.icons.overlay:e===t.item.Type.TILE?t.item.icons.tile:e===t.item.Type.VECTOR?t.item.icons.vector:"icon-page"},e.getLayerExtent=function(t){let e=t.getExtent();if(void 0===e){const o=t.getSource();null!==o&&(o instanceof ol.source.Cluster||o instanceof ol.source.VectorTile||o instanceof ol.source.Vector)&&(e=o.getExtent())}return void 0===e?null:e},e.prototype.getPropertyTypes=function(){return this.layer instanceof ol.layer.Layer?t.item.LayerProperties:this.layer instanceof ol.Overlay?t.item.OverlayProperties:{}},e.prototype.getProperties=function(){const t={name:this.name},e=this.getPropertyTypes(),o=this;return Object.keys(e).forEach(function(e){t[e]=o.layer.get(e)}),t},e.getType=function(e){return e instanceof ol.layer.Group?t.item.Type.GROUP:e instanceof ol.layer.Heatmap?t.item.Type.HEATMAP:e instanceof ol.layer.Image?t.item.Type.IMAGE:e instanceof ol.layer.Tile?t.item.Type.TILE:e instanceof ol.layer.Vector?t.item.Type.VECTOR:e instanceof ol.Overlay?t.item.Type.OVERLAY:null},e.prototype.setProperties=function(t){t.hasOwnProperty("name")&&(this.name=t.name);const e=this.getPropertyTypes(),o=this;Object.keys(e).forEach(function(e){t.hasOwnProperty(e)&&o.layer.set(e,t[e])})},e.prototype.property=function(t,e){if(void 0!==this[t])return void 0!==e&&(this[t]=e),this[t]},e.prototype.zoomTo=function(e){const o=e.getView();if(this.type===t.item.Type.OVERLAY){const t=this.layer.getPosition();if(void 0!==t)return void o.setCenter(t);w2alert("Overlay has no position defined to which to zoom.","Warning")}else{const t=this.getExtent();if(null!==t)return void o.fit(t,e.getSize());w2alert("Layer has no extent defined to which to zoom.","Warning")}},t.item.Item=function(t,o,n){const i=new e(t,o,n);return{getDetails:i.getDetails.bind(i),getProperties:i.getProperties.bind(i),getPropertyTypes:i.getPropertyTypes.bind(i),icon:i.icon,id:i.id,layer:i.layer,moving:function(t){return i.property("moving",t)},name:function(t){return i.property("name",t)},setProperties:i.setProperties.bind(i),type:i.type,zoomTo:i.zoomTo.bind(i)}},t.item.OverlayProperties={},t.item.LayerProperties={opacity:{title:"Opacity"}},t.item.Type={GROUP:0,HEATMAP:1,IMAGE:2,OVERLAY:3,TILE:4,VECTOR:5}}(p||{});const h={event:c,item:p.item,manager:{},measure:e,util:s};!function(t){const e=function(e,o,n,i,s){this.event=new t.event.Event({"select:item":[]}),this.managerLayers=new t.manager.NodeManager(i,e.getLayers(),o,n),this.layersId=i,this.managerOverlays=new t.manager.NodeManager(s,e.getOverlays(),o,n),this.map=e,this.map.on("change:layergroup",this.onLayerGroupChanged,this),this.outline=o,this.overlaysId=s};e.prototype.isIdLayerNode=function(t){return"string"==typeof t&&0===t.indexOf(this.layersId)},e.prototype.isIdOverlayNode=function(t){return"string"==typeof t&&0===t.indexOf(this.overlaysId)},e.prototype.isSelected=function(t){return t===this.outline.selected},e.prototype.getById=function(t){return this.isIdLayerNode(t)?this.managerLayers.getById(t):this.isIdOverlayNode(t)?this.managerOverlays.getById(t):null},e.prototype.getDetails=function(t){if(this.isIdLayerNode(t)){const e=this.managerLayers.getById(t);if(null!==e)return e.getDetails()}else if(this.isIdOverlayNode(t)){const e=this.managerOverlays.getById(t);if(null!==e)return e.getDetails()}return[]},e.prototype.getNode=function(t){return this.outline.get(t)},e.prototype.moveDown=function(t){return void 0===t&&(t=this.outline.selected),this.isIdLayerNode(t)?this.managerLayers.moveDown(t):!!this.isIdOverlayNode(t)&&this.managerOverlays.moveDown(t)},e.prototype.moveUp=function(t){return void 0===t&&(t=this.outline.selected),this.isIdLayerNode(t)?this.managerLayers.moveUp(t):!!this.isIdOverlayNode(t)&&this.managerOverlays.moveUp(t)},e.prototype.off=function(t,e,o){this.event.off(t,e,o),this.managerLayers.off(t,e,o),this.managerOverlays.off(t,e,o)},e.prototype.on=function(t,e,o){this.event.on(t,e,o),this.managerLayers.on(t,e,o),this.managerOverlays.on(t,e,o)},e.prototype.onItemSelected=function(t){this.event.trigger("select:item",t)},e.prototype.onLayerGroupChanged=function(t){this.managerLayers.setLayers(t.target.getLayers())},e.prototype.removeFromMap=function(t){return t.hasOwnProperty("id")?this.isIdLayerNode(t.id)?this.managerLayers.removeFromMap(t):this.isIdOverlayNode(t.id)?this.managerOverlays.removeFromMap(t):null:null},e.prototype.toggleNode=function(t){if("string"!=typeof t)return;const e=this.outline.get(t).disabled;if(e?this.outline.enable(t):this.outline.disable(t),this.isIdLayerNode(t)){const o=this.managerLayers.getById(t);null!==o&&o.layer.setVisible(e)}else if(this.isIdOverlayNode(t)){const o=this.managerOverlays.getById(t);if(null!==o){const t=o.layer.getProperties();if(t.hasOwnProperty("element")){const o=$(t.element);e?o.show():o.hide()}}}},e.prototype.updateItem=function(t,e){const o=this.getById(t);if(null!==o){o.setProperties(e),this.outline.get(t).text=o.name(),this.outline.refresh()}},e.prototype.zoomTo=function(t){this.getById(t).zoomTo(this.map)},t.manager.Manager=function(t,o,n,i,s){const r=new e(t,o,n,i,s);return{getById:r.getById.bind(r),getDetails:r.getDetails.bind(r),getNode:r.getNode.bind(r),isSelected:r.isSelected.bind(r),moveDown:r.moveDown.bind(r),moveUp:r.moveUp.bind(r),off:r.off.bind(r),on:r.on.bind(r),onItemSelected:r.onItemSelected.bind(r),removeFromMap:r.removeFromMap.bind(r),toggleNode:r.toggleNode.bind(r),updateItem:r.updateItem.bind(r),zoomTo:r.zoomTo.bind(r)}}}(h||{}),function(t){const e=function(e,o,n,i){this.count=0,this.details=i,this.event=new t.event.Event({"remove:item":[]}),this.id=e,this.items=[],this.layers=o,this.layers.on("change:length",this.onLayerChanged,this),this.managers={},this.outline=n};e.prototype.addLayer=function(o){this.count+=1;const n=this.id+"-"+this.count;let i="Item "+this.count;const s=o.getProperties();s.hasOwnProperty("name")&&(i=s.name);const r=new t.item.Item(n,i,o);this.items.push(r);const l={id:r.id,img:r.icon,text:r.name()},a=this.outline.get(this.id).nodes;if(0===a.length?this.outline.add(this.id,[l]):this.outline.insert(this.id,a[0].id,[l]),r.type===t.item.Type.GROUP){const t=o.getLayers(),n=new e(r.id,t,this.outline,this.details);t.forEach(function(t){n.addLayer(t)},this),this.managers[r.id]=n,this.outline.expand(r.id)}return r},e.prototype.getById=function(e,o){void 0===o&&(o=!0);const n=this;let i=null;return this.items.forEach(function(s){if(null===i)if(s.id!==e){if(s.type===t.item.Type.GROUP&&o){const t=n.managers[s.id].getById(e);if(null!==t&&t.id===e)return void(i=t)}}else i=s}),i},e.prototype.getByLayer=function(e,o){void 0===o&&(o=!0);const n=this;let i=null;return this.items.forEach(function(s){if(null===i)if(s.layer!==e){if(s.type===t.item.Type.GROUP&&o){const t=n.managers[s.id].getByLayer(e);if(null!==t&&t.layer===e)return void(i=t)}}else i=s}),i},e.prototype.getSize=function(){return this.items.length},e.prototype.isSelected=function(t){return t===this.outline.selected},e.prototype.isHidden=function(e){return e instanceof t.measure.Overlay},e.prototype.moveDown=function(e){const o=this.getById(e,!1);if(null!==o){let t=this.moveLayerUp(this.layers,o.layer);return t&&(t=this.moveItemDown(e)),t}const n=this;let i=null;return this.items.forEach(function(o){if(null===i&&o.type===t.item.Type.GROUP){const t=n.managers[o.id].moveDown(e);if(null!==t)return void(i=t)}}),i},e.prototype.moveItemDown=function(t){const e=this.outline.get(t);if(null===e)return!1;const o=this.outline.find(e.parent.id,{parent:e.parent}),n=this.outline.get(e.parent.id,t,!0);if(n>=o.length-1)return!1;const i=o[n+1].id,s=o[n+1];return e.parent===s.parent&&(this.outline.remove(i),this.outline.insert(e.parent,t,s),this.outline.select(t),!0)},e.prototype.moveItemUp=function(t){const e=this.outline.get(t);if(null===e)return!1;const o=this.outline.find(e.parent.id,{parent:e.parent}),n=this.outline.get(e.parent.id,t,!0);if(n<=0)return!1;const i=o[n-1].id,s=o[n-1];return e.parent===s.parent&&(this.outline.remove(t),this.outline.insert(e.parent,i,e),this.outline.select(t),!0)},e.prototype.moveLayerDown=function(e,o){const n=t.util.indexOf(e,o);if(n0){const t=this.getByLayer(o,!1);return t.moving(!0),e.removeAt(n),e.insertAt(n-1,o),t.moving(!1),!0}return!1},e.prototype.moveUp=function(e){const o=this.getById(e,!1);if(null!==o){let t=this.moveLayerDown(this.layers,o.layer);return t&&(t=this.moveItemUp(e)),t}const n=this;let i=null;return this.items.forEach(function(o){if(null===i&&o.type===t.item.Type.GROUP){const t=n.managers[o.id].moveUp(e);if(null!==t)return void(i=t)}}),i},e.prototype.off=function(e,o,n){this.event.off(e,o,n);const i=this.getSize();let s=0;for(s=0;s0;)this.onItemRemoved(this.items[this.items.length-1]);this.layers=t,this.layers.on("change:length",this.onLayerChanged,this);let e=0;for(e=0;e'},olmap:{target:n+"-explorer-id-map"},overlays:{id:n+"-explorer-id-overlays"},settings:{prefix:n}});const i=this,s=$("
",{id:this.options.explorer.id,class:this.options.explorer.cls});$("#"+e).append(s),this.layout=$("#"+this.options.explorer.id).w2layout({name:this.options.explorer.layout,panels:[this.options.navigation,this.options.map,this.options.toolbar]}),this.toolbar=$("").w2toolbar({name:this.options.explorer.toolbar}),this.navigation=$("").w2layout({name:this.options.explorer.navigation,onResize:function(){i.hasOwnProperty("map")&&i.map.updateSize(),i.hasOwnProperty("details")&&i.details.resize()},panels:[this.options.outline,this.options.details]}),this.outline=$("").w2sidebar({name:this.options.explorer.outline,nodes:[this.options.layers,this.options.overlays],onClick:function(t){const e=t.target,o=i.manager.getDetails(e);i.details.clear(),i.details.add(o),i.manager.onItemSelected(e)},onDblClick:function(t){const e=t.target;i.manager.toggleNode(e),i.manager.onItemSelected(e)},onRender:function(t){t.onComplete=function(){const t=i.outline.selected;i.manager.onItemSelected(t)}}}),this.details=$("").w2grid({columns:[{field:"property",caption:"Property",size:"100%",sortable:!0},{field:"value",caption:"Value",size:"100%",sortable:!0}],name:this.options.explorer.details}),this.navigation.content(this.options.outline.type,this.outline),this.navigation.content(this.options.details.type,this.details),this.layout.content(this.options.navigation.type,this.navigation),this.map=new ol.Map(this.options.olmap),this.manager=new t.manager.Manager(this.map,this.outline,this.details,this.options.layers.id,this.options.overlays.id);const r=this.options.settings,l=t.menu.zoom(this.manager,r),a=t.menu.properties(this.manager,r),c=t.menu.remove(this.manager,r);this.menu={items:[],callbacks:{}},this.menu.items.push(l.menu),this.menu.items.push(a.menu),this.menu.items.push(c.menu),this.menu.callbacks[l.menu.id]=l.click,this.menu.callbacks[a.menu.id]=a.click,this.menu.callbacks[c.menu.id]=c.click,this.outline.menu=this.menu.items,this.outline.onMenuClick=function(t){const e=t.menuItem.id;void 0!==i.menu.callbacks[e]&&i.menu.callbacks[e](t)},this.util=new t.util.Util(this.options.settings);const p=this.util.getInteractions(this.map);Object.keys(this.options.olinteractions).forEach(function(t){const e=p[t];i.options.olinteractions[t]&&i.map.addInteraction(e)});const h=this.util.getControls();Object.keys(this.options.olcontrols).forEach(function(t){const e=h[t];i.map.addControl(e),e.setMap(i.options.olcontrols[t]?i.map:null)}),this.selector=new t.selection.Feature(this.map,this.details),this.selector.setEnable(!0),this.api={details:this.details,layout:this.layout,manager:this.manager,map:this.map,navigation:this.navigation,options:this.options,outline:this.outline,toolbar:this.toolbar},this.options.controls.toolbarhide&&(this.toolbar.add(t.control.ToolbarHide(this.api,{hidden:this.options.toolbar.hidden,settings:this.options.settings})),this.toolbar.add({id:"break-toolbar-hide",type:"break"})),this.options.controls.layermanager&&(this.toolbar.add(t.control.LayerManager(this.api,this.manager,{details:{checked:!this.options.details.hidden},navigation:{checked:!this.options.navigation.hidden},settings:this.options.settings})),this.toolbar.add({id:"break-layer-manager",type:"break"})),this.options.controls.layermenu&&(this.toolbar.add(t.control.LayerMenu(this.api,this.manager,this.menu,{settings:this.options.settings})),this.toolbar.add({id:"break-item-menu",type:"break"})),this.options.controls.layercontrol&&(this.toolbar.add(t.control.LayerControl(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-layer-control",type:"break"})),this.options.controls.graticule&&(this.toolbar.add(t.control.Graticule(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-graticule",type:"break"})),this.options.controls.measure&&(this.toolbar.add(t.control.Measure(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-measure",type:"break"})),this.options.controls.exportmap&&(this.toolbar.add(t.control.ExportMap(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-export-map",type:"break"})),this.options.controls.editsettings&&(this.toolbar.add(t.control.EditSettings(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-edit-settings",type:"break"})),this.layout.set(this.options.toolbar.type,{content:"",show:{toolbar:!0},toolbar:this.toolbar})};t.destroy=function(t){void 0!==t.map&&t.map.setTarget(null),void 0!==t.details&&t.details.destroy(),void 0!==t.outline&&t.outline.destroy(),void 0!==t.navigation&&t.navigation.destroy(),void 0!==t.toolbar&&t.toolbar.destroy(),void 0!==t.layout&&t.layout.destroy()},t.Explorer=function(t,o){return new e(t,o).api}}(y||{}),{destroy:y.destroy,Explorer:y.Explorer}}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).olexp=e()}(this,function(){"use strict";const t={measure:{}};!function(t){t.measure.properties={area:"olexp-measure-property-area",length:"olexp-measure-property-length"};const e=function(t){ol.Overlay.call(this,t)};e.prototype=Object.create(ol.Overlay.prototype);const o=function(t,e,o){const n=$.extend(!0,{measure:{Tool:{continueLineMsg:"Click to continue drawing the line",continuePolygonMsg:"Click to continue drawing the polygon",helpTooltipOffset:[20,0],helpTooltipPositioning:"center-left",measuredStyle:new ol.style.Style({fill:new ol.style.Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new ol.style.Stroke({color:"#ffcc33",width:2}),image:new ol.style.Circle({radius:7,fill:new ol.style.Fill({color:"#ffcc33"})})}),measuringStyle:new ol.style.Style({fill:new ol.style.Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new ol.style.Stroke({color:"rgba(0, 0, 0, 0.5)",lineDash:[10,10],width:2}),image:new ol.style.Circle({radius:5,stroke:new ol.style.Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new ol.style.Fill({color:"rgba(255, 255, 255, 0.2)"})})}),measureTooltipOffset:[0,-20],measureTooltipPositioning:"bottom-center",messageStart:"Click to start drawing. Double click to stop."}}},o);this.settings=n.measure.Tool,this.continueLineMsg=this.settings.continueLineMsg,this.continuePolygonMsg=this.settings.continuePolygonMsg,this.count=0,this.draw=null,this.drawing=!1,this.geodesic=!1,this.helpTooltip=null,this.helpTooltipElement=null,this.map=t,this.measureTooltip=null,this.measureTooltipElement=null,this.pointerMoveCallback=this.onPointerMove.bind(this),this.sketch=null,this.source=null,this.sphere=new ol.Sphere(6378137),this.type=e,this.vector=null};o.prototype.createHelpTooltip=function(){this.helpTooltipElement&&this.helpTooltipElement.parentNode.removeChild(this.helpTooltipElement),this.helpTooltipElement=document.createElement("div"),this.helpTooltipElement.className="olexp-measure olexp-measure-hidden",this.helpTooltip=new t.measure.Overlay({element:this.helpTooltipElement,offset:this.settings.helpTooltipOffset,positioning:this.settings.helpTooltipPositioning}),this.map.addOverlay(this.helpTooltip)},o.prototype.createMeasureVector=function(){this.vector=new ol.layer.Vector({source:this.source,style:this.settings.measuredStyle}),this.vector.set("name","Measurement #"+(this.count+1)),this.map.addLayer(this.vector)},o.prototype.createMeasureTooltip=function(){this.measureTooltipElement&&this.measureTooltipElement.parentNode.removeChild(this.measureTooltipElement),this.measureTooltipElement=document.createElement("div"),this.measureTooltipElement.className="olexp-measure olexp-measure-active",this.measureTooltip=new t.measure.Overlay({element:this.measureTooltipElement,offset:this.settings.measureTooltipOffset,positioning:this.settings.measureTooltipPositioning}),this.measureTooltip.set("name","Measurement #"+(this.count+1)),this.map.addOverlay(this.measureTooltip)},o.prototype.formatArea=function(t){let e=0;if(this.geodesic){const o=this.map.getView().getProjection(),n=t.clone().transform(o,"EPSG:4326").getLinearRing(0).getCoordinates();e=Math.abs(this.sphere.geodesicArea(n))}else e=t.getArea();let o="";return o=e>1e4?Math.round(e/1e6*100)/100+" km2":Math.round(100*e)/100+" m2"},o.prototype.formatLength=function(t){let e,o=0;if(this.geodesic){let e=0,n=0,i=0;const s=this.map.getView().getProjection(),r=t.getCoordinates(),l=r.length;for(e=0;e100?Math.round(o/1e3*100)/100+" km":Math.round(100*o)/100+" m"},o.prototype.onPointerMove=function(t){if(t.dragging)return;let e=this.settings.messageStart;if(this.sketch){const t=this.sketch.getGeometry();t instanceof ol.geom.Polygon?e=this.continuePolygonMsg:t instanceof ol.geom.LineString&&(e=this.continueLineMsg)}this.helpTooltipElement.innerHTML=e,this.helpTooltip.setPosition(t.coordinate),$(this.helpTooltipElement).removeClass("olexp-measure-hidden")},o.prototype.setEnable=function(t){t?this.map.on("pointermove",this.pointerMoveCallback):this.map.un("pointermove",this.pointerMoveCallback),this.setInteraction(t)},o.prototype.setInteraction=function(e){void 0===e&&(e=!0);const o=this;if(this.draw&&this.map.removeInteraction(this.draw),!e)return $(this.helpTooltipElement).addClass("olexp-measure-hidden"),void(this.drawing&&(this.map.removeLayer(this.vector),this.vector=null,this.measureTooltipElement.parentNode.removeChild(this.measureTooltipElement),this.measureTooltipElement=null,this.drawing=!1));$(this.helpTooltipElement).removeClass("olexp-measure-hidden"),this.source=new ol.source.Vector,this.draw=new ol.interaction.Draw({source:this.source,type:this.type,style:this.settings.measuringStyle}),this.map.addInteraction(this.draw),this.createMeasureTooltip(),this.createHelpTooltip();let n=null;this.draw.on("drawstart",function(t){o.drawing=!0,o.createMeasureVector();let e=t.coordinate;o.sketch=t.feature,n=o.sketch.getGeometry().on("change",function(t){let n="";const i=t.target;i instanceof ol.geom.Polygon?(n=o.formatArea(i),e=i.getInteriorPoint().getCoordinates()):i instanceof ol.geom.LineString&&(n=o.formatLength(i),e=i.getLastCoordinate()),o.measureTooltipElement.innerHTML=n,o.measureTooltip.setPosition(e)})},this),this.draw.on("drawend",function(){o.drawing=!1,o.count+=1;const e=o.sketch.getGeometry(),i={};e instanceof ol.geom.Polygon?(i[t.measure.properties.area]=o.formatArea(e),o.vector.setProperties(i)):e instanceof ol.geom.LineString&&(i[t.measure.properties.length]=o.formatLength(e),o.vector.setProperties(i)),o.sketch=null,o.measureTooltipElement.parentNode.removeChild(o.measureTooltipElement),o.measureTooltipElement=null,o.createMeasureTooltip(),ol.Observable.unByKey(n),o.setInteraction(!0)},this)},o.prototype.setType=function(t){this.type=t},t.measure.Tool=function(e,n){void 0===n&&(n={}),void 0===n.type&&(n.type=t.measure.Type.LINE),void 0===n.settings&&(n.settings={});const i=new o(e,n.type,n.settings);return{setEnable:function(t){i.setEnable(t)},setType:function(t){i.setType(t)}}},t.measure.Type={AREA:"Polygon",LINE:"LineString"},t.measure.Overlay=e}(t||{});var e=t.measure;const o={ol:{}};!function(t){const e=function(t,e){const o=$.extend(!0,{ol:{ToolbarShow:{html:"T",title:"Show toolbar"}}},e);this.settings=o.ol.ToolbarShow,this.explorer=t;const n=document.createElement("button");n.innerHTML=this.settings.html,n.title=this.settings.title,n.addEventListener("click",this.show.bind(this),!1),n.addEventListener("touchstart",this.show.bind(this),!1);const i=document.createElement("div");i.id=e.prefix+"-ol-toolbar-show",i.className="olexp-ol-toolbar-show ol-unselectable ol-control",i.appendChild(n),ol.control.Control.call(this,{element:i})};ol.inherits(e,ol.control.Control),e.prototype.show=function(){this.explorer.layout.show(this.explorer.options.toolbar.type),this.setMap(null)},t.ol.toolbarShow=function(t,o){const n=$.extend({hidden:!1},o),i=new e(t,n.settings);return n.hidden&&i.setMap(t.map),i}}(o||{});var n=o.ol;const i={util:{}};!function(t){const e=function(t){const e=$.extend(!0,{util:{Util:{cluster:function(t){return[new ol.style.Style({image:new ol.style.Circle({radius:10,stroke:new ol.style.Stroke({color:"#ffffff"}),fill:new ol.style.Fill({color:"#3399CC"})}),text:new ol.style.Text({text:t.toString(),fill:new ol.style.Fill({color:"#ffffff"})})})]},Point:[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,255,0,0.5)"}),radius:5,stroke:new ol.style.Stroke({color:"#ff0",width:1})})})],LineString:[new ol.style.Style({stroke:new ol.style.Stroke({color:"#f00",width:3})})],Polygon:[new ol.style.Style({fill:new ol.style.Fill({color:"rgba(0,255,255,0.5)"}),stroke:new ol.style.Stroke({color:"#0ff",width:1})})],MultiPoint:[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,0,255,0.5)"}),radius:5,stroke:new ol.style.Stroke({color:"#f0f",width:1})})})],MultiLineString:[new ol.style.Style({stroke:new ol.style.Stroke({color:"#0f0",width:3})})],MultiPolygon:[new ol.style.Style({fill:new ol.style.Fill({color:"rgba(0,0,255,0.5)"}),stroke:new ol.style.Stroke({color:"#00f",width:1})})]}}},t);this.settings=e.util.Util,this.defaultStyle={Point:this.settings.Point,LineString:this.settings.LineString,Polygon:this.settings.Polygon,MultiPoint:this.settings.MultiPoint,MultiLineString:this.settings.MultiLineString,MultiPolygon:this.settings.MultiPolygon},this.clusterStyleCache={}};e.prototype.addLayerVector=function(t,e,o,n){void 0===n&&(n=!0);const i=this;o.forEach(function(t){if(!1===n)return;const e=t.getGeometry();void 0!==e&&"Point"===e.getType()||(n=!1)});let s=new ol.source.Vector({features:o});n&&(s=new ol.source.Cluster({source:s}));let r=function(t,e){const o=t.getStyleFunction();return o?o.call(t,e):i.defaultStyle[t.getGeometry().getType()]};n&&(r=function(t){return i.getClusterStyle(t)});const l=new ol.layer.Vector({source:s,style:r});l.set("name",e),t.getLayers().push(l)},e.prototype.getClusterStyle=function(t){const e=t.get("features").length;let o=this.clusterStyleCache[e];return o||(o=this.settings.cluster(e),this.clusterStyleCache[e]=o),o},e.prototype.getControls=function(){return{fullscreen:new ol.control.FullScreen,mouseposition:new ol.control.MousePosition({coordinateFormat:ol.coordinate.createStringXY(6),projection:"EPSG:4326"}),overviewmap:new ol.control.OverviewMap,rotate:new ol.control.Rotate,scaleline:new ol.control.ScaleLine,zoom:new ol.control.Zoom,zoomslider:new ol.control.ZoomSlider,zoomtoextent:new ol.control.ZoomToExtent}},e.prototype.getDragAndDrop=function(e){const o=this,n=new ol.interaction.DragAndDrop({formatConstructors:$.map(t.util.FileTypes,function(t){return t.Format})});return n.on("addfeatures",function(n){const i=t.util.setExtension(n.file.name,"");o.addLayerVector(e,i,n.features)}),n},e.prototype.getGraticule=function(t,e){const o=$.extend($.extend({},e),{color:"#"+e.color}),n=new ol.Graticule({map:t,strokeStyle:new ol.style.Stroke(o)});return n.olexpRecord=$.extend({enable:null!==t},e),n},e.prototype.getInteractions=function(t){return{draganddrop:this.getDragAndDrop(t)}},e.prototype.getTileTypes=function(){const t={};return t.osm={class:ol.source.OSM,name:"OpenStreetMap",settings:{}},t.stamenTerrain={class:ol.source.Stamen,name:"Stamen (Terrain)",settings:{layer:"terrain"}},t.stamenToner={class:ol.source.Stamen,name:"Stamen (Toner)",settings:{layer:"toner"}},t.stamenWater={class:ol.source.Stamen,name:"Stamen (Water Color)",settings:{layer:"watercolor"}},t},t.util.FileTypes={gpx:{extensions:["gpx"],Format:ol.format.GPX,name:"GPX"},igc:{extensions:["igc"],Format:ol.format.IGC,name:"IGC"},json:{extensions:["json","geojson"],Format:ol.format.GeoJSON,name:"GeoJSON"},kml:{extensions:["kml"],Format:ol.format.KML,name:"KML"}},t.util.getReader=function(e){const o=e.substring(e.lastIndexOf(".")+1).toLowerCase();let n=null;return Object.keys(t.util.FileTypes).forEach(function(e){if(null!==n)return;const i=t.util.FileTypes[e];i.extensions.forEach(function(t){null===n&&o===t&&(n=new i.Format)})}),n},t.util.indexOf=function(t,e){let o=0;const n=t.getLength();for(o=0;o
',onOpen:function(e){e.onComplete=function(){$("#w2ui-popup #"+t).w2render(i)}},onToggle:function(t){const e=w2ui[i];$(e.box).hide(),t.onComplete=function(){$(e.box).show(),e.resize()}}}))},t.util.setExtension=function(t,e){const o=t.split(".");return 1===o.length?o[0]:(o.pop(),o.join(".")+e)},t.util.toProperties=function(t){let e=t.getProperties();if(e.hasOwnProperty("features")){const t=e.features;if(t instanceof Array)if(1===t.length)t[0]instanceof ol.Feature&&(e=t[0].getProperties());else{let o=0;t.forEach(function(t){t instanceof ol.Feature&&(o+=1,e["Cluster Size"]=o)})}}return e},t.util.toRecords=function(t){const e=[];let o=0;return Object.keys(t).forEach(function(n){const i=t[n];o+=1,e.push({recid:o,property:n,value:i})}),e},t.util.Util=function(t){const o=new e(t);return{addLayerVector:o.addLayerVector.bind(o),getControls:o.getControls.bind(o),getGraticule:o.getGraticule.bind(o),getInteractions:o.getInteractions.bind(o),getTileTypes:o.getTileTypes.bind(o)}}}(i||{});var s=i.util;const r={control:{},measure:e,ol:n,util:s};!function(t){const e=function(t,e){const o=$.extend(!0,{control:{EditSettings:{form:{header:"",style:"border: 0px; background-color: transparent;"},hint:"Edit Controls",popup:{height:380,style:"width: 100%; height: 100%;",title:"Edit Controls",width:225},span:6}}},e);this.settings=o.control.EditSettings,this.button=e.prefix+"-control-edit-settings-button",this.icon="olexp-control-edit-settings",this.id=e.prefix+"-control-edit-settings-form",this.map=t,this.name=e.prefix+"-control-edit-settings-form"};e.prototype.display=function(){const e=this,o=[{html:{caption:"Full Screen",span:this.settings.span},name:"fullscreen",type:"checkbox"},{html:{caption:"Mouse Position",span:this.settings.span},name:"mouseposition",type:"checkbox"},{html:{caption:"Overview Map",span:this.settings.span},name:"overviewmap",type:"checkbox"},{html:{caption:"Rotate",span:this.settings.span},name:"rotate",type:"checkbox"},{html:{caption:"Scale Line",span:this.settings.span},name:"scaleline",type:"checkbox"},{html:{caption:"Zoom",span:this.settings.span},name:"zoom",type:"checkbox"},{html:{caption:"Zoom Slider",span:this.settings.span},name:"zoomslider",type:"checkbox"},{html:{caption:"Zoom To Extent",span:this.settings.span},name:"zoomtoextent",type:"checkbox"}],n={fullscreen:this.isControlActive("fullscreen"),mouseposition:this.isControlActive("mouseposition"),overviewmap:this.isControlActive("overviewmap"),rotate:this.isControlActive("rotate"),scaleline:this.isControlActive("scaleline"),zoom:this.isControlActive("zoom"),zoomslider:this.isControlActive("zoomslider"),zoomtoextent:this.isControlActive("zoomtoextent")},i=$.extend(this.settings.form,{fields:o,name:this.name,record:n}),s=this.settings.popup;t.util.popup(this.id,function(t){Object.keys(t).forEach(function(o){const n=t[o];e.setControl(o,n)})},i,s)},e.prototype.getControl=function(t){const e=this.map.getControls().getArray();let o=null;return e.forEach(function(e){null===o&&("fullscreen"===t&&e instanceof ol.control.FullScreen?o=e:"mouseposition"===t&&e instanceof ol.control.MousePosition?o=e:"overviewmap"===t&&e instanceof ol.control.OverviewMap?o=e:"rotate"===t&&e instanceof ol.control.Rotate?o=e:"scaleline"===t&&e instanceof ol.control.ScaleLine?o=e:"zoom"===t&&e instanceof ol.control.Zoom?o=e:"zoomslider"===t&&e instanceof ol.control.ZoomSlider?o=e:"zoomtoextent"===t&&e instanceof ol.control.ZoomToExtent&&(o=e))}),o},e.prototype.isControlActive=function(t){const e=this.getControl(t);return null!==e&&null!==e.getMap()},e.prototype.setControl=function(t,e){const o=this.getControl(t);if(null===o)return;const n=e?this.map:null;o.setMap(n)},t.control.editSettings=function(t,o){const n=new e(t.map,o.settings);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.display()},type:"button"}}}(r||{}),function(t){const e=function(t,e){const o=$.extend(!0,{control:{ExportMap:{filename:"map.png",hint:"Export map"}}},e);this.settings=o.control.ExportMap,this.anchor=e.prefix+"-control-export-map-anchor",this.button=e.prefix+"-control-export-map-button",this.filename=this.settings.filename,this.icon="olexp-control-export-map",this.map=t};e.prototype.toImage=function(){const t=this.anchor,e=this.filename;$("body").append('');const o=document.getElementById(t),n=this;o.addEventListener("click",function(){n.map.once("postcompose",function(t){o.href=t.context.canvas.toDataURL("image/png")}),n.map.renderSync()}.bind(this),!1),$("#"+t)[0].click(),$("#"+t).remove()},t.control.exportMap=function(t,o){const n=new e(t.map,o.settings);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.toImage()},type:"button"}}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{Graticule:{enable:!1,form:{header:"",style:"border: 0px; background-color: transparent;"},hint:"Edit Grid Lines",options:{color:"000000",lineDash:[.5,4],width:2},popup:{height:225,style:"border: 0px; background-color: transparent;",title:"Edit Grid Lines",width:300},span:3}}},o);this.settings=n.control.Graticule,this.button=o.prefix+"-control-graticule-button",this.icon="olexp-control-graticule",this.id=o.prefix+"-control-graticule",this.map=e,this.name=o.prefix+"-control-graticule-form",this.util=new t.util.Util(n),this.graticule=this.util.getGraticule(this.settings.enable?this.map:null,$.extend({},this.settings.options))};e.prototype.display=function(){const e=this,o=[{html:{caption:"Enable",span:this.settings.span},name:"enable",required:!0,type:"checkbox"},{html:{caption:"Color",span:this.settings.span},name:"color",options:{silent:!1},required:!0,type:"color"},{html:{caption:"Width",span:this.settings.span},name:"width",options:{arrows:!0,max:4,min:.25,placeholder:"0.25 - 4",silent:!1,step:.25},required:!0,type:"float"}],n=this.graticule.olexpRecord,i=$.extend(this.settings.form,{fields:o,name:this.name,record:n}),s=this.settings.popup;t.util.popup(this.id,function(t){Object.keys(t).forEach(function(e){n[e]=t[e]});const o=$.extend({},n);delete o.enable,e.graticule.setMap(null),e.graticule=e.util.getGraticule(n.enable?e.map:null,o)},i,s)},t.control.graticule=function(t,o){void 0===o&&(o={}),void 0===o.settings&&(o.settings={});const n=new e(t.map,o.settings);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.display()},type:"button"}}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{LayerControlTile:{form:{header:"",style:"border: 0px; background-color: transparent;"},hint:"Add Tile Layer",popup:{height:165,style:"border: 0px; background-color: transparent;",title:"Add Tile Layer",width:290},span:3},LayerControlVector:{form:{header:"File Types: "+$.map(t.util.FileTypes,function(t){return" "+t.name}),style:"border: 0px; background-color: transparent;"},hint:"Add Vector Layer",popup:{height:195,style:"border: 0px; background-color: transparent;",title:"Add Vector Layer",width:350},span:4}}},o);this.settingsTile=n.control.LayerControlTile,this.settingsVector=n.control.LayerControlVector,this.icons={tile:"olexp-control-layer-control-add-tile",vector:"olexp-control-layer-control-add-vector"},this.buttons={tile:o.prefix+"-control-layer-control-add-tile-button",vector:o.prefix+"-control-layer-control-add-vector-button"},this.ids={tile:o.prefix+"-control-layer-control-add-tile",vector:o.prefix+"-control-layer-control-add-vector"},this.map=e,this.names={tile:o.prefix+"-control-tile-form",vector:o.prefix+"-control-vector-form"},this.util=new t.util.Util(this.map)};e.prototype.tile=function(){const e=this,o=this.util.getTileTypes(),n=$.map(o,function(t){return t.name}),i=[{field:"tile_source",html:{caption:"Source",span:this.settingsTile.span},options:{items:n},required:!0,type:"list"}],s={};s[i[0].field]=null;const r=$.extend(this.settingsTile.form,{fields:i,name:this.names.tile,record:s}),l=this.settingsTile.popup;t.util.popup(this.ids.tile,function(t){Object.keys(t).forEach(function(n){if(n!==i[0].field)return;const s=t[n].id;Object.keys(o).forEach(function(t){if(s!==o[t].name)return;const n=o[t],i=n.class,r=new ol.layer.Tile({source:new i(n.settings)});r.set("name",s),e.map.addLayer(r)})})},r,l)},e.prototype.vector=function(){const e=this,o=[{field:"vector_source",html:{caption:"Source",span:this.settingsVector.span},options:{placeholder:"Click to add file",silent:!1},required:!0,type:"file"}],n={};n[o[0].field]=null;const i=$.extend(this.settingsVector.form,{fields:o,name:this.names.vector,record:n}),s=this.settingsVector.popup;t.util.popup(this.ids.vector,function(n){Object.keys(n).forEach(function(i){i===o[0].field&&Object.keys(n[i]).forEach(function(o){const s=n[i][o].content;if(null==s)return;const r=n[i][o].name,l=t.util.setExtension(r,""),a=t.util.getReader(r);if(null===a)return void w2alert("Unable to open file "+r,"Error");const c=atob(s),p={featureProjection:e.map.getView().getProjection()},h=a.readFeatures(c,p);e.util.addLayerVector(e.map,l,h)})})},i,s)},t.control.layerControl=function(t,o){void 0===o&&(o={}),void 0===o.tile&&(o.tile=!0),void 0===o.vector&&(o.vector=!0),void 0===o.settings&&(o.settings={});const n=new e(t.map,o.settings),i=[];return o.tile&&i.push({hint:n.settingsTile.hint,id:n.buttons.tile,img:n.icons.tile,onClick:function(){n.tile()},type:"button"}),o.vector&&i.push({hint:n.settingsVector.hint,id:n.buttons.vector,img:n.icons.vector,onClick:function(){n.vector()},type:"button"}),i}}(r||{}),function(t){const e=function(t,e,o){const n=$.extend(!0,{control:{LayerManager:{hintDetailsHide:"Hide details",hintDetailsShow:"Show details",hintMoveDown:"Move item down",hintMoveUp:"Move item up",hintOutlineHide:"Hide outline",hintOutlineShow:"Show outline"}}},o);this.buttons={details:o.prefix+"-control-layer-manager-button-details",down:o.prefix+"-control-layer-manager-button-down",navigation:o.prefix+"-control-layer-manager-button-navigation",up:o.prefix+"-control-layer-manager-button-up"},this.explorer=t,this.icons={details:"olexp-control-layer-manager-details",down:"olexp-control-layer-manager-down",navigation:"olexp-control-layer-manager-navigation",up:"olexp-control-layer-manager-up"},this.manager=e,this.settings=n.control.LayerManager,this.manager.on("remove:item",this.onItemRemoved,this),this.manager.on("select:item",this.onItemSelected,this)};e.prototype.details=function(){const t=this.explorer.options.details.type;this.explorer.navigation.toggle(t);const e=this.explorer.navigation.get(t);this.explorer.toolbar.get(this.buttons.details).hint=this.hintDetails(e.hidden),this.explorer.toolbar.refresh()},e.prototype.down=function(){this.manager.moveDown()},e.prototype.hintDetails=function(t){return t?this.settings.hintDetailsShow:this.settings.hintDetailsHide},e.prototype.hintNavigation=function(t){return t?this.settings.hintOutlineShow:this.settings.hintOutlineHide},e.prototype.navigation=function(){const t=this.explorer.options.navigation.type;this.explorer.layout.toggle(t);const e=this.explorer.layout.get(t);this.explorer.toolbar.get(this.buttons.navigation).hint=this.hintNavigation(e.hidden),this.explorer.toolbar.refresh()},e.prototype.onItemRemoved=function(t){this.manager.isSelected(t.id)&&(this.explorer.toolbar.disable(this.buttons.up),this.explorer.toolbar.disable(this.buttons.down))},e.prototype.onItemSelected=function(t){if(void 0===t)return;const e=this.manager.getById(t);null!==e&&(this.manager.getNode(e.id).disabled?(this.explorer.toolbar.disable(this.buttons.up),this.explorer.toolbar.disable(this.buttons.down)):(this.explorer.toolbar.enable(this.buttons.up),this.explorer.toolbar.enable(this.buttons.down)))},e.prototype.up=function(){this.manager.moveUp()},t.control.layerManager=function(t,o,n){void 0===n&&(n={}),void 0===n.details&&(n.details={}),void 0===n.details.enabled&&(n.details.enabled=!0),void 0===n.details.checked&&(n.details.checked=!0),void 0===n.down&&(n.down=!0),void 0===n.navigation&&(n.navigation={}),void 0===n.navigation.enabled&&(n.navigation.enabled=!0),void 0===n.navigation.checked&&(n.navigation.checked=!0),void 0===n.up&&(n.up=!0);const i=new e(t,o,n.settings),s=[];return n.navigation.enabled&&s.push({checked:n.navigation.checked,hint:i.hintNavigation(!n.navigation.checked),id:i.buttons.navigation,img:i.icons.navigation,onClick:function(){i.navigation()},type:"check"}),n.details.enabled&&s.push({checked:n.details.checked,hint:i.hintDetails(!n.details.checked),id:i.buttons.details,img:i.icons.details,onClick:function(){i.details()},type:"check"}),n.up&&s.push({disabled:!0,hint:i.settings.hintMoveUp,id:i.buttons.up,img:i.icons.up,onClick:function(){i.up()},type:"button"}),n.down&&s.push({disabled:!0,hint:i.settings.hintMoveDown,id:i.buttons.down,img:i.icons.down,onClick:function(){i.down()},type:"button"}),s}}(r||{}),function(t){const e=function(t,e,o,n){const i=$.extend(!0,{control:{LayerMenu:{arrow:!0,hint:"Item Options",text:""}}},n);this.button=n.prefix+"-control-layer-menu",this.explorer=t,this.icon="olexp-control-layer-menu",this.manager=e,this.menu=o,this.settings=i.control.LayerMenu,this.manager.on("remove:item",this.onItemRemoved,this),this.manager.on("select:item",this.onItemSelected,this)};e.prototype.onItemRemoved=function(t){this.manager.isSelected(t.id)&&this.explorer.toolbar.disable(this.button)},e.prototype.onItemSelected=function(t){if(void 0===t)return;const e=this.manager.getById(t);null!==e&&(this.manager.getNode(e.id).disabled?this.explorer.toolbar.disable(this.button):this.explorer.toolbar.enable(this.button))},t.control.layerMenu=function(t,o,n,i){const s=new e(t,o,n,i.settings);return t.toolbar.on("click",function(e){if(null===t.outline.selected)return;const o=s.button+":";if(e.target.indexOf(o)<0)return;const i=e.target.replace(o,"");void 0!==n.callbacks[i]&&n.callbacks[i]({target:t.outline.selected})}),{arrow:s.settings.arrow,disabled:!0,hint:s.settings.hint,id:s.button,img:s.icon,items:s.menu.items,text:s.settings.text,type:"menu"}}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{Measurement:{hintArea:"Measure area",hintLength:"Measure length"}}},o);this.explorer=e,this.icons={area:"olexp-control-measure-area",length:"olexp-control-measure-length"},this.ids={area:o.prefix+"-control-measure-area-button",length:o.prefix+"-control-measure-length-button"},this.settings=n.control.Measurement,this.tool=new t.measure.Tool(e.map,{type:t.measure.Type.LINE,settings:o})};e.prototype.area=function(){const e=!this.explorer.toolbar.get(this.ids.area).checked;this.measure(t.measure.Type.AREA,e)},e.prototype.length=function(){const e=!this.explorer.toolbar.get(this.ids.length).checked;this.measure(t.measure.Type.LINE,e)},e.prototype.measure=function(t,e){this.tool.setEnable(!1),e&&(this.tool.setType(t),this.tool.setEnable(!0))},t.control.measure=function(t,o){void 0===o&&(o={}),void 0===o.area&&(o.area=!0),void 0===o.length&&(o.length=!0),void 0===o.settings&&(o.settings={});const n=new e(t,o.settings),i=[];return o.area&&i.push({hint:n.settings.hintArea,id:n.ids.area,img:n.icons.area,onClick:function(){o.length&&t.toolbar.uncheck(n.ids.length),n.area()},type:"check"}),o.length&&i.push({hint:n.settings.hintLength,id:n.ids.length,img:n.icons.length,onClick:function(){o.area&&t.toolbar.uncheck(n.ids.area),n.length()},type:"check"}),i}}(r||{}),function(t){const e=function(e,o){const n=$.extend(!0,{control:{ToolbarHide:{hint:"Hide toolbar"}}},o.settings);this.button=o.settings.prefix+"-control-toolbar-hide-button",this.explorer=e,this.icon="olexp-control-toolbar-hide",this.settings=n.control.ToolbarHide,this.show=t.ol.toolbarShow(this.explorer,o)};e.prototype.hide=function(){this.explorer.layout.hide(this.explorer.options.toolbar.type),this.show.setMap(this.explorer.map)},t.control.toolbarHide=function(t,o){const n=new e(t,o);return{hint:n.settings.hint,id:n.button,img:n.icon,onClick:function(){n.hide()},type:"button"}}}(r||{});var l=r.control;const a={event:{}};!function(t){const e=function(t){this.listeners=$.extend({},t)};e.prototype.on=function(t,e,o){if(void 0===this.listeners[t])return;let n=e;void 0!==o&&(n=e.bind(o)),this.listeners[t].push(n)},e.prototype.register=function(t){void 0===this.listeners[t]&&(this.listeners[t]=[])},e.prototype.trigger=function(t,...e){if(void 0===this.listeners[t])return;const o=this;this.listeners[t].forEach(function(t){t.apply(o,e)})},e.prototype.unregister=function(t){if(void 0===this.listeners[t])return[];const e=this.listeners[t];return delete this.listeners[t],e},e.prototype.off=function(t,e,o){if(void 0===this.listeners[t])return;let n=e;void 0!==o&&(n=e.bind(o));const i=this.listeners[t].indexOf(n);i>-1&&this.listeners[t].splice(i,1)},t.event.Event=function(t){return new e(t)}}(a||{});var c=a.event;const p={item:{},measure:e,util:s};!function(t){t.item.icons={group:"olexp-item-group",heatmap:"olexp-item-heatmap",image:"olexp-item-image",overlay:"olexp-item-overlay",tile:"olexp-item-tile",vector:"olexp-item-vector"};const e=function(t,o,n){this.id=t,this.layer=n,this.moving=!1,this.name=o,this.type=e.getType(this.layer),this.icon=e.getIcon(this.type)};e.prototype.getDetails=function(){const e={};e.Name=this.name;const o=this.layer.getProperties();if(o.hasOwnProperty(t.measure.properties.area)?e.Area=o[t.measure.properties.area]:o.hasOwnProperty(t.measure.properties.length)&&(e.Length=o[t.measure.properties.length]),this.type===t.item.Type.GROUP){const t=this.layer.getLayers();e["Layer Count"]=t.getLength()}if(this.type===t.item.Type.VECTOR){const t=this.layer.getSource().getFeatures();e["Feature Count"]=t.length}return t.util.toRecords(e)},e.prototype.getExtent=function(){if(this.type===t.item.Type.OVERLAY)return null;if(this.type===t.item.Type.GROUP){let t=null;return this.layer.getLayers().forEach(function(o){const n=e.getLayerExtent(o);null===t&&null!==n?t=n:null!==t&&null!==n&&(t=ol.extent.extend(t,n))},this),t}return e.getLayerExtent(this.layer)},e.getIcon=function(e){return e===t.item.Type.GROUP?t.item.icons.group:e===t.item.Type.HEATMAP?t.item.icons.heatmap:e===t.item.Type.IMAGE?t.item.icons.image:e===t.item.Type.OVERLAY?t.item.icons.overlay:e===t.item.Type.TILE?t.item.icons.tile:e===t.item.Type.VECTOR?t.item.icons.vector:"icon-page"},e.getLayerExtent=function(t){let e=t.getExtent();if(void 0===e){const o=t.getSource();null!==o&&(o instanceof ol.source.Cluster||o instanceof ol.source.VectorTile||o instanceof ol.source.Vector)&&(e=o.getExtent())}return void 0===e?null:e},e.prototype.getPropertyTypes=function(){return this.layer instanceof ol.layer.Layer?t.item.LayerProperties:this.layer instanceof ol.Overlay?t.item.OverlayProperties:{}},e.prototype.getProperties=function(){const t={name:this.name},e=this.getPropertyTypes(),o=this;return Object.keys(e).forEach(function(e){t[e]=o.layer.get(e)}),t},e.getType=function(e){return e instanceof ol.layer.Group?t.item.Type.GROUP:e instanceof ol.layer.Heatmap?t.item.Type.HEATMAP:e instanceof ol.layer.Image?t.item.Type.IMAGE:e instanceof ol.layer.Tile?t.item.Type.TILE:e instanceof ol.layer.Vector?t.item.Type.VECTOR:e instanceof ol.Overlay?t.item.Type.OVERLAY:null},e.prototype.setProperties=function(t){t.hasOwnProperty("name")&&(this.name=t.name);const e=this.getPropertyTypes(),o=this;Object.keys(e).forEach(function(e){t.hasOwnProperty(e)&&o.layer.set(e,t[e])})},e.prototype.property=function(t,e){if(void 0!==this[t])return void 0!==e&&(this[t]=e),this[t]},e.prototype.zoomTo=function(e){const o=e.getView();if(this.type===t.item.Type.OVERLAY){const t=this.layer.getPosition();if(void 0!==t)return void o.setCenter(t);w2alert("Overlay has no position defined to which to zoom.","Warning")}else{const t=this.getExtent();if(null!==t)return void o.fit(t,e.getSize());w2alert("Layer has no extent defined to which to zoom.","Warning")}},t.item.Item=function(t,o,n){const i=new e(t,o,n);return{getDetails:i.getDetails.bind(i),getProperties:i.getProperties.bind(i),getPropertyTypes:i.getPropertyTypes.bind(i),icon:i.icon,id:i.id,layer:i.layer,moving:function(t){return i.property("moving",t)},name:function(t){return i.property("name",t)},setProperties:i.setProperties.bind(i),type:i.type,zoomTo:i.zoomTo.bind(i)}},t.item.OverlayProperties={},t.item.LayerProperties={opacity:{title:"Opacity"}},t.item.Type={GROUP:0,HEATMAP:1,IMAGE:2,OVERLAY:3,TILE:4,VECTOR:5}}(p||{});const h={event:c,item:p.item,manager:{},measure:e,util:s};!function(t){const e=function(e,o,n,i,s){this.event=new t.event.Event({"select:item":[]}),this.managerLayers=new t.manager.NodeManager(i,e.getLayers(),o,n),this.layersId=i,this.managerOverlays=new t.manager.NodeManager(s,e.getOverlays(),o,n),this.map=e,this.map.on("change:layergroup",this.onLayerGroupChanged,this),this.outline=o,this.overlaysId=s};e.prototype.isIdLayerNode=function(t){return"string"==typeof t&&0===t.indexOf(this.layersId)},e.prototype.isIdOverlayNode=function(t){return"string"==typeof t&&0===t.indexOf(this.overlaysId)},e.prototype.isSelected=function(t){return t===this.outline.selected},e.prototype.getById=function(t){return this.isIdLayerNode(t)?this.managerLayers.getById(t):this.isIdOverlayNode(t)?this.managerOverlays.getById(t):null},e.prototype.getDetails=function(t){if(this.isIdLayerNode(t)){const e=this.managerLayers.getById(t);if(null!==e)return e.getDetails()}else if(this.isIdOverlayNode(t)){const e=this.managerOverlays.getById(t);if(null!==e)return e.getDetails()}return[]},e.prototype.getNode=function(t){return this.outline.get(t)},e.prototype.moveDown=function(t){return void 0===t&&(t=this.outline.selected),this.isIdLayerNode(t)?this.managerLayers.moveDown(t):!!this.isIdOverlayNode(t)&&this.managerOverlays.moveDown(t)},e.prototype.moveUp=function(t){return void 0===t&&(t=this.outline.selected),this.isIdLayerNode(t)?this.managerLayers.moveUp(t):!!this.isIdOverlayNode(t)&&this.managerOverlays.moveUp(t)},e.prototype.off=function(t,e,o){this.event.off(t,e,o),this.managerLayers.off(t,e,o),this.managerOverlays.off(t,e,o)},e.prototype.on=function(t,e,o){this.event.on(t,e,o),this.managerLayers.on(t,e,o),this.managerOverlays.on(t,e,o)},e.prototype.onItemSelected=function(t){this.event.trigger("select:item",t)},e.prototype.onLayerGroupChanged=function(t){this.managerLayers.setLayers(t.target.getLayers())},e.prototype.removeFromMap=function(t){return t.hasOwnProperty("id")?this.isIdLayerNode(t.id)?this.managerLayers.removeFromMap(t):this.isIdOverlayNode(t.id)?this.managerOverlays.removeFromMap(t):null:null},e.prototype.toggleNode=function(t){if("string"!=typeof t)return;const e=this.outline.get(t).disabled;if(e?this.outline.enable(t):this.outline.disable(t),this.isIdLayerNode(t)){const o=this.managerLayers.getById(t);null!==o&&o.layer.setVisible(e)}else if(this.isIdOverlayNode(t)){const o=this.managerOverlays.getById(t);if(null!==o){const t=o.layer.getProperties();if(t.hasOwnProperty("element")){const o=$(t.element);e?o.show():o.hide()}}}},e.prototype.updateItem=function(t,e){const o=this.getById(t);if(null!==o){o.setProperties(e),this.outline.get(t).text=o.name(),this.outline.refresh()}},e.prototype.zoomTo=function(t){this.getById(t).zoomTo(this.map)},t.manager.Manager=function(t,o,n,i,s){const r=new e(t,o,n,i,s);return{getById:r.getById.bind(r),getDetails:r.getDetails.bind(r),getNode:r.getNode.bind(r),isSelected:r.isSelected.bind(r),moveDown:r.moveDown.bind(r),moveUp:r.moveUp.bind(r),off:r.off.bind(r),on:r.on.bind(r),onItemSelected:r.onItemSelected.bind(r),removeFromMap:r.removeFromMap.bind(r),toggleNode:r.toggleNode.bind(r),updateItem:r.updateItem.bind(r),zoomTo:r.zoomTo.bind(r)}}}(h||{}),function(t){const e=function(e,o,n,i){this.count=0,this.details=i,this.event=new t.event.Event({"remove:item":[]}),this.id=e,this.items=[],this.layers=o,this.layers.on("change:length",this.onLayerChanged,this),this.managers={},this.outline=n};e.prototype.addLayer=function(o){this.count+=1;const n=this.id+"-"+this.count;let i="Item "+this.count;const s=o.getProperties();s.hasOwnProperty("name")&&(i=s.name);const r=new t.item.Item(n,i,o);this.items.push(r);const l={id:r.id,img:r.icon,text:r.name()},a=this.outline.get(this.id).nodes;if(0===a.length?this.outline.add(this.id,[l]):this.outline.insert(this.id,a[0].id,[l]),r.type===t.item.Type.GROUP){const t=o.getLayers(),n=new e(r.id,t,this.outline,this.details);t.forEach(function(t){n.addLayer(t)},this),this.managers[r.id]=n,this.outline.expand(r.id)}return r},e.prototype.getById=function(e,o){void 0===o&&(o=!0);const n=this;let i=null;return this.items.forEach(function(s){if(null===i)if(s.id!==e){if(s.type===t.item.Type.GROUP&&o){const t=n.managers[s.id].getById(e);if(null!==t&&t.id===e)return void(i=t)}}else i=s}),i},e.prototype.getByLayer=function(e,o){void 0===o&&(o=!0);const n=this;let i=null;return this.items.forEach(function(s){if(null===i)if(s.layer!==e){if(s.type===t.item.Type.GROUP&&o){const t=n.managers[s.id].getByLayer(e);if(null!==t&&t.layer===e)return void(i=t)}}else i=s}),i},e.prototype.getSize=function(){return this.items.length},e.prototype.isSelected=function(t){return t===this.outline.selected},e.prototype.isHidden=function(e){return e instanceof t.measure.Overlay},e.prototype.moveDown=function(e){const o=this.getById(e,!1);if(null!==o){let t=this.moveLayerUp(this.layers,o.layer);return t&&(t=this.moveItemDown(e)),t}const n=this;let i=null;return this.items.forEach(function(o){if(null===i&&o.type===t.item.Type.GROUP){const t=n.managers[o.id].moveDown(e);if(null!==t)return void(i=t)}}),i},e.prototype.moveItemDown=function(t){const e=this.outline.get(t);if(null===e)return!1;const o=this.outline.find(e.parent.id,{parent:e.parent}),n=this.outline.get(e.parent.id,t,!0);if(n>=o.length-1)return!1;const i=o[n+1].id,s=o[n+1];return e.parent===s.parent&&(this.outline.remove(i),this.outline.insert(e.parent,t,s),this.outline.select(t),!0)},e.prototype.moveItemUp=function(t){const e=this.outline.get(t);if(null===e)return!1;const o=this.outline.find(e.parent.id,{parent:e.parent}),n=this.outline.get(e.parent.id,t,!0);if(n<=0)return!1;const i=o[n-1].id,s=o[n-1];return e.parent===s.parent&&(this.outline.remove(t),this.outline.insert(e.parent,i,e),this.outline.select(t),!0)},e.prototype.moveLayerDown=function(e,o){const n=t.util.indexOf(e,o);if(n0){const t=this.getByLayer(o,!1);return t.moving(!0),e.removeAt(n),e.insertAt(n-1,o),t.moving(!1),!0}return!1},e.prototype.moveUp=function(e){const o=this.getById(e,!1);if(null!==o){let t=this.moveLayerDown(this.layers,o.layer);return t&&(t=this.moveItemUp(e)),t}const n=this;let i=null;return this.items.forEach(function(o){if(null===i&&o.type===t.item.Type.GROUP){const t=n.managers[o.id].moveUp(e);if(null!==t)return void(i=t)}}),i},e.prototype.off=function(e,o,n){this.event.off(e,o,n);const i=this.getSize();let s=0;for(s=0;s0;)this.onItemRemoved(this.items[this.items.length-1]);this.layers=t,this.layers.on("change:length",this.onLayerChanged,this);let e=0;for(e=0;e'},olmap:{target:n+"-explorer-id-map"},overlays:{id:n+"-explorer-id-overlays"},settings:{prefix:n}});const i=this,s=$("
",{id:this.options.explorer.id,class:this.options.explorer.cls});$("#"+e).append(s),this.layout=$("#"+this.options.explorer.id).w2layout({name:this.options.explorer.layout,panels:[this.options.navigation,this.options.map,this.options.toolbar]}),this.toolbar=$("").w2toolbar({name:this.options.explorer.toolbar}),this.navigation=$("").w2layout({name:this.options.explorer.navigation,onResize:function(){i.hasOwnProperty("map")&&i.map.updateSize(),i.hasOwnProperty("details")&&i.details.resize()},panels:[this.options.outline,this.options.details]}),this.outline=$("").w2sidebar({name:this.options.explorer.outline,nodes:[this.options.layers,this.options.overlays],onClick:function(t){const e=t.target,o=i.manager.getDetails(e);i.details.clear(),i.details.add(o),i.manager.onItemSelected(e)},onDblClick:function(t){const e=t.target;i.manager.toggleNode(e),i.manager.onItemSelected(e)},onRender:function(t){t.onComplete=function(){const t=i.outline.selected;i.manager.onItemSelected(t)}}}),this.details=$("").w2grid({columns:[{field:"property",caption:"Property",size:"100%",sortable:!0},{field:"value",caption:"Value",size:"100%",sortable:!0}],name:this.options.explorer.details}),this.navigation.content(this.options.outline.type,this.outline),this.navigation.content(this.options.details.type,this.details),this.layout.content(this.options.navigation.type,this.navigation),this.map=new ol.Map(this.options.olmap),this.manager=new t.manager.Manager(this.map,this.outline,this.details,this.options.layers.id,this.options.overlays.id);const r=this.options.settings,l=t.menu.zoom(this.manager,r),a=t.menu.properties(this.manager,r),c=t.menu.remove(this.manager,r);this.menu={items:[],callbacks:{}},this.menu.items.push(l.menu),this.menu.items.push(a.menu),this.menu.items.push(c.menu),this.menu.callbacks[l.menu.id]=l.click,this.menu.callbacks[a.menu.id]=a.click,this.menu.callbacks[c.menu.id]=c.click,this.outline.menu=this.menu.items,this.outline.onMenuClick=function(t){const e=t.menuItem.id;void 0!==i.menu.callbacks[e]&&i.menu.callbacks[e](t)},this.util=new t.util.Util(this.options.settings);const p=this.util.getInteractions(this.map);Object.keys(this.options.olinteractions).forEach(function(t){const e=p[t];i.options.olinteractions[t]&&i.map.addInteraction(e)});const h=this.util.getControls();Object.keys(this.options.olcontrols).forEach(function(t){const e=h[t];i.map.addControl(e),e.setMap(i.options.olcontrols[t]?i.map:null)}),this.selector=new t.selection.Feature(this.map,this.details),this.selector.setEnable(!0),this.api={details:this.details,layout:this.layout,manager:this.manager,map:this.map,navigation:this.navigation,options:this.options,outline:this.outline,toolbar:this.toolbar},this.options.controls.toolbarhide&&(this.toolbar.add(t.control.toolbarHide(this.api,{hidden:this.options.toolbar.hidden,settings:this.options.settings})),this.toolbar.add({id:"break-toolbar-hide",type:"break"})),this.options.controls.layermanager&&(this.toolbar.add(t.control.layerManager(this.api,this.manager,{details:{checked:!this.options.details.hidden},navigation:{checked:!this.options.navigation.hidden},settings:this.options.settings})),this.toolbar.add({id:"break-layer-manager",type:"break"})),this.options.controls.layermenu&&(this.toolbar.add(t.control.layerMenu(this.api,this.manager,this.menu,{settings:this.options.settings})),this.toolbar.add({id:"break-item-menu",type:"break"})),this.options.controls.layercontrol&&(this.toolbar.add(t.control.layerControl(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-layer-control",type:"break"})),this.options.controls.graticule&&(this.toolbar.add(t.control.graticule(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-graticule",type:"break"})),this.options.controls.measure&&(this.toolbar.add(t.control.measure(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-measure",type:"break"})),this.options.controls.exportmap&&(this.toolbar.add(t.control.exportMap(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-export-map",type:"break"})),this.options.controls.editsettings&&(this.toolbar.add(t.control.editSettings(this.api,{settings:this.options.settings})),this.toolbar.add({id:"break-edit-settings",type:"break"})),this.layout.set(this.options.toolbar.type,{content:"",show:{toolbar:!0},toolbar:this.toolbar})};t.destroy=function(t){void 0!==t.map&&t.map.setTarget(null),void 0!==t.details&&t.details.destroy(),void 0!==t.outline&&t.outline.destroy(),void 0!==t.navigation&&t.navigation.destroy(),void 0!==t.toolbar&&t.toolbar.destroy(),void 0!==t.layout&&t.layout.destroy()},t.Explorer=function(t,o){return new e(t,o).api}}(y||{}),{destroy:y.destroy,Explorer:y.Explorer}}); diff --git a/src/js/control.js b/src/js/control.js index 339eeee..305c77c 100644 --- a/src/js/control.js +++ b/src/js/control.js @@ -287,7 +287,7 @@ const olexp = { * @return {external:jQuery.fn.w2toolbar.properties} EditSettings toolbar * control */ - olexp.control.EditSettings = function(explorer, options) { + olexp.control.editSettings = function(explorer, options) { const control = new EditSettings(explorer.map, options.settings); return { @@ -417,7 +417,7 @@ const olexp = { * @return {external:jQuery.fn.w2toolbar.properties} ExportMap toolbar * control */ - olexp.control.ExportMap = function(explorer, options) { + olexp.control.exportMap = function(explorer, options) { const control = new ExportMap(explorer.map, options.settings); return { @@ -634,7 +634,7 @@ const olexp = { * @return {external:jQuery.fn.w2toolbar.properties} Graticule toolbar * control */ - olexp.control.Graticule = function(explorer, options) { + olexp.control.graticule = function(explorer, options) { if (options === undefined) { options = {}; } @@ -962,7 +962,7 @@ const olexp = { * @public * @return {array} Array of w2toolbar properties */ - olexp.control.LayerControl = function(explorer, options) { + olexp.control.layerControl = function(explorer, options) { if (options === undefined) { options = {}; } @@ -1218,7 +1218,7 @@ const olexp = { * @public * @return {array} Array of external:jQuery.fn.w2toolbar.properties */ - olexp.control.LayerManager = function(explorer, manager, options) { + olexp.control.layerManager = function(explorer, manager, options) { if (options === undefined) { options = {}; } @@ -1440,7 +1440,7 @@ const olexp = { * @return {external:jQuery.fn.w2toolbar.properties} LayerMenu toolbar * control */ - olexp.control.LayerMenu = function(explorer, manager, menu, options) { + olexp.control.layerMenu = function(explorer, manager, menu, options) { const control = new LayerMenu(explorer, manager, menu, options.settings); explorer.toolbar.on('click', function(event) { @@ -1599,7 +1599,7 @@ const olexp = { * @public * @return {array} Array of w2toolbar properties */ - olexp.control.Measure = function(explorer, options) { + olexp.control.measure = function(explorer, options) { if (options === undefined) { options = {}; } @@ -1740,7 +1740,7 @@ const olexp = { * @return {external:jQuery.fn.w2toolbar.properties} ToolbarHide toolbar * control */ - olexp.control.ToolbarHide = function(explorer, options) { + olexp.control.toolbarHide = function(explorer, options) { const control = new ToolbarHide(explorer, options); return { diff --git a/src/js/explorer.js b/src/js/explorer.js index 5de8985..07cbebf 100644 --- a/src/js/explorer.js +++ b/src/js/explorer.js @@ -874,7 +874,7 @@ const olexp = { // -------------------------------------------------- if (this.options.controls.toolbarhide) { - this.toolbar.add(olexp.control.ToolbarHide(this.api, { + this.toolbar.add(olexp.control.toolbarHide(this.api, { hidden: this.options.toolbar.hidden, settings: this.options.settings, })); @@ -882,7 +882,7 @@ const olexp = { } if (this.options.controls.layermanager) { - this.toolbar.add(olexp.control.LayerManager(this.api, this.manager, { + this.toolbar.add(olexp.control.layerManager(this.api, this.manager, { details: {checked: !this.options.details.hidden}, navigation: {checked: !this.options.navigation.hidden}, settings: this.options.settings, @@ -891,41 +891,41 @@ const olexp = { } if (this.options.controls.layermenu) { - this.toolbar.add(olexp.control.LayerMenu(this.api, this.manager, + this.toolbar.add(olexp.control.layerMenu(this.api, this.manager, this.menu, {settings: this.options.settings})); this.toolbar.add({id: 'break-item-menu', type: 'break'}); } if (this.options.controls.layercontrol) { - this.toolbar.add(olexp.control.LayerControl(this.api, { + this.toolbar.add(olexp.control.layerControl(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-layer-control', type: 'break'}); } if (this.options.controls.graticule) { - this.toolbar.add(olexp.control.Graticule(this.api, { + this.toolbar.add(olexp.control.graticule(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-graticule', type: 'break'}); } if (this.options.controls.measure) { - this.toolbar.add(olexp.control.Measure(this.api, { + this.toolbar.add(olexp.control.measure(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-measure', type: 'break'}); } if (this.options.controls.exportmap) { - this.toolbar.add(olexp.control.ExportMap(this.api, { + this.toolbar.add(olexp.control.exportMap(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-export-map', type: 'break'}); } if (this.options.controls.editsettings) { - this.toolbar.add(olexp.control.EditSettings(this.api, { + this.toolbar.add(olexp.control.editSettings(this.api, { settings: this.options.settings, })); this.toolbar.add({id: 'break-edit-settings', type: 'break'});