123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #include "stdafx.h"
- #include <memory.h>
- #include <algorithm>
- #include "loc_point.h"
- #include "message.h"
- #include "ProcessRemodule.h"
- NAMESPACE_POINT_BEGIN(NAMESPACE_POINT)
- loc_point::loc_point()
- :m_time(0)
- ,m_cid(-1)
- ,m_sid(-1)
- ,m_ct(-1)
- ,m_acc(0)
- ,m_rav(0)
- ,m_cred_level(0)
- ,m_dist(0)
- ,m_speed(0)
- ,m_stat(0)
- ,m_dist1(0)
- ,m_dist2(0)
- ,m_smooth_x(0)
- ,m_smooth_y(0)
- {
- memset(&m_tof,0,sizeof(m_tof));
- memset(&m_rsp,0,sizeof(m_rsp));
- }
- loc_point& loc_point::reset()
- {
- memset(this,0,sizeof(*this));
- return *this;
- }
- const char* loc_point::now(char*date_str,uint64_t time) const
- {
- time_t ntime=time/1000;
- struct tm buff;
- #ifndef _WINDOWS
- const struct tm*t=localtime_r(&ntime, &buff);
- #else
- const struct tm*t=localtime(&ntime);
- #endif
- sprintf(date_str,"%d-%02d-%02d %02d:%02d:%02d.%03d" ,
- t->tm_year+1900,t->tm_mon+1,t->tm_mday,
- t->tm_hour,t->tm_min,t->tm_sec,(int)(time%1000));
- return date_str;
- }
- void loc_point::debug_out()const
- {
- char time_buff[128] = { 0 };
- debug_print_syslog(0,"t=%s,sit=%d,card=%d,ct=%d,cred=%d,tof1=%d,tof2=%d,pt=(%.f,%.f),rsp=%d,acc=%.2f,dist=%f,dist1=%f,dist2=%f",
- now(time_buff,m_time), m_sid, m_cid, m_ct, m_cred_level,
- m_tof[0], m_tof[1], x,
- y ,(int)(m_rsp[0]+m_rsp[1])/2,m_acc,
- m_dist1,m_dist,m_dist2
- );
- //debug_print_syslog(0,"[lemon_smooth_log]t=%s,sit=%d,card=%d,ct=%d,cred=%d,tof1=%d,tof2=%d,dist=%f,dir=0,pt=(%f,%f),rsp=%d,acc=%.2f,dist1=%.2f,dist2=%.2f\n",
- // now(time_buff,m_time), m_sid, m_cid, m_ct, m_cred_level,
- // m_tof[0], m_tof[1],m_dist, x,
- // y ,(int)(m_rsp[0]+m_rsp[1])/2,m_acc,
- // m_dist1,m_dist2
- // );
- }
- int loc_point::inc_cl(int cred_level)
- {
- return m_cred_level+=cred_level;
- }
- int loc_point::set_cl(int cred_level)
- {
- return m_cred_level=cred_level;
- }
- int loc_point::cl()const
- {
- return m_cred_level;
- }
- void loc_point::set_source(int cid, int site_id,const loc_info&li,const loc_info&li2)
- {
- m_cid=cid;
- m_sid=site_id;
- #ifndef _WINDOWS
- m_time=std::min(li.m_loc_time,li2.m_loc_time);
- #else
- m_time=min(li.m_loc_time,li2.m_loc_time);
- #endif
- m_ct=li.m_card_ct;
- m_acc=li.m_acc;
- m_rav=li.m_rav;
- m_tof[li.m_ant_id]=li.m_tof;
- m_tof[li2.m_ant_id]=li2.m_tof;
- m_rsp[li.m_ant_id]=li.m_card_sp;
- m_rsp[li2.m_ant_id]=li2.m_card_sp;
- m_step=0;
- m_card_type=li.m_card_type;
- }
- void loc_point::set_source(int cid, int site_id,const loc_info&li)
- {
- m_cid=cid;
- m_sid=site_id;
- m_time=li.m_loc_time;
- m_ct=li.m_card_ct;
- m_acc=li.m_acc;
- m_rav=li.m_rav;
- m_tof[li.m_ant_id]=li.m_tof;
- m_rsp[li.m_ant_id]=li.m_card_sp;
- m_tof[li.m_ant_id?0:1]=0;
- m_rsp[li.m_ant_id?0:1]=0;
- m_step=0;
- m_card_type=li.m_card_type;
- }
- NAMESPACE_POINT_END(NAMESPACE_POINT)
|