changeset 1075:2e1d6c2ed3ee spectrogram-minor-refactor

Another tiny bit
author Chris Cannam
date Wed, 29 Jun 2016 15:13:54 +0100
parents 6f98aa5291d4
children e536dfc6b250
files layer/Colour3DPlotRenderer.cpp layer/Colour3DPlotRenderer.h
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Wed Jun 29 14:04:57 2016 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Wed Jun 29 15:13:54 2016 +0100
@@ -16,11 +16,30 @@
 #include "Colour3DPlotRenderer.h"
 #include "RenderTimer.h"
 
+#include "data/model/DenseThreeDimensionalModel.h"
+#include "data/model/Dense3DModelPeakCache.h"
+#include "data/model/FFTModel.h"
+
+#include "view/LayerGeometryProvider.h"
+
 Colour3DPlotRenderer::RenderResult
 Colour3DPlotRenderer::render(QPainter &paint,
 			     QRect rect,
 			     bool complete)
 {
+    LayerGeometryProvider *v = m_sources.geometryProvider;
+    if (!v) {
+	throw std::logic_error("no LayerGeometryProvider provided");
+    }
+
+    DenseThreeDimensionalModel *model = m_sources.source;
+    if (!model || !model->isOK() || !model->isReady()) {
+	throw std::logic_error("no source model provided, or model not ready");
+    }
+	
+    sv_frame_t startFrame = v->getStartFrame();
+
+    
     //!!! todo: timing/incomplete paint
 
     //!!! todo: peak frequency style
--- a/layer/Colour3DPlotRenderer.h	Wed Jun 29 14:04:57 2016 +0100
+++ b/layer/Colour3DPlotRenderer.h	Wed Jun 29 15:13:54 2016 +0100
@@ -108,6 +108,12 @@
      *
      * If complete is true, the whole rect will be rendered and the
      * returned QRect will be equal to the passed QRect.
+     *
+     * If the model to render from is not ready, this will throw a
+     * std::logic_error exception. The model must be ready and the
+     * layer requesting the render must not be dormant in its view, so
+     * that the LayerGeometryProvider returns valid results; it is the
+     * caller's responsibility to ensure these.
      */
     RenderResult render(QPainter &paint,
                         QRect rect,