annotate layer/Colour3DPlotRenderer.cpp @ 1077:5144d7185fb5 spectrogram-minor-refactor

Move LayerGeometryProvider from view to layer
author Chris Cannam
date Thu, 30 Jun 2016 10:59:11 +0100
parents e536dfc6b250
children 7ebfb61b1701
rev   line source
Chris@1071 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1071 2
Chris@1071 3 /*
Chris@1071 4 Sonic Visualiser
Chris@1071 5 An audio file viewer and annotation editor.
Chris@1071 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1071 7 This file copyright 2006-2016 Chris Cannam and QMUL.
Chris@1071 8
Chris@1071 9 This program is free software; you can redistribute it and/or
Chris@1071 10 modify it under the terms of the GNU General Public License as
Chris@1071 11 published by the Free Software Foundation; either version 2 of the
Chris@1071 12 License, or (at your option) any later version. See the file
Chris@1071 13 COPYING included with this distribution for more information.
Chris@1071 14 */
Chris@1071 15
Chris@1071 16 #include "Colour3DPlotRenderer.h"
Chris@1074 17 #include "RenderTimer.h"
Chris@1071 18
Chris@1075 19 #include "data/model/DenseThreeDimensionalModel.h"
Chris@1075 20 #include "data/model/Dense3DModelPeakCache.h"
Chris@1075 21 #include "data/model/FFTModel.h"
Chris@1075 22
Chris@1077 23 #include "LayerGeometryProvider.h"
Chris@1075 24
Chris@1073 25 Colour3DPlotRenderer::RenderResult
Chris@1076 26 Colour3DPlotRenderer::render(QPainter &paint, QRect rect)
Chris@1076 27 {
Chris@1076 28 return render(paint, rect, false);
Chris@1076 29 }
Chris@1076 30
Chris@1076 31 Colour3DPlotRenderer::RenderResult
Chris@1076 32 Colour3DPlotRenderer::renderTimeConstrained(QPainter &paint, QRect rect)
Chris@1076 33 {
Chris@1076 34 return render(paint, rect, true);
Chris@1076 35 }
Chris@1076 36
Chris@1076 37 Colour3DPlotRenderer::RenderResult
Chris@1076 38 Colour3DPlotRenderer::render(QPainter &paint, QRect rect, bool timeConstrained)
Chris@1073 39 {
Chris@1075 40 LayerGeometryProvider *v = m_sources.geometryProvider;
Chris@1075 41 if (!v) {
Chris@1075 42 throw std::logic_error("no LayerGeometryProvider provided");
Chris@1075 43 }
Chris@1075 44
Chris@1075 45 DenseThreeDimensionalModel *model = m_sources.source;
Chris@1075 46 if (!model || !model->isOK() || !model->isReady()) {
Chris@1075 47 throw std::logic_error("no source model provided, or model not ready");
Chris@1075 48 }
Chris@1075 49
Chris@1075 50 sv_frame_t startFrame = v->getStartFrame();
Chris@1075 51
Chris@1075 52
Chris@1073 53 //!!! todo: timing/incomplete paint
Chris@1073 54
Chris@1073 55 //!!! todo: peak frequency style
Chris@1073 56
Chris@1073 57 //!!! todo: transparent style from Colour3DPlot
Chris@1074 58
Chris@1074 59 //!!! todo: bin boundary alignment when in BinResolution
Chris@1074 60
Chris@1074 61 return { rect, {} };
Chris@1073 62 }
Chris@1073 63