]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
détection des problèmes de chargement d'images
authorPaul RASCLE <paul.rascle@edf.fr>
Tue, 5 Jan 2016 09:42:59 +0000 (10:42 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Tue, 5 Jan 2016 09:42:59 +0000 (10:42 +0100)
12 files changed:
doc/salome/examples/h001_importImage.py
doc/salome/examples/h002_importImage.py
doc/salome/examples/h003_changeLCS.py
doc/salome/examples/h005_importImageBad.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_Image.cxx

index 184e2434db8ded5f750e665b1075495d0c2eaaf8..6c072bff8d083994e862f18001f0dcba1dbc7048 100644 (file)
@@ -20,7 +20,8 @@ hydro_doc.SetLocalCS( 0, 0 )
 garonne_ign_01 = hydro_doc.CreateObject( KIND_IMAGE )
 garonne_ign_01.SetName( "garonne_ign_01" )
 
-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 ) )
index d884dc808d27c2438e0dd661911546fb19869f7f..efa0ead52983d5e43fa3a7ceb87ba821a7c7a142 100644 (file)
@@ -23,7 +23,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 ) )
@@ -40,7 +41,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 ) )
index a5b88f7bb6fd7ce647d2f11712f16500cc33a51f..be02467ed9c8aa5d9a1e04a0c9263fa23b4a53c1 100644 (file)
@@ -23,7 +23,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 ) )
@@ -40,7 +41,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 ) )
index e9ece7584f3d327accf2c799cea967938fb9a171..d2e6887cef19c7fac7b3658ea8031667d12d7803 100644 (file)
@@ -20,19 +20,10 @@ hydro_doc.SetLocalCS( 0, 0 )
 garonne_ign_inexistant = hydro_doc.CreateObject( KIND_IMAGE )
 garonne_ign_inexistant.SetName( "garonne_ign_inexistant" )
 
-garonne_ign_inexistant.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_inexistant.png" ))
+ret = garonne_ign_inexistant.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_inexistant.png" ))
 
-# TODO : ce chargement doit echouer avec un retour d'erreur à traiter
-raise ValueError('file not found')
-
-garonne_ign_inexistant.SetLocalPoints( QPoint( 40, 817 ),
-                               QPoint( 1325, 85 ) )
-
-garonne_ign_inexistant.SetGlobalPoints( 1,
-                                QPointF( 471562, 6.36775e+06 ),
-                                QPointF( 489400, 6.37702e+06 ) )
-
-garonne_ign_inexistant.Update()
+if ret:
+  raise ValueError('loading problem not detected: return value should be null')
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index b1d8dfa160d7f6cf17fcc106ccd93b49cd853c9c..cd407f19c4f7fc91e94789d7ba41e2a46aa8dac1 100644 (file)
@@ -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 ) )
index 5f63d5306cfdcbad67ecc90a9ac3168cbf6ace01..6c5272d05428300278127d53c23dae00b30d5102 100644 (file)
@@ -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 ) )
index b995db475dfbed075d6ff122897520bd640d16a3..492823074060a44e45093042bfb330248333736b 100644 (file)
@@ -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 ) )
index de2f5cf1a4e2a067e701cba45354d762f8b60eb0..6b679b4b1f32f437017db5b4aba57583a4d89157 100644 (file)
@@ -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 ) )
index 73d07f75168eae9375f5cda921688d5f6008b51e..6e013f8d4b2aec5e41ccf41f4d305a046076392c 100644 (file)
@@ -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 ) )
index fd95340e96c669808536b0de5e9bd95b84258799..174c6bee343ba9394138cfa976169412fc10adb9 100644 (file)
@@ -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 ) )
index 4df4002f9c5af2e231378315aefff669cfe22763..5395883f66703930d64c3b704be0b66bb0d31060 100644 (file)
@@ -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 ) )
index 6a3e9a3b815d70127295fe8c12ca604f36f9c123..9cabbc12d5b547358f66cc37ec2c8e09ae2d064c 100644 (file)
@@ -71,8 +71,9 @@ QStringList HYDROData_Image::DumpToPython( const QString&       thePyScriptPath,
   if ( !aFilePath.isEmpty() )
   {
     aResList << QString( "" );
-    aResList << QString( "%1.LoadImage( \"%2\" )" )
+    aResList << QString( "if not(%1.LoadImage( \"%2\" )):" )
                 .arg( anImageName ).arg( aFilePath );
+    aResList << QString( "  raise ValueError('problem while loading image')" );
     aResList << QString( "" );
 
     // Dump transformation points for image