Marker
This commit is contained in:
parent
1800bedfa4
commit
9149ac8476
|
@ -63,7 +63,7 @@
|
||||||
//途经点
|
//途经点
|
||||||
var wayMarker;
|
var wayMarker;
|
||||||
//初始化中心坐标
|
//初始化中心坐标
|
||||||
var centerGPS = _GPS_CENTER_;//['120.21473911773758', '30.263519892563018'];
|
var centerGPS = _GPS_CENTER_;
|
||||||
//途经点数组。方便清空数据
|
//途经点数组。方便清空数据
|
||||||
var wayMarkerArray = new Array();
|
var wayMarkerArray = new Array();
|
||||||
var carStart, carEnd;
|
var carStart, carEnd;
|
||||||
|
@ -81,6 +81,10 @@
|
||||||
var gpsData = JSON.parse(allData)
|
var gpsData = JSON.parse(allData)
|
||||||
var rowLength = gpsData.data.rows.length;
|
var rowLength = gpsData.data.rows.length;
|
||||||
var gpsLength = gpsData.data.rows[rowLength - 1].gpsInfos.length;
|
var gpsLength = gpsData.data.rows[rowLength - 1].gpsInfos.length;
|
||||||
|
for(var i=0;i<rowLength;i++){
|
||||||
|
wayMarkerArray[i] = new Array();
|
||||||
|
}
|
||||||
|
|
||||||
//添加小汽车
|
//添加小汽车
|
||||||
carStart = [gpsData.data.rows[0].gpsInfos[0].longitude, gpsData.data.rows[0].gpsInfos[0].latitude]
|
carStart = [gpsData.data.rows[0].gpsInfos[0].longitude, gpsData.data.rows[0].gpsInfos[0].latitude]
|
||||||
carEnd = [gpsData.data.rows[rowLength - 1].gpsInfos[gpsLength - 1].longitude, gpsData.data.rows[rowLength - 1].gpsInfos[gpsLength - 1].latitude]
|
carEnd = [gpsData.data.rows[rowLength - 1].gpsInfos[gpsLength - 1].longitude, gpsData.data.rows[rowLength - 1].gpsInfos[gpsLength - 1].latitude]
|
||||||
|
@ -187,10 +191,10 @@
|
||||||
// 实例化点标记
|
// 实例化点标记
|
||||||
function addMarker(i) {
|
function addMarker(i) {
|
||||||
if (null != wayMarker) {
|
if (null != wayMarker) {
|
||||||
wayMarkerArray.forEach(function (wayMarkerPoint) {
|
wayMarkerArray[i].forEach(function (wayMarkerPoint) {
|
||||||
wayMarkerPoint.setMap(null);
|
wayMarkerPoint.setMap(null);
|
||||||
})
|
})
|
||||||
wayMarkerArray = new Array();
|
wayMarkerArray[i] = new Array();
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = gpsData.data.rows[i];
|
var data = gpsData.data.rows[i];
|
||||||
|
@ -209,7 +213,7 @@
|
||||||
direction: 'right' //设置文本标注方位
|
direction: 'right' //设置文本标注方位
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
wayMarkerArray.push(wayMarker);
|
wayMarkerArray[i].push(wayMarker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +239,7 @@
|
||||||
|
|
||||||
/**********动画 START**********/
|
/**********动画 START**********/
|
||||||
function startAnimation() {
|
function startAnimation() {
|
||||||
marker.moveAlong(lineArr, 99200);
|
marker.moveAlong(lineArr, 992);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pauseAnimation() {
|
function pauseAnimation() {
|
||||||
|
|
Loading…
Reference in New Issue