forked from geokrety/geokrety-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_latlon-1.min.js
1 lines (1 loc) · 2.64 KB
/
edit_latlon-1.min.js
1
var OneDegLonToMArray=[111195,111177,111127,111042,110924,110771,110585,110366,110112,109825,109505,109151,108764,108344,107891,107405,106887,106336,105752,105136,104488,103809,103097,102355,101581,100776,99941,99075,98179,97252,96297,95312,94298,93255,92184,91085,89958,88803,87622,86414,85179,83919,82633,81322,79986,78626,77241,75834,74403,72949,71474,69976,68457,66918,65358,63778,62178,60560,58923,57269,55596,53907,52202,50480,48744,46992,45226,43446,41653,39848,38030,36201,34360,32509,30649,28779, 26900,25013,23118,21216,19308,17394,15475,13551,11622,9691,7756,5819,3880,1940],OneDegLatToM=111195,circle,rect,map;function updateLatLon(a){document.getElementById("latlon").value=Math.round(1E5*a.lat())/1E5+" "+Math.round(1E5*a.lng())/1E5} function updateRectangle(a,b){if(!0==b)rect.setMap(null);else{rect.setMap(map);var c=a.lat(),f=a.lng();0>c&&(c*=-1);var d=Math.round(c);90==d&&(d=89);var e=OneDegLonToMArray[d],g=document.getElementById("radius"),d=1E3*1/OneDegLatToM*g.value,e=1E3*1/e*g.value;rect.setBounds(new google.maps.LatLngBounds(new google.maps.LatLng(c-d,f-e),new google.maps.LatLng(c+d,f+e)))}} function initialize(){var a=new google.maps.LatLng(initial_map_lat,initial_map_lon);map=new google.maps.Map(document.getElementById("map_canvas"),{zoom:initial_zoom,center:a,mapTypeId:google.maps.MapTypeId.ROADMAP,streetViewControl:!1,scaleControl:!0});rect=new google.maps.Rectangle({map:map,strokeWeight:1,strokeColor:"#FF0000",fillOpacity:0.15});rect.setBounds(new google.maps.LatLngBounds(new google.maps.LatLng(initial_lat1,initial_lon1),new google.maps.LatLng(initial_lat2,initial_lon2)));google.maps.event.addListener(map, "drag",function(){var a=map.getCenter();updateLatLon(a);updateRectangle(a);document.getElementById("reticule").style.display="block"})}google.maps.event.addDomListener(window,"load",initialize); function latlon_keyup(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var b=document.getElementById("latlon"),a=document.getElementById("reticule");""==b.value?(a.style.display="none",updateRectangle(null,!0)):(b=/([\+\-]?\d+\.?\d*)[\s\,\/]+([\+\-]?\d+\.?\d*)/.exec(b.value),null!=b?(b=new google.maps.LatLng(b[1],b[2]),map.setCenter(b),updateRectangle(b),a.style.display="block",1>=map.getZoom()&&map.setZoom(8)):a.style.display="none");return!0} function radius_keyup(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var a=document.getElementById("radius").value,b=document.getElementById("radrange");0<=a&&10>=a?(b.style.color="",b.style.fontWeight="",updateRectangle(map.getCenter())):(b.style.color="#ff0000",b.style.fontWeight="bold",updateRectangle(null,!0));return!0};