]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
IPAL52559: TC7.5.0: Auto color has no effect on the faces group
authorvsr <vsr@opencascade.com>
Fri, 31 Oct 2014 14:03:46 +0000 (17:03 +0300)
committervsr <vsr@opencascade.com>
Fri, 31 Oct 2014 14:03:46 +0000 (17:03 +0300)
src/GEOMGUI/GEOM_Displayer.cxx

index 7d79a2cd5e3f6168cfeb9485463f71003207670a..f0cf6aa4febf26d484928e46634e666b267a2db0 100644 (file)
@@ -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;