Browse Source

修复历史轨迹点

lixioayao 5 years ago
parent
commit
d2204831b9
4 changed files with 7 additions and 6 deletions
  1. 1 1
      card.cpp
  2. 1 1
      card.h
  3. 4 4
      his_location.h
  4. 1 0
      main.cpp

+ 1 - 1
card.cpp

@@ -18,7 +18,7 @@
 #include "mine_business.h"
 
 extern config_file config;
-const int three_rates_flag=config.get("service.three_rates_flag",0);
+int three_rates_flag=0;
 void card_list::init_staffer(const std::string & lszId64)
 {
     std::string strategy = config.get("person.strategy","PS_1");

+ 1 - 1
card.h

@@ -5,7 +5,7 @@
 
 #include "card_base.h"
 #include "write-copy.h"
-extern const int three_rates_flag;
+extern int three_rates_flag;
 struct card_list_visit:visitor<std::shared_ptr<card_location_base>>
 {
 	bool visit(std::shared_ptr<card_location_base> c);

+ 4 - 4
his_location.h

@@ -83,7 +83,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<2)return false;
         double dis = p.dist(pt);
 		double arg = make_arg(pt,p);
         //查看路径方向是否改变
@@ -211,7 +211,7 @@ struct location_card
 		const char * sql = "replace into his_location (obj_id,card_type_id,ident,begin_time,map_id,area_id,begin_pt,direction)"
 		                   "values(%d,%d,%d,'%s',%d,%d,'%.2f,%.2f',%f);";
 		snprintf(nsql,512,sql,m_objid,m_type,m_cardid,tool_time::to_str(m_timestamp/1000).c_str(),m_mapid,m_areaid,m_p.x,m_p.y,m_arg);
-		log_info("his_location[%d]:%s",m_cardid,nsql);
+		log_info("his_location[%d,%lu]:%s",m_cardid,m_timestamp,nsql);
 		sDBConnPool.PushAsync(nsql);
 	}
 	void update(const point &p,uint64_t timestamp)
@@ -225,7 +225,7 @@ struct location_card
 		if(std::isnan(avge_speed)|| std::isinf(avge_speed))avge_speed=0;
 
 		snprintf(nsql,512,sql,tool_time::to_str(timestamp/1000).c_str(),avge_speed,m_objid,tool_time::to_str(m_timestamp/1000).c_str());
-		log_info("his_location[%d]:%s",m_cardid,nsql);
+		log_info("his_location[%d]:%s[%lu,%lu]",m_cardid,nsql,timestamp,m_timestamp);
 		sDBConnPool.PushAsync(nsql);
 	}
     std::vector<point> find_path(const point &p1,const point &p2)
@@ -266,7 +266,7 @@ struct location_card
                     pt.y=-pt.y;dis+=_p.dist(pt);_p=pt;
                     });
 		uint64_t t=timestamp/1000 - m_timestamp/1000;
-        if(t==0)return true;
+        if(t==0||dis<0.1)return true;
 		double avge_speed= dis/t;
 
         for(const point & pp:rc)

+ 1 - 0
main.cpp

@@ -41,6 +41,7 @@ struct Init_Setting
 {
     void init()
     {
+        three_rates_flag=config.get("service.three_rates_flag",0);
         YADB::_DB_POOL_SETTING_ DBSetting;
         DBSetting.Host = config.get("db.host","127.0.0.1");
         DBSetting.User = config.get("db.user","root");