comparison document/SVFileReader.cpp @ 154:f6ce5febc07f

* save/reload measurements in session
author Chris Cannam
date Tue, 26 Jun 2007 12:27:47 +0000
parents 006c90387f40
children 567df8af372c
comparison
equal deleted inserted replaced
153:d2cc3b10e26f 154:f6ce5febc07f
52 m_currentDerivedModel(0), 52 m_currentDerivedModel(0),
53 m_currentDerivedModelId(-1), 53 m_currentDerivedModelId(-1),
54 m_currentPlayParameters(0), 54 m_currentPlayParameters(0),
55 m_datasetSeparator(" "), 55 m_datasetSeparator(" "),
56 m_inRow(false), 56 m_inRow(false),
57 m_inLayer(false),
58 m_inView(false),
57 m_rowNumber(0), 59 m_rowNumber(0),
58 m_ok(false) 60 m_ok(false)
59 { 61 {
60 } 62 }
61 63
202 ok = true; 204 ok = true;
203 205
204 } else if (name == "selection") { 206 } else if (name == "selection") {
205 207
206 ok = readSelection(attributes); 208 ok = readSelection(attributes);
209
210 } else if (name == "measurement") {
211
212 ok = readMeasurement(attributes);
213
214 } else {
215 std::cerr << "WARNING: SV-XML: Unexpected element \""
216 << name.toLocal8Bit().data() << "\"" << std::endl;
207 } 217 }
208 218
209 if (!ok) { 219 if (!ok) {
210 std::cerr << "WARNING: SV-XML: Failed to completely process element \"" 220 std::cerr << "WARNING: SV-XML: Failed to completely process element \""
211 << name.toLocal8Bit().data() << "\"" << std::endl; 221 << name.toLocal8Bit().data() << "\"" << std::endl;
293 m_currentTransform = ""; 303 m_currentTransform = "";
294 m_currentTransformConfiguration = ""; 304 m_currentTransformConfiguration = "";
295 305
296 } else if (name == "row") { 306 } else if (name == "row") {
297 m_inRow = false; 307 m_inRow = false;
308 } else if (name == "layer") {
309 m_inLayer = false;
298 } else if (name == "view") { 310 } else if (name == "view") {
299 m_inView = false; 311 m_inView = false;
300 } else if (name == "selections") { 312 } else if (name == "selections") {
301 m_inSelections = false; 313 m_inSelections = false;
302 } else if (name == "playparameters") { 314 } else if (name == "playparameters") {
705 m_document->addLayerToView(m_currentPane, layer); 717 m_document->addLayerToView(m_currentPane, layer);
706 718
707 layer->setLayerDormant(m_currentPane, dormant); 719 layer->setLayerDormant(m_currentPane, dormant);
708 } 720 }
709 721
722 m_currentLayer = layer;
723 m_inLayer = true;
724
710 return true; 725 return true;
711 } 726 }
712 727
713 bool 728 bool
714 SVFileReader::readDatasetStart(const QXmlAttributes &attributes) 729 SVFileReader::readDatasetStart(const QXmlAttributes &attributes)
1062 m_paneCallback.addSelection(start, end); 1077 m_paneCallback.addSelection(start, end);
1063 1078
1064 return true; 1079 return true;
1065 } 1080 }
1066 1081
1082 bool
1083 SVFileReader::readMeasurement(const QXmlAttributes &attributes)
1084 {
1085 std::cerr << "SVFileReader::readMeasurement: inLayer "
1086 << m_inLayer << ", layer " << m_currentLayer << std::endl;
1087
1088 if (!m_inLayer) {
1089 std::cerr << "WARNING: SV-XML: Measurement found outside layer" << std::endl;
1090 return false;
1091 }
1092
1093 m_currentLayer->addMeasurementRect(attributes);
1094 return true;
1095 }
1096
1067 SVFileReaderPaneCallback::~SVFileReaderPaneCallback() 1097 SVFileReaderPaneCallback::~SVFileReaderPaneCallback()
1068 { 1098 {
1069 } 1099 }
1070 1100