﻿function AddTileLayer(tileSourceId,tileSource,numServers,bounds,minZoom,maxZoom,getTilePath,opacity,zindex){if(GetTileLayerByID(tileSourceId)==null){map.AddTileLayer(new VETileSourceSpecification(tileSourceId,tileSource,numServers,bounds,minZoom,maxZoom,getTilePath,opacity,zindex),true);}else{map.ShowTileLayer(tileSourceId);}};function RemoveTileLayer(tileSourceId){if(GetTileLayerByID(tileSourceId)!=null){map.DeleteTileLayer(tileSourceId);}};function ShowTileLayer(tileSourceId){if(GetTileLayerByID(tileSourceId)!=null){map.ShowTileLayer(tileSourceId);}};function HideTileLayer(tileSourceId){if(GetTileLayerByID(tileSourceId)!=null){map.HideTileLayer(tileSourceId);}};function GetTileLayerByID(tileSourceId){return map.GetTileLayerByID(tileSourceId);};function iG(title,description){var layer=new VEShapeLayer();layer.SetTitle(title);layer.SetDescription(description);map.AddShapeLayer(layer);return layer;};function iJ(layer){if(layer!=null){layer.DeleteAllShapes();map.DeleteShapeLayer(layer);}};function jM(description){return description;};function iF(layer,latLong,icon,draggable,title,description){var shape=new VEShape(VEShapeType.Pushpin,latLong);shape.Draggable=draggable;shape.SetTitle(title);shape.SetDescription(jM(description));shape.SetCustomIcon(icon);shape.ShowIcon();layer.AddShape(shape);return shape;};function jO(shape,latLon){shape.SetPoints(latLon);};function SetPushpinCustomIcon(shape,icon){shape.SetCustomIcon(icon);};function jK(shape,value){if(value){shape.Show();}else{shape.Hide();}};function iL(layer,points,color){var line=new VEShape(VEShapeType.Polyline,points);line.HideIcon();line.SetLineColor(color);layer.AddShape(line);return line;};function ja(line,latLon,index){var points=line.GetPoints();if(index==null||index<0){points[points.length]=latLon;}else{points.splice(index,0,latLon);}line.SetPoints(points);};function jc(line,index){if(line==null){return false;}if(index==null){return false;}if(index<0){return false;}var points=line.GetPoints();points.splice(index,1);if(points.length>1){line.SetPoints(points);return true;}return false;};function jJ(line,latLon,index){if(line==null){return false;}if(index==null){return false;}if(index<0){return false;}var points=line.GetPoints();points[index]=latLon;if(points.length>1){line.SetPoints(points);return true;}return false;};function jf(layer,lat,lon,radius,lineColor,fillColor){if(lineColor==null){lineColor=new VEColor(0,0,0,0)}if(fillColor==null){fillColor=new VEColor(255,128,128,0.5)}var shape=jN(lat,lon,radius);shape.HideIcon();shape.SetLineColor(lineColor);shape.SetFillColor(fillColor);shape.Draggable=false;layer.AddShape(shape);return shape;};function jN(latin,lonin,radius){var locs=new Array();var lat1=latin*Math.PI/180.0;var lon1=lonin*Math.PI/180.0;var d=radius/3956;var x;for(x=0;x<=360;x+=10){var tc=(x/90)*Math.PI/2;var lat=Math.asin(Math.sin(lat1)*Math.cos(d)+Math.cos(lat1)*Math.sin(d)*Math.cos(tc));lat=180.0*lat/Math.PI;var lon;if(Math.cos(lat1)==0){lon=lonin;}else{lon=((lon1-Math.asin(Math.sin(tc)*Math.sin(d)/Math.cos(lat1))+Math.PI)%(2*Math.PI))-Math.PI;}lon=180.0*lon/Math.PI;var loc=new VELatLong(lat,lon);locs.push(loc);}var circle=new VEShape(VEShapeType.Polygon,locs);return circle;};function eV(tbID){return jz(document.getElementById(tbID).value);};function jz(hex){return new VEColor(parseInt("0x"+hex.substring(0,2)),parseInt("0x"+hex.substring(2,4)),parseInt("0x"+hex.substring(4,6)),0.5);};function Rectangle(maxLat,minLon,minLat,maxLon){return[new VELatLongRectangle(new VELatLong(maxLat,minLon),new VELatLong(minLat,maxLon))];}