Mercurial > hg > svgui
comparison layer/ColourScale.cpp @ 1265:6e724c81f18f
Convert some cerrs to SVCERRs. Apart from anything else, this makes MSVC2017 happy
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 14:43:53 +0000 |
parents | 822edd9bb665 |
children | a34a2a25907c |
comparison
equal
deleted
inserted
replaced
1264:5f68f5c74904 | 1265:6e724c81f18f |
---|---|
28 ColourScale::ColourScale(Parameters parameters) : | 28 ColourScale::ColourScale(Parameters parameters) : |
29 m_params(parameters), | 29 m_params(parameters), |
30 m_mapper(m_params.colourMap, 1.f, double(m_maxPixel)) | 30 m_mapper(m_params.colourMap, 1.f, double(m_maxPixel)) |
31 { | 31 { |
32 if (m_params.minValue >= m_params.maxValue) { | 32 if (m_params.minValue >= m_params.maxValue) { |
33 cerr << "ERROR: ColourScale::ColourScale: minValue = " | 33 SVCERR << "ERROR: ColourScale::ColourScale: minValue = " |
34 << m_params.minValue << ", maxValue = " << m_params.maxValue << endl; | 34 << m_params.minValue << ", maxValue = " << m_params.maxValue << endl; |
35 throw std::logic_error("maxValue must be greater than minValue"); | 35 throw std::logic_error("maxValue must be greater than minValue"); |
36 } | 36 } |
37 | 37 |
38 m_mappedMin = m_params.minValue; | 38 m_mappedMin = m_params.minValue; |
76 std::swap(m_mappedMin, m_mappedMax); | 76 std::swap(m_mappedMin, m_mappedMax); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 if (m_mappedMin >= m_mappedMax) { | 80 if (m_mappedMin >= m_mappedMax) { |
81 cerr << "ERROR: ColourScale::ColourScale: minValue = " << m_params.minValue | 81 SVCERR << "ERROR: ColourScale::ColourScale: minValue = " << m_params.minValue |
82 << ", maxValue = " << m_params.maxValue | 82 << ", maxValue = " << m_params.maxValue |
83 << ", threshold = " << m_params.threshold | 83 << ", threshold = " << m_params.threshold |
84 << ", scale = " << int(m_params.scaleType) | 84 << ", scale = " << int(m_params.scaleType) |
85 << " resulting in mapped minValue = " << m_mappedMin | 85 << " resulting in mapped minValue = " << m_mappedMin |
86 << ", mapped maxValue = " << m_mappedMax << endl; | 86 << ", mapped maxValue = " << m_mappedMax << endl; |
104 double maxPixF = m_maxPixel; | 104 double maxPixF = m_maxPixel; |
105 | 105 |
106 if (m_params.scaleType == ColourScaleType::Phase) { | 106 if (m_params.scaleType == ColourScaleType::Phase) { |
107 double half = (maxPixF - 1.f) / 2.f; | 107 double half = (maxPixF - 1.f) / 2.f; |
108 int pixel = 1 + int((value * half) / M_PI + half); | 108 int pixel = 1 + int((value * half) / M_PI + half); |
109 // cerr << "phase = " << value << " pixel = " << pixel << endl; | 109 // SVCERR << "phase = " << value << " pixel = " << pixel << endl; |
110 return pixel; | 110 return pixel; |
111 } | 111 } |
112 | 112 |
113 value *= m_params.gain; | 113 value *= m_params.gain; |
114 | 114 |