笔记

【js获取项目路径】

var curWwwPath=window.document.location.href;
//输出:   http://localhost:8080/order/find.do?id=1

var pathName=window.document.location.pathname;
//输出:   /order/find.do?id=1

var pos=curWwwPath.indexOf(pathName);
//输出:  21

var localhostPath=curWwwPath.substring(0,pos);
//输出:  http://localhost:8080
【百度地图经纬度计算】

输入:经度=13497120,维度=68321769
输出:经度=113.88803079676322,维度=22.505998652763452

var x_PI = 52.35987755982988, PI = 3.141592653589793, a = 6378245, ee = .006693421622965943;
function gcj02tobd09(a, b) {
            var c = Math.sqrt(a * a + b * b) + 2e-5 * Math.sin(b * x_PI), d = Math.atan2(b, a) + 3e-6 * Math.cos(a * x_PI);
            return [c * Math.cos(d) + .0065, c * Math.sin(d) + .006]
        }

function wgs84togcj02(b, c) {
            var d = transformlat(b - 105, c - 35), e = transformlng(b - 105, c - 35), f = c / 180 * PI, g = Math.sin(f);
            g = 1 - ee * g * g;
            var h = Math.sqrt(g);
            return d = 180 * d / (a * (1 - ee) / (g * h) * PI), e = 180 * e / (a / h * Math.cos(f) * PI), [b + e, c + d]
        }
function transformlat(a, b) {
            var c = 2 * a - 100 + 3 * b + .2 * b * b + .1 * a * b + .2 * Math.sqrt(Math.abs(a));
            return c += 2 * (20 * Math.sin(6 * a * PI) + 20 * Math.sin(2 * a * PI)) / 3, c += 2 * (20 * Math.sin(b * PI) + 40 * Math.sin(b / 3 * PI)) / 3, c += 2 * (160 * Math.sin(b / 12 * PI) + 320 * Math.sin(b * PI / 30)) / 3
        }

function transformlng(a, b) {
            var c = 300 + a + 2 * b + .1 * a * a + .1 * a * b + .1 * Math.sqrt(Math.abs(a));
            return c += 2 * (20 * Math.sin(6 * a * PI) + 20 * Math.sin(2 * a * PI)) / 3, c += 2 * (20 * Math.sin(a * PI) + 40 * Math.sin(a / 3 * PI)) / 3, c += 2 * (150 * Math.sin(a / 12 * PI) + 300 * Math.sin(a / 30 * PI)) / 3
        }

var gcj02 = wgs84togcj02(parseInt(lon) / 6e5, parseInt(lat) / 6e5);
var longitude = gcj02tobd09(gcj02[0], gcj02[1])[0];//经度
var latitude = gcj02tobd09(gcj02[0], gcj02[1])[1];//纬度
var new_point = new BMap.Point(longitude,latitude);
【调用list的sublist(int, int)会影响原来的list】

LinkedList<String> ll = new LinkedList<>();
ll.add("a");
ll.add("b");
ll.add("c");
List<String> l2 =  ll.subList(1, 2);//[)
l2.add("new");
System.out.println(ll);
System.out.println(l2);
//输出:
//[a, b, new, c] 
//[b, new] 

LinkedList<String> ll = new LinkedList<>();
ll.add("a");
ll.add("b");
ll.add("c");
List<String> l2 =  ll.subList(1, 2);//[)
ll.add("d");
System.out.println(ll);
System.out.println(l2);
//报错:Exception in thread “main” java.util.ConcurrentModificationException 

//正确截断一个List:
list.subList(from, to).clear();
var infoWindow = new BMap.InfoWindow(info, infoWindowWidth);
var marker = new BMap.Marker(new_point,{icon:myIcon});  // 创建标注
//点击标注显示信息
marker.addEventListener("mouseover", function(){
    this.openInfoWindow(infoWindow);
});
map.addOverlay(marker);  // 将标注添加到地图中
marker.openInfoWindow(infoWindow); // 加载后默认显示信息(注意openInfoWindow需要在addOverlay方法后)

【js的toFixed问题】http://caibaojian.com/js-tofixed.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值