diff layer/Colour3DPlotLayer.cpp @ 743:a352fb986e7b tony_integration

Merge from branch tonioni
author Chris Cannam
date Tue, 11 Mar 2014 17:33:19 +0000
parents 67e6d518ac27
children c27a3604fe6f
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Tue Jan 28 15:02:09 2014 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Tue Mar 11 17:33:19 2014 +0000
@@ -51,6 +51,7 @@
     m_binScale(LinearBinScale),
     m_normalizeColumns(false),
     m_normalizeVisibleArea(false),
+    m_normalizeHybrid(false),
     m_invertVertical(false),
     m_opaque(false),
     m_smooth(false),
@@ -430,6 +431,21 @@
 }
 
 void
+Colour3DPlotLayer::setNormalizeHybrid(bool n)
+{
+    if (m_normalizeHybrid == n) return;
+    m_normalizeHybrid = n;
+    cacheInvalid();
+    emit layerParametersChanged();
+}
+
+bool
+Colour3DPlotLayer::getNormalizeHybrid() const
+{
+    return m_normalizeHybrid;
+}
+
+void
 Colour3DPlotLayer::setNormalizeVisibleArea(bool n)
 {
     if (m_normalizeVisibleArea == n) return;
@@ -882,7 +898,7 @@
 {
     DenseThreeDimensionalModel::Column values = m_model->getColumn(col);
     while (values.size() < m_model->getHeight()) values.push_back(0.f);
-    if (!m_normalizeColumns) return values;
+    if (!m_normalizeColumns && !m_normalizeHybrid) return values;
 
     float colMax = 0.f, colMin = 0.f;
     float min = 0.f, max = 0.f;
@@ -905,6 +921,13 @@
         if (value != newvalue) values[y] = newvalue;
     }
 
+    if (m_normalizeHybrid && (colMax > 0.0)) {
+        float logmax = log10(colMax);
+        for (size_t y = 0; y < values.size(); ++y) {
+            values[y] *= logmax;
+        }
+    }
+
     return values;
 }