66 QDomNode moving = forest.
getNode(movingData->getUid());
70 if (delta_pre_rMd.
mFixed ==
"")
72 fixed = forest.
getNode(movingData->getParentSpace());
80 "Update Registration using\n"
83 "\tDelta matrix (rMd'=Delta*rMd)\n"
86 .arg(movingData->getUid())
89 this->updateTransform(oldTime, allMovingData, delta_pre_rMd, silent);
99 QString fixedAncestorUid = fixedAncestor.toElement().tagName();
101 QString newFixedSpace = fixedAncestorUid;
104 if (mSource.count(fixedAncestorUid) && mSource[fixedAncestorUid]->getParentSpace()==
"")
106 newFixedSpace = this->generateNewSpaceUid();
108 this->changeParentSpace(oldTime, mSource[fixedAncestorUid], newParentSpace);
111 QString movingBaseUid = movingBase.toElement().tagName();
113 if (mSource.count(movingBaseUid))
115 movingBaseUid = mSource[movingBaseUid]->getParentSpace();
120 this->changeParentSpace(oldTime, allMovingData, movingBaseUid, newParentSpace);
124 QString RegistrationApplicator::generateNewSpaceUid()
const
127 std::map<QString, DataPtr>::const_iterator iter;
128 for (iter = mSource.begin(); iter != mSource.end(); ++iter)
130 QStringList parentList =
qstring_cast(iter->second->getParentSpace()).split(
"_");
131 if (parentList.size() < 2)
133 max = std::max(max, parentList[1].toInt());
139 void RegistrationApplicator::updateTransform(QDateTime oldTime, std::vector<DataPtr> data, RegistrationTransform delta_pre_rMd,
bool silent)
142 for (
unsigned i=0; i<data.size(); ++i)
144 RegistrationTransform newTransform = delta_pre_rMd;
145 newTransform.mValue = delta_pre_rMd.mValue * data[i]->get_rMd();
146 data[i]->get_rMd_History()->updateRegistration(oldTime, newTransform);
149 report(
"Updated registration of data " + data[i]->getName());
153 void RegistrationApplicator::changeParentSpace(QDateTime oldTime, std::vector<DataPtr> data, QString oldParentSpace, ParentSpace newParentSpace)
155 for (
unsigned i=0; i<data.size(); ++i)
157 if (data[i]->getParentSpace() != oldParentSpace)
159 this->changeParentSpace(oldTime, data[i], newParentSpace);
163 void RegistrationApplicator::changeParentSpace(QDateTime oldTime,
DataPtr data, ParentSpace newParentSpace)
165 report(QString(
"Reset parent frame of %1 from [%2] to [%3].")
166 .arg(data->getName())
167 .arg(data->getParentSpace())
168 .arg(newParentSpace.mValue));
170 data->get_rMd_History()->updateParentSpace(oldTime, newParentSpace);
QString qstring_cast(const T &val)
QDomNode getOldestAncestor(QDomNode node)
Definition of a parent space event.
A graph combining Space dependencies between all Data.Relations between coordinate spaces among Data ...
virtual void updateRegistration(QDateTime oldTime, RegistrationTransform deltaTransform, DataPtr data, bool silent=false)
std::vector< DataPtr > getDataFromDescendantsAndSelf(QDomNode node)
boost::shared_ptr< class Data > DataPtr
RegistrationApplicator(const std::map< QString, DataPtr > &source)
QDomNode getNode(QString frame)
~RegistrationApplicator()
QDomNode getOldestAncestorNotCommonToRef(QDomNode child, QDomNode ref)