From 42c40bebef1b9b668aef56459bf0dc65f0e2ac5f Mon Sep 17 00:00:00 2001 From: Frederic Larue Date: Mon, 14 Oct 2019 15:11:25 +0200 Subject: [PATCH] Metric grid modified so as to recover the current scale level. --- GLViewer/MetricGrid.cpp | 8 ++++---- GLViewer/MetricGrid.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/GLViewer/MetricGrid.cpp b/GLViewer/MetricGrid.cpp index cf0333c..e925a46 100644 --- a/GLViewer/MetricGrid.cpp +++ b/GLViewer/MetricGrid.cpp @@ -214,7 +214,7 @@ void MetricGrid::display( GLViewer *viewer ) double log10Dist = std::log10( 1.75*viewer->distToFocusPoint() ); int log10DistI = (int) std::floor( log10Dist ); - double scaleFactor = std::pow( 10.0, (double)log10DistI ); + m_CurrentScale = std::pow( 10.0, (double)log10DistI ); // Determine the alpha value for smooth transitions between successive grid scales. @@ -268,10 +268,10 @@ void MetricGrid::display( GLViewer *viewer ) glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); if( alpha != 255 ) - displayGrid( viewer, 10.0*scaleFactor, 255-alpha ); - displayGrid( viewer, scaleFactor, 255 ); + displayGrid( viewer, 10.0*m_CurrentScale, 255-alpha ); + displayGrid( viewer, m_CurrentScale, 255 ); if( alpha ) - displayGrid( viewer, 0.1*scaleFactor, alpha ); + displayGrid( viewer, 0.1*m_CurrentScale, alpha ); // Restore the previously backed up state. diff --git a/GLViewer/MetricGrid.h b/GLViewer/MetricGrid.h index 106d533..fc7a5d1 100644 --- a/GLViewer/MetricGrid.h +++ b/GLViewer/MetricGrid.h @@ -47,6 +47,7 @@ private: bool m_EnableLabels; int m_EnableAxisOnAlignedOrtho; int m_EnableGridsOnAlignedOrtho; + double m_CurrentScale; const QString* m_Suffix; /*****************************\ @@ -102,6 +103,8 @@ public: inline void setSuffix( const QString *suffix ) { m_Suffix = suffix; } inline QString suffix() const { return *m_Suffix; } + + inline double currentScale() const { return m_CurrentScale; } }; -- GitLab