From 3082b2ecaefb4fc1317d6afd3ca835f2d6f33893 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Sat, 2 Jul 2016 23:24:32 +0200 Subject: [PATCH] dump zones color in calculation case --- doc/salome/examples/h016_pilesPontManualMesh.py | 11 +++++++++++ src/HYDROData/HYDROData_Region.cxx | 7 ++++++- src/HYDROPy/HYDROData_Entity.sip | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/salome/examples/h016_pilesPontManualMesh.py b/doc/salome/examples/h016_pilesPontManualMesh.py index f075bc4f..35a4e795 100644 --- a/doc/salome/examples/h016_pilesPontManualMesh.py +++ b/doc/salome/examples/h016_pilesPontManualMesh.py @@ -962,47 +962,58 @@ casGaronne_1.SetBoundaryPolyline( domaine ) casGaronne_1.Update() casGaronne_1_riveDroite = hydro_doc.FindObjectByName( "casGaronne_1_Reg_1" ) casGaronne_1_Zone_1 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_1" ) +casGaronne_1_Zone_1.SetColor( QColor( 64, 192, 147 )) casGaronne_1_riveDroite.AddZone( casGaronne_1_Zone_1 ) casGaronne_1_Zone_2 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_2" ) +casGaronne_1_Zone_2.SetColor( QColor( 111, 192, 64 )) casGaronne_1_riveDroite.AddZone( casGaronne_1_Zone_2 ) casGaronne_1_aval = hydro_doc.FindObjectByName( "casGaronne_1_Reg_2" ) casGaronne_1_Zone_3 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_3" ) casGaronne_1_Zone_3.SetMergeType( HYDROData_Zone.Merge_Object ) garonne_point_L93 = hydro_doc.FindObjectByName( "garonne_point_L93" ) casGaronne_1_Zone_3.SetMergeObject( garonne_point_L93 ) +casGaronne_1_Zone_3.SetColor( QColor( 192, 183, 64 )) casGaronne_1_aval.AddZone( casGaronne_1_Zone_3 ) casGaronne_1_riveGauche = hydro_doc.FindObjectByName( "casGaronne_1_Reg_3" ) casGaronne_1_Zone_4 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_4" ) +casGaronne_1_Zone_4.SetColor( QColor( 158, 192, 64 )) casGaronne_1_riveGauche.AddZone( casGaronne_1_Zone_4 ) casGaronne_1_Zone_6 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_6" ) +casGaronne_1_Zone_6.SetColor( QColor( 64, 192, 156 )) casGaronne_1_riveGauche.AddZone( casGaronne_1_Zone_6 ) casGaronne_1_pont = hydro_doc.FindObjectByName( "casGaronne_1_Reg_4" ) casGaronne_1_Zone_5 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_5" ) casGaronne_1_Zone_5.SetMergeType( HYDROData_Zone.Merge_Object ) garonne_point_L93 = hydro_doc.FindObjectByName( "garonne_point_L93" ) casGaronne_1_Zone_5.SetMergeObject( garonne_point_L93 ) +casGaronne_1_Zone_5.SetColor( QColor( 192, 85, 64 )) casGaronne_1_pont.AddZone( casGaronne_1_Zone_5 ) casGaronne_1_amont = hydro_doc.FindObjectByName( "casGaronne_1_Reg_5" ) casGaronne_1_Zone_7 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_7" ) casGaronne_1_Zone_7.SetMergeType( HYDROData_Zone.Merge_Object ) garonne_point_L93 = hydro_doc.FindObjectByName( "garonne_point_L93" ) casGaronne_1_Zone_7.SetMergeObject( garonne_point_L93 ) +casGaronne_1_Zone_7.SetColor( QColor( 64, 90, 192 )) casGaronne_1_amont.AddZone( casGaronne_1_Zone_7 ) casGaronne_1_pile1 = hydro_doc.FindObjectByName( "casGaronne_1_Reg_6" ) casGaronne_1_Zone_8 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_8" ) casGaronne_1_Zone_8.SetMergeType( HYDROData_Zone.Merge_ZMAX ) +casGaronne_1_Zone_8.SetColor( QColor( 64, 190, 192 )) casGaronne_1_pile1.AddZone( casGaronne_1_Zone_8 ) casGaronne_1_pile2 = hydro_doc.FindObjectByName( "casGaronne_1_Reg_7" ) casGaronne_1_Zone_9 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_9" ) casGaronne_1_Zone_9.SetMergeType( HYDROData_Zone.Merge_ZMAX ) +casGaronne_1_Zone_9.SetColor( QColor( 160, 192, 64 )) casGaronne_1_pile2.AddZone( casGaronne_1_Zone_9 ) casGaronne_1_pile3 = hydro_doc.FindObjectByName( "casGaronne_1_Reg_8" ) casGaronne_1_Zone_10 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_10" ) casGaronne_1_Zone_10.SetMergeType( HYDROData_Zone.Merge_ZMAX ) +casGaronne_1_Zone_10.SetColor( QColor( 192, 166, 64 )) casGaronne_1_pile3.AddZone( casGaronne_1_Zone_10 ) casGaronne_1_pile4 = hydro_doc.FindObjectByName( "casGaronne_1_Reg_9" ) casGaronne_1_Zone_11 = hydro_doc.FindObjectByName( "casGaronne_1_Zone_11" ) casGaronne_1_Zone_11.SetMergeType( HYDROData_Zone.Merge_ZMAX ) +casGaronne_1_Zone_11.SetColor( QColor( 64, 192, 92 )) casGaronne_1_pile4.AddZone( casGaronne_1_Zone_11 ) casGaronne_1_riveDroite.SetName( "casGaronne_1_riveDroite" ) casGaronne_1_aval.SetName( "casGaronne_1_aval" ) diff --git a/src/HYDROData/HYDROData_Region.cxx b/src/HYDROData/HYDROData_Region.cxx index 0a0604d8..698cfc94 100644 --- a/src/HYDROData/HYDROData_Region.cxx +++ b/src/HYDROData/HYDROData_Region.cxx @@ -44,6 +44,7 @@ #include #include +#include //#define DEB_GET_REGION_SHAPE @@ -433,9 +434,13 @@ QStringList HYDROData_Region::DumpToPython( const QString& thePyScriptPath .arg( aMergeObject->GetObjPyName() ); } } - + // set color + QColor zoneColor = aZone->GetColor(Qt::darkBlue); + aResList << QString( "%1.SetColor( QColor( %2, %3, %4 ))" ) + .arg( aZone->GetObjPyName() ).arg( zoneColor.red() ).arg( zoneColor.green() ).arg( zoneColor.blue() ); // add zone setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aZone, "AddZone" ); + } return aResList; diff --git a/src/HYDROPy/HYDROData_Entity.sip b/src/HYDROPy/HYDROData_Entity.sip index fda3ec35..4eae394f 100644 --- a/src/HYDROPy/HYDROData_Entity.sip +++ b/src/HYDROPy/HYDROData_Entity.sip @@ -256,7 +256,8 @@ public: */ virtual void RemoveZLevel(); - + void SetColor( const QColor& theColor, const int theTag = 0 ); + protected: /** -- 2.39.2