comparison layer/Colour3DPlotLayer.cpp @ 1481:e540aa5d89cd by-id

Update for removal of (public) getId from Model
author Chris Cannam
date Fri, 05 Jul 2019 15:34:50 +0100
parents 886c1cd48f9d
children 0e971e3d93e2
comparison
equal deleted inserted replaced
1480:232262e38051 1481:e540aa5d89cd
153 m_model = modelId; 153 m_model = modelId;
154 154
155 if (newModel) { 155 if (newModel) {
156 connectSignals(m_model); 156 connectSignals(m_model);
157 157
158 connect(newModel.get(), SIGNAL(modelChanged()), 158 connect(newModel.get(), SIGNAL(modelChanged(ModelId)),
159 this, SLOT(handleModelChanged())); 159 this, SLOT(handleModelChanged(ModelId)));
160 connect(newModel.get(), SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), 160 connect(newModel.get(), SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)),
161 this, SLOT(handleModelChangedWithin(sv_frame_t, sv_frame_t))); 161 this, SLOT(handleModelChangedWithin(ModelId, sv_frame_t, sv_frame_t)));
162 162
163 m_peakResolution = 256; 163 m_peakResolution = 256;
164 if (newModel->getResolution() > 512) { 164 if (newModel->getResolution() > 512) {
165 m_peakResolution = 16; 165 m_peakResolution = 16;
166 } else if (newModel->getResolution() > 128) { 166 } else if (newModel->getResolution() > 128) {
212 Colour3DPlotLayer::getPeakCache() const 212 Colour3DPlotLayer::getPeakCache() const
213 { 213 {
214 if (m_peakCache.isNone()) { 214 if (m_peakCache.isNone()) {
215 auto peakCache = std::make_shared<Dense3DModelPeakCache> 215 auto peakCache = std::make_shared<Dense3DModelPeakCache>
216 (m_model, m_peakCacheDivisor); 216 (m_model, m_peakCacheDivisor);
217 ModelById::add(peakCache); 217 m_peakCache = ModelById::add(peakCache);
218 m_peakCache = peakCache->getId();
219 } 218 }
220 return m_peakCache; 219 return m_peakCache;
221 } 220 }
222 221
223 void 222 void
224 Colour3DPlotLayer::handleModelChanged() 223 Colour3DPlotLayer::handleModelChanged(ModelId modelId)
225 { 224 {
226 if (!m_colourScaleSet && m_colourScale == ColourScaleType::Linear) { 225 if (!m_colourScaleSet && m_colourScale == ColourScaleType::Linear) {
227 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_model); 226 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_model);
228 if (model) { 227 if (model) {
229 if (model->shouldUseLogValueScale()) { 228 if (model->shouldUseLogValueScale()) {
232 m_colourScaleSet = true; 231 m_colourScaleSet = true;
233 } 232 }
234 } 233 }
235 } 234 }
236 invalidatePeakCache(); 235 invalidatePeakCache();
237 emit modelChanged(); 236 emit modelChanged(modelId);
238 } 237 }
239 238
240 void 239 void
241 Colour3DPlotLayer::handleModelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame) 240 Colour3DPlotLayer::handleModelChangedWithin(ModelId modelId,
241 sv_frame_t startFrame,
242 sv_frame_t endFrame)
242 { 243 {
243 if (!m_colourScaleSet && m_colourScale == ColourScaleType::Linear) { 244 if (!m_colourScaleSet && m_colourScale == ColourScaleType::Linear) {
244 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_model); 245 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_model);
245 if (model && model->getWidth() > 50) { 246 if (model && model->getWidth() > 50) {
246 if (model->shouldUseLogValueScale()) { 247 if (model->shouldUseLogValueScale()) {
248 } else { 249 } else {
249 m_colourScaleSet = true; 250 m_colourScaleSet = true;
250 } 251 }
251 } 252 }
252 } 253 }
253 emit modelChangedWithin(startFrame, endFrame); 254 emit modelChangedWithin(modelId, startFrame, endFrame);
254 } 255 }
255 256
256 Layer::PropertyList 257 Layer::PropertyList
257 Colour3DPlotLayer::getProperties() const 258 Colour3DPlotLayer::getProperties() const
258 { 259 {