# HG changeset patch # User Chris Cannam # Date 1182860867 0 # Node ID f6ce5febc07f1b76899e05a75f9d40aaf0e76d35 # Parent d2cc3b10e26f4b0e1a9a11f3ba49de699c1a2811 * save/reload measurements in session diff -r d2cc3b10e26f -r f6ce5febc07f document/SVFileReader.cpp --- a/document/SVFileReader.cpp Thu Jun 14 15:20:49 2007 +0000 +++ b/document/SVFileReader.cpp Tue Jun 26 12:27:47 2007 +0000 @@ -54,6 +54,8 @@ m_currentPlayParameters(0), m_datasetSeparator(" "), m_inRow(false), + m_inLayer(false), + m_inView(false), m_rowNumber(0), m_ok(false) { @@ -204,6 +206,14 @@ } else if (name == "selection") { ok = readSelection(attributes); + + } else if (name == "measurement") { + + ok = readMeasurement(attributes); + + } else { + std::cerr << "WARNING: SV-XML: Unexpected element \"" + << name.toLocal8Bit().data() << "\"" << std::endl; } if (!ok) { @@ -295,6 +305,8 @@ } else if (name == "row") { m_inRow = false; + } else if (name == "layer") { + m_inLayer = false; } else if (name == "view") { m_inView = false; } else if (name == "selections") { @@ -707,6 +719,9 @@ layer->setLayerDormant(m_currentPane, dormant); } + m_currentLayer = layer; + m_inLayer = true; + return true; } @@ -1064,6 +1079,21 @@ return true; } +bool +SVFileReader::readMeasurement(const QXmlAttributes &attributes) +{ + std::cerr << "SVFileReader::readMeasurement: inLayer " + << m_inLayer << ", layer " << m_currentLayer << std::endl; + + if (!m_inLayer) { + std::cerr << "WARNING: SV-XML: Measurement found outside layer" << std::endl; + return false; + } + + m_currentLayer->addMeasurementRect(attributes); + return true; +} + SVFileReaderPaneCallback::~SVFileReaderPaneCallback() { } diff -r d2cc3b10e26f -r f6ce5febc07f document/SVFileReader.h --- a/document/SVFileReader.h Thu Jun 14 15:20:49 2007 +0000 +++ b/document/SVFileReader.h Tue Jun 26 12:27:47 2007 +0000 @@ -196,6 +196,7 @@ bool readPlayParameters(const QXmlAttributes &); bool readPlugin(const QXmlAttributes &); bool readSelection(const QXmlAttributes &); + bool readMeasurement(const QXmlAttributes &); void addUnaddedModels(); Document *m_document; @@ -206,6 +207,7 @@ std::map m_models; std::set m_addedModels; std::map m_awaitingDatasets; // map dataset id -> model id + Layer *m_currentLayer; Model *m_currentDataset; Model *m_currentDerivedModel; int m_currentDerivedModelId; @@ -216,6 +218,7 @@ QString m_currentTransformConfiguration; QString m_datasetSeparator; bool m_inRow; + bool m_inLayer; bool m_inView; bool m_inData; bool m_inSelections;