X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvReadState.cxx;fp=vv%2FvvReadState.cxx;h=980bbf1ffeac7a832fc086265f68f14a05911dd0;hb=84facf1bc847da95b567b0c7531404c170f68cc2;hp=13bb083867ab6e6a008fecba941c92e154b6525b;hpb=eaa43bf30ce191f4f83f70823aa68d9d242e5da9;p=clitk.git diff --git a/vv/vvReadState.cxx b/vv/vvReadState.cxx index 13bb083..980bbf1 100644 --- a/vv/vvReadState.cxx +++ b/vv/vvReadState.cxx @@ -73,6 +73,7 @@ void vvReadState::ReadTree() { std::string value; + // read images while (!m_XmlReader->isEndElement() || value != "Images") { m_XmlReader->readNext(); value = m_XmlReader->qualifiedName().toString().toStdString(); @@ -81,6 +82,15 @@ void vvReadState::ReadTree() } } + // read links + while (!m_XmlReader->isEndElement() || value != "Links") { + m_XmlReader->readNext(); + value = m_XmlReader->qualifiedName().toString().toStdString(); + if (m_XmlReader->isStartElement()) { + if (value == "LinkedFrom") value = ReadLink(); + } + } + if (m_XmlReader->hasError()) std::cout << "Error " << m_XmlReader->error() << " XML " << std::endl; } @@ -262,6 +272,33 @@ std::string vvReadState::ReadVector(int index) //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +std::string vvReadState::ReadLink() +{ + std::string id_from, id_to, value; + + QXmlStreamAttributes attributes = m_XmlReader->attributes(); + if (!m_XmlReader->hasError()) { + id_from = attributes.value("Id").toString().toStdString(); + } + + while (!m_XmlReader->isEndElement() || value != "LinkedFrom") { + m_XmlReader->readNext(); + value = m_XmlReader->qualifiedName().toString().toStdString(); + if (m_XmlReader->isStartElement()) { + if (value == "LinkedTo") { + id_to = m_XmlReader->readElementText().toStdString(); + if (!m_XmlReader->hasError()) { + m_Window->AddLink(id_from.c_str(), id_to.c_str(), false); + } + } + } + } + + return value; +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvReadState::ReadGUI() {