Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 1572:5f6fdd525158
Cut this down, we don't need the things we were calculating (also avoid possible null pointer dereference of v)
author | Chris Cannam |
---|---|
date | Wed, 15 Jan 2020 13:58:33 +0000 |
parents | 563bab925c9b |
children |
comparison
equal
deleted
inserted
replaced
1571:9cd77efef37c | 1572:5f6fdd525158 |
---|---|
223 // every call - calls probably being infrequent - to avoid having | 223 // every call - calls probably being infrequent - to avoid having |
224 // to worry about view lifecycles. | 224 // to worry about view lifecycles. |
225 | 225 |
226 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_model); | 226 auto model = ModelById::getAs<DenseThreeDimensionalModel>(m_model); |
227 if (!model) return {}; | 227 if (!model) return {}; |
228 int viewId = v->getId(); | |
229 | 228 |
230 Colour3DPlotExporter::Sources sources; | 229 Colour3DPlotExporter::Sources sources; |
231 sources.verticalBinLayer = this; | 230 sources.verticalBinLayer = this; |
232 sources.source = m_model; | 231 sources.source = m_model; |
233 sources.provider = v; | 232 sources.provider = v; |
234 | 233 |
235 double minValue = 0.0; | |
236 double maxValue = 1.0; | |
237 | |
238 if (m_normalizeVisibleArea && m_viewMags[viewId].isSet()) { | |
239 minValue = m_viewMags[viewId].getMin(); | |
240 maxValue = m_viewMags[viewId].getMax(); | |
241 } else if (m_normalization == ColumnNormalization::Hybrid) { | |
242 minValue = 0; | |
243 maxValue = log10(model->getMaximumLevel() + 1.0); | |
244 } else if (m_normalization == ColumnNormalization::None) { | |
245 minValue = model->getMinimumLevel(); | |
246 maxValue = model->getMaximumLevel(); | |
247 } | |
248 | |
249 if (maxValue <= minValue) { | |
250 maxValue = minValue + 0.1f; | |
251 | |
252 if (!(maxValue > minValue)) { // one of them must be NaN or Inf | |
253 SVCERR << "WARNING: Colour3DPlotLayer::getExportModel: resetting " | |
254 << "minValue and maxValue to zero and one" << endl; | |
255 minValue = 0.f; | |
256 maxValue = 1.f; | |
257 } | |
258 } | |
259 | |
260 Colour3DPlotExporter::Parameters params; | 234 Colour3DPlotExporter::Parameters params; |
261 params.threshold = minValue; | 235 // No thresholding for Colour3DPlot layers, so no need for gain or |
262 params.gain = m_gain; // matching ColourScale in getRenderer | 236 // normalisaion values either |
263 params.normalization = m_normalization; | |
264 | 237 |
265 ModelId exporter = ModelById::add | 238 ModelId exporter = ModelById::add |
266 (std::make_shared<Colour3DPlotExporter>(sources, params)); | 239 (std::make_shared<Colour3DPlotExporter>(sources, params)); |
267 m_exporters.push_back(exporter); | 240 m_exporters.push_back(exporter); |
268 return exporter; | 241 return exporter; |