Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 1103:d84a0033b305 spectrogram-minor-refactor
Turn BinDisplay and BinScale into enum classes
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2016 15:13:37 +0100 |
parents | 36a981a0fa31 |
children | 46cc4644206d |
comparison
equal
deleted
inserted
replaced
1102:36a981a0fa31 | 1103:d84a0033b305 |
---|---|
72 m_minFrequency(10), | 72 m_minFrequency(10), |
73 m_maxFrequency(8000), | 73 m_maxFrequency(8000), |
74 m_initialMaxFrequency(8000), | 74 m_initialMaxFrequency(8000), |
75 m_colourScale(ColourScale::LogColourScale), | 75 m_colourScale(ColourScale::LogColourScale), |
76 m_colourMap(0), | 76 m_colourMap(0), |
77 m_binScale(Colour3DPlotRenderer::LinearBinScale), | 77 m_binScale(BinScale::Linear), |
78 m_binDisplay(Colour3DPlotRenderer::AllBins), | 78 m_binDisplay(BinDisplay::AllBins), |
79 m_normalization(ColumnOp::NoNormalization), | 79 m_normalization(ColumnOp::NoNormalization), |
80 m_lastEmittedZoomStep(-1), | 80 m_lastEmittedZoomStep(-1), |
81 m_synchronous(false), | 81 m_synchronous(false), |
82 m_haveDetailedScale(false), | 82 m_haveDetailedScale(false), |
83 m_exiting(false), | 83 m_exiting(false), |
97 m_initialMaxFrequency = 1500; | 97 m_initialMaxFrequency = 1500; |
98 setMaxFrequency(1500); | 98 setMaxFrequency(1500); |
99 setMinFrequency(40); | 99 setMinFrequency(40); |
100 setColourScale(ColourScale::LinearColourScale); | 100 setColourScale(ColourScale::LinearColourScale); |
101 setColourMap(ColourMapper::Sunset); | 101 setColourMap(ColourMapper::Sunset); |
102 setBinScale(Colour3DPlotRenderer::LogBinScale); | 102 setBinScale(BinScale::Log); |
103 colourConfigName = "spectrogram-melodic-colour"; | 103 colourConfigName = "spectrogram-melodic-colour"; |
104 colourConfigDefault = int(ColourMapper::Sunset); | 104 colourConfigDefault = int(ColourMapper::Sunset); |
105 // setGain(20); | 105 // setGain(20); |
106 } else if (config == MelodicPeaks) { | 106 } else if (config == MelodicPeaks) { |
107 setWindowSize(4096); | 107 setWindowSize(4096); |
108 setWindowHopLevel(5); | 108 setWindowHopLevel(5); |
109 m_initialMaxFrequency = 2000; | 109 m_initialMaxFrequency = 2000; |
110 setMaxFrequency(2000); | 110 setMaxFrequency(2000); |
111 setMinFrequency(40); | 111 setMinFrequency(40); |
112 setBinScale(Colour3DPlotRenderer::LogBinScale); | 112 setBinScale(BinScale::Log); |
113 setColourScale(ColourScale::LinearColourScale); | 113 setColourScale(ColourScale::LinearColourScale); |
114 setBinDisplay(Colour3DPlotRenderer::PeakFrequencies); | 114 setBinDisplay(BinDisplay::PeakFrequencies); |
115 setNormalization(ColumnOp::NormalizeColumns); | 115 setNormalization(ColumnOp::NormalizeColumns); |
116 colourConfigName = "spectrogram-melodic-colour"; | 116 colourConfigName = "spectrogram-melodic-colour"; |
117 colourConfigDefault = int(ColourMapper::Sunset); | 117 colourConfigDefault = int(ColourMapper::Sunset); |
118 } | 118 } |
119 | 119 |
345 | 345 |
346 } else if (name == "Frequency Scale") { | 346 } else if (name == "Frequency Scale") { |
347 | 347 |
348 *min = 0; | 348 *min = 0; |
349 *max = 1; | 349 *max = 1; |
350 *deflt = int(Colour3DPlotRenderer::LinearBinScale); | 350 *deflt = int(BinScale::Linear); |
351 val = (int)m_binScale; | 351 val = (int)m_binScale; |
352 | 352 |
353 } else if (name == "Bin Display") { | 353 } else if (name == "Bin Display") { |
354 | 354 |
355 *min = 0; | 355 *min = 0; |
356 *max = 2; | 356 *max = 2; |
357 *deflt = int(Colour3DPlotRenderer::AllBins); | 357 *deflt = int(BinDisplay::AllBins); |
358 val = (int)m_binDisplay; | 358 val = (int)m_binDisplay; |
359 | 359 |
360 } else if (name == "Normalization") { | 360 } else if (name == "Normalization") { |
361 | 361 |
362 *min = 0; | 362 *min = 0; |
545 case 4: setColourScale(ColourScale::PhaseColourScale); break; | 545 case 4: setColourScale(ColourScale::PhaseColourScale); break; |
546 } | 546 } |
547 } else if (name == "Frequency Scale") { | 547 } else if (name == "Frequency Scale") { |
548 switch (value) { | 548 switch (value) { |
549 default: | 549 default: |
550 case 0: setBinScale(Colour3DPlotRenderer::LinearBinScale); break; | 550 case 0: setBinScale(BinScale::Linear); break; |
551 case 1: setBinScale(Colour3DPlotRenderer::LogBinScale); break; | 551 case 1: setBinScale(BinScale::Log); break; |
552 } | 552 } |
553 } else if (name == "Bin Display") { | 553 } else if (name == "Bin Display") { |
554 switch (value) { | 554 switch (value) { |
555 default: | 555 default: |
556 case 0: setBinDisplay(Colour3DPlotRenderer::AllBins); break; | 556 case 0: setBinDisplay(BinDisplay::AllBins); break; |
557 case 1: setBinDisplay(Colour3DPlotRenderer::PeakBins); break; | 557 case 1: setBinDisplay(BinDisplay::PeakBins); break; |
558 case 2: setBinDisplay(Colour3DPlotRenderer::PeakFrequencies); break; | 558 case 2: setBinDisplay(BinDisplay::PeakFrequencies); break; |
559 } | 559 } |
560 } else if (name == "Normalization") { | 560 } else if (name == "Normalization") { |
561 switch (value) { | 561 switch (value) { |
562 default: | 562 default: |
563 case 0: setNormalization(ColumnOp::NoNormalization); break; | 563 case 0: setNormalization(ColumnOp::NoNormalization); break; |
631 } | 631 } |
632 | 632 |
633 int | 633 int |
634 SpectrogramLayer::getFFTOversampling() const | 634 SpectrogramLayer::getFFTOversampling() const |
635 { | 635 { |
636 if (m_binDisplay != Colour3DPlotRenderer::AllBins) { | 636 if (m_binDisplay != BinDisplay::AllBins) { |
637 return 1; | 637 return 1; |
638 } | 638 } |
639 | 639 |
640 Preferences::SpectrogramSmoothing smoothing = | 640 Preferences::SpectrogramSmoothing smoothing = |
641 Preferences::getInstance()->getSpectrogramSmoothing(); | 641 Preferences::getInstance()->getSpectrogramSmoothing(); |
850 { | 850 { |
851 return m_colourMap; | 851 return m_colourMap; |
852 } | 852 } |
853 | 853 |
854 void | 854 void |
855 SpectrogramLayer::setBinScale(Colour3DPlotRenderer::BinScale binScale) | 855 SpectrogramLayer::setBinScale(BinScale binScale) |
856 { | 856 { |
857 if (m_binScale == binScale) return; | 857 if (m_binScale == binScale) return; |
858 | 858 |
859 invalidateImageCaches(); | 859 invalidateImageCaches(); |
860 m_binScale = binScale; | 860 m_binScale = binScale; |
861 | 861 |
862 emit layerParametersChanged(); | 862 emit layerParametersChanged(); |
863 } | 863 } |
864 | 864 |
865 Colour3DPlotRenderer::BinScale | 865 BinScale |
866 SpectrogramLayer::getBinScale() const | 866 SpectrogramLayer::getBinScale() const |
867 { | 867 { |
868 return m_binScale; | 868 return m_binScale; |
869 } | 869 } |
870 | 870 |
871 void | 871 void |
872 SpectrogramLayer::setBinDisplay(Colour3DPlotRenderer::BinDisplay binDisplay) | 872 SpectrogramLayer::setBinDisplay(BinDisplay binDisplay) |
873 { | 873 { |
874 if (m_binDisplay == binDisplay) return; | 874 if (m_binDisplay == binDisplay) return; |
875 | 875 |
876 invalidateImageCaches(); | 876 invalidateImageCaches(); |
877 m_binDisplay = binDisplay; | 877 m_binDisplay = binDisplay; |
878 | 878 |
879 emit layerParametersChanged(); | 879 emit layerParametersChanged(); |
880 } | 880 } |
881 | 881 |
882 Colour3DPlotRenderer::BinDisplay | 882 BinDisplay |
883 SpectrogramLayer::getBinDisplay() const | 883 SpectrogramLayer::getBinDisplay() const |
884 { | 884 { |
885 return m_binDisplay; | 885 return m_binDisplay; |
886 } | 886 } |
887 | 887 |
1150 | 1150 |
1151 sv_samplerate_t sr = m_model->getSampleRate(); | 1151 sv_samplerate_t sr = m_model->getSampleRate(); |
1152 double minf = getEffectiveMinFrequency(); | 1152 double minf = getEffectiveMinFrequency(); |
1153 double maxf = getEffectiveMaxFrequency(); | 1153 double maxf = getEffectiveMaxFrequency(); |
1154 | 1154 |
1155 bool logarithmic = (m_binScale == Colour3DPlotRenderer::LogBinScale); | 1155 bool logarithmic = (m_binScale == BinScale::Log); |
1156 | 1156 |
1157 q0 = v->getFrequencyForY(y, minf, maxf, logarithmic); | 1157 q0 = v->getFrequencyForY(y, minf, maxf, logarithmic); |
1158 q1 = v->getFrequencyForY(y - 1, minf, maxf, logarithmic); | 1158 q1 = v->getFrequencyForY(y - 1, minf, maxf, logarithmic); |
1159 | 1159 |
1160 // Now map these on to ("proportions of") actual bins | 1160 // Now map these on to ("proportions of") actual bins |
1182 | 1182 |
1183 sv_samplerate_t sr = m_model->getSampleRate(); | 1183 sv_samplerate_t sr = m_model->getSampleRate(); |
1184 double minf = getEffectiveMinFrequency(); | 1184 double minf = getEffectiveMinFrequency(); |
1185 double maxf = getEffectiveMaxFrequency(); | 1185 double maxf = getEffectiveMaxFrequency(); |
1186 | 1186 |
1187 bool logarithmic = (m_binScale == Colour3DPlotRenderer::LogBinScale); | 1187 bool logarithmic = (m_binScale == BinScale::Log); |
1188 | 1188 |
1189 double q = v->getFrequencyForY(y, minf, maxf, logarithmic); | 1189 double q = v->getFrequencyForY(y, minf, maxf, logarithmic); |
1190 | 1190 |
1191 // Now map on to ("proportions of") actual bins | 1191 // Now map on to ("proportions of") actual bins |
1192 | 1192 |
1284 | 1284 |
1285 sv_samplerate_t sr = m_model->getSampleRate(); | 1285 sv_samplerate_t sr = m_model->getSampleRate(); |
1286 | 1286 |
1287 bool haveAdj = false; | 1287 bool haveAdj = false; |
1288 | 1288 |
1289 bool peaksOnly = (m_binDisplay == Colour3DPlotRenderer::PeakBins || | 1289 bool peaksOnly = (m_binDisplay == BinDisplay::PeakBins || |
1290 m_binDisplay == Colour3DPlotRenderer::PeakFrequencies); | 1290 m_binDisplay == BinDisplay::PeakFrequencies); |
1291 | 1291 |
1292 for (int q = q0i; q <= q1i; ++q) { | 1292 for (int q = q0i; q <= q1i; ++q) { |
1293 | 1293 |
1294 for (int s = s0i; s <= s1i; ++s) { | 1294 for (int s = s0i; s <= s1i; ++s) { |
1295 | 1295 |
1818 | 1818 |
1819 // cerr << "(giving actual minFreq " << minFreq << " and display minFreq " << displayMinFreq << ")" << endl; | 1819 // cerr << "(giving actual minFreq " << minFreq << " and display minFreq " << displayMinFreq << ")" << endl; |
1820 | 1820 |
1821 int increment = getWindowIncrement(); | 1821 int increment = getWindowIncrement(); |
1822 | 1822 |
1823 bool logarithmic = (m_binScale == Colour3DPlotRenderer::LogBinScale); | 1823 bool logarithmic = (m_binScale == BinScale::Log); |
1824 | 1824 |
1825 MagnitudeRange overallMag = m_viewMags[v->getId()]; | 1825 MagnitudeRange overallMag = m_viewMags[v->getId()]; |
1826 bool overallMagChanged = false; | 1826 bool overallMagChanged = false; |
1827 | 1827 |
1828 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1828 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1941 | 1941 |
1942 } else { | 1942 } else { |
1943 | 1943 |
1944 // neither limitation applies, so use a short soft limit | 1944 // neither limitation applies, so use a short soft limit |
1945 | 1945 |
1946 if (m_binDisplay == Colour3DPlotRenderer::PeakFrequencies) { | 1946 if (m_binDisplay == BinDisplay::PeakFrequencies) { |
1947 softTimeLimit = 0.15; | 1947 softTimeLimit = 0.15; |
1948 } else { | 1948 } else { |
1949 softTimeLimit = 0.1; | 1949 softTimeLimit = 0.1; |
1950 } | 1950 } |
1951 } | 1951 } |
1952 | 1952 |
1953 if (m_binDisplay != Colour3DPlotRenderer::PeakFrequencies) { | 1953 if (m_binDisplay != BinDisplay::PeakFrequencies) { |
1954 | 1954 |
1955 for (int y = 0; y < h; ++y) { | 1955 for (int y = 0; y < h; ++y) { |
1956 double q0 = 0, q1 = 0; | 1956 double q0 = 0, q1 = 0; |
1957 if (!getYBinRange(v, h-y-1, q0, q1)) { | 1957 if (!getYBinRange(v, h-y-1, q0, q1)) { |
1958 binfory[y] = -1; | 1958 binfory[y] = -1; |
2405 DenseThreeDimensionalModel *peakCacheModel = 0; | 2405 DenseThreeDimensionalModel *peakCacheModel = 0; |
2406 FFTModel *fftModel = 0; | 2406 FFTModel *fftModel = 0; |
2407 DenseThreeDimensionalModel *sourceModel = 0; | 2407 DenseThreeDimensionalModel *sourceModel = 0; |
2408 | 2408 |
2409 #ifdef DEBUG_SPECTROGRAM_REPAINT | 2409 #ifdef DEBUG_SPECTROGRAM_REPAINT |
2410 cerr << "SpectrogramLayer::paintDrawBuffer: Note: bin display = " << m_binDisplay << ", w = " << w << ", binforx[" << w-1 << "] = " << binforx[w-1] << ", binforx[0] = " << binforx[0] << endl; | 2410 cerr << "SpectrogramLayer::paintDrawBuffer: Note: bin display = " << int(m_binDisplay) << ", w = " << w << ", binforx[" << w-1 << "] = " << binforx[w-1] << ", binforx[0] = " << binforx[0] << endl; |
2411 #endif | 2411 #endif |
2412 | 2412 |
2413 int divisor = 1; | 2413 int divisor = 1; |
2414 if (usePeaksCache) { | 2414 if (usePeaksCache) { |
2415 peakCacheModel = getPeakCache(); | 2415 peakCacheModel = getPeakCache(); |
2425 bool interpolate = false; | 2425 bool interpolate = false; |
2426 Preferences::SpectrogramSmoothing smoothing = | 2426 Preferences::SpectrogramSmoothing smoothing = |
2427 Preferences::getInstance()->getSpectrogramSmoothing(); | 2427 Preferences::getInstance()->getSpectrogramSmoothing(); |
2428 if (smoothing == Preferences::SpectrogramInterpolated || | 2428 if (smoothing == Preferences::SpectrogramInterpolated || |
2429 smoothing == Preferences::SpectrogramZeroPaddedAndInterpolated) { | 2429 smoothing == Preferences::SpectrogramZeroPaddedAndInterpolated) { |
2430 if (m_binDisplay != Colour3DPlotRenderer::PeakBins && | 2430 if (m_binDisplay != BinDisplay::PeakBins && |
2431 m_binDisplay != Colour3DPlotRenderer::PeakFrequencies) { | 2431 m_binDisplay != BinDisplay::PeakFrequencies) { |
2432 interpolate = true; | 2432 interpolate = true; |
2433 } | 2433 } |
2434 } | 2434 } |
2435 | 2435 |
2436 int psx = -1; | 2436 int psx = -1; |
2515 | 2515 |
2516 if (m_colourScale != ColourScale::PhaseColourScale) { | 2516 if (m_colourScale != ColourScale::PhaseColourScale) { |
2517 column = ColumnOp::normalize(column, m_normalization); | 2517 column = ColumnOp::normalize(column, m_normalization); |
2518 } | 2518 } |
2519 | 2519 |
2520 if (m_binDisplay == Colour3DPlotRenderer::PeakBins) { | 2520 if (m_binDisplay == BinDisplay::PeakBins) { |
2521 column = ColumnOp::peakPick(column); | 2521 column = ColumnOp::peakPick(column); |
2522 } | 2522 } |
2523 | 2523 |
2524 preparedColumn = | 2524 preparedColumn = |
2525 ColumnOp::distribute(ColumnOp::applyGain(column, m_gain), | 2525 ColumnOp::distribute(ColumnOp::applyGain(column, m_gain), |
2624 SpectrogramLayer::getYForFrequency(const LayerGeometryProvider *v, double frequency) const | 2624 SpectrogramLayer::getYForFrequency(const LayerGeometryProvider *v, double frequency) const |
2625 { | 2625 { |
2626 return v->getYForFrequency(frequency, | 2626 return v->getYForFrequency(frequency, |
2627 getEffectiveMinFrequency(), | 2627 getEffectiveMinFrequency(), |
2628 getEffectiveMaxFrequency(), | 2628 getEffectiveMaxFrequency(), |
2629 m_binScale == Colour3DPlotRenderer::LogBinScale); | 2629 m_binScale == BinScale::Log); |
2630 } | 2630 } |
2631 | 2631 |
2632 double | 2632 double |
2633 SpectrogramLayer::getFrequencyForY(const LayerGeometryProvider *v, int y) const | 2633 SpectrogramLayer::getFrequencyForY(const LayerGeometryProvider *v, int y) const |
2634 { | 2634 { |
2635 return v->getFrequencyForY(y, | 2635 return v->getFrequencyForY(y, |
2636 getEffectiveMinFrequency(), | 2636 getEffectiveMinFrequency(), |
2637 getEffectiveMaxFrequency(), | 2637 getEffectiveMaxFrequency(), |
2638 m_binScale == Colour3DPlotRenderer::LogBinScale); | 2638 m_binScale == BinScale::Log); |
2639 } | 2639 } |
2640 | 2640 |
2641 int | 2641 int |
2642 SpectrogramLayer::getCompletion(LayerGeometryProvider *) const | 2642 SpectrogramLayer::getCompletion(LayerGeometryProvider *) const |
2643 { | 2643 { |
2664 | 2664 |
2665 sv_samplerate_t sr = m_model->getSampleRate(); | 2665 sv_samplerate_t sr = m_model->getSampleRate(); |
2666 min = double(sr) / getFFTSize(); | 2666 min = double(sr) / getFFTSize(); |
2667 max = double(sr) / 2; | 2667 max = double(sr) / 2; |
2668 | 2668 |
2669 logarithmic = (m_binScale == Colour3DPlotRenderer::LogBinScale); | 2669 logarithmic = (m_binScale == BinScale::Log); |
2670 unit = "Hz"; | 2670 unit = "Hz"; |
2671 return true; | 2671 return true; |
2672 } | 2672 } |
2673 | 2673 |
2674 bool | 2674 bool |
2907 haveValues = true; | 2907 haveValues = true; |
2908 } | 2908 } |
2909 | 2909 |
2910 QString adjFreqText = "", adjPitchText = ""; | 2910 QString adjFreqText = "", adjPitchText = ""; |
2911 | 2911 |
2912 if (m_binDisplay == Colour3DPlotRenderer::PeakFrequencies) { | 2912 if (m_binDisplay == BinDisplay::PeakFrequencies) { |
2913 | 2913 |
2914 if (!getAdjustedYBinSourceRange(v, x, y, freqMin, freqMax, | 2914 if (!getAdjustedYBinSourceRange(v, x, y, freqMin, freqMax, |
2915 adjFreqMin, adjFreqMax)) { | 2915 adjFreqMin, adjFreqMax)) { |
2916 return ""; | 2916 return ""; |
2917 } | 2917 } |
3019 m_model->getSampleRate() / 2)); | 3019 m_model->getSampleRate() / 2)); |
3020 | 3020 |
3021 int fw = paint.fontMetrics().width(tr("43Hz")); | 3021 int fw = paint.fontMetrics().width(tr("43Hz")); |
3022 if (tw < fw) tw = fw; | 3022 if (tw < fw) tw = fw; |
3023 | 3023 |
3024 int tickw = (m_binScale == Colour3DPlotRenderer::LogBinScale ? 10 : 4); | 3024 int tickw = (m_binScale == BinScale::Log ? 10 : 4); |
3025 | 3025 |
3026 return cw + tickw + tw + 13; | 3026 return cw + tickw + tw + 13; |
3027 } | 3027 } |
3028 | 3028 |
3029 void | 3029 void |
3037 | 3037 |
3038 //!!! cache this? | 3038 //!!! cache this? |
3039 | 3039 |
3040 int h = rect.height(), w = rect.width(); | 3040 int h = rect.height(), w = rect.width(); |
3041 | 3041 |
3042 int tickw = (m_binScale == Colour3DPlotRenderer::LogBinScale ? 10 : 4); | 3042 int tickw = (m_binScale == BinScale::Log ? 10 : 4); |
3043 int pkw = (m_binScale == Colour3DPlotRenderer::LogBinScale ? 10 : 0); | 3043 int pkw = (m_binScale == BinScale::Log ? 10 : 0); |
3044 | 3044 |
3045 int bins = getFFTSize() / 2; | 3045 int bins = getFFTSize() / 2; |
3046 sv_samplerate_t sr = m_model->getSampleRate(); | 3046 sv_samplerate_t sr = m_model->getSampleRate(); |
3047 | 3047 |
3048 if (m_maxFrequency > 0) { | 3048 if (m_maxFrequency > 0) { |
3162 } | 3162 } |
3163 | 3163 |
3164 int freq = int((sr * bin) / getFFTSize()); | 3164 int freq = int((sr * bin) / getFFTSize()); |
3165 | 3165 |
3166 if (py >= 0 && (vy - py) < textHeight - 1) { | 3166 if (py >= 0 && (vy - py) < textHeight - 1) { |
3167 if (m_binScale == Colour3DPlotRenderer::LinearBinScale) { | 3167 if (m_binScale == BinScale::Linear) { |
3168 paint.drawLine(w - tickw, h - vy, w, h - vy); | 3168 paint.drawLine(w - tickw, h - vy, w, h - vy); |
3169 } | 3169 } |
3170 continue; | 3170 continue; |
3171 } | 3171 } |
3172 | 3172 |
3180 } | 3180 } |
3181 | 3181 |
3182 py = vy; | 3182 py = vy; |
3183 } | 3183 } |
3184 | 3184 |
3185 if (m_binScale == Colour3DPlotRenderer::LogBinScale) { | 3185 if (m_binScale == BinScale::Log) { |
3186 | 3186 |
3187 // piano keyboard | 3187 // piano keyboard |
3188 | 3188 |
3189 PianoScale().paintPianoVertical | 3189 PianoScale().paintPianoVertical |
3190 (v, paint, QRect(w - pkw - 1, 0, pkw, h), | 3190 (v, paint, QRect(w - pkw - 1, 0, pkw, h), |
3302 SpectrogramRangeMapper mapper(sr, getFFTSize()); | 3302 SpectrogramRangeMapper mapper(sr, getFFTSize()); |
3303 double newdist = mapper.getValueForPosition(step); | 3303 double newdist = mapper.getValueForPosition(step); |
3304 | 3304 |
3305 double newmin, newmax; | 3305 double newmin, newmax; |
3306 | 3306 |
3307 if (m_binScale == Colour3DPlotRenderer::LogBinScale) { | 3307 if (m_binScale == BinScale::Log) { |
3308 | 3308 |
3309 // need to pick newmin and newmax such that | 3309 // need to pick newmin and newmax such that |
3310 // | 3310 // |
3311 // (log(newmin) + log(newmax)) / 2 == logmid | 3311 // (log(newmin) + log(newmax)) / 2 == logmid |
3312 // and | 3312 // and |
3444 .arg(m_minFrequency) | 3444 .arg(m_minFrequency) |
3445 .arg(m_maxFrequency) | 3445 .arg(m_maxFrequency) |
3446 .arg(convertOutColourScale(m_colourScale)) | 3446 .arg(convertOutColourScale(m_colourScale)) |
3447 .arg(m_colourMap) | 3447 .arg(m_colourMap) |
3448 .arg(m_colourRotation) | 3448 .arg(m_colourRotation) |
3449 .arg(m_binScale) | 3449 .arg(int(m_binScale)) |
3450 .arg(m_binDisplay); | 3450 .arg(int(m_binDisplay)); |
3451 | 3451 |
3452 // New-style normalization attributes, allowing for more types of | 3452 // New-style normalization attributes, allowing for more types of |
3453 // normalization in future: write out the column normalization | 3453 // normalization in future: write out the column normalization |
3454 // type separately, and then whether we are normalizing visible | 3454 // type separately, and then whether we are normalizing visible |
3455 // area as well afterwards | 3455 // area as well afterwards |
3526 if (ok) setColourMap(colourMap); | 3526 if (ok) setColourMap(colourMap); |
3527 | 3527 |
3528 int colourRotation = attributes.value("colourRotation").toInt(&ok); | 3528 int colourRotation = attributes.value("colourRotation").toInt(&ok); |
3529 if (ok) setColourRotation(colourRotation); | 3529 if (ok) setColourRotation(colourRotation); |
3530 | 3530 |
3531 Colour3DPlotRenderer::BinScale binScale = (Colour3DPlotRenderer::BinScale) | 3531 BinScale binScale = (BinScale) |
3532 attributes.value("frequencyScale").toInt(&ok); | 3532 attributes.value("frequencyScale").toInt(&ok); |
3533 if (ok) setBinScale(binScale); | 3533 if (ok) setBinScale(binScale); |
3534 | 3534 |
3535 Colour3DPlotRenderer::BinDisplay binDisplay = (Colour3DPlotRenderer::BinDisplay) | 3535 BinDisplay binDisplay = (BinDisplay) |
3536 attributes.value("binDisplay").toInt(&ok); | 3536 attributes.value("binDisplay").toInt(&ok); |
3537 if (ok) setBinDisplay(binDisplay); | 3537 if (ok) setBinDisplay(binDisplay); |
3538 | 3538 |
3539 bool haveNewStyleNormalization = false; | 3539 bool haveNewStyleNormalization = false; |
3540 | 3540 |