| 570 | } |
| 571 | |
| 572 | void MapPoint::PreSave(set<KeyFrame*>& spKF,set<MapPoint*>& spMP) |
| 573 | { |
| 574 | mBackupReplacedId = -1; |
| 575 | if(mpReplaced && spMP.find(mpReplaced) != spMP.end()) |
| 576 | mBackupReplacedId = mpReplaced->mnId; |
| 577 | |
| 578 | mBackupObservationsId1.clear(); |
| 579 | mBackupObservationsId2.clear(); |
| 580 | // Save the id and position in each KF who view it |
| 581 | for(std::map<KeyFrame*,std::tuple<int,int> >::const_iterator it = mObservations.begin(), end = mObservations.end(); it != end; ++it) |
| 582 | { |
| 583 | KeyFrame* pKFi = it->first; |
| 584 | if(spKF.find(pKFi) != spKF.end()) |
| 585 | { |
| 586 | mBackupObservationsId1[it->first->mnId] = get<0>(it->second); |
| 587 | mBackupObservationsId2[it->first->mnId] = get<1>(it->second); |
| 588 | } |
| 589 | else |
| 590 | { |
| 591 | EraseObservation(pKFi); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | // Save the id of the reference KF |
| 596 | if(spKF.find(mpRefKF) != spKF.end()) |
| 597 | { |
| 598 | mBackupRefKFId = mpRefKF->mnId; |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | void MapPoint::PostLoad(map<long unsigned int, KeyFrame*>& mpKFid, map<long unsigned int, MapPoint*>& mpMPid) |
| 603 | { |