|
@@ -4855,31 +4855,14 @@ std::string CYAServerDlg::get_json_position()
|
|
pos_card[JSON_KEY_SPEED] = CFunctions::round(it->second->get_speed(),2);
|
|
pos_card[JSON_KEY_SPEED] = CFunctions::round(it->second->get_speed(),2);
|
|
pos_cards.append(pos_card[JSON_KEY_SPEED]);
|
|
pos_cards.append(pos_card[JSON_KEY_SPEED]);
|
|
|
|
|
|
- //landmark ID
|
|
|
|
- _point card_point(it->second->x, it->second->y, it->second->z);
|
|
|
|
- int landmark_id = GetLandmarkID(card_point);
|
|
|
|
- it->second->landmark_id = landmark_id;
|
|
|
|
- pos_card[JSON_KEY_LANDMARK_ID] = landmark_id;
|
|
|
|
|
|
+ pos_card[JSON_KEY_LANDMARK_ID] = it->second->landmark_id;
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_ID]);
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_ID]);
|
|
|
|
|
|
//directory ID
|
|
//directory ID
|
|
- _point landmark_point;
|
|
|
|
- LandmarkInfoMap::iterator itLandmark = mp_landmark_list.find(landmark_id);
|
|
|
|
- if(itLandmark != mp_landmark_list.end())
|
|
|
|
- {
|
|
|
|
- landmark_point.x = itLandmark->second->x;
|
|
|
|
- landmark_point.y = itLandmark->second->y;
|
|
|
|
- landmark_point.z = itLandmark->second->z;
|
|
|
|
- }
|
|
|
|
- int directory_id = GetDirectoryType(card_point, landmark_point, it->second->map_id);
|
|
|
|
- it->second->directory = directory_id;
|
|
|
|
- pos_card[JSON_KEY_DIRECTORY_ID] = directory_id;
|
|
|
|
|
|
+ pos_card[JSON_KEY_DIRECTORY_ID] = it->second->directory;
|
|
pos_cards.append(pos_card[JSON_KEY_DIRECTORY_ID]);
|
|
pos_cards.append(pos_card[JSON_KEY_DIRECTORY_ID]);
|
|
|
|
|
|
- //distance
|
|
|
|
- double distance = GetDistance(card_point, landmark_point) * it->second->map_scale;
|
|
|
|
- it->second->landmark_dis = distance;
|
|
|
|
- pos_card[JSON_KEY_LANDMARK_DIS] = distance;
|
|
|
|
|
|
+ pos_card[JSON_KEY_LANDMARK_DIS] = it->second->landmark_dis;
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_DIS]);
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_DIS]);
|
|
|
|
|
|
if(!pos_cards.isNull()){
|
|
if(!pos_cards.isNull()){
|
|
@@ -4928,33 +4911,6 @@ std::string CYAServerDlg::get_json_card_position(std::shared_ptr<Card> card)
|
|
pos_cards.append(pos_card[JSON_KEY_CORDINATE_Y]);
|
|
pos_cards.append(pos_card[JSON_KEY_CORDINATE_Y]);
|
|
}
|
|
}
|
|
|
|
|
|
- /*x,y×řąę
|
|
|
|
- switch(card->m_nOutputPosState){
|
|
|
|
- case 0:
|
|
|
|
- LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_231);
|
|
|
|
- pos_card[JSON_KEY_CORDINATE_X] = CFunctions::round(card->x, 2);
|
|
|
|
- pos_cards.append(pos_card[JSON_KEY_CORDINATE_X]);
|
|
|
|
- pos_card[JSON_KEY_CORDINATE_Y] = CFunctions::round(card->y, 2);
|
|
|
|
- pos_cards.append(pos_card[JSON_KEY_CORDINATE_Y]);
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_232);
|
|
|
|
- pos_card[JSON_KEY_CORDINATE_X] = CFunctions::round(card->left_x, 2);
|
|
|
|
- pos_cards.append(pos_card[JSON_KEY_CORDINATE_X]);
|
|
|
|
- pos_card[JSON_KEY_CORDINATE_Y] = CFunctions::round(card->left_y, 2);
|
|
|
|
- pos_cards.append(pos_card[JSON_KEY_CORDINATE_Y]);
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_233);
|
|
|
|
- pos_card[JSON_KEY_CORDINATE_X] = CFunctions::round(card->right_x, 2);
|
|
|
|
- pos_cards.append(pos_card[JSON_KEY_CORDINATE_X]);
|
|
|
|
- pos_card[JSON_KEY_CORDINATE_Y] = CFunctions::round(card->right_y, 2);
|
|
|
|
- pos_cards.append(pos_card[JSON_KEY_CORDINATE_Y]);
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
int ms = 1000; //תΪms
|
|
int ms = 1000; //תΪms
|
|
//Č랎ʹźä´Á
|
|
//Č랎ʹźä´Á
|
|
double t = *((int64_t*)&card->down_time)*ms;
|
|
double t = *((int64_t*)&card->down_time)*ms;
|
|
@@ -5008,29 +4964,14 @@ std::string CYAServerDlg::get_json_card_position(std::shared_ptr<Card> card)
|
|
pos_cards.append(pos_card[JSON_KEY_SPEED]);
|
|
pos_cards.append(pos_card[JSON_KEY_SPEED]);
|
|
|
|
|
|
//landmark ID
|
|
//landmark ID
|
|
- _point card_point(card->x, card->y, card->z);
|
|
|
|
- int landmark_id = GetLandmarkID(card_point);
|
|
|
|
- card->landmark_id = landmark_id;
|
|
|
|
- pos_card[JSON_KEY_LANDMARK_ID] = landmark_id;
|
|
|
|
|
|
+ pos_card[JSON_KEY_LANDMARK_ID] = card->landmark_id;
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_ID]);
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_ID]);
|
|
|
|
|
|
//directory ID
|
|
//directory ID
|
|
- _point landmark_point;
|
|
|
|
- LandmarkInfoMap::iterator itLandmark = mp_landmark_list.find(landmark_id);
|
|
|
|
- if(itLandmark != mp_landmark_list.end())
|
|
|
|
- {
|
|
|
|
- landmark_point.x = itLandmark->second->x;
|
|
|
|
- landmark_point.y = itLandmark->second->y;
|
|
|
|
- landmark_point.z = itLandmark->second->z;
|
|
|
|
- }
|
|
|
|
- int directory_id = GetDirectoryType(card_point, landmark_point, card->map_id);
|
|
|
|
- card->directory = directory_id;
|
|
|
|
- pos_card[JSON_KEY_DIRECTORY_ID] = directory_id;
|
|
|
|
|
|
+ pos_card[JSON_KEY_DIRECTORY_ID] = card->directory;
|
|
pos_cards.append(pos_card[JSON_KEY_DIRECTORY_ID]);
|
|
pos_cards.append(pos_card[JSON_KEY_DIRECTORY_ID]);
|
|
//distance
|
|
//distance
|
|
- double distance = GetDistance(card_point, landmark_point) * card->map_scale;
|
|
|
|
- card->landmark_dis = distance;
|
|
|
|
- pos_card[JSON_KEY_LANDMARK_DIS] = distance;
|
|
|
|
|
|
+ pos_card[JSON_KEY_LANDMARK_DIS] = card->landmark_dis;
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_DIS]);
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_DIS]);
|
|
|
|
|
|
if(!pos_cards.isNull()){
|
|
if(!pos_cards.isNull()){
|
|
@@ -5293,29 +5234,14 @@ std::string CYAServerDlg::get_json_position_all()
|
|
pos_cards.append(pos_card[JSON_KEY_SPEED]);
|
|
pos_cards.append(pos_card[JSON_KEY_SPEED]);
|
|
|
|
|
|
//landmark ID
|
|
//landmark ID
|
|
- _point card_point(it->second->x, it->second->y, it->second->z);
|
|
|
|
- int landmark_id = GetLandmarkID(card_point);
|
|
|
|
- it->second->landmark_id = landmark_id;
|
|
|
|
- pos_card[JSON_KEY_LANDMARK_ID] = landmark_id;
|
|
|
|
|
|
+ pos_card[JSON_KEY_LANDMARK_ID] = it->second->landmark_id;
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_ID]);
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_ID]);
|
|
|
|
|
|
//directory ID
|
|
//directory ID
|
|
- _point landmark_point;
|
|
|
|
- LandmarkInfoMap::iterator itLandmark = mp_landmark_list.find(landmark_id);
|
|
|
|
- if(itLandmark != mp_landmark_list.end())
|
|
|
|
- {
|
|
|
|
- landmark_point.x = itLandmark->second->x;
|
|
|
|
- landmark_point.y = itLandmark->second->y;
|
|
|
|
- landmark_point.z = itLandmark->second->z;
|
|
|
|
- }
|
|
|
|
- int directory_id = GetDirectoryType(card_point, landmark_point, it->second->map_id);
|
|
|
|
- it->second->directory = directory_id;
|
|
|
|
- pos_card[JSON_KEY_DIRECTORY_ID] = directory_id;
|
|
|
|
|
|
+ pos_card[JSON_KEY_DIRECTORY_ID] = it->second->directory;
|
|
pos_cards.append(pos_card[JSON_KEY_DIRECTORY_ID]);
|
|
pos_cards.append(pos_card[JSON_KEY_DIRECTORY_ID]);
|
|
//distance
|
|
//distance
|
|
- double distance = GetDistance(card_point, landmark_point) * it->second->map_scale;
|
|
|
|
- it->second->landmark_dis = distance;
|
|
|
|
- pos_card[JSON_KEY_LANDMARK_DIS] = distance;
|
|
|
|
|
|
+ pos_card[JSON_KEY_LANDMARK_DIS] = it->second->landmark_dis;
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_DIS]);
|
|
pos_cards.append(pos_card[JSON_KEY_LANDMARK_DIS]);
|
|
|
|
|
|
if(!pos_cards.isNull()){
|
|
if(!pos_cards.isNull()){
|
|
@@ -6442,8 +6368,8 @@ void CYAServerDlg::store_data_card(std::shared_ptr<Card> card /*Card* card*/, in
|
|
if(card->map_id != 0 && card->area_id != 0){
|
|
if(card->map_id != 0 && card->area_id != 0){
|
|
b_exec = true;
|
|
b_exec = true;
|
|
sprintf_s(sql, LENGTH_SQL,
|
|
sprintf_s(sql, LENGTH_SQL,
|
|
- "INSERT IGNORE INTO his_location(card_id, cur_time, x, y, z, map_id, area_id, state,speed,mileage) VALUES(%s, '%s', %.3f, %.3f, %.3f, %d, %d, %d,%.3f,%.4f);",
|
|
|
|
- card->card_id.c_str(), _time, card->x, card->y, card->z, card->map_id, card->area_id, card->state,card->get_speed(),CFunctions::round(card->mileage,4));
|
|
|
|
|
|
+ "INSERT IGNORE INTO his_location(card_id, cur_time, x, y, z, map_id, area_id, state,speed,mileage, landmark_id, landmark_mapper_id, distance) VALUES(%s, '%s', %.3f, %.3f, %.3f, %d, %d, %d,%.3f,%.4f, %d, %d, %.4f);",
|
|
|
|
+ card->card_id.c_str(), _time, card->x, card->y, card->z, card->map_id, card->area_id, card->state,card->get_speed(),card->mileage, card->landmark_id, card->directory, card->landmark_dis);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -9212,6 +9138,29 @@ void CYAServerDlg::save_card_postion(std::shared_ptr<Card> card /* Card* card*/
|
|
card->stored_y = card->y;
|
|
card->stored_y = card->y;
|
|
card->stored_z = card->z;
|
|
card->stored_z = card->z;
|
|
|
|
|
|
|
|
+ //landmark ID
|
|
|
|
+ _point card_point(card->x, card->y, card->z);
|
|
|
|
+ int landmark_id = GetLandmarkID(card_point);
|
|
|
|
+ card->landmark_id = landmark_id;
|
|
|
|
+ _point landmark_point;
|
|
|
|
+ int directory_id = NODIRECTORY;
|
|
|
|
+ double distance = 0;
|
|
|
|
+ LandmarkInfoMap::iterator itLandmark = mp_landmark_list.find(landmark_id);
|
|
|
|
+ if(itLandmark != mp_landmark_list.end())
|
|
|
|
+ {
|
|
|
|
+ landmark_point.x = itLandmark->second->x;
|
|
|
|
+ landmark_point.y = itLandmark->second->y;
|
|
|
|
+ landmark_point.z = itLandmark->second->z;
|
|
|
|
+
|
|
|
|
+ directory_id = GetDirectoryType(card_point, landmark_point, card->map_id);
|
|
|
|
+ if(NODIRECTORY != directory_id ){
|
|
|
|
+ distance = GetDistance(card_point, landmark_point) *card->map_scale;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ card->directory = directory_id;
|
|
|
|
+ card->landmark_dis = distance;
|
|
|
|
+
|
|
store_data_card(card, HIS_LOCATION);
|
|
store_data_card(card, HIS_LOCATION);
|
|
}
|
|
}
|
|
|
|
|