Mercurial > hg > sonic-visualiser
changeset 186:7b943924b8d3
* Phase 1 of an image layer.
author | Chris Cannam |
---|---|
date | Thu, 04 Oct 2007 16:34:11 +0000 |
parents | f3191ab6d564 |
children | 77cd75905998 |
files | document/SVFileReader.cpp icons/emptypage.png sonic-visualiser.qrc |
diffstat | 3 files changed, 30 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/document/SVFileReader.cpp Thu Oct 04 11:52:38 2007 +0000 +++ b/document/SVFileReader.cpp Thu Oct 04 16:34:11 2007 +0000 @@ -30,6 +30,7 @@ #include "data/model/SparseTimeValueModel.h" #include "data/model/NoteModel.h" #include "data/model/TextModel.h" +#include "data/model/ImageModel.h" #include "view/Pane.h" @@ -493,10 +494,21 @@ READ_MANDATORY(int, resolution, toInt); - SparseOneDimensionalModel *model = new SparseOneDimensionalModel - (sampleRate, resolution); - model->setObjectName(name); - m_models[id] = model; + if (attributes.value("subtype") == "image") { + + bool notifyOnAdd = (attributes.value("notifyOnAdd") == "true"); + ImageModel *model = new ImageModel(sampleRate, resolution, + notifyOnAdd); + model->setObjectName(name); + m_models[id] = model; + + } else { + + SparseOneDimensionalModel *model = new SparseOneDimensionalModel + (sampleRate, resolution); + model->setObjectName(name); + m_models[id] = model; + } int dataset = attributes.value("dataset").trimmed().toInt(&ok); if (ok) m_awaitingDatasets[dataset] = id; @@ -779,6 +791,7 @@ switch (dimensions) { case 1: if (dynamic_cast<SparseOneDimensionalModel *>(model)) good = true; + else if (dynamic_cast<ImageModel *>(model)) good = true; break; case 2: @@ -796,7 +809,7 @@ } if (!good) { - std::cerr << "WARNING: SV-XML: Model id " << modelId << " has wrong number of dimensions for " << dimensions << "-D dataset " << id << std::endl; + std::cerr << "WARNING: SV-XML: Model id " << modelId << " has wrong number of dimensions or inappropriate type for " << dimensions << "-D dataset " << id << std::endl; m_currentDataset = 0; return false; } @@ -861,6 +874,17 @@ return ok; } + ImageModel *im = dynamic_cast<ImageModel *>(m_currentDataset); + + if (im) { +// std::cerr << "Current dataset is an image model" << std::endl; + QString image = attributes.value("image"); + QString label = attributes.value("label"); +// std::cerr << "SVFileReader::addPointToDataset: ImageModel: frame = " << frame << ", image = " << image.toStdString() << ", label = " << label.toStdString() << ", ok = " << ok << std::endl; + im->addPoint(ImageModel::Point(frame, image, label)); + return ok; + } + std::cerr << "WARNING: SV-XML: Point element found in non-point dataset" << std::endl; return false;
--- a/sonic-visualiser.qrc Thu Oct 04 11:52:38 2007 +0000 +++ b/sonic-visualiser.qrc Thu Oct 04 16:34:11 2007 +0000 @@ -62,6 +62,7 @@ <file>icons/stereo.png</file> <file>icons/sharpen.png</file> <file>icons/help.png</file> + <file>icons/emptypage.png</file> <file>icons/sv-16x16.png</file> <file>icons/sv-22x22.png</file> <file>icons/sv-24x24.png</file>