From 84fa6ee9f30381aecbaae4398474846db2929e35 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 31 Oct 2014 17:03:46 +0300 Subject: [PATCH] IPAL52559: TC7.5.0: Auto color has no effect on the faces group --- src/GEOMGUI/GEOM_Displayer.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 7d79a2cd5..f0cf6aa4f 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -253,7 +253,20 @@ namespace #endif } } -} + + uint randomize( uint size ) + { + static bool initialized = false; + if ( !initialized ) { + qsrand( QDateTime::currentDateTime().toTime_t() ); + initialized = true; + } + uint v = qrand(); + v = uint( (double)( v ) / RAND_MAX * size ); + v = qMax( uint(0), qMin ( v, size-1 ) ); + return v; + } +} // namespace //================================================================ // Function : getActiveStudy @@ -2261,7 +2274,7 @@ SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor() } } - static int currentColor = 0; + static int currentColor = randomize( colors.size() ); SALOMEDS::Color color; color.R = (double)colors[currentColor].red() / 255.0; -- 2.39.2