123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- #pragma
- #ifndef YASERVER_CELL_STRUCT_H_
- #define YASERVER_CELL_STRUCT_H_
- #define CELL_WIDTH 0.3 //格子宽度,单位为米
- #define SEND_CELL_INTERVAL 500
- #define BRANCH_RANGE 6 //分支确认范围,单位为米
- #define LAST_V_POWER 0.7
- #define THIS_V_POWER 0.3
- #define MAX_CHANGE_DIR_COUNTS 5
- #define MAX_CELL_FORWARD_JUMP 20 //15
- #define MAX_IDLE_CELL_THRE 2 //怠速单员格阈值
- #define FIT_RELIABILITY 0.7 //拟合数据权限
- #define MAX_FIT_DATA_COUNTS 5 //最大拟合数据统计数
- #define MAX_IDLING_HISTORY_DATA_COUNTS 15 //最大历史数据队列, 用于怠速判断
- #define MAX_DIRECTION_COUNTS 5 //最大方向统计数
- struct point{
- double x;
- double y;
- point(){
- x = y = 0;
- }
- point& operator=(point& p){
- x = p.x;
- y = p.y;
- return *this;
- }
- };
- struct ReaderInfo{
- int reader_id;
- double x;
- double y;
- double z;
- ReaderInfo(){
- reader_id = 0;
- x = y = z =0;
- }
- ReaderInfo& operator=(ReaderInfo& v){
- reader_id = v.reader_id;
- x = v.x;
- y = v.y;
- z = v.z;
- return *this;
- }
- bool operator<(ReaderInfo& v) const{
- if (abs(x-v.x) < 1E-2)
- {
- if (y < v.y)
- {
- return true;
- }else{
- return false;
- }
- }else{
- if (x < v.x)
- {
- return true;
- }else{
- return false;
- }
- }
- }
- };
- //格子信息20170705
- class Cell{
- public:
- Cell(){
- strSubjectReader = "";
- strOriginReaderName = "";
- id = 0;
- nStep = 0;
- minReaderId = maxReaderId = 0;
- dataSource = 0;
- card_stamp_time = 0;
- isHasBranch = false;
- isFit = isOverThre = false;
- isChangePath = false;
- top.x = top.y = bottom.x = bottom.y = left.x = left.y = right.x = right.y = 0;
- originId = 0;
- ::GetLocalTime(&deal_time);
- ::GetLocalTime(&interval_time);
- }
- ~Cell(){}
- public:
- int id; //格子id
- int minReaderId; //此格子所属的分站路径中的最小分站
- int maxReaderId; //此格子所属的分站路径中的最大分站
- int originMinReaderId;
- int originMaxReaderId;
- int nStep; //距离上一次格子的步进
- //数据来源,0为未知,1为定位算法生成,2为定时器内生成, 3 算法调整值, 后续流程可能被替换为后续定义的具体值
- // 10以后算法定义
- // 10 剔除大跳野值后, 由线性拟合生成数据
- // 11 位置 position 求解失败, 多解求一解失败, 由线性拟合生成数据
- // 14 通过格子 id 判断运动方向是否相同, 不同, 判断回退次数是否小于10, 减速补值
- // 15 通过格子 id 判断运动方向是否相同, 相同后由线性拟合生成数据
- int dataSource;
- int originId; //原始定位坐标转换的原始格子id
- int card_stamp_time; //卡的ct号
- std::string strSubjectReader; //格子所属分站名称
- std::string strOriginReaderName; //原始格子所属分站名,通过原始格子号+此属性,可以唯一确定格子的中心点坐标
- point top,bottom,left,right; //格子的4个顶点位置
-
- bool isHasBranch; //此格子附近是否有分支
- bool isFit; //此格子是否是拟合出的结果
- bool isOverThre; //是否越界,或者大跳
- bool isChangePath; //是否切换分站
- SYSTEMTIME deal_time; //格子的处理时间
- SYSTEMTIME interval_time; //格子的0,500ms间隔时间
- int realId;
- public:
- double getX(){
- return (this->top.x + this->bottom.x)/2;
- }
- double getY(){
- return (this->top.y + this->bottom.y)/2;
- }
- public:
- Cell& operator=(Cell&c){
- id = c.id;
- nStep = c.nStep;
- minReaderId = c.minReaderId;
- maxReaderId = c.maxReaderId;
- originMinReaderId = c.originMinReaderId;
- originMaxReaderId = c.originMaxReaderId;
- strSubjectReader = c.strSubjectReader;
- dataSource = c.dataSource;
- top = c.top;
- bottom = c.bottom;
- left = c.left;
- right = c.right;
- isHasBranch = c.isHasBranch;
- isFit = c.isFit;
- card_stamp_time = c.card_stamp_time;
- isOverThre = c.isOverThre;
- isChangePath = c.isChangePath;
- deal_time = c.deal_time;
- originId = c.originId;
- strOriginReaderName = c.strOriginReaderName;
- realId = c.realId;
- return *this;
- }
- };
- #endif // !YASERVER_CELL_STRUCT_H_
|