1 # -*- coding: utf-8 -*-
4 HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test")
5 HYDRO_TEST_RESOURCES = os.path.join(os.environ["HYDRO_DIR"], "bin", "salome", "test", "tmp_test")
6 if not os.path.isdir(HYDRO_TEST_RESOURCES):
7 os.mkdir(HYDRO_TEST_RESOURCES)
10 tmpdir = tempfile.mkdtemp()
11 print("tmpdir=",tmpdir)
18 #----------------------
20 #----------------------
23 from PyQt5.QtCore import *
24 from PyQt5.QtGui import *
26 from salome.hydrotools.hydroGeoMeshUtils import loadImage, GeolocaliseImageCoords, GeolocaliseImageReference
27 from salome.hydrotools.hydroGeoMeshUtils import importPolylines, importBathymetry, createImmersibleZone, mergePolylines, getChildrenInStudy
29 hydro_doc = HYDROData_Document.Document()
31 hydro_doc.SetLocalCS( 0, 0 )
33 simplePolylines = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "simplePolyline.shp"), True, 1)
34 imZone = createImmersibleZone(hydro_doc, "imZone", simplePolylines[0], None, True, 0)
37 Case_1 = hydro_doc.CreateObject( KIND_CALCULATION )
38 Case_1.SetName( "Case_1" )
40 Case_1.SetAssignmentMode( HYDROData_CalculationCase.AUTOMATIC )
41 Case_1.AddGeometryObject( imZone )
43 case_geom_group = imZone.GetGroup( 0 );
44 Case_1.AddGeometryGroup( case_geom_group );
45 Case_1.SetBoundaryPolyline( simplePolylines[0] )
47 # Start the algorithm of the partition and assignment
50 # Export of the calculation case
51 Case_1_entry = Case_1.Export()
53 #----------------------
55 #----------------------
57 # Get geometry shape and print debug information
59 from salome.geom import geomBuilder
62 from salome.hydrotools.controls import controlGeomProps
64 geompy = geomBuilder.New()
66 print("Entry:", Case_1_entry)
67 Case_1_geom = salome.IDToObject( str( Case_1_entry ) )
68 print("Geom shape:", Case_1_geom)
69 print("Geom shape name:", Case_1_geom.GetName())
71 controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
73 if salome.sg.hasDesktop():
74 salome.sg.updateObjBrowser()