# HG changeset patch # User Chris Cannam # Date 1191515651 0 # Node ID 7b943924b8d35e22aee3300759b9e46b42000679 # Parent f3191ab6d5646edd214eb68c3cf775a43630f48e * Phase 1 of an image layer. diff -r f3191ab6d564 -r 7b943924b8d3 document/SVFileReader.cpp --- 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(model)) good = true; + else if (dynamic_cast(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(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; diff -r f3191ab6d564 -r 7b943924b8d3 icons/emptypage.png Binary file icons/emptypage.png has changed diff -r f3191ab6d564 -r 7b943924b8d3 sonic-visualiser.qrc --- 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 @@ icons/stereo.png icons/sharpen.png icons/help.png + icons/emptypage.png icons/sv-16x16.png icons/sv-22x22.png icons/sv-24x24.png