Mercurial > hg > svgui
comparison layer/WaveformLayer.cpp @ 1470:696e569ff21b by-id
Further layer updates for ById
author | Chris Cannam |
---|---|
date | Fri, 28 Jun 2019 17:37:22 +0100 |
parents | e866102db32a |
children | f2525e6cbdf1 |
comparison
equal
deleted
inserted
replaced
1469:11a150e65ee1 | 1470:696e569ff21b |
---|---|
58 WaveformLayer::~WaveformLayer() | 58 WaveformLayer::~WaveformLayer() |
59 { | 59 { |
60 delete m_cache; | 60 delete m_cache; |
61 } | 61 } |
62 | 62 |
63 void | 63 const ZoomConstraint * |
64 WaveformLayer::setModel(const RangeSummarisableTimeValueModel *model) | 64 WaveformLayer::getZoomConstraint() const |
65 { | 65 { |
66 auto model = ModelById::get(m_model); | |
67 if (model) return m_model->getZoomConstraint(); | |
68 else return nullptr; | |
69 } | |
70 | |
71 void | |
72 WaveformLayer::setModel(ModelId modelId) | |
73 { | |
74 auto oldModel = ModelById::getAs<RangeSummarisableTimeValueModel>(m_model); | |
75 auto newModel = ModelById::getAs<RangeSummarisableTimeValueModel>(modelId); | |
76 | |
77 if (!newModel) { | |
78 SVCERR << "WARNING: WaveformLayer::setModel: Model is not a RangeSummarisableTimeValueModel" << endl; | |
79 } | |
80 | |
66 bool channelsChanged = false; | 81 bool channelsChanged = false; |
67 if (m_channel == -1) { | 82 if (m_channel == -1) { |
68 if (!m_model) { | 83 if (!oldModel) { |
69 if (model) { | 84 if (newModel) { |
70 channelsChanged = true; | 85 channelsChanged = true; |
71 } | 86 } |
72 } else { | 87 } else { |
73 if (model && | 88 if (newModel && |
74 m_model->getChannelCount() != model->getChannelCount()) { | 89 oldModel->getChannelCount() != newModel->getChannelCount()) { |
75 channelsChanged = true; | 90 channelsChanged = true; |
76 } | 91 } |
77 } | 92 } |
78 } | 93 } |
79 | 94 |
80 m_model = model; | 95 m_model = modelId; |
81 m_cacheValid = false; | 96 m_cacheValid = false; |
82 if (!m_model || !m_model->isOK()) return; | 97 if (!newModel || !newModel->isOK()) return; |
83 | 98 |
84 connectSignals(m_model); | 99 connectSignals(m_model); |
85 | 100 |
86 emit modelReplaced(); | 101 emit modelReplaced(); |
87 | 102 |