Browse Source

增加一人多卡日志,修复历史轨迹

lixioayao 6 years ago
parent
commit
e0ff57404c
3 changed files with 13 additions and 11 deletions
  1. 4 3
      bindmorecard.h
  2. 8 7
      his_location.h
  3. 1 1
      select_tool.cpp

+ 4 - 3
bindmorecard.h

@@ -99,7 +99,7 @@ struct TcardInterface
 				}
 				break;
 			}
-			else
+			else if(tsp>=tmp_tsp_max)
 			{
 				if(timeout())
 				{
@@ -107,6 +107,7 @@ struct TcardInterface
 					stp = check(std::get<0>(tp),std::get<1>(tp));
 					skip(1);
 				}
+                log_info("grow(%d)%lu&%lu,%d,%lu",SIZE,m_cardid.first,m_cardid.second,m_arr.size(),tsp);
 				grow(tsp);
 				tmp_tsp_min = back(0).m_timestamp;
 				tmp_tsp_max = back(0).m_timestamp + TIME_WIN_MILLISEC;
@@ -129,7 +130,7 @@ struct TcardInterface
 	}
 	void skip(int count)
 	{
-		for(int i =0;i<count&&i<size();i++)
+		for(int i=0;i<count&&i<size();i++)
 		  m_arr.pop_front();
 	}
 	bool empty()
@@ -143,7 +144,6 @@ struct TcardInterface
 	void  grow(uint64_t ct)
 	{
 		Data d(ct);
-		d.reset();
 		m_arr.push_back(d);
 	}
 	Data &back(int index)
@@ -191,6 +191,7 @@ struct TcardInterface
 	{
 		if(index*1.0/ct>=0.72)
 		{
+
 			std::string s = getInfo_1();
 			return std::make_tuple(true,s);
 		}

+ 8 - 7
his_location.h

@@ -78,8 +78,7 @@ struct location_card
 
 		if(point::eq(p.x,pt.x,0.2) && point::eq(p.y,pt.y,0.2)) return false;
         double dis1=m_p.dist(pt);
-        if(dis1<1.5)
-            return false;
+        if(dis1<1.5)return false;
         double dis = p.dist(pt);
 		double arg = make_arg(pt,p);
 		log_info("his_location:line_changed:%d,%f,m_arg:%f,%s,%f,%f",m_cardid,arg,m_arg, (arg-m_arg > -1e-10 && arg-m_arg<1e-10)?"same":"not same",m_arg-arg,dis);
@@ -113,7 +112,7 @@ struct location_card
 	}
 	bool time_out(const point &p,uint64_t time)
 	{
-		if(time-m_timestamp>=60*1000 && !(p == m_p))
+		if(time-m_timestamp>=10*60*1000 && !(p == m_p))
 			return true;
 		return false;
 	}
@@ -162,8 +161,8 @@ struct location_card
 		bool flag=false;
 		bool iflag=false;
 		flag=handle_message(p,timestamp);
-		if(time_out(p,timestamp))
-			if(!flag)iflag=true;
+		//if(time_out(p,timestamp))
+		//	if(!flag)iflag=true;
 		if(is_speed_changed(p,timestamp))
 			if(!flag)iflag=true;
 		if(is_area_changed(areaid))
@@ -193,7 +192,7 @@ struct location_card
 	{
 		std::string tabName=getTabName();
 		char nsql[512]={0};
-		const char * sql = "update his_location set last_time='%s',speed=%.2f where obj_id=%d and begin_time='%s';";
+		const char * sql = "update his_location set last_time='%s',speed=%.2f where obj_id=%d and begin_time='%s' and last_time is null;";
 		double dist = m_p.dist(p);
 		double t	= timestamp - m_timestamp;
 		double avge_speed= dist/t*1000;
@@ -286,8 +285,10 @@ struct location_vehicle:location_card
 		bool flag =false;
 		if(line_changed(p))
 		{
-			log_info("his_location:line_changed %d ",m_cardid);
 			flag=true;
+            //如果有拐点,说明是丢失信号后,飞跃得过程
+//			std::vector<point> rc=card_path::inst().find_path(point(m_d.back().p.x,-m_d.back().p.y),point(p.x,-p.y));
+			log_info("his_location:line_changed %d ",m_cardid);
 			update(m_d.back().p,m_d.back().time);
 			set(m_d.back().p,m_d.back().time);init_att();
 		}

+ 1 - 1
select_tool.cpp

@@ -158,7 +158,7 @@ bool select_point_object::select_solution(const std::vector<point> &vp,const sit
        std::array<solpoint,4> res;
        for(int i=0;i<2;i++)
 	   {
-           int x = i+2;
+            int x = i+2;
 			double d=vp[i].dist(vp[x]);
 			if(d<sit->ant_dist()*3)
 			{