salome.salome_init()
theStudy = salome.myStudy
+#----------------------
+# --- HYDRO
+#----------------------
+
from HYDROPy import *
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-
-# -------------------------------------
-
-def controlGeomProps(geomShape, refLength, refArea):
- props = geompy.BasicProperties(geomShape)
- print " Wires length: ", props[0]
- print " Surface area: ", props[1]
- print " Volume : ", props[2]
- deltaLength = 2.0*abs((props[0] - refLength)/(props[0] + refLength))
- deltaArea = 2.0*abs((props[1] - refArea)/(props[1] + refArea))
- if deltaLength > 1e-7 or deltaArea > 1e-7 or props[2] != 0:
- print "While must be:"
- print " Wires length: ", refLength
- print " Surface area: ", refArea
- print " Volume : ", 0.
- raise ValueError("Bad length or area")
-
-# -------------------------------------
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() )
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 ) )
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 ) )
garonne.SetZLevel( 2 )
garonne.AddSection( "Section_1", 1, 1 )
+garonne.AddPoint( 0, gp_XY( 38191.48, 33184.55 ) )
+garonne.AddPoint( 0, gp_XY( 38553.78, 33013.53 ) )
+garonne.AddPoint( 0, gp_XY( 38993.90, 32767.64 ) )
+garonne.AddPoint( 0, gp_XY( 39678.58, 32533.58 ) )
+garonne.AddPoint( 0, gp_XY( 40240.26, 32305.27 ) )
garonne.AddPoint( 0, gp_XY( 40717.94, 32193.70 ) )
garonne.AddPoint( 0, gp_XY( 41361.00, 32464.18 ) )
garonne.AddPoint( 0, gp_XY( 41831.41, 32626.69 ) )
garonne.AddPoint( 0, gp_XY( 39782.86, 32207.17 ) )
garonne.AddPoint( 0, gp_XY( 38814.10, 32560.43 ) )
garonne.AddPoint( 0, gp_XY( 38302.17, 32903.70 ) )
-garonne.AddPoint( 0, gp_XY( 38191.48, 33184.55 ) )
-garonne.AddPoint( 0, gp_XY( 38553.78, 33013.53 ) )
-garonne.AddPoint( 0, gp_XY( 38993.90, 32767.64 ) )
-garonne.AddPoint( 0, gp_XY( 39678.58, 32533.58 ) )
-garonne.AddPoint( 0, gp_XY( 40240.26, 32305.27 ) )
garonne.Update()
domaine.SetZLevel( 3 )
domaine.AddSection( "Section_1", 0, 1 )
-domaine.AddPoint( 0, gp_XY( 40325.30, 34641.11 ) )
-domaine.AddPoint( 0, gp_XY( 37581.56, 30348.45 ) )
-domaine.AddPoint( 0, gp_XY( 44835.83, 24264.97 ) )
-domaine.AddPoint( 0, gp_XY( 46006.47, 24575.11 ) )
-domaine.AddPoint( 0, gp_XY( 48787.77, 30167.56 ) )
-domaine.AddPoint( 0, gp_XY( 45532.36, 33239.83 ) )
-domaine.AddPoint( 0, gp_XY( 43548.77, 34048.39 ) )
+domaine.AddPoint( 0, gp_XY( 39901.15, 34762.30 ) );
+domaine.AddPoint( 0, gp_XY( 38086.50, 29964.69 ) );
+domaine.AddPoint( 0, gp_XY( 44835.83, 24264.97 ) );
+domaine.AddPoint( 0, gp_XY( 46758.56, 25021.86 ) );
+domaine.AddPoint( 0, gp_XY( 46757.20, 26601.21 ) );
+domaine.AddPoint( 0, gp_XY( 48566.45, 30152.81 ) );
+domaine.AddPoint( 0, gp_XY( 45532.36, 33239.83 ) );
+domaine.AddPoint( 0, gp_XY( 43548.77, 34048.39 ) );
domaine.Update()
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()
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()
garonne_1.SetName( "garonne_1" )
garonne_1.SetAssignmentMode( HYDROData_CalculationCase.MANUAL )
-garonne_1.SetAssignmentLandCoverMode( HYDROData_CalculationCase.AUTOMATIC )
garonne_1.AddGeometryObject( litMineur )
garonne_1.AddGeometryObject( domaineEtendu )
garonne_1.AddGeometryObject( litMajeur )
case_geom_group = litMajeur.GetGroup( 0 )
garonne_1.AddGeometryGroup( case_geom_group )
garonne_1.SetBoundaryPolyline( domaine )
+#garonne_1.SetStricklerTable( Strickler_table_1 )
# Start the algorithm of the partition and assignment
garonne_1.Update()
garonne_1_litMineur = hydro_doc.FindObjectByName( "garonne_1_Reg_1" )
garonne_1_Zone_1 = hydro_doc.FindObjectByName( "garonne_1_Zone_1" )
garonne_1_Zone_1.SetMergeType( HYDROData_Zone.Merge_ZMIN )
+garonne_1_Zone_1.SetColor( QColor( 192, 113, 64 ))
garonne_1_litMineur.AddZone( garonne_1_Zone_1 )
+
garonne_1_riveDroite = hydro_doc.FindObjectByName( "garonne_1_Reg_2" )
garonne_1_Zone_2 = hydro_doc.FindObjectByName( "garonne_1_Zone_2" )
+garonne_1_Zone_2.SetColor( QColor( 141, 192, 64 ))
garonne_1_riveDroite.AddZone( garonne_1_Zone_2 )
+
garonne_1_Zone_3 = hydro_doc.FindObjectByName( "garonne_1_Zone_3" )
+garonne_1_Zone_3.SetMergeType( HYDROData_Zone.Merge_Object )
+Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
+garonne_1_Zone_3.SetMergeObject( Cloud_02 )
+garonne_1_Zone_3.SetColor( QColor( 64, 192, 77 ))
garonne_1_riveDroite.AddZone( garonne_1_Zone_3 )
+
garonne_1_riveGauche = hydro_doc.FindObjectByName( "garonne_1_Reg_3" )
garonne_1_Zone_4 = hydro_doc.FindObjectByName( "garonne_1_Zone_4" )
+garonne_1_Zone_4.SetMergeType( HYDROData_Zone.Merge_Object )
+Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
+garonne_1_Zone_4.SetMergeObject( Cloud_02 )
+garonne_1_Zone_4.SetColor( QColor( 64, 75, 192 ))
garonne_1_riveGauche.AddZone( garonne_1_Zone_4 )
+
garonne_1_Zone_5 = hydro_doc.FindObjectByName( "garonne_1_Zone_5" )
+garonne_1_Zone_5.SetColor( QColor( 64, 192, 77 ))
garonne_1_riveGauche.AddZone( garonne_1_Zone_5 )
-garonne_1_litMineur.SetName("garonne_1_litMineur")
-garonne_1_riveDroite.SetName("garonne_1_riveDroite")
-garonne_1_riveGauche.SetName("garonne_1_riveGauche")
+garonne_1_litMineur.SetName( "garonne_1_litMineur" )
+garonne_1_riveDroite.SetName( "garonne_1_riveDroite" )
+garonne_1_riveGauche.SetName( "garonne_1_riveGauche" )
# Export of the calculation case
garonne_1_entry = garonne_1.Export( theStudy._get_StudyId() )
+#----------------------
+# --- Geometry
+#----------------------
+
# Get geometry shape and print debug information
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
+from salome.hydrotools.controls import controlGeomProps
geompy = geomBuilder.New(theStudy)
geompy.addToStudyInFather( HYDRO_garonne_1, litMineur, 'litMineur' )
geompy.addToStudyInFather( HYDRO_garonne_1, riveDroite, 'riveDroite' )
-controlGeomProps(riveGauche, 29255.966464, 36865800.781542)
-controlGeomProps(litMineur, 30220.240241, 3309295.161572)
-controlGeomProps(riveDroite, 31841.799764, 26782824.517334)
+controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061)
+#controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399)
+#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
+controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
+controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)