UNPKG

js-pkg

Version:
10 lines 128 kB
/*! * filename: ej.map.min.js * version : 15.3.0.33 * Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ (function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min","./../common/ej.data.min","./../web/ej.slider.min"],n):n()})(function(){(function(t,i,r){i.widget({ejMap:"ej.datavisualization.Map"},{validTags:["div"],_initPrivateProperties:function(){this._rootgroup=null;this._bubblegroup=null;this._scale=1;this._prevDistance=0;this._tileTranslatePoint={x:0,y:0};this._translatePoint={x:0,y:0};this._prevPoint=null;this._Tiles=[];this._prevScale=0;this._tileDiv=null;this._containerWidth=500;this._containerHeight=400;this._baseTranslatePoint={x:0,y:0};this._isDragging=!1;this._prevLevel=1;this._startPoint={x:0,y:0};this._stopPoint={x:0,y:0};this.mouseClickable=!1;this._browser=null;this._baseScale=0;this._mapBounds=null;this._svgns="http://www.w3.org/2000/svg";this._ispanning=!1;this._dragStartX=0;this._isNavigationPressed=!1;this._iskeyboardKeysPressed=!1;this._isPolygonSelected=!1;this._dragStartY=0;this._width=350;this._height=350;this._isMapCoordinates=!0;this._margintop=0;this._marginleft=0;this._svgDocument=null;this._tooltipElement=null;this._templateDiv=null;this._scrollLegendDiv=null;this._legendContainer=null;this._legendDiv=null;this._legendDivHeight=0;this._legendDivWidth=0;this._mapContainer=null;this._isSVG=!0;this._VMLPathFractionCount=0;this._sliderControl=null;this._isTileMap=!1;this._isRendered=!1;this._urlTemplate=null;this._polylineCount=0;this._pointscount=0;this._isPinching=!1;this._groupSize=null;this._groupBorder={x:0,y:0}},defaults:{locale:null,enableGroupSeparator:!1,background:"transparent",zoomSettings:{minValue:1,maxValue:100,factor:1,level:1,enableZoomOnSelection:!1,enableZoom:!0},centerPosition:null,enableResize:!0,isResponsive:!0,enableAnimation:!1,draggingOnSelection:!1,navigationControl:{enableNavigation:!1,content:null,orientation:"vertical",absolutePosition:{x:0,y:0},dockPosition:"centerleft"},enableLayerChangeAnimation:!1,enablePan:!0,zoomLevel:1,minZoom:1,maxZoom:100,zoomFactor:1,baseMapIndex:0,shapeSelected:"",markerSelected:"",zoomedIn:"",onRenderComplete:"",refreshed:"",panned:"",zoomedOut:"",mouseover:"",mouseleave:"",layers:[]},observables:["baseMapIndex","enablePan","enableResize","enableAnimation","zoomLevel","minZoom","maxZoom","zoomFactor",],_zoomLevel:i.util.valueFunction("zoomLevel"),_minZoom:i.util.valueFunction("minZoom"),_maxZoom:i.util.valueFunction("maxZoom"),_zoomFactor:i.util.valueFunction("zoomFactor"),baseMapIndex:i.util.valueFunction("baseMapIndex"),enablePan:i.util.valueFunction("enablePan"),enableResize:i.util.valueFunction("enableResize"),enableAnimation:i.util.valueFunction("enableAnimation"),_tags:[{tag:"layers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","legendSettings.leftLabel","legendSettings.rightLabel","legendSettings.icon","legendSettings.iconHeight","legendSettings.iconWidth","legendSettings.height","legendSettings.width","legendSettings.showLabels","labelSettings.showLabels","labelSettings.labelPath","labelSettings.enableSmartLabel","labelSettings.labelLength","labelSettings.smartLabelSize","selectedMapShapes","selectionMode","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.bubbleOpacity","bubbleSettings.showTooltip","bubbleSettings.tooltipTemplate","bubbleSettings.colorValuePath","bubbleSettings.maxValue","bubbleSettings.color","enableAnimation","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient","shapeSettings.colorPalette","shapeSettings.customPalette","key",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","gradientColors"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"},{tag:"subLayers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","legendSettings.leftLabel","legendSettings.rightLabel","legendSettings.icon","legendSettings.iconHeight","legendSettings.iconWidth","legendSettings.height","legendSettings.width","legendSettings.showLabels","labelSettings.showLabels","labelSettings.labelPath","labelSettings.enableSmartLabel","labelSettings.labelLength","labelSettings.smartLabelSize","selectedMapShapes","selectionMode","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.bubbleOpacity","bubbleSettings.showTooltip","bubbleSettings.tooltipTemplate","bubbleSettings.colorValuePath","bubbleSettings.maxValue","bubbleSettings.color","enableAnimation","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient","shapeSettings.colorPalette","shapeSettings.customPalette","key",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","highlightcolor"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"}],],singular:"subLayer"}]],singular:"layer"}],dataTypes:{layers:"array"},_destroy:function(){this._unWireEvents();this._isSVG?t(this.element).removeClass("e-datavisualization-map e-js").find("#svgDocument").remove():t(this.element).removeClass("e-datavisualization-map e-js").find("#rootGroup").remove();t(this.element).removeClass("e-map-navigation").find("#ejNavigation").remove();t(this.element).find(".e-TemplateDiv").remove()},_setModel:function(n){var i,r;for(i in n)switch(i){case"zoomSettings":this.model.zoomSettings.enableZoom&&(this._zoomLevel(this.model.zoomSettings.level),this._zoomFactor(this.model.zoomSettings.factor),this._maxZoom(this.model.zoomSettings.maxValue),this._minZoom(this.model.zoomSettings.minValue),this.zoom(this._zoomLevel()));break;case"zoomLevel":this.model.zoomSettings.level=this._zoomLevel();this.zoom(this._zoomLevel());break;case"zoomFactor":this.model.zoomSettings.factor=this._zoomFactor();this.zoom(this._zoomLevel());break;case"minZoom":this.model.zoomSettings.minValue=this._minZoom();this.zoom(this._zoomLevel());break;case"maxZoom":this.model.zoomSettings.maxValue=this._maxZoom();this.zoom(this._zoomLevel());break;case"baseMapIndex":this.baseMapIndex(n[i]);r=this;this._groupSize=null;this.enableAnimation()?(this.model.enableLayerChangeAnimation=!0,t(this._mapContainer).animate({opacity:0},500,function(){r.refresh(!0)})):this.refresh(!0);break;case"background":baseLayer.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background)}},_layers:function(n,t){t=="shapeSettings.fill"||t=="shapeSettings.strokeThickness"||t=="shapeSettings.selectionColor"||t=="shapeSettings.highlightColor"?this.clearShapeSelection():t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh(!0)},_layers_markers:function(){this.refreshMarkers()},_layers_subLayers:function(n,t){t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh(!0)},_init:function(){var n=this;this._navigationStyle=null;this.navigationControlData=null;this._initPrivateProperties();this._setZoomProperties();this._localizedLabels=this._getLocalizedLabels();t.each(this.model.layers,function(t){n._layerInitialize(t)});this._mapContainer=this.element;t(this._mapContainer).css({overflow:"hidden"});document.documentMode==8&&t(this._mapContainer).css({overflow:"hidden",position:"relative"});this._wireEvents();this.refresh();this._trigger("onRenderComplete");this._isRendered=!0;this._isSVG&&this.model.enablePan&&t(this._svgDocument).pinchZoom(this._rootgroup,this)},_setZoomProperties:function(){typeof this.model.zoomSettings.factor!="function"&&(this._zoomFactor(this.model.zoomSettings.factor),this._zoomLevel(this.model.zoomSettings.level),this._minZoom(this.model.zoomSettings.minValue),this._maxZoom(this.model.zoomSettings.maxValue))},_getLocalizedLabels:function(){return i.getLocalizedConstants(this.sfType,this.model.locale)},_layerInitialize:function(n){var i=this;this.model.layers[n]!=null?t.each(this.model.layers,function(n,r){r=i._checkArrayObject(r,n);var f=new u;t.extend(f,r);t.extend(r,f);t.each(r.subLayers,function(n,r){r=i._checkArrayObject(r,n);var f=new u;t.extend(f,r);t.extend(r,f)})}):this.layers[0]=new u},_checkArrayObject:function(n,i){var f=["background","zoomSettings","bubbleSettings","minValue","maxValue","factor","level","enableZoomOnSelection","enableZoom","centerPosition","enableResize","isResponsive","enableAnimation","draggingOnSelection","navigationControl","enableNavigation","orientation","absolutePosition","dockPosition","enablePan","baseMapIndex","enableSelection","selectionMode","enableMouseHover","shapeData","dataSource","showTooltip","legendSettings","showLegend","showLabels","position","height","width","type","mode","dockOnMap","dockPosition","labelSettings","labelPath","enableSmartLabel","smartLabelSize","layerType","showMapItems","shapeSettings","highlightColor","highlightBorderWidth","selectionColor","fill","strokeThickness","stroke","highlightStroke","selectionStroke","selectionStrokeWidth","colorValuePath","valuePath","enableGradient","autoFill",""],r=this;return t.each(n,function(n,t){if(f.indexOf(n)>-1)if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new u;r._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),n},_loadIndividualDefaultValues:function(n,i,r){var u=null,f=this;return t.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),t.each(n,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),t.extend(u,n),t.extend(n,u),n},_refreshWithAnimation:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPositionWithAnimation(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPositionWithAnimation(this)},_resizeShape:function(){this.model.layers[this.baseMapIndex()]._resizeShapes(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._resizeShapes(this)},_refrshLayers:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPosition(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPosition(this)},_panTileMap:function(n,t,i){var u=Math.pow(2,this._zoomLevel())*256,r;this._tileTranslatePoint.x=n/2-u/2;this._tileTranslatePoint.y=t/2-u/2;r=this._convertTileLatLongtoPoint(i[0],i[1]);this._tileTranslatePoint.x-=r.x-n/2;this._tileTranslatePoint.y-=r.y-t/2},_generateTiles:function(n){var w=navigator.language||navigator.userLanguage,b,k,e,o,s,h,r,p,c,u,l,a,v;this.Tiles=[];b=k=Math.pow(2,n);var y=this.model.layers[this.baseMapIndex()],d=Math.min(k,(-this._tileTranslatePoint.y+this._height)/256+1),g=Math.min(b,(-this._tileTranslatePoint.x+this._width)/256+1),nt=-(this._tileTranslatePoint.x+256)/256,tt=-(this._tileTranslatePoint.y+256)/256;for(e=Math.round(nt);e<Math.round(g);e++)for(o=Math.round(tt);o<Math.round(d);o++)s=256*e+this._tileTranslatePoint.x,h=256*o+this._tileTranslatePoint.y,s>-256&&s<=this._width&&h>-256&&h<this._height&&e>=0&&o>=0&&(r=new f(e,o),r.left=s,r.top=h,r.src=y.layerType==i.datavisualization.Map.LayerType.Bing?this._getBingMap(r,y.key,y.bingMapType,w):this._urlTemplate.replace("level",this._zoomLevel()).replace("tileX",r.X).replace("tileY",r.Y),this.Tiles.push(r));for(p=t.extend(!0,[],this.Tiles),c=0;c<this.model.layers[this.baseMapIndex()].subLayers.length;c++)if(u=this.model.layers[this.baseMapIndex()].subLayers[c],u.layerType==i.datavisualization.Map.LayerType.OSM||u.layerType==i.datavisualization.Map.LayerType.Bing)for(l=0;l<p.length;l++)a=p[l],v=t.extend(!0,{},a),v.src=u.layerType==i.datavisualization.Map.LayerType.Bing?this._getBingMap(v,u.key,u.bingMapType,w):u.urlTemplate.replace("level",this._zoomLevel()).replace("tileX",a.X).replace("tileY",a.Y),this.Tiles.push(v);this._arrangeTiles()},_getBingMap:function(n,t,r,u){for(var f,s,h,e="",o=this._zoomLevel();o>0;o--)f=0,s=1<<o-1,(n.X&s)!=0&&f++,(n.Y&s)!=0&&(f+=2),e=e+""+f;return h=r==i.datavisualization.Map.BingMapType.Aerial?"A,G":r==i.datavisualization.Map.BingMapType.AerialWithLabel?"A,G,L":"G,VE,BX,L,LA","http://ak.dynamic.t2.tiles.virtualearth.net/comp/ch/"+e+"?mkt="+u+"&ur=IN&it="+h+"&shading=hill&og=45&n=z&Key="+t},_arrangeTiles:function(){var n=t.templates("<div><div style='position:absolute;left:{{:left}}px;top:{{:top}}px;height:{{:height}}px;width:{{:width}}px;'><img src={{:src}}><\/img><\/div><\/div>"),i=n.render(this.Tiles),r=this._mapContainer[0].children[0];this._tileDiv.html(i)},_generatePath:function(){var n=this.model.layers[this.baseMapIndex()],f="",u,e,o;for(this._polylineCount=0,this._pointscount=0,this._isSVG=window.SVGSVGElement?!0:!1,n.layerType==i.datavisualization.Map.LayerType.Geometry?n!=r&&n.shapeData!=null&&(n._isBaseLayer=!0,this._isTileMap=!1,this._scale=this._zoomLevel(),f=this._readShapeData(n)):(this._isTileMap=!0,this._scale=Math.pow(2,this._zoomLevel()-this._zoomFactor())),u=0;u<n.subLayers.length;u++)n.subLayers[u].layerType==i.datavisualization.Map.LayerType.Geometry&&n.subLayers[u].shapeData!=null&&(n.subLayers[u]._isBaseLayer=!1,f+=this._readShapeData(n.subLayers[u]));this._isSVG?(e='<div style="position:relative;" id="tileDiv"/><svg xmlns="http://www.w3.org/2000/svg" style= "overflow:hidden;z-index:0;float:left;left:0,top:0"id="svgDocument"> <g id="rootGroup">'+f+"<\/g><\/svg>",this._mapContainer.html(e),this._svgDocument=this.element.find("#svgDocument")[0],this._tileDiv=this.element.find("#tileDiv")):(document.createStyleSheet().addRule(".vml","behavior:url(#default#VML);display:inline-block"),document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),o='<div id="tileDiv"/><v:group id = "rootGroup" style="position:absolute; width:'+this._width+"px;height:"+this._height+'px;" coordorigin = "0 0" coordsize="'+this._width+" "+this._height+'">'+f+"<\/v:group>",this._mapContainer.html(o),this._tileDiv=this.element.find("#tileDiv"),this._bubblegroup=this._createGroup(!1,"bubbleGroup"),this._bubblegroup.style.position="absolute",this.element.append(this._bubblegroup));(n.layerType==i.datavisualization.Map.LayerType.OSM||n.layerType==i.datavisualization.Map.LayerType.Bing)&&(this._urlTemplate=n.urlTemplate,this.model.centerPosition!=null?this._panTileMap(this._width,this._height,this.model.centerPosition):this._panTileMap(this._width,this._height,[0,0]),this._generateTiles(this._zoomLevel()),this._isSVG&&t(this._svgDocument).css("position","relative"));this._isSVG&&t(this._mapContainer).css("position","relative");this._rootgroup=this.element.find("#rootGroup")[0];this._on(t(this.element),i.eventType.mouseDown,{map:this},this.dragDown);this._on(t(this.element),i.eventType.mouseMove,{map:this},this.dragMove);this._on(t(this.element),i.eventType.mouseUp,{map:this},this.dragUp)},isMultipolygon:function(n){return n.length>0&&n[0].length>0&&n[0][0].length>0&&n[0][0][0].length>0},calculateMultiPolygonBBox:function(n,t,i){for(var r=0;r<n.length;r++)t=this.calculatePolygonBBox(n[r],t,i||r>0);return!0},calculatePolygonBBox:function(n,t,i){for(var r,u,e=n.length,f=0;f<e;f++)if(r="",e>1?(r=n[f][0],r.length<=2&&(r=n[f])):r=n[f],r.length>2)for(u=0;u<r.length;u++)r[u][1]!=null&&r[u][0]!=null&&(i?(t.minLatitude=Math.min(t.minLatitude,r[u][1]),t.maxLatitude=Math.max(t.maxLatitude,r[u][1]),t.minLongitude=Math.min(t.minLongitude,r[u][0]),t.maxLongitude=Math.max(t.maxLongitude,r[u][0])):(t.minLatitude=t.maxLatitude=r[u][1],t.minLongitude=t.maxLongitude=r[u][0],i=!0));else r[u][1]!=null&&r[u][0]!=null&&(i?(t.minLatitude=Math.min(t.minLatitude,r[1]),t.maxLatitude=Math.max(t.maxLatitude,r[1]),t.minLongitude=Math.min(t.minLongitude,r[0]),t.maxLongitude=Math.max(t.maxLongitude,r[0])):(t.minLatitude=t.maxLatitude=r[1],t.minLongitude=t.maxLongitude=r[0],i=!0));return t},_calculateBBox:function(n,t,i){var u,f,e,o,v,c={minLatitude:0,maxLatitude:0,minLongitude:0,maxLongitude:0},a=!1,l,r,h,s;if(u=f=e=o=0,n!=null&&n.length>0)for(r=0;r<n.length;r++)l=n[r],v=l.geometry!=null?l.geometry.coordinates:l.coordinates,this.isMultipolygon(v)?this.calculateMultiPolygonBBox(v,c,r>0):this.calculatePolygonBBox(v,c,a);if(u=c.minLatitude,f=c.maxLatitude,e=c.minLongitude,o=c.maxLongitude,i!=null&&i.length>0)for(r=0;r<i.length;r++)l=i[r],subData=l.geometry.coordinates,a?(u=Math.min(u,subData[1]),f=Math.max(f,subData[1]),e=Math.min(e,subData[0]),o=Math.max(o,subData[0])):(u=f=subData[1],e=o=subData[0],a=!0);if(t!=null&&t.length>0)for(r=0;r<t.length;r++)for(h=t[r].geometry==null?t[r].coordinates:t[r].geometry.coordinates,s=0;s<h.length;s++)a?(u=Math.min(u,h[s][1]),f=Math.max(f,h[s][1]),e=Math.min(e,h[s][0]),o=Math.max(o,h[s][0])):(u=f=h[s][1],e=o=h[s][0],a=!0);return this._groupSize!=null||this._isMapCoordinates||(this._groupSize={minX:e,maxX:o,minY:u,maxY:f}),[[e,u],[o,f]]},_readShapeData:function(n){var u=this,t,r;if(n.shapeData!=null)if(typeof n.shapeData=="string")t=new i.DataManager(n.shapeData),r=i.Query().from(n),t.executeQuery(r).done(function(t){if(t.result!=null)return u._getPathCollection(t.result,n)});else return this._getPathCollection(n.shapeData,n)},_getFactor:function(){var n,t,i,r;if(this._mapBounds!=null){var u=this._convertTileLatLongtoPointForShapes(this._mapBounds[0][1],this._mapBounds[0][0],this._mapBounds),f=this._convertTileLatLongtoPointForShapes(this._mapBounds[1][1],this._mapBounds[1][0],this._mapBounds);r=i=1;n=f.y-u.y;t=f.x-u.x}else n=t=500;return i=n<this._height?parseFloat(Math.abs(this._height/n+"e+1").toString().split(".")[0]/10):this._height/n,r=t<this._width?parseFloat(Math.abs(this._width/t+"e+1").toString().split(".")[0]/10):this._width/t,Math.min(r,i)},_getPolyPath:function(n,t,i,r,u,f){var tt=0,it="",rt=n[0][0].length,d=n.length,b,a,o,l,s,v,e,y,p,c,h;if(d>1)for(b=n,a=0;a<b.length;a++)rt<b[a][0].length&&(rt=b[a][0].length,tt=a);for(o="",l=0;l<d;l++){if(s="",d>1?(s=n[l][0],s.length<=2&&(s=n[l])):s=n[l],v=[],e=[],s.length>2)for(y=0;y<s.length;y++)v.push({lat:parseFloat(s[y][1]),lng:parseFloat(s[y][0])});else v.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])});for(p=0;p<v.length-1||v.length==1&&p==0;p++){var k=v[p],g=k.lat,nt=k.lng,w=this._mapBounds;(this._isTileMap||nt>=w[0][0]&&nt<=w[1][0]&&g>=w[0][1]&&g<=w[1][1])&&(c=this._convertTileLatLongtoPointForShapes(g,nt,w,u),f.flag&&this._groupSize==null?(f.minX=f.maxX=c.x,f.minY=f.maxY=c.y,f.flag=!1):(f.minX=Math.min(f.minX,c.x),f.maxX=Math.max(f.maxX,c.x),f.minY=Math.min(f.minY,c.y),f.maxY=Math.max(f.maxY,c.y)),e.push({x:c.x,y:c.y,lat:k.lat,lng:k.lng}))}if(l==tt&&t._newBounds.push(this._findMidPointofPoylgon(e)),e.length>0)if(this._isSVG){for(o+="M"+e[0].x+","+e[0].y,h=1;h<e.length;h++)o+=","+e[h].x+","+e[h].y;o+="Z"}else{for(o+="m"+parseInt(e[0].x)+","+parseInt(e[0].y),o+=" l"+parseInt(e[0].x)+","+parseInt(e[0].y),h=1;h<e.length;h++)o+=","+parseInt(e[h].x)+","+parseInt(e[h].y);o+=" e"}}return o!=""?it+=this._isSVG?'<path class="e-mapShape" stroke='+t.shapeSettings.stroke+" stroke-width="+t.shapeSettings.strokeThickness/this._scale+" fill= "+t.shapeSettings.fill+' d="'+o+'" stroke-linejoin= round stroke-linecap= square><\/path>':'<v:shape style="width:'+this._width+"px;height:"+this._height+'px;" coordsize="'+this._width+" "+this._height+'" coordorigin="0 0" strokecolor='+t.shapeSettings.stroke+" stroke-width="+t.shapeSettings.strokeThickness/this._scale+'px" fillcolor= '+t.shapeSettings.fill+' path="'+o+'"><\/v:shape>':(i.splice(r,1),r--),it},_getMultiPolygonPath:function(n,t,i,r,u){for(var s,o,f,e=0;e<n.length;e++)for(f=n[e],s=f.geometry!=null?f.geometry.coordinates:f.coordinates,o=0;o<s.length;o++)i+=this._getPolyPath(s[o],t,n,e,r,u);return i},_getPolygonPath:function(n,t,i,r,u){for(var f=0;f<n.length;f++){var e=n[f],o=e.geometry!=null?e.geometry.coordinates:e.coordinates;i+=this._getPolyPath(o,t,n,f,r,u)}return i},_getPathCollection:function(n,r){var tt="",k="",d="",ft,et,ot,e,o,s,h,p,st,bt,n,w,kt,b,f,it,ht,ct,v,u,rt,ut,nt,g,l,lt;if(n.features!=null?(d=new i.DataManager(n.features),k="geometry.type",r._isBaseLayer&&(this._mapBounds=n.bbox)):n.geometries!=null&&(d=new i.DataManager(n.geometries),k="type",r._isBaseLayer&&n.bbox!=null&&(this._mapBounds=[[n.bbox[0],n.bbox[1]],[n.bbox[2],n.bbox[3]]])),n.geometries!=null||n.features!=null){var at=i.Query().from(r).where(k,i.FilterOperators.equal,"LineString"),vt=i.Query().from(r).where(k,i.FilterOperators.equal,"Polygon"),yt=i.Query().from(r).where(k,i.FilterOperators.equal,"MultiPolygon"),a=d.executeLocal(at),c=d.executeLocal(vt),pt=i.Query().from(r).where(k,i.FilterOperators.equal,"Point"),y=d.executeLocal(pt),wt=d.executeLocal(yt);if(this._polylineCount=this._polylineCount+a.length,this._pointscount=this._pointscount+y.length,t.merge(c,wt),r._isBaseLayer&&r.geometryType==i.datavisualization.Map.GeometryType.Normal&&(this._isMapCoordinates=!1),this._mapBounds==null&&r._isBaseLayer?this._mapBounds=this._calculateBBox(c,a,y):this._mapBounds==null&&(this._mapBounds=[[-180,-85],[180,85]]),g=this._getFactor(),r._newBounds=[],ot="",this._groupSize!=null&&(e=this._groupSize.minX,o=this._groupSize.maxX,s=this._groupSize.minY,h=this._groupSize.maxY),p=!0,y.length>0)for(u=0;u<y.length;u++)st=y[u],bt="",subData=st.geometry.coordinates,n=[],w=[],n.push({lat:parseFloat(subData[1]),lng:parseFloat(subData[0])}),kt=0,b=n[0],ft=b.lat,et=b.lng,f=this._convertTileLatLongtoPointForShapes(ft,et,this._mapBounds,g),it=this._mapBounds,et>=it[0][0]&&et<=it[1][0]&&ft>=it[0][1]&&ft<=it[1][1]?(p&&this._groupSize==null?(e=o=f.x,s=h=f.y,p=!1):(e=Math.min(e,f.x),o=Math.max(o,f.x),s=Math.min(s,f.y),h=Math.max(h,f.y)),this._isSVG?w.push({x:f.x,y:f.y,lat:b.lat,lng:b.lng}):w.push({x:f.x-5/this._scale,y:f.y-5/this._scale,lat:b.lat,lng:b.lng}),this._isSVG?ot+='<circle cx="'+w[0].x+'" cy="'+w[0].y+'" r="'+r.shapeSettings.radius/this._scale+'" stroke="'+r.shapeSettings.stroke+'" stroke-width="'+r.shapeSettings.strokeThickness+'" fill="'+r.shapeSettings.fill+'" />':(ht='<v:oval display="block" fill="'+r.shapeSettings.fill+'" style="position:absolute;top: '+w[0].y+"px;left:"+w[0].x+"px;width:"+10/this._scale+"px;height:"+10/this._scale+"px;stroke-width:"+r.shapeSettings.strokeThickness+'px;"><\/v:oval>',ot+=ht)):(y.splice(u,1),u--);if(c.length>0&&(ct=c[0].geometry!=null?c[0].geometry.coordinates:c[0].coordinates,v={flag:p,minX:e,minY:s,maxX:o,maxY:h},tt+=this.isMultipolygon(ct)?this._getMultiPolygonPath(c,r,tt,g,v):this._getPolygonPath(c,r,tt,g,v),e=v.minX,o=v.maxX,s=v.minY,h=v.maxY,p=v.flag),a.length>0)for(u=0;u<a.length;u++){for(rt=a[u].geometry==null?a[u].coordinates:a[u].geometry.coordinates,ut="",nt=0;nt<rt.length;nt++)g=this._getFactor(),l=this._convertTileLatLongtoPointForShapes(rt[nt][1],rt[nt][0],this._mapBounds,g),p&&this._groupSize==null?(e=o=l.x,s=h=l.y,p=!1):(e=Math.min(e,l.x),o=Math.max(o,l.x),s=Math.min(s,l.y),h=Math.max(h,l.y)),ut+=l.x+","+l.y,nt!=rt.length-1&&(ut+=",");tt+=this._isSVG?"<polyline stroke="+r.shapeSettings.stroke+" stroke-width="+r.shapeSettings.strokeThickness/this._scale+' fill="transparent" stroke-width="1" points="'+ut+'" ><\/polyline>':'<v:polyline coordsize="'+this._width+","+this._height+'" coordorigin="0 0" strokecolor='+r.shapeSettings.stroke+" strokeweight="+r.shapeSettings.strokeThickness/this._scale+'px" fillcolor='+r.shapeSettings.fill+' points="'+ut+'"/>'}return this._isMapCoordinates&&(this._groupSize={minX:e,maxX:o,minY:s,maxY:h}),lt=[].concat(c,a),r._polygonData=t.merge(lt,y),tt+ot}return r._polygonData=[],null},_createGroup:function(n,t){var i;return i=document.createElement("<v:group class="+t+">"),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,n&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_generatePaletteColorsForShape:function(n,t,i,r){r!=null&&(t.shapeSettings.highlightColor=r.highlightColor,t.shapeSettings.highlightStroke=r.highlightStroke,t.shapeSettings.selectionColor=r.SelectionColor,t.shapeSettings.selectionStroke=r.SelectionStroke);this._isSVG?n.setAttribute("fill",i[t._prevPaletteIndex]):n.fillcolor=i[t._prevPaletteIndex];t._prevPaletteIndex=t._prevPaletteIndex+1;t._prevPaletteIndex>i.length-1&&(t._prevPaletteIndex=0)},_renderLayers:function(n,u,f){var d,b,ut,dt,g,p,at,nt,vt,o,a,w,yt,pt,k,ri,wt,h,v,st,ht,ui,fi,c,bt,ei,ct,tt,kt,l,lt,y;n._prevPaletteIndex=0;n._initializeLocalValues();n.selectedItems==null&&(n.selectedItems=[]);var si=this._rootgroup,oi=this._svgDocument,s=this,e=n;e.legendSettings!=null&&e.shapeSettings.colorMappings!=null&&(e.legendSettings.type==r||e.legendSettings.type==i.datavisualization.Map.LegendType.Layers)&&e._generateLegends(this);e.legendSettings!=null&&e.bubbleSettings.colorMappings!=null&&e.legendSettings.type==i.datavisualization.Map.LegendType.Bubbles&&e._generateBubbleLegends(this);e.shapeSettings.colorMappings!=null&&e.shapeSettings.colorMappings.rangeColorMapping!=null&&e.shapeSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);e.bubbleSettings.colorMappings!=null&&e.bubbleSettings.colorMappings.rangeColorMapping!=null&&e.bubbleSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);var it=0,rt=0;if(e.dataSource!=null&&e.bubbleSettings!=null)for(e.bubbleSettings.colorValuePath==null&&(e.bubbleSettings.colorValuePath=e.bubbleSettings.valuePath),d=0;d<e.dataSource.length;d++)b=parseFloat(this._reflection(e.dataSource[d],e.bubbleSettings.valuePath)),d!=0?b>rt?rt=b:b<it&&(it=b):it=rt=b;if(this._generateTooltipForLayers(e),e.shapeData!=null){if(ut=[],e.dataSource!=null)for(v=0;v<e.dataSource.length;v++)dt=e.dataSource[v],g=s._reflection(dt,e.shapeDataPath),g!=null&&(g=g.toLowerCase()),ut.push(g);var gt=i.browserInfo(),hi=this.model,ft=gt.isMSPointerEnabled,et=gt.pointerEnabled,ot=ft?et?"pointerup":"MSPointerUp":"touchend mouseup",ni=ft?et?"pointermove":"MSPointerMove":"touchmove mousemove",ti=ft?et?"pointerdown":"MSPointerDown":"touchstart mousedown",ii=ft?et?"pointerleave":"MSPointerOut":"touchend mouseleave";for(p=0;p<e._polygonData.length;p++){if(at=e._polygonData[p].properties,nt=s._reflection(at,e.shapePropertyPath),nt!=null&&typeof nt=="string"&&(vt=nt.toLowerCase()),o=this._rootgroup.childNodes[p+u],f._isSVG?o.setAttribute("fill",e.shapeSettings.fill):(o.fillcolor=e.shapeSettings.fill,o.strokecolor=e.shapeSettings.stroke),h={},a=e._newBounds[p],e.shapeSettings.autoFill)switch(e.shapeSettings.colorPalette){case i.datavisualization.Map.ColorPalette.Palette1:this._generatePaletteColorsForShape(o,e,e.colorPalettes.Palette1,e._colorPaletteSettings.Palette1);break;case i.datavisualization.Map.ColorPalette.Palette2:this._generatePaletteColorsForShape(o,e,e.colorPalettes.Palette2,e._colorPaletteSettings.Palette2);break;case i.datavisualization.Map.ColorPalette.Palette3:this._generatePaletteColorsForShape(o,e,e.colorPalettes.Palette3,e._colorPaletteSettings.Palette3);break;case i.datavisualization.Map.ColorPalette.CustomPalette:this._generatePaletteColorsForShape(o,e,e.shapeSettings.customPalette,null)}if(ut.indexOf(vt)!=-1&&(w=e.dataSource[ut.indexOf(vt)],yt=nt,w!=null)){if(o!=null&&(pt=yt),n._bounds.push(a),e.showMapItems){if(k=t("<div class='e-mapItems' style='display:block;position:absolute;pointer-events: none;'><\/div>"),k[0].className=yt,s._templateDiv.append(k),t(k).css({left:a.x,top:a.y}),wt=this.model.locale,h=t.extend({},w),wt&&this.model.enableGroupSeparator)for(v in h)h[v]=isNaN(parseFloat(h[v]))?h[v]:parseFloat(h[v]).toLocaleString(wt);ri=e.mapItemsTemplate==null?t(" <div><label>{{:"+e.shapeSettings.valuePath+"}}<\/label><\/div>").render(h):t("#"+e.mapItemsTemplate).render(h);t(k).html(ri);n._mapItems.push(k)}e.shapeSettings.colorMappings!=null?(e.shapeSettings.colorValuePath==null&&(e.shapeSettings.colorValuePath=e.shapeSettings.valuePath),st=s._reflection(w,e.shapeSettings.colorValuePath),st==null||e.shapeSettings.autoFill||((e.legendSettings!=null&&e.legendSettings.mode==i.datavisualization.Map.LegendMode.Interactive||e.shapeSettings.enableGradient)&&e.shapeSettings.colorMappings.rangeColorMapping!=null?(h.legendrect=e._updateLegendRange(st,e,o),ht=e.shapeSettings.fill,h.legendrect!=r&&(ht=h.legendrect.color),f._isSVG?o.setAttribute("fill",ht):o.fillcolor=ht):e._fillColors(st,e.shapeSettings.colorMappings,o,f))):e.shapeSettings.autoFill||(f._isSVG?o.setAttribute("fill",e.shapeSettings.fill):(o.fillcolor=e.shapeSettings.fill,o.strokecolor=e.shapeSettings.stroke));e.bubbleSettings.showBubble&&e.bubbleSettings!=null&&e.bubbleSettings.valuePath!=null&&(f._isSVG?c=document.createElementNS(s._svgns,"circle"):(ui="bubble_"+pt,fi='<v:oval class="e-mapBubble" id='+ui+' display="block" style="position:absolute;top: 0px;left:0px;width:100px;height:100px;stroke-width:0px;"><v:fill opacity="0.9"/><\/v:oval>',this._bubblegroup.innerHTML=this._bubblegroup.innerHTML+fi,c=document.getElementById("bubble_"+pt)),bt=s._reflection(w,e.bubbleSettings.valuePath),ei=s._reflection(w,e.bubbleSettings.colorValuePath),e.bubbleSettings.colorMappings!=null?e._fillColors(ei,e.bubbleSettings.colorMappings,c,f):f._isSVG?c.setAttribute("fill",e.bubbleSettings.color):(c.strokecolor=e.bubbleSettings.color,c.fillcolor=e.bubbleSettings.color),ct=s._getRatioOfBubble(e.bubbleSettings.minValue,e.bubbleSettings.maxValue,bt,it,rt),f._isSVG?(t(c).attr({cx:a.x,cy:a.y,"fill-opacity":e.bubbleSettings.bubbleOpacity,r:ct,"class":"e-mapBubble"}),s.enableAnimation()&&!this._isTileMap&&t(c).css("display","none")):t(c).css({height:2*ct+"px",width:2*ct+"px"}),e.bubbleSettings.showTooltip==!0?(tt=t("<div class='e-bubbleToolTip' style='position:absolute;display:none;z-index:9999'/>"),kt=null,e.bubbleSettings.tooltipTemplate!=null?kt=e.bubbleSettings.tooltipTemplate:t(tt).append('<div class="e-bubbleToolTip" style="margin-left:10px;margin-top:-25px;"><div class="e-defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">'+bt+"<\/label><\/p><\/div><\/div>"),t(c).mouseenter({htmlobj:tt,templateID:kt,itemsrc:w},s._bubbleEnterFunction),t(c).mousemove({htmlobj:tt},s._bubbleOverFunction),t(c).mouseleave({htmlobj:tt},s._bubbleleaveFunction)):t(c).css("pointer-events","none"),f._isSVG?(oi.appendChild(c),n._bubbles.push(c)):n._bubbles.push(c));h.data=w}n.labelSettings!=null&&n.labelSettings.showLabels&&n.labelSettings.labelPath!=null&&e.geometryType!=i.datavisualization.Map.GeometryType.Normal&&(lt=s._reflection(at,n.labelSettings.labelPath),lt!=null&&(a==null,l=t("<div class='e-labelStyle'><\/div>"),t(l).css({"pointer-events":"none",position:"absolute"}),l[0].innerHTML=lt,this._templateDiv.append(l),n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="top"?t(this._templateDiv).css({"margin-top":n.legendSettings.height}):n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="left"&&t(this._templateDiv).css({"margin-left":n.legendSettings.width}),t(l).css({left:a.x,top:a.y}),s._off(t(l),i.eventType.mouseUp,s._polyClickFunction),s._on(t(l),i.eventType.mouseUp,{Param1:null,Param2:n,Param3:o},s._polyClickFunction),s._off(t(l),i.eventType.mouseLeave,s._polyLeaveFunction),s._on(t(l),i.eventType.mouseLeave,{Param1:n,Param2:h,map:this},s._polyLeaveFunction),l[0].setAttribute("data-nodeValue",o.getAttribute("fill")),n._labelCollection.push(l),n._labelBounds.push(a),n._labelData.push(lt)));h.shapeIndex=p;h.shape=o;h.shapeData=n._polygonData[p];s._off(t(l),i.eventType.mouseMove,s._polyMoveFunction);s._on(t(l),i.eventType.mouseMove,{Param1:e,Param2:h},s._polyMoveFunction);o!=null&&(y=null,f._isSVG?(y=o.getAttribute("fill"),y=="undefined"&&(y=n.shapeSettings.fill),o.setAttribute("data-nodeValue",y)):(y=o.fillcolor.value,y=="undefined"&&(y=n.shapeSettings.fill),o.style.behavior=y));s.model.zoomSettings.enableZoomOnSelection&&t(o).hover(function(){t(this).css("cursor","pointer")},function(){t(this).css("cursor","auto")});n._mapShapes.push(h);this._off(t(o),"mouseenter touchmove",s._polyEnterFunction);this._on(t(o),"mouseenter touchmove",{Param1:e,Param2:h,map:s},s._polyEnterFunction);this._off(t(o),ti,s._polyMouseDown);this._on(t(o),ti,{Param1:h,Param2:e},s._polyMouseDown);this._off(t(o),ot,s._polyClickFunction);this._on(t(o),ot,{Param1:h,Param2:e,Param3:o},s._polyClickFunction);this._off(t(o),ni,s._polyMoveFunction);this._on(t(o),ni,{Param1:e,Param2:h,Param3:o},s._polyMoveFunction);this._off(t(o),ii,s._polyLeaveFunction);this._on(t(o),ii,{Param1:e,Param2:h,map:this},s._polyLeaveFunction);this._off(t(o),ot,s._polyUpFunction);this._on(t(o),ot,{Param1:h,Param2:e,Param3:o},s._polyUpFunction)}}e._isBaseLayer&&e.geometryType==i.datavisualization.Map.GeometryType.Normal&&e.labelSettings.showLabels&&(e._generateLabels(this),e._labelSizeCalculation(this),this._applyTransform(this._scale,this._translatePoint))},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},validateBubblePosition:function(n,t,i){var e=[],o=[],f,u,r;if(n==null&&(n=[],n.push(t)),!this.isPointInPolygon(n,t,!0)){for(f=0,r=0;r<n.length;r++)u={x:(n[r].x+this._translatePoint.x)*this._scale,y:(n[r].y+this._translatePoint.y)*this._scale},(u.y<t.y&&f.y>=t.y||f.y<t.y&&u.y>=t.y)&&(u.x<t.x?e.push(u.x):o.push(u.x)),f=u;if(!e.length>0||!o.length>0){if(e.length>0){for(r=t.x+i;!this.isPointInPolygon(n,{x:r-2,y:t.y},!0);)r=r-2;t.x=parseFloat(r-2-i)}if(o.length>0){for(r=t.x-i;!this.isPointInPolygon(n,{x:r+2,y:t.y},!0);)r=r+2;t.x=parseFloat(r+2+i)}}}return t},isPointInPolygon:function(n,t,i){for(var r,f,o=!1,e=0,u=0;u<n.length;u++){r={x:n[u].x,y:n[u].y};f={x:n[e].x,y:n[e].y};i&&(r={x:(n[u].x+this._translatePoint.x)*this._scale,y:(n[u].y+this._translatePoint.y)*this._scale},f={x:(n[e].x+this._translatePoint.x)*this._scale,y:(n[e].y+this._translatePoint.y)*this._scale});var s=t.y-r.y,h=f.y-r.y,c=f.x-r.x;(r.y<t.y&&f.y>=t.y||f.y<t.y&&r.y>=t.y)&&r.x+s/h*c<t.x&&(o=!0);e=u}return o},dragDown:function(n){var r=n.data.map,t=r.model.layers[0],i=this._mapContainer,u;if(n.type=="mousedown"?(r._startPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop},r._stopPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop}):n.type=="touchstart"?(r._startPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop}):n.type=="MSPointerDown"&&(r._startPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop}),r.mouseClickable=!0,r.model.draggingOnSelection&&t._prevSelectedShapes.length>0){for(u=0;u<t._prevSelectedShapes.length;u++)t._prevSelectedShapes[u].setAttribute("class","e-mapShape"),this._isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("data-nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t.fillcolor=t._prevSelectedShapes[u].getAttribute("data-nodeValue"),t.strokecolor=t.shapeSettings.stroke,t.strokeweight=t.shapeSettings.strokeThickness/this._scale);t._prevSelectedShapes=[]}},dragMove:function(n){var i=n.data.map,o=i.model.layers[0],f,e,r=this._mapContainer,u;i.model.draggingOnSelection&&i.mouseClickable&&(i.ispanning=!1,n.type=="mousemove"?i._stopPoint={x:n.pageX-r[0].offsetLeft,y:n.pageY-r[0].offsetTop}:n.type=="touchmove"?i._stopPoint={x:n.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:n.type=="MSPointerMove"&&(i._stopPoint={x:n.originalEvent.pageX-r[0].offsetLeft,y:n.originalEvent.pageY-r[0].offsetTop}),t(".e-mapDragSelection").remove(),u=t('<div class = "e-mapDragSelection"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),t(u).css({top:Math.min(i._startPoint.y,i._stopPoint.y),left:Math.min(i._startPoint.x,i._stopPoint.x),width:f,height:e,position:"absolute","z-index":100}),t(u).appendTo("#maps"))},dragUp:function(n){var i=n.data.map,s=Math.abs(i._stopPoint.x-i._startPoint.x),h=Math.abs(i._stopPoint.y-i._startPoint.y),e=i.model.layers[0],o=this._mapContainer,u,r,f;if(i.model.draggingOnSelection){for(t(".e-mapDragSelection").remove(),t(".e-mapDragSelection").css({display:"none"}),i.mouseClickable=!1,u=0;u<i.model.layers[0]._mapShapes.length;u++)r=i.model.layers[0]._mapShapes[u].shape,f=r.getBoundingClientRect(),f.left-o[0].offsetLeft+f.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+s<f.left-o[0].offsetLeft||f.top-o[0].offsetTop+f.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+h<f.top-o[0].offsetTop||i.model.layers[0]._contains(e._prevSelectedShapes,r)||e._prevSelectedShapes.push(r);for(u=0;u<e._prevSelectedShapes.length;u++)r=e._prevSelectedShapes[u],f=r.getBoundingClientRect(),r.setAttribute("class","e-mapSelectedShape mapShape"),this._isSVG&&(r.setAttribute("fill",e.shapeSettings.selectionColor),r.setAttribute("stroke",e.shapeSettings.selectionStroke),r.setAttribute("stroke-width",e.shapeSettings.selectionStrokeWidth/i._scale))}},isIntersectBubbles:function(){for(var r,n,i,t=[],u=0;u<this.model.layers.length;u++)for(r=this.model.layers[u],Array.prototype.push.apply(t,r._bubbleCollection),n=0;n<r.subLayers.length;n++)Array.prototype.push.apply(t,r.subLayers[n]._bubbleCollection);for(n=0;n<t.length;n++){var f=t[n].getAttribute("cx"),e=t[n].getAttribute("cy"),h=t[n].getAttribute("r");for(i=n+1;i<t.length;i++){var o=t[i].getAttribute("cx"),s=t[i].getAttribute("cy"),c=t[i].getAttribute("r"),l=Math.sqrt((f-o)*(f-o)+(e-s)*(e-s)),a=parseFloat(h)+parseFloat(c);if(l<=a)return!0}}return!1},_zooming:function(n,t){var i=this._getCurrentPoint(t);n>=120?this._zoomingIn(i.x,i.y,t):this._zoomingOut(i.x,i.y,t)},_zoomingIn:function(n,t,i){var r=this,f,e,u;r.model.zoomSettings.enableZoom&&r._zoomLevel()>=r._minZoom()&&r._zoomLevel()<=r._maxZoom()&&(f=r._scale,e={x:n,y:t},r._prevScale=f,this._isTileMap?(this._tileZoom(r._zoomLevel()-r._zoomFactor(),r._zoomLevel(),e),u=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor()),this._generateTiles(this._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,u))/Math.pow(2,u),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,u))/Math.pow(2,u),r._scale=Math.pow(2,u)):(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale+r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale+r._zoomFactor()))/(r._height/t),r._scale=f+r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor())),r._trigger("zoomedIn",{originalEvent:i,zoomLevel:r._zoomLevel()}),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue())},_zoomingOut:function(n,t,i){var r=this,u,f,e;r.model.zoomSettings.enableZoom&&(r._zoomLevel()>this._minZoom()?(u=r._scale,f={x:n,y:t},r._prevScale=u,r._isTileMap?(r._tileZoom(r._zoomLevel()+r._zoomFactor(),r._zoomLevel(),f),e=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._generateTiles(r._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._scale=Math.pow(2,r._zoomLevel()-r._zoomFactor())):r._scale>1&&(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale-r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale-r._zoomFactor()))/(r._height/t),r._scale=r._scale-r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._scale=r._zoomLevel()),r._zoomLevel()<r._minZoom()&&(r.model.zoomSettings.level=r._minZoom(),r._zoomLevel(r._minZoom()),r.zoom(r._zoomLevel())),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue()):r.zoom(r._minZoom(),!1),r._trigger("zoomedOut",{originalEvent:i,zoomLevel:r._zoomLevel()}))},_getRatioOfBubble:function(n,t,i,r,u){var e=100/(u-r)*(i-r),f=(parseFloat(t)-parseFloat(n))/100*e+parseFloat(n);return u==r&&(f=(parseFloat(t)-parseFloat(n))/100+parseFloat(n)),f},_reflection:function(n,i){var u=n,f,e,o;if(i!=null&&n!=null){for(f=i.split("."),e=0,f.push(i);e<f.length;e++)n!=r&&u!=null&&(o=u.hasOwnProperty(f[e]),o&&t.each(u,function(n,t){if(n==f[e])return u=t,!1}));return u}return null},clearShapeSelection:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._clearShapeWidth(this._scale,this),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._clearShapeWidth(this._scale,this)},shapeSelectionOnResize:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._shapeSelection(),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._shapeSelection()},refreshMarkers:function(){for(var t,i=document.getElementsByClassName("e-mapMarker"),n=i.length-1;n>=0;n--)i[n].parentNode.removeChild(i[n]);for(n=this.baseMapIndex(),this.model.layers[n]._generateMarkerForLayers(this),t=0;t<this.model.layers[n].subLayers.length;t++)this.model.layers[n].subLayers[t]._generateMarkerForLayers(this);this._refrshLayers()},_generateTooltipForLayers:function(n){var i,r,u;n.showTooltip&&(i=document.documentMode==8?document.querySelectorAll("e-shapeToolTip"):document.getElementsByClassName("e-shapeToolTip"),i!=null&&i.length==0?(r=t("<div class='e-shapeToolTip' style='display:none;position:absolute;z-index:1000;pointer-events:none;'><\/div>"),t(document.body).append(r),n._tooltipElement=r):n._tooltipElement=i[0],n.tooltipTemplate==null&&(u=n.shapeSettings.valuePath,u!=null&&(n.tooltipTemplate="defaultTooltip",this._mapContainer.append(t('<div id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="e-defaultToolTip"><p style="margin-top:-4px"><label style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">{{:#data["'+u+'"]}}<\/label><\/p><\/div><\/div><\/div>')))))},_orderByNameAscending:function(n,t){return n.Range==t.Range?0:n.Range>t.Range?1:-1},_resizingContainer:function(){this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-1):1;this._isTileMap?(this._translatePoint.x=(this._tileTranslatePoint.x-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor()),this._translatePoint.y=(this._tileTranslatePoint.y-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor())):(this._translatePoint.x=this._tileTranslatePoint.x/this._scale,this._translatePoint.y=this._tileTranslatePoint.y/this._scale);this._applyTransform(this._scale,this._translatePoint);this._zoomLevel()>1&&(this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-this._zoomFactor()):this._zoomLevel(),this._applyTransform(this._scale,this._translatePoint));this._baseScale=1;this._baseTranslatePoint={x:this._translatePoint.x*2,y:this._translatePoint.y*2}},_calculateMarginConditions:function(){var n=this._calculateMinMax();this._translatePoint.y>n.maxY?this._translatePoint.y=n.maxY:this._translatePoint.y<n.minY&&(this._translatePoint.y=n.minY);this._translatePoint.x>n.maxX?this._translatePoint.x=n.maxX:this._translatePoint.x<n.minX&&(this._translatePoint.x=n.minX)},_calculateMinMax:function(){var n=this._groupBorder,t,i,r,u;return this._containerHeight*this._scale<=this._height?(i=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y,u=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y):(i=-n.y+1,u=(this._height-this._containerHeight*this._scale)/this._scale-n.y-1),this._containerWidth*this._scale<=this._width?(t=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x,r=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x):(t=-n.x+1,r=(this._width-this._containerWidth*this._scale)/this._scale-n.x-1),{minX:r,maxX:t,minY:u,maxY:i}},_findMidPointofPoylgon:function(n){var y,p,r,t;if(n.length>0){var k=0,v=n.length,u=n[0],d=u.x,g=u.x,nt=u.y,tt=u.y,h,c,f,e,o=0,s=0,i=0;for(r=k;r<=v-1;r++)y=n[r],h=y.x,c=y.y,r==v-1?(f=u.x,e=u.y):(p=n[r+1],f=p.x,e=p.y),o=o+Math.abs(h*e-f*c),s=s+Math.abs((h+f)*(h*e-f*c)),i=i+Math.abs((c+e)*(h*e-f*c));o=.5*o;s=1/(4*o)*s;i=1/(4*o)*i;var w={x:0,y:0},l={x:0,y:0},b={x:0,y:0},a={x:0,y:0};for(r=k;r<=v-1;r++)t=n[r],t.x>s?t.y<i&&i-t.y<i-w.y?w={x:t.x,y:t.y}:t.y>i&&(l.y==0||t.y-i<l.y-i)&&(l={x:t.x,y:t.y}):t.y<i&&i-t.y<i-b.y?b={x:t.x,y:t.y}:t.y>i&&(a.y==0||t.y-i<a.y-i)&&(a={x:t.x,y:t.y});return{x:s,y:i,rightMin:w,rightMax:l,leftMin:b,leftMax:a,points:n}}},_convertPointToLatLong:function(n,t,i,r){var u,f,e,o,s;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,o=Math.min(n,0,u-1)/u-.5,s=.5-Math.min(t,0,u-1)/u,f=90-360*Math.atan(Math.exp(-s*2*Math.PI))/Math.PI,e=360*o,{x:f,y:e}},_convertTileLatLongtoPointForShapes:function(n,t,i,r){var u,s,f,h,e,o;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,s=(t+180)/360,f=Math.sin(n*Math.PI/180),f==-1&&(f=-.5),h=.5-Math.log((1+f)/(1-f))/(4*Math.PI),this._isMapCoordinates?(e=Math.min(Math.max(s*u+.5,0),u-1),o=Math.min(Math.max(h*u+.5,0),u-1)):r!=null?(e=Math.abs((t-this._mapBounds[0][0])*r),o=Math.abs((this._mapBounds[1][1]-n)*r)):(e=t,o=n),{x:e,y:o}},_convertTileLatLongtoPoint:function(n,t){var u=Math.pow(2,this._zoomLevel())*256,e=(t+180)/360,f=Math.sin(n*Math.PI/180),o=.5-Math.log((1+f)/(1-f))/(4*Math.PI),i,r;return this._isMapCoordinates?(i=e*u+.5+this._tileTranslatePoint.x,r=o*u+.5+this._tileTranslatePoint.y):factor!=null?(i=Math.abs((t-this._mapBounds[0][0])*factor),r=Math.abs((this._mapBounds[1][1]-n)*factor)):(i=t,r=n),{x:i,y:r}},_convertLatLongtoPointforMarker:function(n,t){var r=this._getFactor(),i=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,r);return{x:(i.x+this._translatePoint.x)*this._scale,y:(i.y+this._translatePoint.y)*this._scale}},_animate:function(n){function s(n,t){return n[0]==t[0]?null:(t[1]-n[1])/(t[0]-n[0])}function h(n,t){return t===null?n[0]:n[1]-t*n[0]}this._calculateMarginConditions();t(this._rootgroup).stop(!0,!1);this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1);var i=this,e={x:this._translatePoint.x,y:this._translatePoint.y},r=[this._prevPoint.x,this._prevPoint.y],u=[this._translatePoint.x,this._translatePoint.y];var f=s(r,u),c=h(r,f),l=u[0]-r[0],a=u[1]-r[1],v=this._scale-this._prevScale,o=this._scale;this._updateSliderValue();t(this._rootgroup).animate({count:10},{duration:n,step:function(n,t){var u=i._prevScale+n*(v/t.end),e=r[0]+n*(l/t.end)/(u/o),s;s=f==null?r[1]+n*(a/t.end):f*e+c;i._isSVG?i._rootgroup.setAttribute("transform","scale("+u+") translate("+e+", "+s+")"):(i._rootgroup.coordorigin=-e+","+-s,i._rootgroup.coordsize=i._width/u+","+i._height/u);i._translatePoint.x=e;i._translatePoint.y=s;i._scale=u;i._refrshLayers();i._resizeShape()},complete:function(){i._translatePoint.x=e.x;i._translatePoint.y=e.y;i._scale=o;this.count=0}