]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
détection des problèmes de chargement de bathymétrie
authorPaul RASCLE <paul.rascle@edf.fr>
Tue, 5 Jan 2016 13:22:31 +0000 (14:22 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Tue, 5 Jan 2016 13:22:31 +0000 (14:22 +0100)
doc/salome/examples/h004_importBathyXYZ.py
doc/salome/examples/h006_importBathyXYZBad.py
doc/salome/examples/h009_normalCaseManual.py
doc/salome/examples/h010_normalCaseManualMesh.py
doc/salome/examples/h011_normalCaseManualInterpolZ.py
doc/salome/examples/h012_caseDigueManual.py
doc/salome/examples/h013_caseDigueManualMesh.py
doc/salome/examples/h014_caseDigueManualInterpolZ.py
doc/salome/examples/h015_normalCaseManualTelemac.py
src/HYDROData/HYDROData_Bathymetry.cxx

index 6dc8d6991189c8e224c94a15955c169639228b7a..369a7e3712abbdda6ed2a908b0805c37cfb97235 100644 (file)
@@ -21,7 +21,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()
 
index 3a24a9f2fc93c26e44b078d44180400d403fbdf4..d41226e452149eb8c73435373aab890847acb36f 100644 (file)
@@ -21,12 +21,10 @@ Cloud_inexistant = hydro_doc.CreateObject( KIND_BATHYMETRY )
 Cloud_inexistant.SetName( "Cloud_inexistant" )
 
 Cloud_inexistant.SetAltitudesInverted( 0 );
-Cloud_inexistant.ImportFromFile( os.path.join(HYDRO_SAMPLES,  "Cloud_inexistant.xyz" ))
+ret = Cloud_inexistant.ImportFromFile( os.path.join(HYDRO_SAMPLES,  "Cloud_inexistant.xyz" ))
 
-# TODO : ce chargement doit echouer avec un retour d'erreur à traiter
-raise ValueError('file not found')
-
-Cloud_inexistant.Update()
+if ret:
+  raise ValueError('loading problem not detected: return value should be null')
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index cd407f19c4f7fc91e94789d7ba41e2a46aa8dac1..f15bf5005dff36783d46a8bc03d3318298454b02 100644 (file)
@@ -199,7 +199,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()
 
@@ -208,7 +209,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()
 
index 6c5272d05428300278127d53c23dae00b30d5102..d7f88d138046bdb0dba7cb3d9e2d00253ee14564 100644 (file)
@@ -199,7 +199,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()
 
@@ -208,7 +209,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()
 
index 492823074060a44e45093042bfb330248333736b..cbd67350549415e3fde5d13e41ea7cd00fcb9f1b 100644 (file)
@@ -199,7 +199,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()
 
@@ -208,7 +209,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()
 
index 6b679b4b1f32f437017db5b4aba57583a4d89157..311cbaf7f1d361438577af43e1bafe323dc73e28 100644 (file)
@@ -219,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()
 
@@ -228,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()
 
index 6e013f8d4b2aec5e41ccf41f4d305a046076392c..ab55e7301edfb78e219ab035d68b6e3ce339e8f8 100644 (file)
@@ -219,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()
 
@@ -228,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()
 
index 174c6bee343ba9394138cfa976169412fc10adb9..501fd09179bccf3f852bb0c9a7c3f5b740c7782d 100644 (file)
@@ -219,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()
 
@@ -228,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()
 
index 5395883f66703930d64c3b704be0b66bb0d31060..2d5db353e2e23bee8ee677e327ca14905f681145 100644 (file)
@@ -199,7 +199,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()
 
@@ -208,7 +209,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()
 
index baaf0cd3751755e2152d07f1d8cab7f1db508ad1..bc7e75b447e48fd87447e08f849c7718c4a89044 100644 (file)
@@ -81,9 +81,9 @@ QStringList HYDROData_Bathymetry::DumpToPython( const QString& thePyScriptPath,
               .arg( aBathymetryName ).arg( IsAltitudesInverted() );
 
   TCollection_AsciiString aFilePath = GetFilePath();
-  aResList << QString( "%1.ImportFromFile( \"%2\" )" )
+  aResList << QString( "if not(%1.ImportFromFile( \"%2\" )):" )
               .arg( aBathymetryName ).arg( aFilePath.ToCString() );
-
+  aResList << QString( "  raise ValueError('problem while loading bathymetry')" );
   aResList << QString( "" );
   aResList << QString( "%1.Update()" ).arg( aBathymetryName );
   aResList << QString( "" );