|
@@ -1929,7 +1929,7 @@ void Card::get_coordinate( int cnt )
|
|
|
this->output_y = this->y;
|
|
|
}
|
|
|
|
|
|
- if ((isNeedWrited || nStartLocateCounts<6) && m_nCalcSyncNum > 0)
|
|
|
+ if ((isNeedWrited || nStartLocateCounts<6) && m_nCalcSyncNum > 0 && ret == 0)
|
|
|
{
|
|
|
std::string flag1 = is_fit_pos?"Y":"N";
|
|
|
int nSource1 = 1;
|
|
@@ -3938,6 +3938,9 @@ int Card::DiscreteLocate(int cnt)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ /*originCellId = 0;
|
|
|
+ originCellReaderName = "";*/
|
|
|
+
|
|
|
std::shared_ptr<POS> pos = std::make_shared<POS>();
|
|
|
//3.算法定位
|
|
|
std::vector<std::shared_ptr<POS>> udm_pos;
|
|
@@ -3948,21 +3951,44 @@ int Card::DiscreteLocate(int cnt)
|
|
|
//b.可能有解,但解不正确,比如解的位置在4727,-100,但选出的解是4727,-200
|
|
|
ret = ChooseOneSolution(pRdm, udm_pos, pos);
|
|
|
SaveOriginDataBeforeFilter(pos);
|
|
|
+ if (ret)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
bool bRet = false;
|
|
|
bRet = LocateAlgorithm::IsOnMap(pos,pTdoaReaderPathMap);
|
|
|
if (!bRet)
|
|
|
{
|
|
|
return 1;
|
|
|
}
|
|
|
+ if (card_id == "0020000001024" && time_stamp_cal == 1980)
|
|
|
+ {
|
|
|
+ int aa = 1;
|
|
|
+ aa = his_cell.size();
|
|
|
+ }
|
|
|
if (ret)
|
|
|
{
|
|
|
+ if (his_cell.size() < 5)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
//根据上一次数据计算格子数,并根据上一次方向进行偏移
|
|
|
- double y = 0;
|
|
|
- y = fit_k*this->time_stamp_cal + fit_b;
|
|
|
+ //double y = 0;
|
|
|
+ //std::list<std::shared_ptr<Cell>>::iterator it = his_cell.begin();
|
|
|
+
|
|
|
+ //y = fit_k*(this->time_stamp_cal - (*it)->card_stamp_time + 1) + fit_b;
|
|
|
|
|
|
- int nCellId = int(y);
|
|
|
- //将新格子的信息除了格子id信息
|
|
|
- cell = FindCell(curCellReaderName,nCellId);
|
|
|
+ //int nCellId = int(y);
|
|
|
+ ////将新格子的信息除了格子id信息
|
|
|
+ //cell = FindCell(curCellReaderName,nCellId);
|
|
|
+ //如果从多解中未选出解,则按上一次格子的步进匀速运动
|
|
|
+ int nStep = 1;
|
|
|
+ if (last_cell->nStep > 1)
|
|
|
+ {
|
|
|
+ nStep = last_cell->nStep;
|
|
|
+ }
|
|
|
+ std::shared_ptr<Cell> cell = GetNextCell(last_cell,nIncrease,nStep,nullptr);
|
|
|
+ cell->originId = cell->id;
|
|
|
}else{
|
|
|
std::shared_ptr<POS> tmp_pos = std::make_shared<POS>();
|
|
|
//获取分站信息
|
|
@@ -3971,118 +3997,178 @@ int Card::DiscreteLocate(int cnt)
|
|
|
|
|
|
if (ret == 0)
|
|
|
{
|
|
|
+ //将坐标转为格子信息
|
|
|
cell = Position2Cell(tmp_pos);
|
|
|
if (cell)
|
|
|
{
|
|
|
originCellId = cell->id;
|
|
|
originCellReaderName = cell->strSubjectReader;
|
|
|
cell->card_stamp_time = time_stamp_cal;
|
|
|
+ cell->originId = cell->id;
|
|
|
+ cell->strOriginReaderName = cell->strSubjectReader;
|
|
|
+ nStartLocateCounts++;
|
|
|
|
|
|
- if (his_cell.size() > 100)
|
|
|
+ /*if (his_cell.size() > 100)
|
|
|
{
|
|
|
- his_cell.pop_front();
|
|
|
- }
|
|
|
+ his_cell.pop_front();
|
|
|
+ }*/
|
|
|
|
|
|
int cellIdOffset = 0;
|
|
|
- string name = "";
|
|
|
int diff_ct = 0;
|
|
|
int thre_value = 0;
|
|
|
+ bool isAdded = false;
|
|
|
+ string name = "";
|
|
|
|
|
|
if (!is_algo_first_location)
|
|
|
{
|
|
|
+ //不是第一次定位,需要判断是否大跳
|
|
|
if (last_cell)
|
|
|
{
|
|
|
- name = last_cell->strSubjectReader;
|
|
|
+ //name = last_cell->strSubjectReader;
|
|
|
+ name = last_cell->strOriginReaderName;
|
|
|
diff_ct = abs(cell->card_stamp_time - last_cell->card_stamp_time);
|
|
|
}
|
|
|
- if (cell->strSubjectReader == name)
|
|
|
+ //判断当前格子和上一次格子是否在两相同的分站之间
|
|
|
+ //if (cell->strSubjectReader == name)
|
|
|
+ if (cell->strOriginReaderName == name)
|
|
|
{
|
|
|
- cellIdOffset = ceil(abs(cell->id - last_cell->id));
|
|
|
+ //相同,则直接用格子id相减
|
|
|
+ //cellIdOffset = ceil(abs(cell->id - last_cell->id));
|
|
|
+ //相同,使用格子的原始id相减
|
|
|
+ cellIdOffset = ceil(abs(cell->originId - last_cell->originId));
|
|
|
}
|
|
|
else{
|
|
|
+ //不相同,通过计算两次位移之间的距离d,并用d除以格子的长度计算格子偏移数
|
|
|
double distance = sqrt(pow(tmp_pos->cx - this->x,2) + pow(tmp_pos->cy - this->y,2)) * map_scale;
|
|
|
cellIdOffset = ceil(distance / CELL_WIDTH);
|
|
|
}
|
|
|
- //允许调整按ct号的最大格子数
|
|
|
|
|
|
+ //允许调整按ct号的最大格子数
|
|
|
thre_value = MAX_CELL_FORWARD_JUMP;
|
|
|
if (diff_ct > 0)
|
|
|
{
|
|
|
thre_value = MAX_CELL_FORWARD_JUMP*diff_ct;
|
|
|
}
|
|
|
|
|
|
+ //判断此次格子和上一次格子之间存在的格子数是否超过阈值
|
|
|
if (cellIdOffset < thre_value){
|
|
|
- his_cell.push_back(cell);
|
|
|
+ //his_cell.push_back(cell);
|
|
|
+ //没超过,加入到队列内计算
|
|
|
+ colourfulCloudsChasingTheMoon(cell,his_cell);
|
|
|
+ isAdded = true;
|
|
|
}
|
|
|
- }else{
|
|
|
- his_cell.push_back(cell);
|
|
|
- }
|
|
|
|
|
|
- if (his_cell.size() > 4)
|
|
|
- {
|
|
|
- if (cellIdOffset > thre_value)
|
|
|
- {
|
|
|
- //根据上一次数据计算格子数,并根据上一次方向进行偏移
|
|
|
- double y = 0;
|
|
|
- y = fit_k*this->time_stamp_cal + fit_b;
|
|
|
-
|
|
|
- int nCellId = int(y);
|
|
|
- //将新格子的信息除了格子id信息
|
|
|
- cell = FindCell(curCellReaderName,nCellId);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (his_cell.size() > 4)
|
|
|
{
|
|
|
- double ctArray[5] = {0.0};
|
|
|
- double cidArray[5] = {0};
|
|
|
-
|
|
|
- //获取新5个元素的值
|
|
|
- int i = 4;
|
|
|
- for (std::list<std::shared_ptr<Cell>>::reverse_iterator rit = his_cell.rbegin();rit != his_cell.rend();++rit)
|
|
|
+ if (cellIdOffset > thre_value)
|
|
|
{
|
|
|
- ctArray[i] = (*rit)->card_stamp_time;
|
|
|
- cidArray[i] = (*rit)->id;
|
|
|
- i--;
|
|
|
- if (i<0)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ int tmpOriginId = 0;
|
|
|
+ std::string tmpOriginReaderName = "";
|
|
|
+ tmpOriginId = cell->originId;
|
|
|
+ tmpOriginReaderName = cell->strOriginReaderName;
|
|
|
|
|
|
- //第五点和前4点拟合的直线方程y = kx + b的k,b
|
|
|
- Fit f;
|
|
|
- f.linearFit(ctArray,cidArray,5,true);
|
|
|
- double k = f.getSlope();
|
|
|
- double b = f.getIntercept();
|
|
|
- //取得垂直线的k
|
|
|
- /*double k1 = -1.0/k;
|
|
|
- double b1 = cidArray[4] - k1*ctArray[4];*/
|
|
|
+ //根据上一次数据计算格子数,并根据上一次方向进行偏移
|
|
|
+ double y = 0;
|
|
|
+ std::list<std::shared_ptr<Cell>>::iterator it = his_cell.begin();
|
|
|
|
|
|
- fit_k = k;
|
|
|
- fit_b = b;
|
|
|
+ y = fit_k*(this->time_stamp_cal - (*it)->card_stamp_time + 1) + fit_b;
|
|
|
|
|
|
- if (f.getR()!=1)
|
|
|
- {
|
|
|
- if (abs(k) < 5 && f.getR() < 0.55)
|
|
|
- {
|
|
|
- *cell = *last_cell;
|
|
|
- }
|
|
|
- else
|
|
|
+ int nCellId =0 ;
|
|
|
+ std::string strReaderName = "";
|
|
|
+ if ((*it)->strOriginReaderName != cell->strOriginReaderName)
|
|
|
{
|
|
|
- double y = fit_k*ctArray[4] + b;
|
|
|
-
|
|
|
- int newCellId = LocateAlgorithm::round(y);
|
|
|
-
|
|
|
- //将新格子id进行更新
|
|
|
- if (newCellId < mpCellPath->find(originCellReaderName)->second.size())
|
|
|
- {
|
|
|
- //cell->id = newCellId;
|
|
|
- cell = FindCell(originCellReaderName,newCellId);
|
|
|
- }else{
|
|
|
- TRACE(_T("cell id is more bigger.\r\n"));
|
|
|
+ int nRealId = 0;
|
|
|
+ nCellId = LocateAlgorithm::round(y);
|
|
|
+ //换基站了
|
|
|
+ int first_min = (*it)->minReaderId; //first_cell_temp对应的最小分站
|
|
|
+ int first_max = (*it)->maxReaderId; //first_cell_temp对应的最大分站
|
|
|
+ int cell_min = cell->minReaderId; //cell对应的最小分站
|
|
|
+ int cell_max = cell->maxReaderId; //cell对应的最大分站
|
|
|
+
|
|
|
+ if(first_min == cell_min){
|
|
|
+ //nRealId = nCellId;
|
|
|
+ if (nCellId == 0)
|
|
|
+ {
|
|
|
+ nRealId = 1;
|
|
|
+ strReaderName = cell->strSubjectReader;
|
|
|
+ }else if(nCellId > 0){
|
|
|
+ nRealId = nCellId;
|
|
|
+ strReaderName = (*it)->strSubjectReader;
|
|
|
+ }else if(nCellId < 0){
|
|
|
+ nRealId = abs(nCellId);
|
|
|
+ strReaderName = cell->strSubjectReader;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(first_min == cell_max){
|
|
|
+ //nRealId = mpCellPath->find(cell->strSubjectReader)->second.size() - (nCellId - (*it)->id) + 1;
|
|
|
+ //nRealId = mpCellPath->find(cell->strOriginReaderName)->second.size() - (nCellId - (*it)->id) + 1;
|
|
|
+ if (nCellId == 0)
|
|
|
+ {
|
|
|
+ nRealId = mpCellPath->find(cell->strSubjectReader)->second.size();
|
|
|
+ strReaderName = cell->strSubjectReader;
|
|
|
+ }else if(nCellId > 0){
|
|
|
+ nRealId = nCellId;
|
|
|
+ strReaderName = (*it)->strSubjectReader;
|
|
|
+ }else if(nCellId < 0){
|
|
|
+ nRealId = mpCellPath->find(cell->strSubjectReader)->second.size() - abs(nCellId);
|
|
|
+ strReaderName = cell->strSubjectReader;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(first_max == cell_min){
|
|
|
+ //nRealId = nCellId - mpCellPath->find((*it)->strSubjectReader)->second.size();
|
|
|
+ //nRealId = nCellId - mpCellPath->find((*it)->strOriginReaderName)->second.size();
|
|
|
+ //只存在nCellId>0的情况,但还要区分它是否大于所在分站的总格子数
|
|
|
+ if (nCellId >= mpCellPath->find((*it)->strSubjectReader)->second.size())
|
|
|
+ {
|
|
|
+ nRealId = nCellId - mpCellPath->find(cell->strSubjectReader)->second.size();
|
|
|
+ if (nRealId == 0)
|
|
|
+ {
|
|
|
+ nRealId = 1;
|
|
|
+ }
|
|
|
+ strReaderName = cell->strSubjectReader;
|
|
|
+ }else if(nCellId < mpCellPath->find((*it)->strSubjectReader)->second.size()){
|
|
|
+ nRealId = nCellId;
|
|
|
+ strReaderName = (*it)->strSubjectReader;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(first_max == cell_max){
|
|
|
+ //nRealId = (mpCellPath->find(cell->strSubjectReader))->second.size() - (nCellId - ((mpCellPath->find((*it)->strSubjectReader))->second.size() - (*it)->id)) + 1;
|
|
|
+ //nRealId = (mpCellPath->find(cell->strOriginReaderName))->second.size() - (nCellId - ((mpCellPath->find((*it)->strOriginReaderName))->second.size() - (*it)->id)) + 1;
|
|
|
+ if (nCellId >= mpCellPath->find((*it)->strSubjectReader)->second.size())
|
|
|
+ {
|
|
|
+ nRealId = mpCellPath->find(cell->strOriginReaderName)->second.size() - (nCellId - mpCellPath->find((*it)->strSubjectReader)->second.size());
|
|
|
+ strReaderName = cell->strOriginReaderName;
|
|
|
+ }else if(nCellId < mpCellPath->find((*it)->strSubjectReader)->second.size()){
|
|
|
+ nRealId = nCellId;
|
|
|
+ strReaderName = (*it)->strSubjectReader;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nCellId = nRealId;
|
|
|
+ }else{
|
|
|
+ nCellId = LocateAlgorithm::round(y);
|
|
|
+ //strReaderName = cell->strSubjectReader;
|
|
|
+ strReaderName = cell->strOriginReaderName;
|
|
|
+ }
|
|
|
+ //将新格子的信息除了格子id信息
|
|
|
+ cell = FindCell(strReaderName,nCellId);
|
|
|
+ if (cell)
|
|
|
+ {
|
|
|
+ cell->originId = tmpOriginId;
|
|
|
+ cell->strOriginReaderName = tmpOriginReaderName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (!isAdded)
|
|
|
+ {
|
|
|
+ colourfulCloudsChasingTheMoon(cell,his_cell);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ //his_cell.push_back(cell);
|
|
|
+ //如果是第一次定位结果,调用以下函数将cell放入到his_cell队列中
|
|
|
+ colourfulCloudsChasingTheMoon(cell,his_cell);
|
|
|
}
|
|
|
}else{
|
|
|
originCellId = 0;
|
|
@@ -4387,9 +4473,11 @@ std::shared_ptr<Cell> Card::FindCell(std::string strReaderName,int cellid)
|
|
|
cell->left = (*it)->left;
|
|
|
cell->bottom = (*it)->bottom;
|
|
|
cell->right = (*it)->right;
|
|
|
+ cell->strSubjectReader = (*it)->strSubjectReader;
|
|
|
cell->isHasBranch = (*it)->isHasBranch;
|
|
|
cell->maxReaderId = (*it)->maxReaderId;
|
|
|
cell->minReaderId = (*it)->minReaderId;
|
|
|
+ cell->realId = cellid;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -5114,10 +5202,6 @@ int Card::SaveCardAlgoData(std::shared_ptr<Cell>& cell)
|
|
|
curCellReaderName = cell->strSubjectReader;
|
|
|
curCellId = cell->id;
|
|
|
|
|
|
- if (is_algo_first_location)
|
|
|
- {
|
|
|
- is_algo_first_location = false;
|
|
|
- }
|
|
|
//更新格子信息
|
|
|
cell->nStep = nStep;
|
|
|
cell->dataSource = 1;
|
|
@@ -5169,68 +5253,31 @@ int Card::SaveCardAlgoData(std::shared_ptr<Cell>& cell)
|
|
|
locate_cells.push_back(last_cell);
|
|
|
}else
|
|
|
return 1;
|
|
|
- //::PostMessage(pMainWnd,WM_CARD_SEND_JSON,(WPARAM)this,(LPARAM)last_cell.get());
|
|
|
mu.unlock();
|
|
|
|
|
|
- if (!is_fit_pos && m_nLastLocateT != 0)
|
|
|
+ if (!is_algo_first_location)
|
|
|
{
|
|
|
//确保第一次不会进来算速度
|
|
|
if (this->x != INVALID_COORDINATE && this->y != INVALID_COORDINATE)
|
|
|
{
|
|
|
//pos为本次定位坐标,(x,y)为上一次定位坐标
|
|
|
double distance = sqrt(pow(pos->cx - this->x,2) + pow(pos->cy - this->y,2))*map_scale;
|
|
|
- this->mileage = distance;
|
|
|
+ this->mileage = distance/1000.0;
|
|
|
int nCounts = ceil(distance/CELL_WIDTH);
|
|
|
this->v = nCounts*CELL_WIDTH/(SEND_CELL_INTERVAL/1000.0);
|
|
|
this->v*=3.6;
|
|
|
}
|
|
|
- }else{
|
|
|
- this->v = this->v / 2;
|
|
|
- }
|
|
|
-
|
|
|
- if (this->v > 30)
|
|
|
- {
|
|
|
- this->v = 25;
|
|
|
}
|
|
|
|
|
|
this->x = pos->cx;
|
|
|
this->y = pos->cy;
|
|
|
this->z = 0;
|
|
|
|
|
|
- if (m_nLastLocateT != 0 && this->last_locate.x != INVALID_COORDINATE && this->last_locate.y != INVALID_COORDINATE)
|
|
|
- {
|
|
|
- if (abs(this->last_locate.x) > 1E-5 || abs(this->last_locate.y) > 1E-5)
|
|
|
- {
|
|
|
- //去除采集刚启动,last_locate的坐标为零而导致判断车辆上下行方向错误的问题
|
|
|
- //车辆上下行确定
|
|
|
- //3个条件:起点(x1,y1),终点(x2,y2)
|
|
|
- //1.x1==x2的情况下,y2>y1为下行
|
|
|
- //2.y1==y2的情况下,x1>x2为下行
|
|
|
- //3.x1>x2且y2>y1为下行
|
|
|
- //其他情况为上行
|
|
|
- int nStream = 0;
|
|
|
- if ((this->last_locate.x == this->x && this->y > this->last_locate.y)
|
|
|
- ||(this->last_locate.x > this->x && this->y == this->last_locate.y)
|
|
|
- ||(this->last_locate.x > this->x && this->y > this->last_locate.y))
|
|
|
- {
|
|
|
- nStream = DOWN_STREAM;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- nStream = UP_STREAM;
|
|
|
- }
|
|
|
- this->m_nStream = nStream;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //如果怠速,则速度置为零
|
|
|
- if (CheckIdleStatus())
|
|
|
+ if (!is_algo_first_location )
|
|
|
{
|
|
|
- this->v = 0;
|
|
|
+ this->m_nStream = GetStream(this->last_locate.x,this->last_locate.y,this->x,this->y);
|
|
|
}
|
|
|
|
|
|
- is_fit_pos = pos->is_fit;
|
|
|
-
|
|
|
this->last_locate.x = pos->cx;
|
|
|
this->last_locate.y = pos->cy;
|
|
|
this->last_locate.z = 0;
|
|
@@ -5238,6 +5285,11 @@ int Card::SaveCardAlgoData(std::shared_ptr<Cell>& cell)
|
|
|
this->m_nLastLocateT = this->m_nCalcSyncNum;
|
|
|
this->last_locate.v = this->v;
|
|
|
|
|
|
+ if (is_algo_first_location)
|
|
|
+ {
|
|
|
+ is_algo_first_location = false;
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -6653,15 +6705,22 @@ int Card::colourfulCloudsChasingTheMoon(std::shared_ptr<Cell> &cell, std::list<s
|
|
|
pY[i] = (*it)->id; //跟前者在相同基站之间
|
|
|
}else
|
|
|
{
|
|
|
- int last_min = (*first_cell)->minReaderId; //last_cell_temp对应的最小分站
|
|
|
- int last_max = (*first_cell)->maxReaderId; //last_cell_temp对应的最大分站
|
|
|
- int cell_min = (*it)->minReaderId; //cell对应的最小分站
|
|
|
- int cell_max = (*it)->maxReaderId; //cell对应的最大分站
|
|
|
+ int last_min = (*first_cell)->minReaderId; //last_cell_temp对应的最小分站
|
|
|
+ int last_max = (*first_cell)->maxReaderId; //last_cell_temp对应的最大分站
|
|
|
+ int cell_min = (*it)->minReaderId; //cell对应的最小分站
|
|
|
+ int cell_max = (*it)->maxReaderId; //cell对应的最大分站
|
|
|
if(last_min == cell_min){
|
|
|
- pY[i] = pY[i - 1] + pY[i - 1] - 1 + (*it)->id; //换基站了
|
|
|
+ //pY[i] = pY[i - 1] + pY[i - 1] - 1 + (*it)->id; //换基站了
|
|
|
+ pY[i] = 0 - (*it)->id;
|
|
|
}
|
|
|
if(last_min == cell_max){
|
|
|
- pY[i] = pY[i - 1] + pY[i - 1] - 1 + mpCellPath->find((*it)->strSubjectReader)->second.size() - (*it)->id + 1; //换基站了
|
|
|
+ //pY[i] = pY[i - 1] + pY[i - 1] - 1 + mpCellPath->find((*it)->strSubjectReader)->second.size() - (*it)->id + 1; //换基站了
|
|
|
+ int nSize = 0;
|
|
|
+ nSize = mpCellPath->find((*it)->strSubjectReader)->second.size();
|
|
|
+ int nDiff = (*it)->id - nSize;
|
|
|
+ float a = nDiff*1.0;
|
|
|
+ pY[i] = a;
|
|
|
+ //pY[i] = (*it)->id - mpCellPath->find((*it)->strSubjectReader)->second.size();
|
|
|
}
|
|
|
if(last_max == cell_min){
|
|
|
pY[i] = mpCellPath->find((*first_cell)->strSubjectReader)->second.size() + (*it)->id; //换基站了
|
|
@@ -6693,6 +6752,10 @@ int Card::colourfulCloudsChasingTheMoon(std::shared_ptr<Cell> &cell, std::list<s
|
|
|
k = vResult.at(0);
|
|
|
float b = 0.0;
|
|
|
b = vResult.at(1);
|
|
|
+
|
|
|
+ fit_k = k;
|
|
|
+ fit_b = b;
|
|
|
+
|
|
|
float Relation = 0.0;
|
|
|
Relation = vResult.at(2);
|
|
|
//如果是怠速,则当前cell的真实id=idlastcell的真实id
|
|
@@ -6707,29 +6770,89 @@ int Card::colourfulCloudsChasingTheMoon(std::shared_ptr<Cell> &cell, std::list<s
|
|
|
}
|
|
|
}else{
|
|
|
std::list<std::shared_ptr<Cell>>::reverse_iterator end_cell = myCellList.rbegin();
|
|
|
- int realId = floor(pY[0] * k + b); //考虑到有可能跨基站,处理下形成realId
|
|
|
+ //int realId = floor(pY[0] * k + b); //考虑到有可能跨基站,处理下形成realId
|
|
|
+ int realId = floor(pX[4] * k + b);
|
|
|
+ std::string strReaderName = "";
|
|
|
+ std::string tmpOriginReaderName = "";
|
|
|
+ int tmpOriginId = 0;
|
|
|
+ tmpOriginId = cell->originId;
|
|
|
+ tmpOriginReaderName = cell->strOriginReaderName;
|
|
|
if ((*first_cell)->strSubjectReader == (*end_cell)->strSubjectReader){
|
|
|
- cell->realId = realId; //跟前者在相同基站之间
|
|
|
+ cell->realId = realId; //跟前者在相同基站之间
|
|
|
+ strReaderName = (*first_cell)->strSubjectReader;
|
|
|
}else
|
|
|
{
|
|
|
//换基站了
|
|
|
int first_min = (*first_cell)->minReaderId; //first_cell_temp对应的最小分站
|
|
|
int first_max = (*first_cell)->maxReaderId; //first_cell_temp对应的最大分站
|
|
|
- int cell_min = (*end_cell)->minReaderId; //cell对应的最小分站
|
|
|
- int cell_max = (*end_cell)->maxReaderId; //cell对应的最大分站
|
|
|
+ int cell_min = (*end_cell)->minReaderId; //cell对应的最小分站
|
|
|
+ int cell_max = (*end_cell)->maxReaderId; //cell对应的最大分站
|
|
|
if(first_min == cell_min){
|
|
|
- cell->realId = realId - pY[0];
|
|
|
+ //cell->realId = realId - pY[0];
|
|
|
+ if (realId == 0)
|
|
|
+ {
|
|
|
+ cell->realId = 1;
|
|
|
+ strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ }else if(realId > 0){
|
|
|
+ cell->realId = realId;
|
|
|
+ strReaderName = (*first_cell)->strSubjectReader;
|
|
|
+ }else{
|
|
|
+ cell->realId = abs(realId);
|
|
|
+ strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ }
|
|
|
}
|
|
|
if(first_min == cell_max){
|
|
|
- cell->realId = mpCellPath->find((*end_cell)->strSubjectReader)->second.size() - (realId - pY[0]) + 1;
|
|
|
+ if (realId == 0)
|
|
|
+ {
|
|
|
+ cell->realId = mpCellPath->find((*end_cell)->strSubjectReader)->second.size();
|
|
|
+ strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ }else if(realId > 0){
|
|
|
+ //cell->realId = mpCellPath->find((*end_cell)->strSubjectReader)->second.size() - (realId - pY[0]) + 1;
|
|
|
+ cell->realId = realId;
|
|
|
+ strReaderName = (*first_cell)->strSubjectReader;
|
|
|
+ }else{
|
|
|
+ cell->realId = mpCellPath->find((*end_cell)->strSubjectReader)->second.size() + realId;
|
|
|
+ strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ }
|
|
|
}
|
|
|
if(first_max == cell_min){
|
|
|
- cell->realId = realId - (mpCellPath->find((*first_cell)->strSubjectReader)->second.size() - pY[0]);
|
|
|
+ //cell->realId = realId - (mpCellPath->find((*first_cell)->strSubjectReader)->second.size() - pY[0]);
|
|
|
+ //cell->realId = realId - mpCellPath->find((*first_cell)->strSubjectReader)->second.size();
|
|
|
+ //strReaderName = (*first_cell)->strSubjectReader;
|
|
|
+ if (realId >= mpCellPath->find((*first_cell)->strSubjectReader)->second.size())
|
|
|
+ {
|
|
|
+ cell->realId = realId - mpCellPath->find((*first_cell)->strSubjectReader)->second.size();
|
|
|
+ if (cell->realId == 0)
|
|
|
+ {
|
|
|
+ cell->realId = 1;
|
|
|
+ }
|
|
|
+ strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ }else{
|
|
|
+ cell->realId = mpCellPath->find((*first_cell)->strSubjectReader)->second.size() - realId;
|
|
|
+ strReaderName = (*first_cell)->strSubjectReader;
|
|
|
+ }
|
|
|
}
|
|
|
if(first_max == cell_max){
|
|
|
- cell->realId = (mpCellPath->find((*end_cell)->strSubjectReader))->second.size() - (realId - ((mpCellPath->find((*first_cell)->strSubjectReader))->second.size() - pY[0])) + 1;
|
|
|
+ //cell->realId = (mpCellPath->find((*end_cell)->strSubjectReader))->second.size() - (realId - ((mpCellPath->find((*first_cell)->strSubjectReader))->second.size() - pY[0])) + 1;
|
|
|
+ //strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ if (realId >= mpCellPath->find((*first_cell)->strSubjectReader)->second.size())
|
|
|
+ {
|
|
|
+ cell->realId = mpCellPath->find((*end_cell)->strSubjectReader)->second.size() - (realId - mpCellPath->find((*first_cell)->strSubjectReader)->second.size());
|
|
|
+ strReaderName = (*end_cell)->strSubjectReader;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cell->realId = realId;
|
|
|
+ strReaderName = (*first_cell)->strSubjectReader;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+ cell = FindCell(strReaderName,cell->realId);
|
|
|
+ if (cell)
|
|
|
+ {
|
|
|
+ cell->originId = tmpOriginId;
|
|
|
+ cell->strOriginReaderName = tmpOriginReaderName;
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
cell = nullptr;
|