comparison layer/SpectrogramLayer.cpp @ 979:98827470ada2 3.0-integration

Merge from branch normalize_hybrid_option
author Chris Cannam
date Fri, 26 Jun 2015 14:13:31 +0100
parents 64c2b3a4435a 1986c9b0d9c3
children 4f4f0e158ecf
comparison
equal deleted inserted replaced
978:64c2b3a4435a 979:98827470ada2
71 m_initialMaxFrequency(8000), 71 m_initialMaxFrequency(8000),
72 m_colourScale(dBColourScale), 72 m_colourScale(dBColourScale),
73 m_colourMap(0), 73 m_colourMap(0),
74 m_frequencyScale(LinearFrequencyScale), 74 m_frequencyScale(LinearFrequencyScale),
75 m_binDisplay(AllBins), 75 m_binDisplay(AllBins),
76 m_normalizeColumns(false), 76 m_normalization(NoNormalization),
77 m_normalizeVisibleArea(false),
78 m_normalizeHybrid(false),
79 m_lastEmittedZoomStep(-1), 77 m_lastEmittedZoomStep(-1),
80 m_synchronous(false), 78 m_synchronous(false),
81 m_haveDetailedScale(false), 79 m_haveDetailedScale(false),
82 m_lastPaintBlockWidth(0), 80 m_lastPaintBlockWidth(0),
83 m_updateTimer(0), 81 m_updateTimer(0),
105 setMaxFrequency(2000); 103 setMaxFrequency(2000);
106 setMinFrequency(40); 104 setMinFrequency(40);
107 setFrequencyScale(LogFrequencyScale); 105 setFrequencyScale(LogFrequencyScale);
108 setColourScale(LinearColourScale); 106 setColourScale(LinearColourScale);
109 setBinDisplay(PeakFrequencies); 107 setBinDisplay(PeakFrequencies);
110 setNormalizeColumns(true); 108 setNormalization(NormalizeColumns);
111 } 109 }
112 110
113 Preferences *prefs = Preferences::getInstance(); 111 Preferences *prefs = Preferences::getInstance();
114 connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)), 112 connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
115 this, SLOT(preferenceChanged(PropertyContainer::PropertyName))); 113 this, SLOT(preferenceChanged(PropertyContainer::PropertyName)));
153 PropertyList list; 151 PropertyList list;
154 list.push_back("Colour"); 152 list.push_back("Colour");
155 list.push_back("Colour Scale"); 153 list.push_back("Colour Scale");
156 list.push_back("Window Size"); 154 list.push_back("Window Size");
157 list.push_back("Window Increment"); 155 list.push_back("Window Increment");
158 list.push_back("Normalize Columns"); 156 list.push_back("Normalization");
159 list.push_back("Normalize Visible Area");
160 list.push_back("Bin Display"); 157 list.push_back("Bin Display");
161 list.push_back("Threshold"); 158 list.push_back("Threshold");
162 list.push_back("Gain"); 159 list.push_back("Gain");
163 list.push_back("Colour Rotation"); 160 list.push_back("Colour Rotation");
164 // list.push_back("Min Frequency"); 161 // list.push_back("Min Frequency");
173 { 170 {
174 if (name == "Colour") return tr("Colour"); 171 if (name == "Colour") return tr("Colour");
175 if (name == "Colour Scale") return tr("Colour Scale"); 172 if (name == "Colour Scale") return tr("Colour Scale");
176 if (name == "Window Size") return tr("Window Size"); 173 if (name == "Window Size") return tr("Window Size");
177 if (name == "Window Increment") return tr("Window Overlap"); 174 if (name == "Window Increment") return tr("Window Overlap");
178 if (name == "Normalize Columns") return tr("Normalize Columns"); 175 if (name == "Normalization") return tr("Normalization");
179 if (name == "Normalize Visible Area") return tr("Normalize Visible Area");
180 if (name == "Bin Display") return tr("Bin Display"); 176 if (name == "Bin Display") return tr("Bin Display");
181 if (name == "Threshold") return tr("Threshold"); 177 if (name == "Threshold") return tr("Threshold");
182 if (name == "Gain") return tr("Gain"); 178 if (name == "Gain") return tr("Gain");
183 if (name == "Colour Rotation") return tr("Colour Rotation"); 179 if (name == "Colour Rotation") return tr("Colour Rotation");
184 if (name == "Min Frequency") return tr("Min Frequency"); 180 if (name == "Min Frequency") return tr("Min Frequency");
187 if (name == "Zero Padding") return tr("Smoothing"); 183 if (name == "Zero Padding") return tr("Smoothing");
188 return ""; 184 return "";
189 } 185 }
190 186
191 QString 187 QString
192 SpectrogramLayer::getPropertyIconName(const PropertyName &name) const 188 SpectrogramLayer::getPropertyIconName(const PropertyName &) const
193 { 189 {
194 if (name == "Normalize Columns") return "normalise-columns";
195 if (name == "Normalize Visible Area") return "normalise";
196 return ""; 190 return "";
197 } 191 }
198 192
199 Layer::PropertyType 193 Layer::PropertyType
200 SpectrogramLayer::getPropertyType(const PropertyName &name) const 194 SpectrogramLayer::getPropertyType(const PropertyName &name) const
201 { 195 {
202 if (name == "Gain") return RangeProperty; 196 if (name == "Gain") return RangeProperty;
203 if (name == "Colour Rotation") return RangeProperty; 197 if (name == "Colour Rotation") return RangeProperty;
204 if (name == "Normalize Columns") return ToggleProperty;
205 if (name == "Normalize Visible Area") return ToggleProperty;
206 if (name == "Threshold") return RangeProperty; 198 if (name == "Threshold") return RangeProperty;
207 if (name == "Zero Padding") return ToggleProperty; 199 if (name == "Zero Padding") return ToggleProperty;
208 return ValueProperty; 200 return ValueProperty;
209 } 201 }
210 202
217 name == "Window Increment" || 209 name == "Window Increment" ||
218 name == "Zero Padding") return tr("Window"); 210 name == "Zero Padding") return tr("Window");
219 if (name == "Colour" || 211 if (name == "Colour" ||
220 name == "Threshold" || 212 name == "Threshold" ||
221 name == "Colour Rotation") return tr("Colour"); 213 name == "Colour Rotation") return tr("Colour");
222 if (name == "Normalize Columns" || 214 if (name == "Normalization" ||
223 name == "Normalize Visible Area" ||
224 name == "Gain" || 215 name == "Gain" ||
225 name == "Colour Scale") return tr("Scale"); 216 name == "Colour Scale") return tr("Scale");
226 return QString(); 217 return QString();
227 } 218 }
228 219
363 *min = 0; 354 *min = 0;
364 *max = 2; 355 *max = 2;
365 *deflt = int(AllBins); 356 *deflt = int(AllBins);
366 val = (int)m_binDisplay; 357 val = (int)m_binDisplay;
367 358
368 } else if (name == "Normalize Columns") { 359 } else if (name == "Normalization") {
369 360
370 *deflt = 0; 361 *min = 0;
371 val = (m_normalizeColumns ? 1 : 0); 362 *max = 3;
372 363 *deflt = int(NoNormalization);
373 } else if (name == "Normalize Visible Area") { 364 val = (int)m_normalization;
374
375 *deflt = 0;
376 val = (m_normalizeVisibleArea ? 1 : 0);
377 365
378 } else { 366 } else {
379 val = Layer::getPropertyRangeAndValue(name, min, max, deflt); 367 val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
380 } 368 }
381 369
396 case 1: return tr("Meter"); 384 case 1: return tr("Meter");
397 case 2: return tr("dBV^2"); 385 case 2: return tr("dBV^2");
398 case 3: return tr("dBV"); 386 case 3: return tr("dBV");
399 case 4: return tr("Phase"); 387 case 4: return tr("Phase");
400 } 388 }
389 }
390 if (name == "Normalization") {
391 return ""; // icon only
401 } 392 }
402 if (name == "Window Size") { 393 if (name == "Window Size") {
403 return QString("%1").arg(32 << value); 394 return QString("%1").arg(32 << value);
404 } 395 }
405 if (name == "Window Increment") { 396 if (name == "Window Increment") {
461 case 1: return tr("Peak Bins"); 452 case 1: return tr("Peak Bins");
462 case 2: return tr("Frequencies"); 453 case 2: return tr("Frequencies");
463 } 454 }
464 } 455 }
465 return tr("<unknown>"); 456 return tr("<unknown>");
457 }
458
459 QString
460 SpectrogramLayer::getPropertyValueIconName(const PropertyName &name,
461 int value) const
462 {
463 if (name == "Normalization") {
464 switch(value) {
465 default:
466 case 0: return "normalise-none";
467 case 1: return "normalise-columns";
468 case 2: return "normalise";
469 case 3: return "normalise-hybrid";
470 }
471 }
472 return "";
466 } 473 }
467 474
468 RangeMapper * 475 RangeMapper *
469 SpectrogramLayer::getNewPropertyRangeMapper(const PropertyName &name) const 476 SpectrogramLayer::getNewPropertyRangeMapper(const PropertyName &name) const
470 { 477 {
553 default: 560 default:
554 case 0: setBinDisplay(AllBins); break; 561 case 0: setBinDisplay(AllBins); break;
555 case 1: setBinDisplay(PeakBins); break; 562 case 1: setBinDisplay(PeakBins); break;
556 case 2: setBinDisplay(PeakFrequencies); break; 563 case 2: setBinDisplay(PeakFrequencies); break;
557 } 564 }
558 } else if (name == "Normalize Columns") { 565 } else if (name == "Normalization") {
559 setNormalizeColumns(value ? true : false); 566 switch (value) {
560 } else if (name == "Normalize Visible Area") { 567 default:
561 setNormalizeVisibleArea(value ? true : false); 568 case 0: setNormalization(NoNormalization); break;
569 case 1: setNormalization(NormalizeColumns); break;
570 case 2: setNormalization(NormalizeVisibleArea); break;
571 case 3: setNormalization(NormalizeHybrid); break;
572 }
562 } 573 }
563 } 574 }
564 575
565 void 576 void
566 SpectrogramLayer::invalidateImageCaches() 577 SpectrogramLayer::invalidateImageCaches()
932 { 943 {
933 return m_binDisplay; 944 return m_binDisplay;
934 } 945 }
935 946
936 void 947 void
937 SpectrogramLayer::setNormalizeColumns(bool n) 948 SpectrogramLayer::setNormalization(Normalization n)
938 { 949 {
939 if (m_normalizeColumns == n) return; 950 if (m_normalization == n) return;
940 951
941 invalidateImageCaches(); 952 invalidateImageCaches();
942 invalidateMagnitudes(); 953 invalidateMagnitudes();
943 m_normalizeColumns = n; 954 m_normalization = n;
944 955
945 emit layerParametersChanged(); 956 emit layerParametersChanged();
946 } 957 }
947 958
948 bool 959 SpectrogramLayer::Normalization
949 SpectrogramLayer::getNormalizeColumns() const 960 SpectrogramLayer::getNormalization() const
950 { 961 {
951 return m_normalizeColumns; 962 return m_normalization;
952 }
953
954 void
955 SpectrogramLayer::setNormalizeHybrid(bool n)
956 {
957 if (m_normalizeHybrid == n) return;
958
959 invalidateImageCaches();
960 invalidateMagnitudes();
961 m_normalizeHybrid = n;
962
963 emit layerParametersChanged();
964 }
965
966 bool
967 SpectrogramLayer::getNormalizeHybrid() const
968 {
969 return m_normalizeHybrid;
970 }
971
972 void
973 SpectrogramLayer::setNormalizeVisibleArea(bool n)
974 {
975 SVDEBUG << "SpectrogramLayer::setNormalizeVisibleArea(" << n
976 << ") (from " << m_normalizeVisibleArea << ")" << endl;
977
978 if (m_normalizeVisibleArea == n) return;
979
980 invalidateImageCaches();
981 invalidateMagnitudes();
982 m_normalizeVisibleArea = n;
983
984 emit layerParametersChanged();
985 }
986
987 bool
988 SpectrogramLayer::getNormalizeVisibleArea() const
989 {
990 return m_normalizeVisibleArea;
991 } 963 }
992 964
993 void 965 void
994 SpectrogramLayer::setLayerDormant(const LayerGeometryProvider *v, bool dormant) 966 SpectrogramLayer::setLayerDormant(const LayerGeometryProvider *v, bool dormant)
995 { 967 {
1188 int value; 1160 int value;
1189 1161
1190 double min = 0.0; 1162 double min = 0.0;
1191 double max = 1.0; 1163 double max = 1.0;
1192 1164
1193 if (m_normalizeVisibleArea) { 1165 if (m_normalization == NormalizeVisibleArea) {
1194 min = m_viewMags[v].getMin(); 1166 min = m_viewMags[v].getMin();
1195 max = m_viewMags[v].getMax(); 1167 max = m_viewMags[v].getMax();
1196 } else if (!m_normalizeColumns) { 1168 } else if (m_normalization != NormalizeColumns) {
1197 if (m_colourScale == LinearColourScale //|| 1169 if (m_colourScale == LinearColourScale //||
1198 // m_colourScale == MeterColourScale) { 1170 // m_colourScale == MeterColourScale) {
1199 ) { 1171 ) {
1200 max = 0.1; 1172 max = 0.1;
1201 } 1173 }
1966 1938
1967 if (updateViewMagnitudes(v)) { 1939 if (updateViewMagnitudes(v)) {
1968 #ifdef DEBUG_SPECTROGRAM_REPAINT 1940 #ifdef DEBUG_SPECTROGRAM_REPAINT
1969 cerr << "SpectrogramLayer: magnitude range changed to [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl; 1941 cerr << "SpectrogramLayer: magnitude range changed to [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl;
1970 #endif 1942 #endif
1971 if (m_normalizeVisibleArea) { 1943 if (m_normalization == NormalizeVisibleArea) {
1972 cache.validArea = QRect(); 1944 cache.validArea = QRect();
1973 recreateWholeImageCache = true; 1945 recreateWholeImageCache = true;
1974 } 1946 }
1975 } else { 1947 } else {
1976 #ifdef DEBUG_SPECTROGRAM_REPAINT 1948 #ifdef DEBUG_SPECTROGRAM_REPAINT
2401 cache.startFrame = startFrame; 2373 cache.startFrame = startFrame;
2402 cache.zoomLevel = zoomLevel; 2374 cache.zoomLevel = zoomLevel;
2403 2375
2404 if (!m_synchronous) { 2376 if (!m_synchronous) {
2405 2377
2406 if (!m_normalizeVisibleArea || !overallMagChanged) { 2378 if ((m_normalization != NormalizeVisibleArea) || !overallMagChanged) {
2407 2379
2408 if (cache.validArea.x() > 0) { 2380 if (cache.validArea.x() > 0) {
2409 #ifdef DEBUG_SPECTROGRAM_REPAINT 2381 #ifdef DEBUG_SPECTROGRAM_REPAINT
2410 SVDEBUG << "SpectrogramLayer::paint() updating left (0, " 2382 SVDEBUG << "SpectrogramLayer::paint() updating left (0, "
2411 << cache.validArea.x() << ")" << endl; 2383 << cache.validArea.x() << ")" << endl;
2513 if (sx != psx) { 2485 if (sx != psx) {
2514 peakfreqs = fft->getPeakFrequencies(FFTModel::AllPeaks, sx, 2486 peakfreqs = fft->getPeakFrequencies(FFTModel::AllPeaks, sx,
2515 minbin, maxbin - 1); 2487 minbin, maxbin - 1);
2516 if (m_colourScale == PhaseColourScale) { 2488 if (m_colourScale == PhaseColourScale) {
2517 fft->getPhasesAt(sx, values, minbin, maxbin - minbin + 1); 2489 fft->getPhasesAt(sx, values, minbin, maxbin - minbin + 1);
2518 } else if (m_normalizeColumns) { 2490 } else if (m_normalization == NormalizeColumns) {
2519 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2491 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2520 } else if (m_normalizeHybrid) { 2492 } else if (m_normalization == NormalizeHybrid) {
2521 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2493 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2522 double max = fft->getMaximumMagnitudeAt(sx); 2494 double max = fft->getMaximumMagnitudeAt(sx);
2523 if (max > 0.f) { 2495 if (max > 0.f) {
2524 for (int i = minbin; i <= maxbin; ++i) { 2496 for (int i = minbin; i <= maxbin; ++i) {
2525 values[i - minbin] = float(values[i - minbin] * log10(max)); 2497 values[i - minbin] = float(values[i - minbin] * log10(max));
2541 if (bin > maxbin) break; 2513 if (bin > maxbin) break;
2542 2514
2543 double value = values[bin - minbin]; 2515 double value = values[bin - minbin];
2544 2516
2545 if (m_colourScale != PhaseColourScale) { 2517 if (m_colourScale != PhaseColourScale) {
2546 if (!m_normalizeColumns && !m_normalizeHybrid) { 2518 if (m_normalization != NormalizeColumns) {
2547 value /= (m_fftSize/2.0); 2519 value /= (m_fftSize/2.0);
2548 } 2520 }
2549 mag.sample(float(value)); 2521 mag.sample(float(value));
2550 value *= m_gain; 2522 value *= m_gain;
2551 } 2523 }
2680 #ifdef DEBUG_SPECTROGRAM_REPAINT 2652 #ifdef DEBUG_SPECTROGRAM_REPAINT
2681 SVDEBUG << "Retrieving column " << sx << " from fft directly" << endl; 2653 SVDEBUG << "Retrieving column " << sx << " from fft directly" << endl;
2682 #endif 2654 #endif
2683 if (m_colourScale == PhaseColourScale) { 2655 if (m_colourScale == PhaseColourScale) {
2684 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2656 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2685 } else if (m_normalizeColumns) { 2657 } else if (m_normalization == NormalizeColumns) {
2686 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2658 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2687 } else if (m_normalizeHybrid) { 2659 } else if (m_normalization == NormalizeHybrid) {
2688 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2660 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2689 double max = fft->getMaximumMagnitudeAt(sx); 2661 double max = fft->getMaximumMagnitudeAt(sx);
2662 float scale = log10(max + 1.f);
2663 cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl;
2690 for (int i = minbin; i <= maxbin; ++i) { 2664 for (int i = minbin; i <= maxbin; ++i) {
2691 if (max > 0.0) { 2665 autoarray[i - minbin] *= scale;
2692 autoarray[i - minbin] = float(autoarray[i - minbin] * log10(max));
2693 }
2694 } 2666 }
2695 } else { 2667 } else {
2696 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2668 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2697 } 2669 }
2698 } else { 2670 } else {
2699 #ifdef DEBUG_SPECTROGRAM_REPAINT 2671 #ifdef DEBUG_SPECTROGRAM_REPAINT
2700 SVDEBUG << "Retrieving column " << sx << " from peaks cache" << endl; 2672 SVDEBUG << "Retrieving column " << sx << " from peaks cache" << endl;
2701 #endif 2673 #endif
2702 c = sourceModel->getColumn(sx); 2674 c = sourceModel->getColumn(sx);
2703 if (m_normalizeColumns || m_normalizeHybrid) { 2675 if (m_normalization == NormalizeColumns ||
2676 m_normalization == NormalizeHybrid) {
2704 for (int y = 0; y < h; ++y) { 2677 for (int y = 0; y < h; ++y) {
2705 if (c[y] > columnMax) columnMax = c[y]; 2678 if (c[y] > columnMax) columnMax = c[y];
2706 } 2679 }
2707 } 2680 }
2708 values = c.constData() + minbin; 2681 values = c.constData() + minbin;
2741 } 2714 }
2742 if (v0 == 0.0 && v1 == 0.0) continue; 2715 if (v0 == 0.0 && v1 == 0.0) continue;
2743 value = prop * v0 + (1.0 - prop) * v1; 2716 value = prop * v0 + (1.0 - prop) * v1;
2744 2717
2745 if (m_colourScale != PhaseColourScale) { 2718 if (m_colourScale != PhaseColourScale) {
2746 if (!m_normalizeColumns) { 2719 if (m_normalization != NormalizeColumns &&
2720 m_normalization != NormalizeHybrid) {
2747 value /= (m_fftSize/2.0); 2721 value /= (m_fftSize/2.0);
2748 } 2722 }
2749 mag.sample(float(value)); 2723 mag.sample(float(value));
2750 value *= m_gain; 2724 value *= m_gain;
2751 } 2725 }
2766 value < values[bin-minbin-1] || 2740 value < values[bin-minbin-1] ||
2767 value < values[bin-minbin+1]) continue; 2741 value < values[bin-minbin+1]) continue;
2768 } 2742 }
2769 2743
2770 if (m_colourScale != PhaseColourScale) { 2744 if (m_colourScale != PhaseColourScale) {
2771 if (!m_normalizeColumns) { 2745 if (m_normalization != NormalizeColumns &&
2746 m_normalization != NormalizeHybrid) {
2772 value /= (m_fftSize/2.0); 2747 value /= (m_fftSize/2.0);
2773 } 2748 }
2774 mag.sample(float(value)); 2749 mag.sample(float(value));
2775 value *= m_gain; 2750 value *= m_gain;
2776 } 2751 }
2800 for (int y = 0; y < h; ++y) { 2775 for (int y = 0; y < h; ++y) {
2801 2776
2802 double peak = peaks[y]; 2777 double peak = peaks[y];
2803 2778
2804 if (m_colourScale != PhaseColourScale && 2779 if (m_colourScale != PhaseColourScale &&
2805 (m_normalizeColumns || m_normalizeHybrid) && 2780 (m_normalization == NormalizeColumns ||
2781 m_normalization == NormalizeHybrid) &&
2806 columnMax > 0.f) { 2782 columnMax > 0.f) {
2807 peak /= columnMax; 2783 peak /= columnMax;
2808 if (m_normalizeHybrid) { 2784 if (m_normalization == NormalizeHybrid) {
2809 peak *= log10(columnMax); 2785 peak *= log10(columnMax + 1.f);
2810 } 2786 }
2811 } 2787 }
2812 2788
2813 unsigned char peakpix = getDisplayValue(v, peak); 2789 unsigned char peakpix = getDisplayValue(v, peak);
2814 2790
3661 .arg(m_binDisplay); 3637 .arg(m_binDisplay);
3662 3638
3663 s += QString("normalizeColumns=\"%1\" " 3639 s += QString("normalizeColumns=\"%1\" "
3664 "normalizeVisibleArea=\"%2\" " 3640 "normalizeVisibleArea=\"%2\" "
3665 "normalizeHybrid=\"%3\" ") 3641 "normalizeHybrid=\"%3\" ")
3666 .arg(m_normalizeColumns ? "true" : "false") 3642 .arg(m_normalization == NormalizeColumns ? "true" : "false")
3667 .arg(m_normalizeVisibleArea ? "true" : "false") 3643 .arg(m_normalization == NormalizeVisibleArea ? "true" : "false")
3668 .arg(m_normalizeHybrid ? "true" : "false"); 3644 .arg(m_normalization == NormalizeHybrid ? "true" : "false");
3669 3645
3670 Layer::toXml(stream, indent, extraAttributes + " " + s); 3646 Layer::toXml(stream, indent, extraAttributes + " " + s);
3671 } 3647 }
3672 3648
3673 void 3649 void
3731 attributes.value("binDisplay").toInt(&ok); 3707 attributes.value("binDisplay").toInt(&ok);
3732 if (ok) setBinDisplay(binDisplay); 3708 if (ok) setBinDisplay(binDisplay);
3733 3709
3734 bool normalizeColumns = 3710 bool normalizeColumns =
3735 (attributes.value("normalizeColumns").trimmed() == "true"); 3711 (attributes.value("normalizeColumns").trimmed() == "true");
3736 setNormalizeColumns(normalizeColumns); 3712 if (normalizeColumns) {
3713 setNormalization(NormalizeColumns);
3714 }
3737 3715
3738 bool normalizeVisibleArea = 3716 bool normalizeVisibleArea =
3739 (attributes.value("normalizeVisibleArea").trimmed() == "true"); 3717 (attributes.value("normalizeVisibleArea").trimmed() == "true");
3740 setNormalizeVisibleArea(normalizeVisibleArea); 3718 if (normalizeVisibleArea) {
3719 setNormalization(NormalizeVisibleArea);
3720 }
3741 3721
3742 bool normalizeHybrid = 3722 bool normalizeHybrid =
3743 (attributes.value("normalizeHybrid").trimmed() == "true"); 3723 (attributes.value("normalizeHybrid").trimmed() == "true");
3744 setNormalizeHybrid(normalizeHybrid); 3724 if (normalizeHybrid) {
3745 } 3725 setNormalization(NormalizeHybrid);
3746 3726 }
3727 }
3728