from PyQt5.QtCore import *
from PyQt5.QtGui import *
+from salome.hydrotools.hydroGeoMeshUtils import importPolyline, importBathymetry, createImmersibleZone
+
hydro_doc = HYDROData_Document.Document()
hydro_doc.SetLocalCS( offsetX, offsetY )
+
+limite_original = importPolyline(hydro_doc, "garonne_1_brd_FreeBorders", tmpdir, '_0', True, 4)
+limite_domaine = importPolyline(hydro_doc, "extension_1_1", HYDRO_SAMPLES, '_PolyXY_0', False, 2)
+
+Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES)
-name = "garonne_1_brd_FreeBorders"
-shape = os.path.join(tmpdir, name+".shp" )
-HYDROData_PolylineXY.ImportShapesFromFile(shape)
-limite_original = hydro_doc.FindObjectByName(name + '_0')
-for i in range(limite_original.NbSections()):
- limite_original.SetSectionType(i, 1) # spline
- limite_original.Update()
-limite_original.SetZLevel( 4 )
-
-name = "extension_1_1"
-shape = os.path.join(HYDRO_SAMPLES, name+".shp" )
-HYDROData_PolylineXY.ImportShapesFromFile(shape)
-limite_domaine = hydro_doc.FindObjectByName(name + '_PolyXY_0')
-for i in range(limite_domaine.NbSections()):
- limite_domaine.SetSectionType(i, 0) # polyline
- limite_domaine.Update()
-limite_domaine.SetZLevel( 2 )
-
-Cloud_02 = hydro_doc.CreateObject( KIND_BATHYMETRY )
-Cloud_02.SetName( "Cloud_02" )
-Cloud_02.SetAltitudesInverted( 0 )
-if not(Cloud_02.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz" ))):
- raise ValueError('problem while loading bathymetry')
-Cloud_02.Update()
-
-
-domaine_original = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
-domaine_original.SetName( "domaine_original" )
-domaine_original.SetZLevel( 1 )
-domaine_original.SetAltitudeObject( Cloud_02 )
-domaine_original.SetPolyline( limite_original )
-domaine_original.SetIsSubmersible(False)
-domaine_original.Update()
-
-domaine_englobant = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
-domaine_englobant.SetName( "domaine_englobant" )
-domaine_englobant.SetZLevel( 0 )
-domaine_englobant.SetAltitudeObject( Cloud_02 )
-domaine_englobant.SetPolyline( limite_domaine )
-domaine_englobant.Update()
+domaine_original = createImmersibleZone(hydro_doc, "domaine_original", limite_original, Cloud_02, False, 1)
+domaine_englobant = createImmersibleZone(hydro_doc, "domaine_englobant", limite_domaine, Cloud_02, True, 0)
# Calculation case
extension = hydro_doc.CreateObject( KIND_CALCULATION )
isDone = extensionEnglobante.Compute()
+controlMeshStats(extensionEnglobante, 8107, 805, 15885)
+
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()