Salome HOME
correction test case H015
[modules/hydro.git] / doc / salome / examples / h012_caseDigueManual.py
index de2f5cf1a4e2a067e701cba45354d762f8b60eb0..5e184af704b823422de91c32ad2d70f05c746ebe 100644 (file)
@@ -8,14 +8,14 @@ import salome
 
 salome.salome_init()
 theStudy = salome.myStudy
-  
+
 #----------------------
-# --- HYDRO 
+# --- HYDRO
 #----------------------
 
 from HYDROPy import *
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
 
 hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() )
 
@@ -27,7 +27,8 @@ garonne_ign_01.SetName( "garonne_ign_01" )
 garonne_ign_01.SetZLevel( 0 )
 
 
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+  raise ValueError('problem while loading image')
 
 garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
                                QPoint( 1325, 85 ) )
@@ -44,7 +45,8 @@ garonne_ign_02.SetName( "garonne_ign_02" )
 garonne_ign_02.SetZLevel( 1 )
 
 
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+  raise ValueError('problem while loading image')
 
 garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
                                QPoint( 784, 481 ) )
@@ -217,7 +219,8 @@ Cloud_02 = hydro_doc.CreateObject( KIND_BATHYMETRY )
 Cloud_02.SetName( "Cloud_02" )
 
 Cloud_02.SetAltitudesInverted( 0 )
-Cloud_02.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz" ))
+if not(Cloud_02.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz" ))):
+  raise ValueError('problem while loading bathymetry')
 
 Cloud_02.Update()
 
@@ -226,7 +229,8 @@ garonne_point_L93 = hydro_doc.CreateObject( KIND_BATHYMETRY )
 garonne_point_L93.SetName( "garonne_point_L93" )
 
 garonne_point_L93.SetAltitudesInverted( 0 )
-garonne_point_L93.ImportFromFile( os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz" ))
+if not(garonne_point_L93.ImportFromFile( os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz" ))):
+  raise ValueError('problem while loading bathymetry')
 
 garonne_point_L93.Update()
 
@@ -339,25 +343,43 @@ garonne_2.AddGeometryGroup( case_geom_group );
 garonne_2.SetBoundaryPolyline( domaine );
 
 # Start the algorithm of the partition and assignment
-garonne_2.Update();
-garonne_2_litMineur = hydro_doc.FindObjectByName( "garonne_2_Reg_1" );
-garonne_2_Zone_1 = hydro_doc.FindObjectByName( "garonne_2_Zone_1" );
+garonne_2.Update()
+
+garonne_2_litMineur = hydro_doc.FindObjectByName( "garonne_2_Reg_1" )
+garonne_2_Zone_1 = hydro_doc.FindObjectByName( "garonne_2_Zone_1" )
 garonne_2_Zone_1.SetMergeType( HYDROData_Zone.Merge_ZMIN )
-garonne_2_litMineur.AddZone( garonne_2_Zone_1 );
-garonne_2_riveDroite = hydro_doc.FindObjectByName( "garonne_2_Reg_2" );
-garonne_2_Zone_2 = hydro_doc.FindObjectByName( "garonne_2_Zone_2" );
-garonne_2_riveDroite.AddZone( garonne_2_Zone_2 );
-garonne_2_Zone_3 = hydro_doc.FindObjectByName( "garonne_2_Zone_3" );
-garonne_2_riveDroite.AddZone( garonne_2_Zone_3 );
-garonne_2_riveGauche = hydro_doc.FindObjectByName( "garonne_2_Reg_3" );
-garonne_2_Zone_4 = hydro_doc.FindObjectByName( "garonne_2_Zone_4" );
-garonne_2_riveGauche.AddZone( garonne_2_Zone_4 );
-garonne_2_Zone_5 = hydro_doc.FindObjectByName( "garonne_2_Zone_5" );
-garonne_2_riveGauche.AddZone( garonne_2_Zone_5 );
-garonne_2_digue = hydro_doc.FindObjectByName( "garonne_2_Reg_4" );
-garonne_2_Zone_6 = hydro_doc.FindObjectByName( "garonne_2_Zone_6" );
+garonne_2_Zone_1.SetColor( QColor( 192, 137, 64 ))
+garonne_2_litMineur.AddZone( garonne_2_Zone_1 )
+
+garonne_2_riveDroite = hydro_doc.FindObjectByName( "garonne_2_Reg_2" )
+garonne_2_Zone_2 = hydro_doc.FindObjectByName( "garonne_2_Zone_2" )
+garonne_2_Zone_2.SetColor( QColor( 64, 192, 98 ))
+garonne_2_riveDroite.AddZone( garonne_2_Zone_2 )
+
+garonne_2_Zone_3 = hydro_doc.FindObjectByName( "garonne_2_Zone_3" )
+garonne_2_Zone_3.SetMergeType( HYDROData_Zone.Merge_Object )
+Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
+garonne_2_Zone_3.SetMergeObject( Cloud_02 )
+garonne_2_Zone_3.SetColor( QColor( 64, 66, 192 ))
+garonne_2_riveDroite.AddZone( garonne_2_Zone_3 )
+
+garonne_2_riveGauche = hydro_doc.FindObjectByName( "garonne_2_Reg_3" )
+garonne_2_Zone_4 = hydro_doc.FindObjectByName( "garonne_2_Zone_4" )
+garonne_2_Zone_4.SetMergeType( HYDROData_Zone.Merge_Object )
+Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
+garonne_2_Zone_4.SetMergeObject( Cloud_02 )
+garonne_2_Zone_4.SetColor( QColor( 64, 192, 164 ))
+garonne_2_riveGauche.AddZone( garonne_2_Zone_4 )
+
+garonne_2_Zone_5 = hydro_doc.FindObjectByName( "garonne_2_Zone_5" )
+garonne_2_Zone_5.SetColor( QColor( 192, 149, 64 ))
+garonne_2_riveGauche.AddZone( garonne_2_Zone_5 )
+
+garonne_2_digue = hydro_doc.FindObjectByName( "garonne_2_Reg_4" )
+garonne_2_Zone_6 = hydro_doc.FindObjectByName( "garonne_2_Zone_6" )
 garonne_2_Zone_6.SetMergeType( HYDROData_Zone.Merge_ZMAX )
-garonne_2_digue.AddZone( garonne_2_Zone_6 );
+garonne_2_Zone_6.SetColor( QColor( 64, 192, 177 ))
+garonne_2_digue.AddZone( garonne_2_Zone_6 )
 
 garonne_2_litMineur.SetName("garonne_2_litMineur")
 garonne_2_riveDroite.SetName("garonne_2_riveDroite")
@@ -368,7 +390,7 @@ garonne_2_digue.SetName("garonne_2_digue")
 garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() )
 
 #----------------------
-# --- Geometry 
+# --- Geometry
 #----------------------
 
 # Get geometry shape and print debug information
@@ -391,10 +413,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, digue, 'digue' )
 geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' )
 geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' )
 
-controlGeomProps(geompy, riveGauche,  39493.270103, 35885901.558025)
-controlGeomProps(geompy, digue,       10343.900923,   103893.397004)
-controlGeomProps(geompy, litMineur,   30337.548492,  3646827.749809)
-controlGeomProps(geompy, riveDroite,  32012.343241, 26177085.460092)
+controlGeomProps(geompy, riveGauche,  39490.835288, 35845737.590926)
+controlGeomProps(geompy, digue,       10341.466108,   103090.760662)
+controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
+controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)