Commit 91f87eb6 authored by Frédéric Larue's avatar Frédéric Larue

Display of metric grid improved.

parent e7e9b102
...@@ -240,18 +240,18 @@ void MetricGrid::display( GLViewer *viewer ) ...@@ -240,18 +240,18 @@ void MetricGrid::display( GLViewer *viewer )
QVector3D front = viewer->frontAxis(); QVector3D front = viewer->frontAxis();
if( std::abs(front.x()) == 1.0f ) if( std::abs(front.x()) == 1.0f )
{ {
m_EnabledGrids = m_EnableGridsOnAlignedOrtho? YZ : NONE; m_EnabledGrids = m_EnableGridsOnAlignedOrtho * YZ;
m_EnabledAxis = m_EnableAxisOnAlignedOrtho? Y|Z : NONE; m_EnabledAxis = m_EnableAxisOnAlignedOrtho * (Y|Z);
} }
else if( std::abs(front.y()) == 1.0f ) else if( std::abs(front.y()) == 1.0f )
{ {
m_EnabledGrids = m_EnableGridsOnAlignedOrtho? ZX : NONE; m_EnabledGrids = m_EnableGridsOnAlignedOrtho * ZX;
m_EnabledAxis = m_EnableAxisOnAlignedOrtho? Z|X : NONE; m_EnabledAxis = m_EnableAxisOnAlignedOrtho * (Z|X);
} }
else if( std::abs(front.z()) == 1.0f ) else if( std::abs(front.z()) == 1.0f )
{ {
m_EnabledGrids = m_EnableGridsOnAlignedOrtho? XY : NONE; m_EnabledGrids = m_EnableGridsOnAlignedOrtho * XY;
m_EnabledAxis = m_EnableAxisOnAlignedOrtho? X|Y : NONE; m_EnabledAxis = m_EnableAxisOnAlignedOrtho * (X|Y);
} }
} }
......
...@@ -44,8 +44,8 @@ private: ...@@ -44,8 +44,8 @@ private:
int m_EnabledGrids; int m_EnabledGrids;
int m_EnabledAxis; int m_EnabledAxis;
bool m_EnableLabels; bool m_EnableLabels;
bool m_EnableAxisOnAlignedOrtho; int m_EnableAxisOnAlignedOrtho;
bool m_EnableGridsOnAlignedOrtho; int m_EnableGridsOnAlignedOrtho;
/*****************************\ /*****************************\
| Constructor(s) / destructor | | Constructor(s) / destructor |
...@@ -55,16 +55,16 @@ public: ...@@ -55,16 +55,16 @@ public:
m_EnabledGrids(NONE), m_EnabledGrids(NONE),
m_EnabledAxis(ALL), m_EnabledAxis(ALL),
m_EnableLabels(true), m_EnableLabels(true),
m_EnableAxisOnAlignedOrtho(true), m_EnableAxisOnAlignedOrtho(1),
m_EnableGridsOnAlignedOrtho(true) m_EnableGridsOnAlignedOrtho(1)
{} {}
inline MetricGrid( int enabledGrids, inline MetricGrid( int enabledGrids,
int enabledAxis ) : int enabledAxis ) :
m_EnabledGrids(enabledGrids), m_EnabledGrids(enabledGrids),
m_EnabledAxis(enabledAxis), m_EnabledAxis(enabledAxis),
m_EnableLabels(true), m_EnableLabels(true),
m_EnableAxisOnAlignedOrtho(true), m_EnableAxisOnAlignedOrtho(1),
m_EnableGridsOnAlignedOrtho(true) m_EnableGridsOnAlignedOrtho(1)
{} {}
/********************\ /********************\
...@@ -88,13 +88,13 @@ public: ...@@ -88,13 +88,13 @@ public:
inline void disableLabels() { m_EnableLabels = false; } inline void disableLabels() { m_EnableLabels = false; }
inline bool areLabelsEnabled() const { return m_EnableLabels; } inline bool areLabelsEnabled() const { return m_EnableLabels; }
inline void enableAxisOnAlignedOrtho() { m_EnableAxisOnAlignedOrtho = true; } inline void enableAxisOnAlignedOrtho() { m_EnableAxisOnAlignedOrtho = 1; }
inline void disableAxisOnAlignedOrtho() { m_EnableAxisOnAlignedOrtho = false; } inline void disableAxisOnAlignedOrtho() { m_EnableAxisOnAlignedOrtho = 0; }
inline bool areAxisOnAlignedOrthoEnabled() const { return m_EnableAxisOnAlignedOrtho; } inline bool areAxisOnAlignedOrthoEnabled() const { return m_EnableAxisOnAlignedOrtho != 0; }
inline void enableGridsOnAlignedOrtho() { m_EnableGridsOnAlignedOrtho = true; } inline void enableGridsOnAlignedOrtho() { m_EnableGridsOnAlignedOrtho = 1; }
inline void disableGridsOnAlignedOrtho() { m_EnableGridsOnAlignedOrtho = false; } inline void disableGridsOnAlignedOrtho() { m_EnableGridsOnAlignedOrtho = 0; }
inline bool areGridsOnAlignedOrthoEnabled() const { return m_EnableGridsOnAlignedOrtho; } inline bool areGridsOnAlignedOrthoEnabled() const { return m_EnableGridsOnAlignedOrtho != 0; }
void display( GLViewer *viewer ); void display( GLViewer *viewer );
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment