src/main/webapp/resources/js/map/usa_states.js
(开头部分) 63KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*!
*
* Jquery Mapael - Dynamic maps jQuery plugin (based on raphael.js)
* Requires jQuery and Mapael
*
* Map of USA by state
*
* @source http://the55.net/_11/sketch/us_map
*/
(function (factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory(require('jquery'), require('jquery-mapael'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'mapael'], factory);
} else {
// Browser globals
factory(jQuery, jQuery.mapael);
}
}(function ($, Mapael) {
"use strict";
$.extend(true, Mapael,
{
maps :{
usa_states : {
width : 959,
height : 593,
latLngToGrid: function(lat, lng, phi1, phi2, midLng, scale) {
var pi =Math.PI
, midLat = (phi1 + phi2) / 2
, n, tmp1, tmp2, tmp3, x, y, p;
n = (Math.sin(phi1 / 180 * pi) + Math.sin(phi2 / 180 * pi)) / 2;
tmp1 = Math.sqrt(Math.cos(phi1 / 180 * pi)) + 2 * n * Math.sin(phi1 / 180 * pi);
tmp2 = scale * Math.pow(tmp1 - 2 * n * Math.sin(midLat / 180 * pi),0.5) / n;
tmp3 = n * (lng - midLng);
p = scale * Math.pow(tmp1 - 2 * n * Math.sin(lat / 180 * pi),0.5) / n;
x = p * Math.sin(tmp3 / 180 * pi);
y = tmp2 - p * Math.cos(tmp3 / 180 * pi);
return([x,y]);
},
getCoords : function (lat, lon) {
var coords = {},
xOffset,
yOffset,
scaleX,
scaleY,
phi1,
phi2,
midLng,
scale;
if(lat > 51) { // alaska
phi1= 15;
phi2= 105;
midLng = -134;
scale = 530;
后面还有 88 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。