#include <TestViewer.h>
-#include <random.h>
+//#include <random.h>
#include <OCCViewer_ViewManager.h>
#ifdef WIN32
#pragma warning ( disable: 4251 )
return TestViewer::viewer()->getAISContext();
}
-QColor randomColor()
+QColor TestViewer::GetColor(int i)
{
- int r = test_rand();
- int aHue = r%255;
- //std::cout << "hue: " << aHue << std::endl;
- QColor aColor = QColor::fromHsl( aHue, 255, 128 );
- return aColor;
+ QVector<QColor> aCV;
+ aCV << QColor(0,0,255)
+ << QColor(0,255,0)
+ << QColor(255,0,0)
+ << QColor(255,255,20)
+ << QColor(20,255,255)
+ << QColor(100,100,20)
+ << QColor(10,100,150);
+ return aCV[i];
}
void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor )
context()->EraseAll();
myKey = theKey;
- test_srand( 0 );
+ int i = 0;
if( theShape.ShapeType()==TopAbs_SHELL )
{
TopoDS_Iterator anIt( theShape );
- for( ; anIt.More(); anIt.Next() )
- show( anIt.Value(), theMode, false, randomColor() );
+ for( ; anIt.More(); anIt.Next(), i++ )
+ show( anIt.Value(), theMode, false, GetColor(i) );
}
else
- show( theShape, theMode, false, randomColor() );
+ show( theShape, theMode, false, GetColor(0) );
if( isFitAll )
{
static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor );
static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey );
static bool AssertImages( QString& theMessage );
+ static QColor GetColor(int i);
private:
static OCCViewer_ViewManager* myViewManager;