UNPKG

@syncfusion/reporting-javascript

Version:
10 lines 146 kB
/*! * filename: ej.map.min.js * version : 4.1.0.16 * Copyright Syncfusion Inc. 2001 - 2018. 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.reporting.common.min"],n):n()})(function(){(function(n,t,i){t.widget({ejMap:"ej.datavisualization.Map"},{validTags:["div"],_initPrivateProperties:function(){this._prevEnterElement="";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._legendDivWidth=0;this._legendDivHeight=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,enableRTL:!1,enableGroupSeparator:!1,background:"transparent",zoomSettings:{minValue:1,maxValue:100,factor:1,level:1,enableZoomOnSelection:!1,enableMouseWheelZoom:!0,enableZoom:!0,animationDuration:600},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:"",markerEnter:"",markerLeave:"",legendItemRendering:"",displayTextRendering:"",legendItemClick:"",bubbleRendering:"",shapeRendering:"",zoomedIn:"",onRenderComplete:"",refreshed:"",panned:"",zoomedOut:"",mouseover:"",mouseleave:"",click:"",doubleClick:"",rightClick:"",onLoad:"",layers:[]},observables:["baseMapIndex","enablePan","enableResize","enableAnimation","zoomLevel","minZoom","maxZoom","zoomFactor",],_zoomLevel:t.util.valueFunction("zoomLevel"),_minZoom:t.util.valueFunction("minZoom"),_maxZoom:t.util.valueFunction("maxZoom"),_zoomFactor:t.util.valueFunction("zoomFactor"),baseMapIndex:t.util.valueFunction("baseMapIndex"),enablePan:t.util.valueFunction("enablePan"),enableResize:t.util.valueFunction("enableResize"),enableAnimation:t.util.valueFunction("enableAnimation"),_tags:[{tag:"layers",attr:["legendSettings.showLegend","legendSettings.toggleVisibility","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.toggleVisibility","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?n(this.element).removeClass("e-datavisualization-map e-js").find("#svgDocument").remove():n(this.element).removeClass("e-datavisualization-map e-js").find("#rootGroup").remove();n(this.element).removeClass("e-map-navigation").find("#ejNavigation").remove();n(this.element).find(".e-TemplateDiv").remove()},_setModel:function(t){var i,r;for(i in t)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(t[i]);r=this;this._groupSize=null;this.enableAnimation()?(this.model.enableLayerChangeAnimation=!0,n(this._mapContainer).animate({opacity:0},500,function(){r.refresh(!0)})):this.refresh(!0);break;case"background":baseLayer.layerType=="geometry"&&n(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 t=this;this._navigationStyle=null;this.navigationControlData=null;this._initPrivateProperties();this._setZoomProperties();this._localizedLabels=this._getLocalizedLabels();n.each(this.model.layers,function(n){t._layerInitialize(n)});this._mapContainer=this.element;n(this._mapContainer).css({overflow:"hidden"});document.documentMode==8&&n(this._mapContainer).css({overflow:"hidden",position:"relative"});this._wireEvents();this.refresh();this._trigger("onRenderComplete");this._isRendered=!0;this._isSVG&&this.model.enablePan&&n(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 t.getLocalizedConstants(this.sfType,this.model.locale)},_layerInitialize:function(t){var i=this;this.model.layers[t]!=null?n.each(this.model.layers,function(t,u){u=i._checkArrayObject(u,t);var f=new r;n.extend(f,u);n.extend(u,f);n.each(u.subLayers,function(t,u){u=i._checkArrayObject(u,t);var f=new r;n.extend(f,u);n.extend(u,f)})}):this.layers[0]=new r},_checkArrayObject:function(t,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",""],u=this;return n.each(t,function(n,t){if(f.indexOf(n)>-1)if(t instanceof Array)u._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new r;u._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),t},_loadIndividualDefaultValues:function(t,i,r){var u=null,f=this;return n.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),n.each(t,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),n.extend(u,t),n.extend(t,u),t},_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(){var n=this.model.layers[this.baseMapIndex()],t,i;for((n._bubbles.length>0||n._mapItems.length>0||n._mapMarkers.length>0||n._labelCollection.length>0)&&n._setMapItemsPosition(this),i=0;i<n.subLayers.length;i++)t=n.subLayers[i],(t._bubbles.length>0||t._mapItems.length>0||t._mapMarkers.length>0||t._labelCollection.length>0)&&t._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(i,r,f,e){var d=navigator.language||navigator.userLanguage,g,nt,c,l,a,v,s,k,y,h,p,w,b;this.Tiles=[];g=nt=Math.pow(2,i);var o=this.model.layers[this.baseMapIndex()],tt=Math.min(nt,(-this._tileTranslatePoint.y+this._height)/256+1),it=Math.min(g,(-this._tileTranslatePoint.x+this._width)/256+1),rt=-(this._tileTranslatePoint.x+256)/256,ut=-(this._tileTranslatePoint.y+256)/256;for(c=Math.round(rt);c<Math.round(it);c++)for(l=Math.round(ut);l<Math.round(tt);l++)a=256*c+this._tileTranslatePoint.x,v=256*l+this._tileTranslatePoint.y,a>-256&&a<=this._width&&v>-256&&v<this._height&&c>=0&&l>=0&&(s=new u(c,l),s.left=a,s.top=v,o.layerType==t.datavisualization.Map.LayerType.Bing?(r&&o.imageUrl!=r&&(o.imageUrl=r),f&&o.subDomains!=f&&(o.subDomains=f),e&&o.maxZoom!=e&&(o.maxZoom=e),s.src=this._getBingMap(s,o.key,o.bingMapType,d,o.imageUrl,o.subDomains,o.maxZoom)):s.src=this._urlTemplate.replace("level",this._zoomLevel()).replace("tileX",s.X).replace("tileY",s.Y),this.Tiles.push(s));for(k=n.extend(!0,[],this.Tiles),y=0;y<this.model.layers[this.baseMapIndex()].subLayers.length;y++)if(h=this.model.layers[this.baseMapIndex()].subLayers[y],h.layerType==t.datavisualization.Map.LayerType.OSM||h.layerType==t.datavisualization.Map.LayerType.Bing)for(p=0;p<k.length;p++)w=k[p],b=n.extend(!0,{},w),b.src=h.layerType==t.datavisualization.Map.LayerType.Bing?this._getBingMap(b,h.key,h.bingMapType,d):h.urlTemplate.replace("level",this._zoomLevel()).replace("tileX",w.X).replace("tileY",w.Y),this.Tiles.push(b);this._arrangeTiles()},_getBingMap:function(n,t,i,r,u,f,e){for(var s,c,o="",h=Math.min(this._zoomLevel(),e);h>0;h--)s=0,c=1<<h-1,(n.X&c)!=0&&s++,(n.Y&c)!=0&&(s+=2),o=o+""+s;return u=u.replace("{quadkey}",o).replace("{subdomain}",f[Math.min(o.substr(o.length-1,1),f.length)]),u+("&mkt="+r+"&ur=IN&Key="+t)},_arrangeTiles:function(){var t=n.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=t.render(this.Tiles),r=this._mapContainer[0].children[0];this._tileDiv.html(i)},refreshLayer:function(i,r){var f,e,l,o,a,s,v,h,u,c;for(s=t.util.isNullOrUndefined(r),f=s?this.model.layers[i]:this.model.layers[i].subLayers[r],e=s?"_layerIndex"+i:"_sublayerIndex"+r,l=document.getElementById("rootGroup").childNodes.length,o=n("#"+this._id).find("path[id*='"+e+"']"),o.remove(),a=this._calculatePath(i,r,this.model.layers[i]),h=jQuery(a),f.bubbleSettings.showBubble&&(v=n("#"+this._id).find("circle[id*='"+e+"']"),v.remove()),u=0;u<h.length;u++)c=document.createElementNS("http://www.w3.org/2000/svg","path"),this._cloneAttributes(c,h[u]),n("#rootGroup").append(c);this._renderLayers(f,l-o.length,this);this._refrshLayers()},_cloneAttributes:function(n,t){for(var i,r=Array.prototype.slice.call(t.attributes);i=r.pop();)n.setAttribute(i.nodeName,i.nodeValue)},_calculatePath:function(n,r,u){var f=t.util.isNullOrUndefined(r)?u.subLayers:u.subLayers[r],n=t.util.isNullOrUndefined(n)?this.baseMapIndex():n,o="",e;if(this._isSVG=window.SVGSVGElement?!0:!1,t.util.isNullOrUndefined(r)&&(u.layerType.toLowerCase()==t.datavisualization.Map.LayerType.Geometry?u!=i&&u.shapeData!=null&&(u._isBaseLayer=!0,this._isTileMap=!1,this._scale=this._zoomLevel(),o=this._readShapeData(u,n,null)):(this._isTileMap=!0,this._scale=Math.pow(2,this._zoomLevel()-this._zoomFactor()))),t.util.isNullOrUndefined(f.length))f.layerType==t.datavisualization.Map.LayerType.Geometry&&f.shapeData!=null&&(f._isBaseLayer=!1,o+=this._readShapeData(f,n,r));else for(e=0;e<f.length;e++)f[e].layerType==t.datavisualization.Map.LayerType.Geometry&&f[e].shapeData!=null&&(f[e]._isBaseLayer=!1,o+=this._readShapeData(f[e],n,e));return o},_generatePath:function(i,r){var f=t.util.isNullOrUndefined(i)?this.model.layers[this.baseMapIndex()]:this.model.layers[i],e=this._calculatePath(i,r,f),o,s,u;this._isSVG?(o='<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">'+e+"<\/g><\/svg>",this._mapContainer.html(o),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"),s='<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+'">'+e+"<\/v:group>",this._mapContainer.html(s),this._tileDiv=this.element.find("#tileDiv"),this._bubblegroup=this._createGroup(!1,"bubbleGroup"),this._bubblegroup.style.position="absolute",this.element.append(this._bubblegroup));f.layerType==t.datavisualization.Map.LayerType.OSM?(this._urlTemplate=f.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&&n(this._svgDocument).css("position","relative")):f.layerType==t.datavisualization.Map.LayerType.Bing&&(u=this,n.ajax({url:"http://dev.virtualearth.net/REST/V1/Imagery/Metadata/"+f.bingMapType+"?output=json&include=ImageryProviders&key="+f.key,success:function(t){if(t&&t.statusCode==200){var i=t.resourceSets[0].resources[0],r=i.imageUrl,e=i.imageUrlSubdomains,o=i.zoomMax;u._urlTemplate=f.urlTemplate;u.model.centerPosition!=null?u._panTileMap(u._width,u._height,u.model.centerPosition):u._panTileMap(u._width,u._height,[0,0]);u._generateTiles(u._zoomLevel(),r,e,o);u._isSVG&&n(u._svgDocument).css("position","relative")}}}));this._isSVG&&n(this._mapContainer).css("position","relative");this._rootgroup=this.element.find("#rootGroup")[0];this._on(n(this.element),t.eventType.mouseDown,{map:this},this.dragDown);this._on(n(this.element),t.eventType.mouseMove,{map:this},this.dragMove);this._on(n(this.element),t.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,l={minLatitude:0,maxLatitude:0,minLongitude:0,maxLongitude:0},y=!1,a,c,r,h,s;if(u=f=e=o=0,n!=null&&n.length>0)for(r=0;r<n.length;r++)a=n[r],v=a.geometry!=null?a.geometry.coordinates:a.coordinates,this.isMultipolygon(v)?this.calculateMultiPolygonBBox(v,l,r>0):this.calculatePolygonBBox(v,l,r>0);if(u=l.minLatitude,f=l.maxLatitude,e=l.minLongitude,o=l.maxLongitude,i!=null&&i.length>0)for(r=0;r<i.length;r++)a=i[r],c=a.geometry.coordinates,y?(u=Math.min(u,c[1]),f=Math.max(f,c[1]),e=Math.min(e,c[0]),o=Math.max(o,c[0])):(u=f=c[1],e=o=c[0],y=!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++)y?(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],y=!0);return this._groupSize!=null||this._isMapCoordinates||(this._groupSize={minX:e,maxX:o,minY:u,maxY:f}),[[e,u],[o,f]]},_readShapeData:function(n,i,r){var e=this,u,f;if(n.shapeData!=null)if(typeof n.shapeData=="string")u=new t.DataManager(n.shapeData),f=t.Query().from(n),u.executeQuery(f).done(function(t){if(t.result!=null)return e._getPathCollection(t.result,n,i,r)});else return this._getPathCollection(n.shapeData,n,i,r)},_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)},_getPathCollection:function(i,r,u,f){var dt="",st="",ht="",nt,tt,pt,v,y,p,w,et,ni,bt,kt,lt,k,ot,h,i,e,ct,a,b,s,c,o,vt,yt,l,at,g,d,ii;if(i.features!=null?(ht=new t.DataManager(i.features),st="geometry.type",r._isBaseLayer&&(this._mapBounds=i.bbox)):i.geometries!=null&&(ht=new t.DataManager(i.geometries),st="type",r._isBaseLayer&&i.bbox!=null&&(this._mapBounds=[[i.bbox[0],i.bbox[1]],[i.bbox[2],i.bbox[3]]])),i.geometries!=null||i.features!=null){var ri=t.Query().from(r).where(st,t.FilterOperators.equal,"LineString"),ui=t.Query().from(r).where(st,t.FilterOperators.equal,"Polygon"),fi=t.Query().from(r).where(st,t.FilterOperators.equal,"MultiPolygon"),it=ht.executeLocal(ri),ut=ht.executeLocal(ui),ei=t.Query().from(r).where(st,t.FilterOperators.equal,"Point"),ft=ht.executeLocal(ei),oi=ht.executeLocal(fi);if(this._polylineCount=this._polylineCount+it.length,this._pointscount=this._pointscount+ft.length,n.merge(ut,oi),r._isBaseLayer&&r.geometryType==t.datavisualization.Map.GeometryType.Normal&&(this._isMapCoordinates=!1),this._mapBounds==null&&r._isBaseLayer?this._mapBounds=this._calculateBBox(ut,it,ft):this._mapBounds==null&&(this._mapBounds=[[-180,-85],[180,85]]),at=this._getFactor(),r._newBounds=[],pt="",this._groupSize!=null&&(v=this._groupSize.minX,y=this._groupSize.maxX,p=this._groupSize.minY,w=this._groupSize.maxY),et=!0,ft.length>0)for(o=0;o<ft.length;o++){var wt=ft[o],h=wt.geometry.coordinates,i=[],e=[];i.push({lat:parseFloat(h[1]),lng:parseFloat(h[0])});ct=0;a=i[0];nt=a.lat;tt=a.lng;s=this._convertTileLatLongtoPointForShapes(nt,tt,this._mapBounds,at);b=this._mapBounds;tt>=b[0][0]&&tt<=b[1][0]&&nt>=b[0][1]&&nt<=b[1][1]?(et&&this._groupSize==null?(v=y=s.x,p=w=s.y,et=!1):(v=Math.min(v,s.x),y=Math.max(y,s.x),p=Math.min(p,s.y),w=Math.max(w,s.y)),this._isSVG?e.push({x:s.x,y:s.y,lat:a.lat,lng:a.lng}):e.push({x:s.x-5/this._scale,y:s.y-5/this._scale,lat:a.lat,lng:a.lng}),d=this._id+"_layerIndex"+u+(t.util.isNullOrUndefined(f)?"":"_sublayerIndex"+f)+"_shapeIndex"+o,this._isSVG?pt+='<circle cx="'+e[0].x+'" cy="'+e[0].y+'" r="'+r.shapeSettings.radius/this._scale+'" stroke="'+r.shapeSettings.stroke+'" stroke-width="'+r.shapeSettings.strokeThickness+'" id="'+d+'" fill="'+r.shapeSettings.fill+'" />':(ni='<v:oval display="block" fill="'+r.shapeSettings.fill+'" style="position:absolute;top: '+e[0].y+"px;left:"+e[0].x+"px;width:"+10/this._scale+"px;height:"+10/this._scale+"px;stroke-width:"+r.shapeSettings.strokeThickness+'px;"" id="'+d+"><\/v:oval>",pt+=ni)):(ft.splice(o,1),o--)}if(ut.length>0)for(o=0;o<ut.length;o++){var wt=ut[o],si=o,ti=0,gt,rt;if(rt=wt.geometry!=null?wt.geometry.coordinates:wt.coordinates,gt=rt[0][0].length,bt=rt.length,bt>1)for(kt=rt,lt=0;lt<kt.length;lt++)gt<kt[lt][0].length&&(gt=kt[lt][0].length,ti=lt);for(k="",ot=0;ot<bt;ot++){if(h="",bt>1?(h=rt[ot][0],h.length<=2&&(h=rt[ot])):h=rt[ot],i=[],e=[],h.length>2)for(l=0;l<h.length;l++)i.push({lat:parseFloat(h[l][1]),lng:parseFloat(h[l][0])});else if(this.isMultipolygon(rt)){for(c=0;c<h.length;c++)if(h[c].length>2)for(l=0;l<h[c].length;l++)i.push({lat:parseFloat(h[c][l][1]),lng:parseFloat(h[c][l][0])})}else i.push({lat:parseFloat(h[1]),lng:parseFloat(h[0])});for(ct=0;ct<i.length-1||i.length==1&&ct==0;ct++)a=i[ct],nt=a.lat,tt=a.lng,b=this._mapBounds,(this._isTileMap||tt>=b[0][0]&&tt<=b[1][0]&&nt>=b[0][1]&&nt<=b[1][1])&&(s=this._convertTileLatLongtoPointForShapes(nt,tt,b,at),et&&this._groupSize==null?(v=y=s.x,p=w=s.y,et=!1):(v=Math.min(v,s.x),y=Math.max(y,s.x),p=Math.min(p,s.y),w=Math.max(w,s.y)),this._isSVG?e.push({x:s.x,y:s.y,lat:a.lat,lng:a.lng}):e.push({x:s.x,y:s.y,lat:a.lat,lng:a.lng}));if(ot==ti&&r._newBounds.push(this._findMidPointofPoylgon(e)),e.length>0)if(this._isSVG){for(k+="M"+e[0].x+","+e[0].y,c=1;c<e.length;c++)k+=","+e[c].x+","+e[c].y;k+="Z"}else{for(k+="m"+parseInt(e[0].x)+","+parseInt(e[0].y),k+=" l"+parseInt(e[0].x)+","+parseInt(e[0].y),c=1;c<e.length;c++)k+=","+parseInt(e[c].x)+","+parseInt(e[c].y);k+=" e"}}k!=""?(d=this._id+"_layerIndex"+u+(t.util.isNullOrUndefined(f)?"":"_sublayerIndex"+f)+"_shapeIndex"+o,dt+=this._isSVG?'<path class="e-mapShape" stroke='+r.shapeSettings.stroke+" stroke-width="+r.shapeSettings.strokeThickness/this._scale+" fill= "+r.shapeSettings.fill+' d="'+k+'" stroke-linejoin= round stroke-linecap= square id="'+d+'"><\/path>':'<v:shape style="width:'+this._width+"px;height:"+this._height+'px;" coordsize="'+this._width+" "+this._height+'" coordorigin="0 0" strokecolor='+r.shapeSettings.stroke+" stroke-width="+r.shapeSettings.strokeThickness/this._scale+'px" fillcolor= '+r.shapeSettings.fill+" id="+d+' path="'+k+'"><\/v:shape>'):(ut.splice(o,1),o--)}if(it.length>0)for(o=0;o<it.length;o++){for(vt=it[o].geometry==null?it[o].coordinates:it[o].geometry.coordinates,yt="",l=0;l<vt.length;l++)at=this._getFactor(),g=this._convertTileLatLongtoPointForShapes(vt[l][1],vt[l][0],this._mapBounds,at),et&&this._groupSize==null?(v=y=g.x,p=w=g.y,et=!1):(v=Math.min(v,g.x),y=Math.max(y,g.x),p=Math.min(p,g.y),w=Math.max(w,g.y)),yt+=g.x+","+g.y,l!=vt.length-1&&(yt+=",");d=this._id+"_layerIndex"+u+(t.util.isNullOrUndefined(f)?"":"_sublayerIndex"+f)+"_shapeIndex"+o;dt+=this._isSVG?"<polyline stroke="+r.shapeSettings.stroke+" id="+d+" stroke-width="+r.shapeSettings.strokeThickness/this._scale+' fill="transparent" stroke-width="1" points="'+yt+'" ><\/polyline>':'<v:polyline coordsize="'+this._width+", id="+d+this._height+'" coordorigin="0 0" strokecolor='+r.shapeSettings.stroke+" strokeweight="+r.shapeSettings.strokeThickness/this._scale+'px" fillcolor='+r.shapeSettings.fill+' points="'+yt+'"/>'}return this._isMapCoordinates&&(this._groupSize={minX:v,maxX:y,minY:p,maxY:w}),ii=[].concat(ut,it),r._polygonData=n.merge(ii,ft),dt+pt}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(r,u,f){var nt,d,ot,dt,tt,v,s,w,h,yt,gt,pt,g,ni,wt,c,b,ct,lt,ti,ii,l,bt,ri,it,at,rt,kt,a,k,ut,y;r._prevPaletteIndex=0;r._initializeLocalValues();r.selectedItems==null&&(r.selectedItems=[]);var fi=this._rootgroup,ui=this._svgDocument,o=this,e=r,ft=0,et=0;if(e.dataSource!=null&&e.bubbleSettings!=null)for(e.bubbleSettings.colorValuePath==null&&(e.bubbleSettings.colorValuePath=e.bubbleSettings.valuePath),nt=0;nt<e.dataSource.length;nt++)d=parseFloat(this._reflection(e.dataSource[nt],e.bubbleSettings.valuePath)),nt!=0?d>et?et=d:d<ft&&(ft=d):ft=et=d;if(r._renderedShapes=e.dataSource,e.showTooltip&&this._generateTooltipForLayers(e),e.shapeData!=null){if(ot=[],e.dataSource!=null)for(b=0;b<e.dataSource.length;b++)dt=e.dataSource[b],tt=o._reflection(dt,e.shapeDataPath),tt!=null&&(tt=tt.toLowerCase()),ot.push(tt);for(v=0;v<e._polygonData.length;v++){var st=e._polygonData[v].properties,ht=o._reflection(st,e.shapePropertyPath),vt,p=e.bubbleSettings.colorPath;if(ht!=null&&typeof ht=="string"&&(vt=ht.toLowerCase()),s=this._rootgroup.childNodes[v+u],f._isSVG?s.setAttribute("fill",e.shapeSettings.fill):(s.fillcolor=e.shapeSettings.fill,s.strokecolor=e.shapeSettings.stroke),c={},w=e._newBounds[v],e.shapeSettings.autoFill)switch(e.shapeSettings.colorPalette){case t.datavisualization.Map.ColorPalette.Palette1:this._generatePaletteColorsForShape(s,e,e.colorPalettes.Palette1,e._colorPaletteSettings.Palette1);break;case t.datavisualization.Map.ColorPalette.Palette2:this._generatePaletteColorsForShape(s,e,e.colorPalettes.Palette2,e._colorPaletteSettings.Palette2);break;case t.datavisualization.Map.ColorPalette.Palette3:this._generatePaletteColorsForShape(s,e,e.colorPalettes.Palette3,e._colorPaletteSettings.Palette3);break;case t.datavisualization.Map.ColorPalette.CustomPalette:this._generatePaletteColorsForShape(s,e,e.shapeSettings.customPalette,null)}if(ot.indexOf(vt)!=-1&&(h=e.dataSource[ot.indexOf(vt)],yt=ht,h.shape=s,h.shapeIndex=v,h._showBubble=!0,h!=null)){if(s!=null&&(pt=yt),r._bounds.push(w),e.showMapItems){if(g=n("<div class='e-mapItems' style='display:block;position:absolute;pointer-events: none;'><\/div>"),g[0].className=yt,o._templateDiv.append(g),n(g).css({left:w.x,top:w.y}),wt=this.model.locale,c=n.extend({},h),wt&&this.model.enableGroupSeparator)for(b in c)c[b]=isNaN(parseFloat(c[b]))?c[b]:parseFloat(c[b]).toLocaleString(wt);ni=e.mapItemsTemplate==null?n(" <div><label>{{:"+e.shapeSettings.valuePath+"}}<\/label><\/div>").render(c):n("#"+e.mapItemsTemplate).render(c);n(g).html(ni);r._mapItems.push(g)}e.shapeSettings.colorMappings!=null||e.shapeSettings.colorPath?(e.shapeSettings.colorValuePath==null&&(e.shapeSettings.colorValuePath=e.shapeSettings.valuePath),ct=o._reflection(h,e.shapeSettings.colorValuePath),ct==null||e.shapeSettings.autoFill||((e.legendSettings!=null&&e.legendSettings.mode==t.datavisualization.Map.LegendMode.Interactive||e.shapeSettings.enableGradient)&&e.shapeSettings.colorMappings.rangeColorMapping!=null?(c.legendrect=e._updateLegendRange(ct,e,s),lt=e.shapeSettings.fill,c.legendrect!=i&&(lt=c.legendrect.color),f._isSVG?s.setAttribute("fill",lt):s.fillcolor=lt):e._fillColors(ct,e.shapeSettings.colorMappings,s,f,h,st))):e.shapeSettings.autoFill||(f._isSVG?s.setAttribute("fill",e.shapeSettings.fill):(s.fillcolor=e.shapeSettings.fill,s.strokecolor=e.shapeSettings.stroke));e.bubbleSettings.showBubble&&e.bubbleSettings!=null&&e.bubbleSettings.valuePath!=null&&(f._isSVG?l=document.createElementNS(o._svgns,"circle"):(ti=this._id+"bubble_"+pt,ii='<v:oval class="e-mapBubble" id='+ti+' 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+ii,l=document.getElementById("bubble_"+pt)),bt=o._reflection(h,e.bubbleSettings.valuePath),ri=o._reflection(h,e.bubbleSettings.colorValuePath),gt=e.bubbleSettings.color,e.bubbleSettings.colorMappings!=null&&(e.bubbleSettings.colorMappings.rangeColorMapping||e.bubbleSettings.colorMappings.equalColorMapping)?(e._fillColors(ri,e.bubbleSettings.colorMappings,l,f,h,this,!0),y=l.getAttribute("fill"),y==null&&(y=gt,l.setAttribute("fill",y))):(it={fill:p?h[p]:e.bubbleSettings.color,bubbleOpacity:e.bubbleSettings.bubbleOpacity,shapeData:h,shapePropertyData:st},this._trigger("bubbleRendering",{model:this.model,data:it}),it.fill!=h[p]&&(h._bubblecolor=it[p]),f._isSVG?(l.setAttribute("fill",h._bubblecolor?h._bubblecolor:p?h[p]:e.bubbleSettings.color),l.setAttribute("opacity",it.bubbleOpacity)):(l.strokecolor=h._color?h._color:p?h[p]:e.bubbleSettings.color,l.fillcolor=h._color?h._color:p?h[p]:e.bubbleSettings.color)),at=o._getRatioOfBubble(e.bubbleSettings.minValue,e.bubbleSettings.maxValue,bt,ft,et),f._isSVG?(n(l).attr({cx:w.x,cy:w.y,id:s.id+"_bubble_"+v,"fill-opacity":e.bubbleSettings.bubbleOpacity,r:at,"class":"e-mapBubble"}),o.enableAnimation()&&!this._isTileMap&&n(l).css("display","none")):n(l).css({height:2*at+"px",width:2*at+"px"}),e.bubbleSettings.showTooltip==!0?(rt=n("<div class='e-bubbleToolTip' style='position:absolute;display:none;z-index:9999'/>"),kt=null,e.bubbleSettings.tooltipTemplate!=null?kt=e.bubbleSettings.tooltipTemplate:n(rt).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>"),n(l).mouseenter({htmlobj:rt,templateID:kt,itemsrc:h},o._bubbleEnterFunction),n(l).mousemove({htmlobj:rt},o._bubbleOverFunction),n(l).mouseleave({htmlobj:rt},o._bubbleleaveFunction)):n(l).css("pointer-events","none"),f._isSVG?(ui.appendChild(l),r._bubbles.push(l)):r._bubbles.push(l));c.data=h}r.labelSettings!=null&&r.labelSettings.showLabels&&r.labelSettings.labelPath!=null&&e.geometryType!=t.datavisualization.Map.GeometryType.Normal&&(k=o._reflection(st,r.labelSettings.labelPath),k!=null&&(w==null,a=n("<div class='e-labelStyle' id='"+this._id+"labelStyle_"+v+"'><\/div>"),n(a).css({"pointer-events":"none",position:"absolute"}),a[0].innerHTML=k,ut={data:{text:k,labelSettings:r.labelSettings,id:this._id+"labelStyle_"+v,index:v},model:this.model},this._trigger("displayTextRendering",ut),k==ut.data.text||ut.cancel||(k=ut.data.text),this._templateDiv.append(a),r.legendSettings.showLegend&&r.legendSettings.dockOnMap&&r.legendSettings.dockPosition=="top"?n(this._templateDiv).css({"margin-top":r.legendSettings.height}):r.legendSettings.showLegend&&r.legendSettings.dockOnMap&&r.legendSettings.dockPosition=="left"&&n(this._templateDiv).css({"margin-left":r.legendSettings.width}),n(a).css({left:w.x,top:w.y}),o._off(n(a),t.eventType.mouseDown,o._polyMouseDown),o._on(n(a),t.eventType.mouseDown,{Param1:null,Param2:r,Param3:s},o._polyMouseDown),o._off(n(a),t.eventType.mouseUp,o._polyClickFunction),o._on(n(a),t.eventType.mouseUp,{Param1:null,Param2:r,Param3:s},o._polyClickFunction),o._off(n(a),t.eventType.mouseLeave,o._polyLeaveFunction),o._on(n(a),t.eventType.mouseLeave,{Param1:r,Param2:c,map:this},o._polyLeaveFunction),a[0].setAttribute("data-nodeValue",s.getAttribute("fill")),r._labelCollection.push(a),r._labelBounds.push(w),r._labelData.push(k)));c.shapeIndex=v;c.shape=s;c.shapeData=r._polygonData[v];o._off(n(a),t.eventType.mouseMove,o._polyMoveFunction);o._on(n(a),t.eventType.mouseMove,{Param1:e,Param2:c},o._polyMoveFunction);s!=null&&(y=null,f._isSVG?(y=s.getAttribute("fill"),y=="undefined"&&(y=r.shapeSettings.fill),s.setAttribute("data-nodeValue",y)):(y=s.fillcolor.value,y=="undefined"&&(y=r.shapeSettings.fill),s.style.behavior=y));o.model.zoomSettings.enableZoomOnSelection&&n(s).hover(function(){n(this).css("cursor","pointer")},function(){n(this).css("cursor","auto")});r._mapShapes.push(c);v==0&&(this._legendDiv==null&&(this._legendDiv=n("<div class='e-LegendDiv'/>")),e.legendSettings!=null&&(e.shapeSettings.colorMappings!=null||e.shapeSettings.colorPath!=null)&&(e.legendSettings.type==i||e.legendSettings.type.toLowerCase()=="layers")&&e._generateLegends(this),this.model.enableRTL&&e.shapeSettings.colorMappings.rangeColorMapping.reverse(),e.legendSettings!=null&&(e.bubbleSettings.colorMappings!=null||e.bubbleSettings.colorPath!=null)&&e.legendSettings.type.toLowerCase()=="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))}}e._isBaseLayer&&e.geometryType==t.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(t){var i=t.data.map,o=i.model.layers[0],f,e,r=this._mapContainer,u;i.model.draggingOnSelection&&i.mouseClickable&&(i.ispanning=!1,t.type=="mousemove"?i._stopPoint={x:t.pageX-r[0].offsetLeft,y:t.pageY-r[0].offsetTop}:t.type=="touchmove"?i._stopPoint={x:t.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:t.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:t.type=="MSPointerMove"&&(i._stopPoint={x:t.originalEvent.pageX-r[0].offsetLeft,y:t.originalEvent.pageY-r[0].offsetTop}),n(".e-mapDragSelection").remove(),u=n('<div class = "e-mapDragSelection"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),n(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}),n(u).appendTo("#maps"))},dragUp:function(t){var i=t.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(n(".e-mapDragSelection").remove(),n(".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.model.zoomSettings.enableMouseWheelZoom)&&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.enableAnimation()&&!this._isTileMap&&r._animate(r.model.zoomSettings.animationDuration),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.model.zoomSettings.enableMouseWheelZoom)&&(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(t,r){var u=t,f,e,o;if(r!=null&&t!=null){for(f=r.split("."),e=0,f.push(r);e<f.length;e++)t!=i&&u!=null&&(o=u.hasOwnProperty(f[e]),o&&n.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()},addMarkers:function(i,r,u){var e,h,c,f,l,a,s,v,o;for(u=u.length?u:[u],e=t.util.isNullOrUndefined(r)?this.model.layers[i]:this.model.layers[i].subLayers[r],h=e._mapMarkers.length,e.markers=e.markers.concat(u),this._generateMarkers(u,e,this),v=this._getFactor(),o=e._mapMarkers.length-1;o>h-1;o--)c=e._mapMarkers[o],f=e.markers[o],s=this._isTileMap?this._convertTileLatLongtoPoint(f.latitude!=null?f.latitude:f.Latitude,f.longitude!=null?f.longitude:f.Longitude):this._convertLatLongtoPointforMarker(f.latitude!=null?f.latitude:f.Latitude,f.longitude!=null?f.longitude:f.Longitude,v),l=s.x,a=s.y,n(c).css({left:l,top:a})},_generateMarkers:function(i,r,u){for(var h,f,e,s,o=0;o<i.length;o++)e=i[o],r.markerTemplate!=null?(f=n("<div class='e-mapMarker' style='display:block;position:absolute;pointer-events: stroke;'><\/div>"),u._templateDiv.append(f),n(f).css({height:r._height,width:r._width,"margin-top":r._margintop,"margin-left":r._marginleft}),s=n("#"+r.markerTemplate).render(e),u.model.markerSelected==null&&n(f).css({"pointer-events":"none"}),n(f).html(s)):(f=n(' <div class="e-mapMarker" style="display:block;position:absolute;pointer-events: stroke;"><label>'+e.label+"<\/label><\/div>"),r._isSVG?u._templateDiv.append(f):f.appendTo(u._templateDiv),u.model.markerSelected==null&&n(f).css({"pointer-events":"none"})),u._on(n(f),t.eventType.mouseDown,{marker:n(f),data:e},u._markerPressed),u._on(n(f),"dblclick",{marker:n(f),data:e},u._markerPressed),u._on(n(f),"contextmenu",{marker:n(f),data:e},u._markerPressed),u._on(n(f),t.eventType.mouseMove,{markerElement:n(f),markerData:e},u._markerEntered),u._on(n(f),t.eventType.mouseLeave,{markerElement:n(f),markerData:e},u._markerLeaved),r._mapMarkers.push(f),h=r,h.legendSettings.dockPosition==t.datavisualization.Map.DockPosition.Left&&(r._height=r._height,r._width=r._width-parseFloat(this._legendDivWidth),r._marginleft=parseFloat(this._legendDivWidth))},refreshMarkers:function(){for(var n,i,u=document.getElementsByClassName("e-mapMarker"),t=!1,f,r=u.length-1;r>=0;r--)f||(f=u[r].parentNode),f.removeChild(u[r]);for(n=this.model.layers[this.baseMapIndex()],n.markers.length>0&&(n._generateMarkerForLayers(this),t=!0),i=0;i<n.subLayers.length;i++)n.subLayers[i].markers&&(n.subLayers[i]._generateMarkerForLayers(this),t=!0);t=n._labelCollection.length>0?!0:t;t&&this._refrshLayers()},_generateTooltipForLayers:function(t){var i,r,u;i=document.documentMode==8?document.querySelectorAll("e-shapeToolTip"):document.getElementsByClassName("e-shapeToolTip");i!=null&&i.length==0?(r=n("<div class='e-shapeToolTip' style='display:none;position:absolute;z-index:1000;pointer-events:none;'><\/div>"),n(document.body).append(r),t._tooltipElement=r):t._tooltipElement=i[0];t.tooltipTemplate==null&&(u=t.shapeSettings.valuePath,u!=null&&(t.tooltipTemplate="defaultTooltip",this._mapContainer.append(n('<div id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="e-defaultToolTip" style="display:table"><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._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,