comparison framework/Document.cpp @ 111:c82913d31a53

* Save alignments to session file. Needs much testing.
author Chris Cannam
date Tue, 29 Apr 2008 15:34:17 +0000
parents e25e8f5d785b
children e54dff673096
comparison
equal deleted inserted replaced
110:f57047e0522b 111:c82913d31a53
1017 if (i->first && !i->second.empty() && i->first->getModel()) { 1017 if (i->first && !i->second.empty() && i->first->getModel()) {
1018 used.insert(i->first->getModel()); 1018 used.insert(i->first->getModel());
1019 } 1019 }
1020 } 1020 }
1021 1021
1022 std::set<Model *> written;
1023
1022 for (ModelMap::const_iterator i = m_models.begin(); 1024 for (ModelMap::const_iterator i = m_models.begin();
1023 i != m_models.end(); ++i) { 1025 i != m_models.end(); ++i) {
1024 1026
1025 const Model *model = i->first; 1027 Model *model = i->first;
1026 const ModelRecord &rec = i->second; 1028 const ModelRecord &rec = i->second;
1027 1029
1028 if (used.find(model) == used.end()) continue; 1030 if (used.find(model) == used.end()) continue;
1029 1031
1030 // We need an intelligent way to determine which models need 1032 // We need an intelligent way to determine which models need
1054 writeModel = false; 1056 writeModel = false;
1055 } 1057 }
1056 } 1058 }
1057 1059
1058 if (writeModel) { 1060 if (writeModel) {
1059 i->first->toXml(out, indent + " "); 1061 model->toXml(out, indent + " ");
1062 written.insert(model);
1060 } 1063 }
1061 1064
1062 if (haveDerivation) { 1065 if (haveDerivation) {
1063 writeBackwardCompatibleDerivation(out, indent + " ", 1066 writeBackwardCompatibleDerivation(out, indent + " ",
1064 i->first, rec); 1067 model, rec);
1065 } 1068 }
1066 1069
1067 //!!! We should probably own the PlayParameterRepository 1070 //!!! We should probably own the PlayParameterRepository
1068 PlayParameters *playParameters = 1071 PlayParameters *playParameters =
1069 PlayParameterRepository::getInstance()->getPlayParameters(i->first); 1072 PlayParameterRepository::getInstance()->getPlayParameters(model);
1070 if (playParameters) { 1073 if (playParameters) {
1071 playParameters->toXml 1074 playParameters->toXml
1072 (out, indent + " ", 1075 (out, indent + " ",
1073 QString("model=\"%1\"") 1076 QString("model=\"%1\"")
1074 .arg(XmlExportable::getObjectExportId(i->first))); 1077 .arg(XmlExportable::getObjectExportId(model)));
1075 } 1078 }
1076 } 1079 }
1077 1080
1081 //!!!
1082
1083 // We should write out the alignment models here. AlignmentModel
1084 // needs a toXml that writes out the export IDs of its reference
1085 // and aligned models, and then streams its path model. Note that
1086 // this will only work when the alignment is complete, so we
1087 // should probably wait for it if it isn't already by this point.
1088
1089 for (std::set<Model *>::const_iterator i = written.begin();
1090 i != written.end(); ++i) {
1091
1092 const Model *model = *i;
1093 const AlignmentModel *alignment = model->getAlignment();
1094 if (!alignment) continue;
1095
1096 alignment->toXml(out, indent + " ");
1097 }
1098
1078 for (LayerSet::const_iterator i = m_layers.begin(); 1099 for (LayerSet::const_iterator i = m_layers.begin();
1079 i != m_layers.end(); ++i) { 1100 i != m_layers.end(); ++i) {
1080 1101
1081 (*i)->toXml(out, indent + " "); 1102 (*i)->toXml(out, indent + " ");
1082 } 1103 }