Bug fix: Resonators didn't redraw sometimes after level of portal hide and reshow

And some code simplification.
This commit is contained in:
Xelio
2013-05-18 17:07:21 +08:00
parent 07bf9b1299
commit b5381603b8
3 changed files with 59 additions and 55 deletions

View File

@ -43,3 +43,19 @@ window.generateBoundsParams = function(tile_id, minLat, minLng, maxLat, maxLng)
maxLngE6: Math.round(maxLng * 1E6)
};
}
window.getResonatorLatLng = function(dist, slot, portalLatLng) {
// offset in meters
var dn = dist*SLOT_TO_LAT[slot];
var de = dist*SLOT_TO_LNG[slot];
// Coordinate offset in radians
var dLat = dn/EARTH_RADIUS;
var dLon = de/(EARTH_RADIUS*Math.cos(Math.PI/180*portalLatLng[0]));
// OffsetPosition, decimal degrees
var lat0 = portalLatLng[0] + dLat * 180/Math.PI;
var lon0 = portalLatLng[1] + dLon * 180/Math.PI;
return [lat0, lon0];
}