comparison layer/Colour3DPlotRenderer.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 78d9282519b0
comparison
equal deleted inserted replaced
1472:dbff4b290bf0 1473:886c1cd48f9d
424 } 424 }
425 425
426 if (fullColumn.empty()) { 426 if (fullColumn.empty()) {
427 427
428 if (peakCacheIndex >= 0) { 428 if (peakCacheIndex >= 0) {
429 fullColumn = m_sources.peakCaches[peakCacheIndex]->getColumn(sx); 429 auto peakCache = ModelById::getAs<Dense3DModelPeakCache>
430 (m_sources.peakCaches[peakCacheIndex]);
431 if (!peakCache) {
432 return vector<float>(nbins, 0.f);
433 }
434 fullColumn = peakCache->getColumn(sx);
430 } else { 435 } else {
431 auto model = ModelById::getAs<DenseThreeDimensionalModel> 436 auto model = ModelById::getAs<DenseThreeDimensionalModel>
432 (m_sources.source); 437 (m_sources.source);
433 if (!model) { 438 if (!model) {
434 return vector<float>(nbins, 0.f); 439 return vector<float>(nbins, 0.f);
619 624
620 ZoomLevel zoomLevel = v->getZoomLevel(); 625 ZoomLevel zoomLevel = v->getZoomLevel();
621 int binResolution = model->getResolution(); 626 int binResolution = model->getResolution();
622 627
623 for (int ix = 0; in_range_for(m_sources.peakCaches, ix); ++ix) { 628 for (int ix = 0; in_range_for(m_sources.peakCaches, ix); ++ix) {
624 int bpp = m_sources.peakCaches[ix]->getColumnsPerPeak(); 629 auto peakCache = ModelById::getAs<Dense3DModelPeakCache>
630 (m_sources.peakCaches[ix]);
631 if (!peakCache) continue;
632 int bpp = peakCache->getColumnsPerPeak();
625 ZoomLevel equivZoom(ZoomLevel::FramesPerPixel, binResolution * bpp); 633 ZoomLevel equivZoom(ZoomLevel::FramesPerPixel, binResolution * bpp);
626 #ifdef DEBUG_COLOUR_PLOT_REPAINT 634 #ifdef DEBUG_COLOUR_PLOT_REPAINT
627 SVDEBUG << "getPreferredPeakCache: zoomLevel = " << zoomLevel 635 SVDEBUG << "getPreferredPeakCache: zoomLevel = " << zoomLevel
628 << ", cache " << ix << " has bpp = " << bpp 636 << ", cache " << ix << " has bpp = " << bpp
629 << " for equivZoom = " << equivZoom << endl; 637 << " for equivZoom = " << equivZoom << endl;
954 RenderTimer::NoTimeout); 962 RenderTimer::NoTimeout);
955 963
956 Profiler profiler("Colour3DPlotRenderer::renderDrawBuffer"); 964 Profiler profiler("Colour3DPlotRenderer::renderDrawBuffer");
957 965
958 int divisor = 1; 966 int divisor = 1;
959 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_sources.source); 967
960 if (!model) return 0; 968 std::shared_ptr<DenseThreeDimensionalModel> sourceModel;
961 969
962 const DenseThreeDimensionalModel *sourceModel = model.get();
963 if (peakCacheIndex >= 0) { 970 if (peakCacheIndex >= 0) {
964 divisor = m_sources.peakCaches[peakCacheIndex]->getColumnsPerPeak(); 971 auto peakCache = ModelById::getAs<Dense3DModelPeakCache>
965 sourceModel = m_sources.peakCaches[peakCacheIndex]; 972 (m_sources.peakCaches[peakCacheIndex]);
966 } 973 if (peakCache) {
974 divisor = peakCache->getColumnsPerPeak();
975 sourceModel = peakCache;
976 }
977 }
978
979 if (!sourceModel) {
980 sourceModel = ModelById::getAs<DenseThreeDimensionalModel>
981 (m_sources.source);
982 }
983
984 if (!sourceModel) return 0;
967 985
968 #ifdef DEBUG_COLOUR_PLOT_REPAINT 986 #ifdef DEBUG_COLOUR_PLOT_REPAINT
969 SVDEBUG << "renderDrawBuffer: w = " << w << ", h = " << h 987 SVDEBUG << "renderDrawBuffer: w = " << w << ", h = " << h
970 << ", peakCacheIndex = " << peakCacheIndex << " (divisor = " 988 << ", peakCacheIndex = " << peakCacheIndex << " (divisor = "
971 << divisor << "), rightToLeft = " << rightToLeft 989 << divisor << "), rightToLeft = " << rightToLeft