|
@@ -11,7 +11,8 @@
|
|
|
|
|
|
int site::index()const
|
|
|
{
|
|
|
- return m_algo+(m_num_dims<<1);
|
|
|
+ //return m_algo+(m_num_dims<<1);
|
|
|
+ return (m_algo<<4) + m_num_dims;
|
|
|
}
|
|
|
|
|
|
site::site(int id)
|
|
@@ -30,63 +31,6 @@ const algo_config&site::config()const
|
|
|
return g_config[index()];
|
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
-bool site::check_timestamp(const char*tm_buf)
|
|
|
-{
|
|
|
- //秒、分、时、天、周、月、年
|
|
|
-
|
|
|
- struct tm t={0};
|
|
|
-
|
|
|
-
|
|
|
- char buf[6];
|
|
|
- buf[0]=tm_buf[6];
|
|
|
- buf[1]=tm_buf[5];
|
|
|
- buf[2]=tm_buf[3];
|
|
|
- buf[3]=tm_buf[2];
|
|
|
- buf[4]=tm_buf[1];
|
|
|
- buf[5]=tm_buf[0];
|
|
|
-
|
|
|
- t.tm_year=buf[0]+100;
|
|
|
- t.tm_mon=buf[1]-1;
|
|
|
- t.tm_mday=buf[2];
|
|
|
- t.tm_hour=buf[3];
|
|
|
- t.tm_min=buf[4];
|
|
|
- t.tm_sec=buf[5];
|
|
|
-
|
|
|
- time_t now=time(0);
|
|
|
- time_t site_tm=mktime(&t);
|
|
|
- int off=abs(now-site_tm);
|
|
|
-
|
|
|
- if(off>0)
|
|
|
- {
|
|
|
- off=log(off)/log(2);
|
|
|
- }
|
|
|
-
|
|
|
- m_timeoff_count[off]++;
|
|
|
-
|
|
|
- if(m_package_count++ % 300 ==0 )
|
|
|
- {
|
|
|
- std::ostringstream stm;
|
|
|
- for(uint32_t i=0;i<m_timeoff_count.size();i++)
|
|
|
- {
|
|
|
- if(m_timeoff_count[i]==0)
|
|
|
- continue;
|
|
|
-
|
|
|
- stm<<"("<<i<<":"<<m_timeoff_count[i]<<"),";
|
|
|
- }
|
|
|
-
|
|
|
- log_info("site-time-stat:site_id=%d,%s",m_id,stm.str().c_str());
|
|
|
- }
|
|
|
-
|
|
|
- if(memcmp(m_timestamp,buf,6)<=0)
|
|
|
- {
|
|
|
- memcpy(m_timestamp,buf,6);
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
void ant::set_path(const std::vector<line_v>&v_line,std::vector<line_v>::const_iterator itm)
|
|
|
{
|
|
|
auto it=itm;
|
|
@@ -275,23 +219,6 @@ bool visit_site_status::visit(std::shared_ptr<site> s)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-static void test_find_path(card_path&cp,const point&p1,const point&p2)
|
|
|
-{
|
|
|
- printf("\nfind-path: from=(%.3lf,%.3lf),to=(%.3lf,%.3lf)\n",p1.x,p1.y,p2.x,p2.y);
|
|
|
- std::vector<point> rc=cp.find_path(p1,p2);
|
|
|
- for(uint32_t i=0;i<rc.size();i++)
|
|
|
- printf("x=%.3lf,y=%.3lf\n",rc[i].x,rc[i].y);
|
|
|
-}
|
|
|
-
|
|
|
-//static void test_find_poss_path(const card_path&cp ,const point&from)
|
|
|
-//{
|
|
|
-// log_info("\nfind-poss_path: from=(%.3lf,%.3lf)\n",from.x,from.y);
|
|
|
-// std::vector<line_v> rc=cp.find_possible_path(from,3);
|
|
|
-// for(uint32_t i=0;i<rc.size();i++)
|
|
|
-// {
|
|
|
-// log_info("poss path from=(%.3lf,%.3lf) to=(%.3lf,%.3lf)\n", rc[i][0].x,rc[i][0].y, rc[i][1].x,rc[i][1].y);
|
|
|
-// }
|
|
|
-//}
|
|
|
void sit_list::read_ant_path(int id)
|
|
|
{
|
|
|
std::string sql = "SELECT reader_id,tof_flag,b_x,b_y,b_z,e_x,e_y,e_z,spacing_ratio FROM dat_reader_path_tof_n";
|
|
@@ -451,22 +378,13 @@ void sit_list::read_ant_path(int id)
|
|
|
}
|
|
|
|
|
|
card_path::init();
|
|
|
-
|
|
|
- test_find_path(card_path::inst(),point(4784.50,-25.49),point(4784.50,-28.78));
|
|
|
- test_find_path(card_path::inst(),point(4727,-8.06),point(2200,-75));
|
|
|
- test_find_path(card_path::inst(),point(4727,-8.06),point(2600,-100));
|
|
|
- test_find_path(card_path::inst(),point(2768.50,-75.00),point(2768.50,-161.58));
|
|
|
- test_find_path(card_path::inst(),point(4727,-8.06),point(5427.04,-304.02));
|
|
|
- test_find_path(card_path::inst(),point(4714.70,-8.06),point(5427.04,-304.02));
|
|
|
- test_find_path(card_path::inst(),point(4727,-75),point(2200,-75));
|
|
|
- test_find_path(card_path::inst(),point(4683.625,56.988),point(2200,-75));
|
|
|
}
|
|
|
|
|
|
void sit_list::init_site(const std::string &ids /*=""*/)
|
|
|
{
|
|
|
std::string sql = "SELECT reader_id, reader_type_id, dat_reader.map_id, \
|
|
|
area_id, device_type_id, dimension, dat_map.scale,need_power_alarm\
|
|
|
- ,x,y \
|
|
|
+ ,x,y, pdoa_offset, pdoa_direction\
|
|
|
FROM dat_reader, dat_map where \
|
|
|
dat_reader.map_id=dat_map.map_id and state=0";
|
|
|
|
|
@@ -533,20 +451,25 @@ void sit_list::init_site(const std::string &ids /*=""*/)
|
|
|
site_ptr->m_map_id = map_id;
|
|
|
site_ptr->m_area_id = area_id;
|
|
|
site_ptr->m_power_check_enable=power_alarm;
|
|
|
-
|
|
|
site_ptr->m_device_type_id = device_type_id;
|
|
|
-
|
|
|
- site_ptr->m_dimension = dimension;
|
|
|
+ site_ptr->m_num_dims = dimension;
|
|
|
site_ptr->m_scale = scale;
|
|
|
site_ptr->create_area();
|
|
|
|
|
|
-
|
|
|
double x=0,y=0;
|
|
|
DBRes.GetField( "x",x, Error );
|
|
|
DBRes.GetField( "y",y, Error );
|
|
|
|
|
|
- log_info ("site_position:site=%d,x=%.2lf,y=%.2lf,%d",reader_id,x,y,area_id);
|
|
|
+ double offset = 0.0;
|
|
|
+ DBRes.GetField("pdoa_offset", offset, Error);
|
|
|
+ site_ptr->m_pdoa_offset = offset;
|
|
|
+
|
|
|
+ int direction = 0;
|
|
|
+ if(DBRes.GetField("pdoa_direction", direction, Error)){
|
|
|
+ site_ptr->m_pdoa_direction = direction;
|
|
|
+ }
|
|
|
|
|
|
+ log_info ("site_position: site=%d, x=%.2lf, y=%.2lf, area_id=%d, m_scale=%.2f, pdoa_offset=%.2f, pdoa_direction=%d", reader_id, x, y, area_id, scale, offset, direction);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -604,7 +527,10 @@ void sit_list::read_sit_list(int id)
|
|
|
double z= 0;
|
|
|
DBRes.GetField( "z",z, Error );
|
|
|
|
|
|
- log_info("ant-position:reader=%d,antid=%d,x=%.2lf,y=%.2lf",reader_id,antid,x,y);
|
|
|
+ double _angle = 0;
|
|
|
+ DBRes.GetField("angle", _angle, Error);
|
|
|
+
|
|
|
+ log_info("ant-position:reader=%d, antid=%d, x=%.2lf, y=%.2lf, angle=%.2f", reader_id, antid, x, y, _angle);
|
|
|
|
|
|
if(-1 == id)
|
|
|
{
|
|
@@ -614,6 +540,7 @@ void sit_list::read_sit_list(int id)
|
|
|
continue;
|
|
|
site_ptr->m_ant[antid].m_id = antenna_id;
|
|
|
site_ptr->m_ant[antid].set(x,-y);
|
|
|
+ site_ptr->m_ant[antid].m_angle = _angle;
|
|
|
site_ptr->set_ex();
|
|
|
}
|
|
|
else
|
|
@@ -622,6 +549,7 @@ void sit_list::read_sit_list(int id)
|
|
|
if(site_ptr)
|
|
|
{
|
|
|
site_ptr->m_ant[antid].set(x,-y);
|
|
|
+ site_ptr->m_ant[antid].m_angle = _angle;
|
|
|
site_ptr->set_ex();
|
|
|
}
|
|
|
log_info("基础数据 增加或修改天线成功:天线id:%d,分站id:%d",id,reader_id);
|