Browse Source

历史轨迹超过30s的时长更新记录,不重新插入

lixioayao 5 years ago
parent
commit
540b503b3b
1 changed files with 11 additions and 9 deletions
  1. 11 9
      his_location.h

+ 11 - 9
his_location.h

@@ -128,7 +128,7 @@ struct location_card
 	}
 	bool time_out(const point &p,uint64_t time)
 	{
-		if(time-m_timestamp>=10*60*1000 && !(p == m_p))
+		if(time-m_timestamp>=30*1000 && m_p.dist(p)>0.1)
 			return true;
 		return false;
 	}
@@ -185,23 +185,25 @@ struct location_card
             return;
 		}
 		bool flag=false;
-		bool iflag=false;
+		int  iflag=0;
         //判断是否路径发生了变化
 		flag=handle_message(p,timestamp);
-		//if(time_out(p,timestamp))
-		//	if(!flag)iflag=true;
+		if(time_out(p,timestamp))
+			if(!flag)iflag=2;
 		if(is_speed_changed(p,timestamp))
-			if(!flag)iflag=true;
+			if(!flag)iflag=1;
 		if(is_area_changed(areaid))
-			if(!flag)iflag=true;
+			if(!flag)iflag=1;
 		if(is_map_changed(mapid))
-			if(!flag)iflag=true;
+			if(!flag)iflag=1;
 		if(iflag)
 		{
 			update(p,timestamp);
 			//set_invalid();	
-			set(p,timestamp);
-			insert();
+            if(iflag==1){
+			    set(p,timestamp);
+			    insert();
+            }
 		}
 	}
 	void insert()