comparison 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
comparison
equal deleted inserted replaced
1470:696e569ff21b 1471:f2525e6cbdf1
62 m_sliceableModel = nullptr; 62 m_sliceableModel = nullptr;
63 delete m; 63 delete m;
64 } 64 }
65 65
66 void 66 void
67 SpectrumLayer::setModel(DenseTimeValueModel *model) 67 SpectrumLayer::setModel(ModelId modelId)
68 { 68 {
69 SVDEBUG << "SpectrumLayer::setModel(" << model << ") from " << m_originModel << endl; 69 auto newModel = ModelById::getAs<DenseTimeValueModel>(modelId);
70 70 if (!modelId.isNone() && !newModel) {
71 if (m_originModel == model) return; 71 throw std::logic_error("Not a DenseTimeValueModel");
72 72 }
73 m_originModel = model; 73
74 74 if (m_originModel == modelId) return;
75 m_originModel = modelId;
76
77 if (newModel) {
78 //...
79 }
80
81 //!!! todo - all of this
82
75 if (m_sliceableModel) { 83 if (m_sliceableModel) {
76 Model *m = const_cast<Model *> 84 Model *m = const_cast<Model *>
77 (static_cast<const Model *>(m_sliceableModel)); 85 (static_cast<const Model *>(m_sliceableModel));
78 m->aboutToDelete(); 86 m->aboutToDelete();
79 setSliceableModel(nullptr); 87 setSliceableModel(nullptr);