]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
another way to get colors;
authorisn <isn@opencascade.com>
Tue, 20 Oct 2015 09:25:45 +0000 (12:25 +0300)
committerisn <isn@opencascade.com>
Tue, 20 Oct 2015 09:25:45 +0000 (12:25 +0300)
get rid of random.h

src/HYDRO_tests/CMakeLists.txt
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/TestViewer.h
src/HYDRO_tests/random.cxx [deleted file]
src/HYDRO_tests/random.h [deleted file]
src/HYDRO_tests/test_HYDROData_Bathymetry.cxx
src/HYDRO_tests/test_HYDROData_Main.cxx

index 50708823ef7f13c61bfeda88406b32bb17392ccf..a1c314f3cdebdae19d66b4e168288c55602e6f07 100644 (file)
@@ -19,7 +19,6 @@ set(PROJECT_HEADERS
   TestViewer.h
   TestLib_Listener.h
   TestLib_Runner.h
-  random.h
 )
 
 set(PROJECT_SOURCES 
@@ -41,7 +40,6 @@ set(PROJECT_SOURCES
   TestViewer.cxx
   TestLib_Listener.cxx
   TestLib_Runner.cxx
-  random.cxx
 )
 
 add_definitions(
index ebd8d3fc0aeaa83327930caba6c1c633336e2c6f..7dcec1aa3c2a972d91bd0318082ad995617a7522 100644 (file)
@@ -1,6 +1,6 @@
 
 #include <TestViewer.h>
-#include <random.h>
+//#include <random.h>
 #include <OCCViewer_ViewManager.h>
 #ifdef WIN32
   #pragma warning ( disable: 4251 )
@@ -65,13 +65,17 @@ Handle(AIS_InteractiveContext) context()
   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 )
@@ -97,15 +101,15 @@ void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll,
   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 )
   {
index 9768982a2c603f3d0453520f7530ea78dbea07ef..64438b6cea009aa5092a49220c4d3566c4330baa 100644 (file)
@@ -18,6 +18,7 @@ public:
   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;
diff --git a/src/HYDRO_tests/random.cxx b/src/HYDRO_tests/random.cxx
deleted file mode 100644 (file)
index c829b20..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-#include <random.h>
-
-quint32 next = 1;
-
-void test_srand( quint32 theValue )
-{
-  next = theValue + 1;
-}
-
-quint32 test_rand()
-{
-  next = next * 1103515245 + 12345;
-  return next % ( 1 << 24 );
-}
diff --git a/src/HYDRO_tests/random.h b/src/HYDRO_tests/random.h
deleted file mode 100644 (file)
index d690111..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#pragma once
-
-#include <QtGlobal>
-
-void test_srand( quint32 theValue );
-quint32 test_rand();
index 9b6535f3d27ddbc89053d93eebc7292bacb1a463..a4ccd3425cee6c40370bc7189db1da0890fa9947 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <gp_XY.hxx>
 #include <gp_XYZ.hxx>
-#include <random.h>
 
 #include <QDir>
 #include <QFile>
index 4248b2190a2bb38bb0811df53812d82a87352615..74bb9315a863e903d4f1108102d06f6913aa95a9 100644 (file)
 #include <QApplication>
 #include <QColor>
 #include <QTest>
-#include <random.h>
 
 int main( int argc, char* argv[] )
 {
-  test_srand( 0 );
-
   QApplication anApp( argc, argv );
   SUIT_Session aSession;