From: fps Date: Thu, 25 Oct 2012 09:09:21 +0000 (+0000) Subject: Enable GENERAL_AUTOCOLOR and SIMPLE_AUTOCOLOR. X-Git-Tag: V6_main_FINAL~100 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b6bf333002d9d99c135c0605beffc72cbd54dd0b;p=modules%2Fgeom.git Enable GENERAL_AUTOCOLOR and SIMPLE_AUTOCOLOR. Change the getPredefinedUniqueColor algorithm. --- diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 7edbae5b2..1718d7d0b 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -116,10 +116,10 @@ // If the next macro is defined, autocolor feature works for all sub-shapes; // if it is undefined, autocolor feature works for groups only -//#define GENERAL_AUTOCOLOR +#define GENERAL_AUTOCOLOR // Below macro, when uncommented, switches on simplified (more performant) algorithm // of auto-color picking up -//#define SIMPLE_AUTOCOLOR +#define SIMPLE_AUTOCOLOR //================================================================ // Function : getActiveStudy @@ -1835,19 +1835,15 @@ SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor() static QList colors; if ( colors.isEmpty() ) { - const int rfactor = 4; // red color component split factor, must be > 0 - const int gfactor = 4; // green color component split factor, must be > 0 - const int bfactor = 3; // blue color component split factor, must be > 0 - // - - // total number of pre-defined colors is defined as - // nbcolors = rfactor * gfactor * bfactor - // NB: all three factors should not have same values - // otherwise all colors will be greyish - - for ( int g = 0; g < gfactor; g++ ) { - for ( int r = 0; r < rfactor; r++ ) { - for ( int b = 0; b < bfactor; b++ ) - colors.append( QColor( qRgb( r * 255 / (rfactor-1), g * 255 / (gfactor-1), b * 255 / (bfactor-1) ) ) ); + + for (int s = 0; s < 2 ; s++) + { + for (int v = 100; v >= 40; v = v - 20) + { + for (int h = 0; h < 359 ; h = h + 60) + { + colors.append(QColor::fromHsv(h, 255 - s * 127, v * 255 / 100)); + } } } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index c73767ca2..526a9b1e4 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -111,10 +111,10 @@ // If the next macro is defined, autocolor feature works for all sub-shapes; // if it is undefined, autocolor feature works for groups only -//#define GENERAL_AUTOCOLOR +#define GENERAL_AUTOCOLOR // Below macro, when uncommented, switches on simplified (more performant) algorithm // of auto-color picking up -//#define SIMPLE_AUTOCOLOR +#define SIMPLE_AUTOCOLOR void GEOMToolsGUI::OnCheckGeometry() {