diff layer/SpectrumLayer.cpp @ 1471:f2525e6cbdf1 by-id

More layer updates
author Chris Cannam
date Mon, 01 Jul 2019 14:17:13 +0100
parents c8a6fd3f9dff
children 886c1cd48f9d
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Fri Jun 28 17:37:22 2019 +0100
+++ b/layer/SpectrumLayer.cpp	Mon Jul 01 14:17:13 2019 +0100
@@ -64,14 +64,22 @@
 }
 
 void
-SpectrumLayer::setModel(DenseTimeValueModel *model)
+SpectrumLayer::setModel(ModelId modelId)
 {
-    SVDEBUG << "SpectrumLayer::setModel(" << model << ") from " << m_originModel << endl;
+    auto newModel = ModelById::getAs<DenseTimeValueModel>(modelId);
+    if (!modelId.isNone() && !newModel) {
+        throw std::logic_error("Not a DenseTimeValueModel");
+    }
     
-    if (m_originModel == model) return;
+    if (m_originModel == modelId) return;
+    m_originModel = modelId;
 
-    m_originModel = model;
-
+    if (newModel) {
+        //...
+    }
+    
+    //!!! todo - all of this
+    
     if (m_sliceableModel) {
         Model *m = const_cast<Model *>
             (static_cast<const Model *>(m_sliceableModel));