# HG changeset patch # User Chris Cannam # Date 1255606341 0 # Node ID 24f06d34ac99e7ce2aad2bd33e42fe31368e91c3 # Parent 3a61a4df6d5386e0abd364e58e5dee24b3f85662 * When importing regions without values, generate a different value for each distinct label diff -r 3a61a4df6d53 -r 24f06d34ac99 rdf/RDFImporter.cpp --- a/rdf/RDFImporter.cpp Thu Oct 15 10:50:43 2009 +0000 +++ b/rdf/RDFImporter.cpp Thu Oct 15 11:32:21 2009 +0000 @@ -60,6 +60,8 @@ std::map m_audioModelMap; int m_sampleRate; + std::map > m_labelValueMap; + static bool m_prefixesLoaded; static void loadPrefixes(ProgressReporter *reporter); @@ -243,6 +245,8 @@ fs->getLocation(), m_uristring); if (path != "") { + std::cerr << "File finder returns: \"" << path.toStdString() + << "\"" << std::endl; delete fs; fs = new FileSource(path, reporter); if (!fs->isAvailable()) { @@ -938,14 +942,23 @@ RegionModel *rm = dynamic_cast(model); if (rm) { + float value = 0.f; + if (values.empty()) { + // no values? map each unique label to a distinct value + if (m_labelValueMap[model].find(label) == m_labelValueMap[model].end()) { + m_labelValueMap[model][label] = rm->getValueMaximum() + 1.f; + } + value = m_labelValueMap[model][label]; + } else { + value = values[0]; + } if (haveDuration) { - RegionModel::Point point - (ftime, values.empty() ? 0.f : values[0], fduration, label); + RegionModel::Point point(ftime, value, fduration, label); rm->addPoint(point); } else { // This won't actually happen -- we only create region models // if we do have duration -- but just for completeness - float value = 0.f, duration = 1.f; + float duration = 1.f; if (!values.empty()) { value = values[0]; if (values.size() > 1) {