| 920 | } |
| 921 | |
| 922 | void KeyFrame::PostLoad(map<long unsigned int, KeyFrame*>& mpKFid, map<long unsigned int, MapPoint*>& mpMPid, map<unsigned int, GeometricCamera*>& mpCamId){ |
| 923 | // Rebuild the empty variables |
| 924 | |
| 925 | // Pose |
| 926 | SetPose(mTcw); |
| 927 | |
| 928 | mTrl = mTlr.inverse(); |
| 929 | |
| 930 | // Reference reconstruction |
| 931 | // Each MapPoint sight from this KeyFrame |
| 932 | mvpMapPoints.clear(); |
| 933 | mvpMapPoints.resize(N); |
| 934 | for(int i=0; i<N; ++i) |
| 935 | { |
| 936 | if(mvBackupMapPointsId[i] != -1) |
| 937 | mvpMapPoints[i] = mpMPid[mvBackupMapPointsId[i]]; |
| 938 | else |
| 939 | mvpMapPoints[i] = static_cast<MapPoint*>(NULL); |
| 940 | } |
| 941 | |
| 942 | // Conected KeyFrames with him weight |
| 943 | mConnectedKeyFrameWeights.clear(); |
| 944 | for(map<long unsigned int, int>::const_iterator it = mBackupConnectedKeyFrameIdWeights.begin(), end = mBackupConnectedKeyFrameIdWeights.end(); |
| 945 | it != end; ++it) |
| 946 | { |
| 947 | KeyFrame* pKFi = mpKFid[it->first]; |
| 948 | mConnectedKeyFrameWeights[pKFi] = it->second; |
| 949 | } |
| 950 | |
| 951 | // Restore parent KeyFrame |
| 952 | if(mBackupParentId>=0) |
| 953 | mpParent = mpKFid[mBackupParentId]; |
| 954 | |
| 955 | // KeyFrame childrens |
| 956 | mspChildrens.clear(); |
| 957 | for(vector<long unsigned int>::const_iterator it = mvBackupChildrensId.begin(), end = mvBackupChildrensId.end(); it!=end; ++it) |
| 958 | { |
| 959 | mspChildrens.insert(mpKFid[*it]); |
| 960 | } |
| 961 | |
| 962 | // Loop edge KeyFrame |
| 963 | mspLoopEdges.clear(); |
| 964 | for(vector<long unsigned int>::const_iterator it = mvBackupLoopEdgesId.begin(), end = mvBackupLoopEdgesId.end(); it != end; ++it) |
| 965 | { |
| 966 | mspLoopEdges.insert(mpKFid[*it]); |
| 967 | } |
| 968 | |
| 969 | // Merge edge KeyFrame |
| 970 | mspMergeEdges.clear(); |
| 971 | for(vector<long unsigned int>::const_iterator it = mvBackupMergeEdgesId.begin(), end = mvBackupMergeEdgesId.end(); it != end; ++it) |
| 972 | { |
| 973 | mspMergeEdges.insert(mpKFid[*it]); |
| 974 | } |
| 975 | |
| 976 | //Camera data |
| 977 | if(mnBackupIdCamera >= 0) |
| 978 | { |
| 979 | mpCamera = mpCamId[mnBackupIdCamera]; |