Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 1473:886c1cd48f9d by-id
Further layer updates for ModelById
author | Chris Cannam |
---|---|
date | Tue, 02 Jul 2019 11:49:52 +0100 |
parents | f2525e6cbdf1 |
children | e540aa5d89cd |
comparison
equal
deleted
inserted
replaced
1472:dbff4b290bf0 | 1473:886c1cd48f9d |
---|---|
181 { | 181 { |
182 // renderers use the peak cache, so we must invalidate those too | 182 // renderers use the peak cache, so we must invalidate those too |
183 invalidateRenderers(); | 183 invalidateRenderers(); |
184 invalidateMagnitudes(); | 184 invalidateMagnitudes(); |
185 | 185 |
186 delete m_peakCache; | 186 if (!m_peakCache.isNone()) { |
187 m_peakCache = nullptr; | 187 ModelById::release(m_peakCache); |
188 m_peakCache = {}; | |
189 } | |
188 } | 190 } |
189 | 191 |
190 void | 192 void |
191 Colour3DPlotLayer::invalidateRenderers() | 193 Colour3DPlotLayer::invalidateRenderers() |
192 { | 194 { |
204 SVDEBUG << "Colour3DPlotLayer::invalidateMagnitudes called" << endl; | 206 SVDEBUG << "Colour3DPlotLayer::invalidateMagnitudes called" << endl; |
205 #endif | 207 #endif |
206 m_viewMags.clear(); | 208 m_viewMags.clear(); |
207 } | 209 } |
208 | 210 |
209 Dense3DModelPeakCache * | 211 ModelId |
210 Colour3DPlotLayer::getPeakCache() const | 212 Colour3DPlotLayer::getPeakCache() const |
211 { | 213 { |
212 if (!m_peakCache) { | 214 if (m_peakCache.isNone()) { |
213 m_peakCache = new Dense3DModelPeakCache(m_model, m_peakCacheDivisor); | 215 auto peakCache = std::make_shared<Dense3DModelPeakCache> |
216 (m_model, m_peakCacheDivisor); | |
217 ModelById::add(peakCache); | |
218 m_peakCache = peakCache->getId(); | |
214 } | 219 } |
215 return m_peakCache; | 220 return m_peakCache; |
216 } | 221 } |
217 | 222 |
218 void | 223 void |