From: vsr Date: Fri, 31 Oct 2014 14:03:46 +0000 (+0300) Subject: IPAL52559: TC7.5.0: Auto color has no effect on the faces group X-Git-Tag: V7_5_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=84fa6ee9f30381aecbaae4398474846db2929e35;p=modules%2Fgeom.git IPAL52559: TC7.5.0: Auto color has no effect on the faces group --- 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;