changeset 1789:baafe1bb7e51 time-frequency-boxes

Fixes to export of time-frequency box model
author Chris Cannam
date Fri, 20 Sep 2019 14:18:38 +0100
parents 9ab3be243397
children dd51797e528e
files base/Event.h data/model/TextModel.h data/model/TimeFrequencyBoxModel.h
diffstat 3 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/base/Event.h	Fri Sep 20 11:35:14 2019 +0100
+++ b/base/Event.h	Fri Sep 20 14:18:38 2019 +0100
@@ -259,10 +259,12 @@
     struct ExportNameOptions {
 
         ExportNameOptions() :
-            valueAtttributeName("value"),
+            valueAttributeName("value"),
+            levelAttributeName("level"),
             uriAttributeName("uri") { }
 
-        QString valueAtttributeName;
+        QString valueAttributeName;
+        QString levelAttributeName;
         QString uriAttributeName;
     };
     
@@ -275,13 +277,15 @@
         stream << indent << QString("<point frame=\"%1\" ").arg(m_frame);
         if (m_haveValue) {
             stream << QString("%1=\"%2\" ")
-                .arg(opts.valueAtttributeName).arg(m_value);
+                .arg(opts.valueAttributeName).arg(m_value);
         }
         if (m_haveDuration) {
             stream << QString("duration=\"%1\" ").arg(m_duration);
         }
         if (m_haveLevel) {
-            stream << QString("level=\"%1\" ").arg(m_level);
+            stream << QString("%1=\"%2\" ")
+                .arg(opts.levelAttributeName)
+                .arg(m_level);
         }
         if (m_haveReferenceFrame) {
             stream << QString("referenceFrame=\"%1\" ")
--- a/data/model/TextModel.h	Fri Sep 20 11:35:14 2019 +0100
+++ b/data/model/TextModel.h	Fri Sep 20 14:18:38 2019 +0100
@@ -253,7 +253,7 @@
              .arg(extraAttributes));
 
         Event::ExportNameOptions options;
-        options.valueAtttributeName = "height";
+        options.valueAttributeName = "height";
         
         m_events.toXml(out, indent, QString("dimensions=\"2\""), options);
     }
--- a/data/model/TimeFrequencyBoxModel.h	Fri Sep 20 11:35:14 2019 +0100
+++ b/data/model/TimeFrequencyBoxModel.h	Fri Sep 20 14:18:38 2019 +0100
@@ -303,24 +303,28 @@
         Model::toXml
             (out,
              indent,
-             QString("type=\"sparse\" dimensions=\"4\" resolution=\"%1\" "
+             QString("type=\"sparse\" dimensions=\"2\" resolution=\"%1\" "
                      "notifyOnAdd=\"%2\" dataset=\"%3\" subtype=\"%4\" "
                      "minimum=\"%5\" maximum=\"%6\" units=\"%7\" %8")
              .arg(m_resolution)
              .arg("true") // always true after model reaches 100% -
                           // subsequent events are always notified
              .arg(m_events.getExportId())
-             .arg("timefrequency")
+             .arg("timefrequencybox")
              .arg(m_frequencyMinimum)
              .arg(m_frequencyMaximum)
              .arg(encodeEntities(m_units))
              .arg(extraAttributes));
+
+        Event::ExportNameOptions options;
+        options.valueAttributeName = "frequency";
+        options.levelAttributeName = "extent";
         
-        m_events.toXml(out, indent, QString("dimensions=\"3\""));
+        m_events.toXml(out, indent, QString("dimensions=\"2\""), options);
     }
 
     QString toDelimitedDataString(QString delimiter,
-                                  DataExportOptions options,
+                                  DataExportOptions,
                                   sv_frame_t startFrame,
                                   sv_frame_t duration) const override {