From 54b10b232eaee8b77a5f28401971d54bfcf78a27 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Sun, 1 Mar 2015 19:56:02 -0500 Subject: [PATCH] Additional frequency indicators when zoomed in --- src/visual/SpectrumContext.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/visual/SpectrumContext.cpp b/src/visual/SpectrumContext.cpp index 501112d..c148179 100644 --- a/src/visual/SpectrumContext.cpp +++ b/src/visual/SpectrumContext.cpp @@ -107,7 +107,14 @@ void SpectrumContext::Draw(std::vector &points, long long freq, int bandw long long firstMhz = (leftFreq / 1000000) * 1000000; long double mhzStart = ((long double) (firstMhz - leftFreq) / (long double) (rightFreq - leftFreq)) * 2.0; + long double mhzStep = (100000.0 / (long double) (rightFreq - leftFreq)) * 2.0; + float mhzVisualStep = 0.1f; + + if (mhzStep * 0.5 * viewWidth > 400) { + mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0; + mhzVisualStep = 0.01f; + } long double currentMhz = trunc(floor(firstMhz / 1000000.0)); @@ -144,7 +151,7 @@ void SpectrumContext::Draw(std::vector &points, long long freq, int bandw label.str(std::string()); - currentMhz += 0.1f; + currentMhz += mhzVisualStep; } glLineWidth(1.0);