Skip to content

Commit 0afecdb

Browse files
committed
location update
1 parent 004a5e3 commit 0afecdb

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

_posts/2019-02-02-car-location.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
title: car-location
44
---
55
<style>
6-
76
h2{
87
font-size: 1rem;
98
}
9+
input{
10+
font-size: 0.8rem;
11+
}
1012
html{
1113
height: 100%;
1214
}
@@ -27,8 +29,7 @@
2729
}
2830
@media screen and (max-width: 500px) {
2931
body,html {
30-
font-size: 28px;
31-
32+
font-size: 20px;
3233
}
3334
h2{
3435
display: none;
@@ -132,6 +133,7 @@
132133
previousVelocityGroup = getVelocityGroup(currentPointsCost.velocity),
133134
reallyDistance = currentPointsCost.distance,
134135
airDistance = reallyDistance,
136+
distancePointCount = 1,
135137
currentStartPoint = dataPoints[0],
136138
tempPoints = {
137139
points: [getBMapPoint(dataPoints[0].value), getBMapPoint(dataPoints[1].value)],
@@ -144,9 +146,14 @@
144146
reallyDistance += currentPointsCost.distance; //实际距离
145147
airDistance = GPS.distance(currentStartPoint.value.lat, currentStartPoint.value.lon, dataPoints[i].value.lat, dataPoints[i].value.lon); //航空距离
146148
currentVelocityGroup = getVelocityGroup(currentPointsCost.velocity);
149+
//console.log('reallyDistance:',reallyDistance,'airDistance',airDistance);
147150
if(currentVelocityGroup == previousVelocityGroup){ //当前两个点的速度和前两个点的速度属于同一个组
148-
if(reallyDistance - airDistance < 1){
151+
if(reallyDistance - airDistance < 0.02 * ++distancePointCount){
149152
tempPoints.points.length = tempPoints.points.length - 1;
153+
}else{
154+
reallyDistance = currentPointsCost.distance;
155+
currentStartPoint = dataPoints[i - 1];
156+
distancePointCount = 1;
150157
}
151158
tempPoints.points.push(getBMapPoint(dataPoints[i].value));
152159
}else{
@@ -203,7 +210,11 @@
203210
var $prevPageButton = $('prevPageButton');
204211
var $nextPageButton = $('nextPageButton');
205212
var $searchButton = $('searchButton');
213+
var $searchForm = $('searchForm');
206214
var $log = $('log');
215+
$searchForm.onsubmit = function(e){
216+
e.preventDefault();
217+
}
207218
$('baiduMapCtn').style.height = (document.body.offsetHeight - $('head').offsetHeight) + 'px'
208219
function CarMarker(deviceId, start, end){
209220
var _this = this;
@@ -347,9 +358,12 @@
347358
drawGroup: function(pointsGroup){
348359
var _this = this;
349360
var count = 0;
361+
console.log(pointsGroup);
350362
pointsGroup.forEach(item => {
363+
count+= item.points.length;
351364
_this.drawLine(item.points, VelocityGroupColor[item.velocityGroup]);
352365
});
366+
console.log('实际渲染',count);
353367
//加入marker
354368
var iconStart = new BMap.Icon('/resource/2019/markers_bg.png', new BMap.Size(25,40), {
355369
imageSize: new BMap.Size(50, 40),

0 commit comments

Comments
 (0)