From: Paul RASCLE Date: Mon, 30 Nov 2020 22:37:12 +0000 (+0100) Subject: improve and document hydroGeoMeshUtils script X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=364a411adf79e7dde35d5b66628412a2cd8ba4aa;p=modules%2Fhydro.git improve and document hydroGeoMeshUtils script --- diff --git a/doc/salome/examples/g022_extensionSimpleComplete.py b/doc/salome/examples/g022_extensionSimpleComplete.py index 5ae82253..b6c45e14 100644 --- a/doc/salome/examples/g022_extensionSimpleComplete.py +++ b/doc/salome/examples/g022_extensionSimpleComplete.py @@ -36,8 +36,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 5) iles = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "ile.shp"), "ile_PolyXY", True, 4) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 0) litMineur = createImmersibleZone(hydro_doc, "litMineur", garonnes[0], garonne_point_L93, True, 2) diff --git a/doc/salome/examples/g027_domaineAmont.py b/doc/salome/examples/g027_domaineAmont.py index a5ce5502..319c700d 100644 --- a/doc/salome/examples/g027_domaineAmont.py +++ b/doc/salome/examples/g027_domaineAmont.py @@ -34,8 +34,8 @@ hydro_doc.SetLocalCS( offsetX, offsetY ) limites_amont = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaineAmont.shp"), "domaineAmont_PolyXY", False, 4) garonnes_amont = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonneAmont.shp"), "garonneAmont_PolyXY", True, 3) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaine_amont = createImmersibleZone(hydro_doc, "domaine_amont", limites_amont[0], Cloud_02, True, 0) garonne_amont = createImmersibleZone(hydro_doc, "garonne_amont", garonnes_amont[0], garonne_point_L93, True, 0) diff --git a/doc/salome/examples/g028_domaineAmontChevauchant.py b/doc/salome/examples/g028_domaineAmontChevauchant.py index e1228428..479615a4 100644 --- a/doc/salome/examples/g028_domaineAmontChevauchant.py +++ b/doc/salome/examples/g028_domaineAmontChevauchant.py @@ -34,8 +34,8 @@ hydro_doc.SetLocalCS( offsetX, offsetY ) limites_amont = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaineAmontChevauchant.shp"), "domaineAmontChevauchant_PolyXY", False, 4) garonnes_amont = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonneAmont.shp"), "garonneAmont_PolyXY", True, 3) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaine_amont = createImmersibleZone(hydro_doc, "domaine_amont", limites_amont[0], Cloud_02, True, 0) garonne_amont = createImmersibleZone(hydro_doc, "garonne_amont", garonnes_amont[0], garonne_point_L93, True, 0) diff --git a/doc/salome/examples/h009_normalCaseManual.py b/doc/salome/examples/h009_normalCaseManual.py index 14f3afe2..88b916e6 100644 --- a/doc/salome/examples/h009_normalCaseManual.py +++ b/doc/salome/examples/h009_normalCaseManual.py @@ -46,8 +46,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), "domaine_PolyXY", False, 6) lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 7) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h010_normalCaseManualMesh.py b/doc/salome/examples/h010_normalCaseManualMesh.py index ecb4c2f9..b0947375 100644 --- a/doc/salome/examples/h010_normalCaseManualMesh.py +++ b/doc/salome/examples/h010_normalCaseManualMesh.py @@ -46,8 +46,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), "domaine_PolyXY", False, 6) lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 7) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h011_normalCaseManualInterpolZ.py b/doc/salome/examples/h011_normalCaseManualInterpolZ.py index c7a8043e..98ce49d9 100644 --- a/doc/salome/examples/h011_normalCaseManualInterpolZ.py +++ b/doc/salome/examples/h011_normalCaseManualInterpolZ.py @@ -46,8 +46,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), "domaine_PolyXY", False, 6) lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 7) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h012_caseDigueManual.py b/doc/salome/examples/h012_caseDigueManual.py index d531bd92..89c32d2f 100644 --- a/doc/salome/examples/h012_caseDigueManual.py +++ b/doc/salome/examples/h012_caseDigueManual.py @@ -49,8 +49,8 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domain lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 8) axesDigue = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "axeDigue.shp"), "axeDigue_PolyXY", True, 9) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h013_caseDigueManualMesh.py b/doc/salome/examples/h013_caseDigueManualMesh.py index 36047b85..d2781595 100644 --- a/doc/salome/examples/h013_caseDigueManualMesh.py +++ b/doc/salome/examples/h013_caseDigueManualMesh.py @@ -49,8 +49,8 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domain lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 8) axesDigue = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "axeDigue.shp"), "axeDigue_PolyXY", True, 9) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h014_caseDigueManualInterpolZ.py b/doc/salome/examples/h014_caseDigueManualInterpolZ.py index 21dfb1d9..ce5e62e0 100644 --- a/doc/salome/examples/h014_caseDigueManualInterpolZ.py +++ b/doc/salome/examples/h014_caseDigueManualInterpolZ.py @@ -49,8 +49,8 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domain lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 8) axesDigue = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "axeDigue.shp"), "axeDigue_PolyXY", True, 9) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h015_normalCaseManualTelemac.py b/doc/salome/examples/h015_normalCaseManualTelemac.py index 28ed6755..4df586de 100644 --- a/doc/salome/examples/h015_normalCaseManualTelemac.py +++ b/doc/salome/examples/h015_normalCaseManualTelemac.py @@ -46,8 +46,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), "domaine_PolyXY", False, 6) lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 7) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h020_normalCaseChangeBathy.py b/doc/salome/examples/h020_normalCaseChangeBathy.py index 3d33d9de..4e7131fe 100644 --- a/doc/salome/examples/h020_normalCaseChangeBathy.py +++ b/doc/salome/examples/h020_normalCaseChangeBathy.py @@ -46,8 +46,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), "domaine_PolyXY", False, 6) lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 7) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h021_meshChangeBathy.py b/doc/salome/examples/h021_meshChangeBathy.py index fcfe5ea3..c5d080dd 100644 --- a/doc/salome/examples/h021_meshChangeBathy.py +++ b/doc/salome/examples/h021_meshChangeBathy.py @@ -46,8 +46,8 @@ garonnes = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne.shp") limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), "domaine_PolyXY", False, 6) lits_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur.shp"), "lit_majeur_PolyXY", True, 7) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) domaineEtendu = createImmersibleZone(hydro_doc, "domaineEtendu", limites_domaine[0], Cloud_02, True, 2) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lits_majeur[0], garonne_point_L93, True, 3) diff --git a/doc/salome/examples/h022_extensionSimpleComplete.py b/doc/salome/examples/h022_extensionSimpleComplete.py index c03b1952..355c611b 100644 --- a/doc/salome/examples/h022_extensionSimpleComplete.py +++ b/doc/salome/examples/h022_extensionSimpleComplete.py @@ -45,7 +45,7 @@ hydro_doc.SetLocalCS( offsetX, offsetY ) limites_original = importPolylines(hydro_doc, os.path.join(tmpdir, "garonne_2_brd_FreeBorders.shp"), 'garonne_2_brd_FreeBorders', True, 4) limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "extension_1_1.shp"), 'extension_1_1_PolyXY', False, 2) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_original = createImmersibleZone(hydro_doc, "domaine_original", limites_original[0], Cloud_02, False, 1) domaine_englobant = createImmersibleZone(hydro_doc, "domaine_englobant", limites_domaine[0], Cloud_02, True, 0) diff --git a/doc/salome/examples/h023_extensionSimpleAmont.py b/doc/salome/examples/h023_extensionSimpleAmont.py index d7b78f2b..da3c04b7 100644 --- a/doc/salome/examples/h023_extensionSimpleAmont.py +++ b/doc/salome/examples/h023_extensionSimpleAmont.py @@ -51,7 +51,7 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(tmpdir, "extension_1_ limite_extension = mergePolylines(hydro_doc, 'limite_extension', [limites_original[0], limites_domaine[0]]) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_extension = createImmersibleZone(hydro_doc, "domaine_extension", limite_extension, Cloud_02, True, 0) diff --git a/doc/salome/examples/h024_extensionSimpleAval.py b/doc/salome/examples/h024_extensionSimpleAval.py index 48f0c028..65ff61ac 100644 --- a/doc/salome/examples/h024_extensionSimpleAval.py +++ b/doc/salome/examples/h024_extensionSimpleAval.py @@ -51,7 +51,7 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(tmpdir, "extension_1_ limite_extension = mergePolylines(hydro_doc, 'limite_extension', [limites_original[1], limites_domaine[1]]) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_extension = createImmersibleZone(hydro_doc, "domaine_extension", limite_extension, Cloud_02, True, 0) diff --git a/doc/salome/examples/h025_extensionSimpleRiveDroite.py b/doc/salome/examples/h025_extensionSimpleRiveDroite.py index 43f1fb0c..d4b28318 100644 --- a/doc/salome/examples/h025_extensionSimpleRiveDroite.py +++ b/doc/salome/examples/h025_extensionSimpleRiveDroite.py @@ -51,7 +51,7 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(tmpdir, "extension_3_ limite_extension = mergePolylines(hydro_doc, 'limite_extension', [limites_original[0], limites_domaine[0]]) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_extension = createImmersibleZone(hydro_doc, "domaine_extension", limite_extension, Cloud_02, True, 0) diff --git a/doc/salome/examples/h026_extensionSimpleRiveGauche.py b/doc/salome/examples/h026_extensionSimpleRiveGauche.py index 7d057101..9f6e68ba 100644 --- a/doc/salome/examples/h026_extensionSimpleRiveGauche.py +++ b/doc/salome/examples/h026_extensionSimpleRiveGauche.py @@ -51,7 +51,7 @@ limites_domaine = importPolylines(hydro_doc, os.path.join(tmpdir, "extension_3_ limite_extension = mergePolylines(hydro_doc, 'limite_extension', [limites_original[0], limites_domaine[1]]) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_extension = createImmersibleZone(hydro_doc, "domaine_extension", limite_extension, Cloud_02, True, 0) diff --git a/doc/salome/examples/h027_regroupMeshes.py b/doc/salome/examples/h027_regroupMeshes.py index 4b925b30..df96782e 100644 --- a/doc/salome/examples/h027_regroupMeshes.py +++ b/doc/salome/examples/h027_regroupMeshes.py @@ -51,7 +51,7 @@ limites_original = importPolylines(hydro_doc, os.path.join(tmpdir, "garonne_2_br limites_amont = importPolylines(hydro_doc, os.path.join(tmpdir, "garonneAmont_brd_FreeBorders.shp"), 'garonneAmont_brd_FreeBorders', True, 5) limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "raccord_4_2.shp"), 'raccord_4_2_PolyXY', False, 3) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_regroup = createImmersibleZone(hydro_doc, "domaine_regroup", limites_domaine[0], Cloud_02, True, 0) domaine_original = createImmersibleZone(hydro_doc, "domaine_original", limites_original[0], Cloud_02, False, 1) diff --git a/doc/salome/examples/h028_regroupOverlappingMeshes.py b/doc/salome/examples/h028_regroupOverlappingMeshes.py index ed7fff86..a464f3b8 100644 --- a/doc/salome/examples/h028_regroupOverlappingMeshes.py +++ b/doc/salome/examples/h028_regroupOverlappingMeshes.py @@ -63,7 +63,7 @@ limites_original = importPolylines(hydro_doc, os.path.join(tmpdir, "garonne_2_br limites_amont = importPolylines(hydro_doc, os.path.join(tmpdir, "garonneAmont_brd_FreeBorders.shp"), 'garonneAmont_brd_FreeBorders', True, 5) limites_domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "raccord_4_2.shp"), 'raccord_4_2_PolyXY', False, 3) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_regroup = createImmersibleZone(hydro_doc, "domaine_regroup", limites_domaine[0], Cloud_02, True, 0) domaine_original = createImmersibleZone(hydro_doc, "domaine_original", limites_original[0], Cloud_02, False, 1) diff --git a/doc/salome/examples/h029_regroupMeshesNonEnglobant.py b/doc/salome/examples/h029_regroupMeshesNonEnglobant.py index ddb49c24..c8c14e70 100644 --- a/doc/salome/examples/h029_regroupMeshesNonEnglobant.py +++ b/doc/salome/examples/h029_regroupMeshesNonEnglobant.py @@ -66,7 +66,7 @@ fitShapePointsToMesh(os.path.join(tmpdir, "garonneAmont_brd_FreeBorders.shp"), limites_amont = importPolylines(hydro_doc, os.path.join(tmpdir, "garonneAmont_brd_FreeBorders.shp"), 'garonneAmont_brd_FreeBorders', False, 5) limites_domaine = importPolylines(hydro_doc, os.path.join(tmpdir, "raccord_4_1_adj_adj.shp"), 'raccord_4_1_adj', False, 2) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) junction = createImmersibleZone(hydro_doc, "junction", limites_domaine[0], Cloud_02, True, 0) garonneAval = createImmersibleZone(hydro_doc, "garonneAval", limites_aval[0], Cloud_02, False, 0) diff --git a/doc/salome/examples/h030_editNonHydroMesh.py b/doc/salome/examples/h030_editNonHydroMesh.py index 1acfb9ab..48a681e7 100644 --- a/doc/salome/examples/h030_editNonHydroMesh.py +++ b/doc/salome/examples/h030_editNonHydroMesh.py @@ -57,7 +57,7 @@ hydro_doc.SetLocalCS( offsetX, offsetY ) limites_original = importPolylines(hydro_doc, os.path.join(tmpdir, "garonne_2_cut_brd_FreeBorders.shp"), 'garonne_2_cut_brd_FreeBorders', False, 4) [nouvelle_digue] = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "nouvelleDigue.shp"), 'nouvelleDigue_PolyXY', True, 4) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) domaine_nouveau = createImmersibleZone(hydro_doc, "domaine_nouveau", limites_original[2], Cloud_02, True, 0) diff --git a/doc/salome/examples/h032_completeCaseNoRegions.py b/doc/salome/examples/h032_completeCaseNoRegions.py index 5b4858c5..8cc28e06 100644 --- a/doc/salome/examples/h032_completeCaseNoRegions.py +++ b/doc/salome/examples/h032_completeCaseNoRegions.py @@ -36,8 +36,8 @@ lit_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur. ile = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "ile.shp"), 'ile_PolyXY', True, 4) domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), 'domaine_PolyXY', False, 5) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) litMineur = createImmersibleZone(hydro_doc, "litMineur", garonne[0], Cloud_02, True, 6) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lit_majeur[0], garonne_point_L93, True, 5) diff --git a/doc/salome/examples/h033_completeCaseModifiedRegions.py b/doc/salome/examples/h033_completeCaseModifiedRegions.py index 89083975..5ea46ad8 100644 --- a/doc/salome/examples/h033_completeCaseModifiedRegions.py +++ b/doc/salome/examples/h033_completeCaseModifiedRegions.py @@ -36,8 +36,8 @@ lit_majeur = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "lit_majeur. ile = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "ile.shp"), 'ile_PolyXY', True, 4) domaine = importPolylines(hydro_doc, os.path.join(HYDRO_SAMPLES, "domaine.shp"), 'domaine_PolyXY', False, 5) -Cloud_02 = importBathymetry(hydro_doc, "Cloud_02", HYDRO_SAMPLES) -garonne_point_L93 = importBathymetry(hydro_doc, "garonne_point_L93", HYDRO_SAMPLES) +Cloud_02 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz")) +garonne_point_L93 = importBathymetry(hydro_doc, os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz")) litMineur = createImmersibleZone(hydro_doc, "litMineur", garonne[0], Cloud_02, True, 6) litMajeur = createImmersibleZone(hydro_doc, "litMajeur", lit_majeur[0], garonne_point_L93, True, 5) diff --git a/doc/salome/examples/h034_splitShapes.py b/doc/salome/examples/h034_splitShapes.py index 38fa162e..a41ad73a 100644 --- a/doc/salome/examples/h034_splitShapes.py +++ b/doc/salome/examples/h034_splitShapes.py @@ -27,7 +27,7 @@ from HYDROPy import * from PyQt5.QtCore import * from PyQt5.QtGui import * -from salome.hydrotools.hydroGeoMeshUtils import importPolylines, splitShapesAll +from salome.hydrotools.hydroGeoMeshUtils import importPolylines, splitShapesAll, splitShapeTool hydro_doc = HYDROData_Document.Document() hydro_doc.SetLocalCS( offsetX, offsetY ) @@ -41,14 +41,20 @@ seq = contours + lmajeurs shapeList = splitShapesAll(hydro_doc, seq) if len(shapeList) != 8: raise ValueError("Bad nunber of shapes after splitShapesAll, found %d instead of 8"%len(shapeList)) + seq2 = contours + lm2s shapeList2 = splitShapesAll(hydro_doc, seq2) if len(shapeList2) != 16: raise ValueError("Bad nunber of shapes after splitShapesAll, found %d instead of 16"%len(shapeList2)) + seq3 = contours + lm2s + lmajeurs + openPolys shapeList3 = splitShapesAll(hydro_doc, seq3) if len(shapeList3) != 89: raise ValueError("Bad nunber of shapes after splitShapesAll, found %d instead of 89"%len(shapeList3)) +shapeList4 = splitShapeTool(hydro_doc, lmajeurs[0], contours[0]) +if len(shapeList4) != 4: + raise ValueError("Bad nunber of shapes after splitShapeTool, found %d instead of 4"%len(shapeList4)) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() diff --git a/src/HYDROTools/hydroGeoMeshUtils.py b/src/HYDROTools/hydroGeoMeshUtils.py index 30349857..5dcea33e 100644 --- a/src/HYDROTools/hydroGeoMeshUtils.py +++ b/src/HYDROTools/hydroGeoMeshUtils.py @@ -13,7 +13,10 @@ from random import randint def getChildrenInStudy(obj): """ Given an object published in SALOME study (for instance a GEOM object), retreive its children. - return a dictionary [name] --> object + parameters: + obj: a SALOME object published in SALOME study + return: + a dictionary [name] --> object """ SO = salome.myStudy.FindObjectIOR(salome.myStudy.ConvertObjectToIOR(obj)) childIterator = salome.myStudy.NewChildIterator(SO) @@ -30,6 +33,14 @@ def getChildrenInStudy(obj): def loadImage(document, imageFile, imageName, displayLevel): """ + load an image (photo, map...) in order to georeference it and use it as background for drawing shapes + parameters: + document: current HYDROData document + imageFile: full path of the image file to load + imageName: name to give to the object loaded in the HYDRO document + displayLevel: integer >=0, the higher levels are displayed on top + return: + the object image loaded """ image = document.CreateObject(KIND_IMAGE) image.SetName(imageName) @@ -41,6 +52,13 @@ def loadImage(document, imageFile, imageName, displayLevel): def GeolocaliseImageCoords(image, a, b, c ,d): """ + Geolocalize a loaded image with to sets of points: pixels coordinates <--> absolutes coordinates in the geographic reference system. + parameters: + image: loaded image to localize + a: first pixel coordinates QPoint(x, y) (integers) + b: second pixel coordinates QPoint(x, y) (integers) + c: first geographic point QPointF(X, Y) (floats) + d: second geographic point QPointF(X, Y) (floats) """ image.SetLocalPoints(a, b) image.SetGlobalPoints(1, c, d) @@ -48,6 +66,12 @@ def GeolocaliseImageCoords(image, a, b, c ,d): def GeolocaliseImageReference(image, imageRef, a, b, c ,d): """ + Geolocalize an image using another one already localized, with two pair of corresponding pixels on the images + parameters: + image: loaded image to localize + imageRef: loaded image used as a reference + a, b : pixel coordinates on the image to localize QPoint(x, y) (integers) + c, d : pixel coordinates on the reference image QPoint(x, y) (integers) """ image.SetLocalPoints(a, b) image.SetGlobalPoints(3, c, d) @@ -56,6 +80,18 @@ def GeolocaliseImageReference(image, imageRef, a, b, c ,d): def importPolylines(document, shapeFile, shapeName, iSpline, displayLevel): """ + Import a QGis shape (*.shp) containing one or several 2D polylines or polygons. + The polyline is either named from its name in the shape database if existing, or using the shapefile basename + with a suffix '_PolyXY'. + In case of several polylines, name are suffixed in sequence with '_n'. + parameters: + document: current HYDROData document + shapeFile: full path of the shapefile (*.shp) + shapeName: used to retrieve the objects in the HYDRO document: see above, name is given without the sequence suffix + isSpline: boolean to convert the polylines in splines + displayLevel: integer >=0, the higher levels are displayed on top + return: + list of shape objects """ HYDROData_PolylineXY.ImportShapesFromFile(shapeFile) shapeType = 0 # polyline @@ -91,10 +127,59 @@ def importPolylines(document, shapeFile, shapeName, iSpline, displayLevel): shapes.append(shape) return shapes +def splitShapeTool(document, aShape, toolShape, tolerance=1.e-2): + """ + Split the shape (2D polyline or spline) by the shape tool. + return a list of all the split shapes, named after their original shape name, with a sequence suffix _n + parameters; + document: current HYDROData document + aShape: a loaded shape (2D polyline or spline) + toolShape: a loaded shape (2D polyline or spline) + tolerance: used by the algorithm to detect intersections, default value 1.e-2 + return: + a list of all the split shapes, named after their original shape name, with a sequence suffix _n + """ + name = aShape.GetName() + existingNbSplit = {} + index = 1 + found = True + while found: + nameIndex = name + "_%d"%(index) + shape = document.FindObjectByName(nameIndex) + if shape is None: + found = False + else: + index = index + 1 + existingNbSplit[name] = index + print(existingNbSplit) + + op = HYDROData_PolylineOperator() + op.SplitTool(document, aShape, toolShape, tolerance) + + listSplit = [] + index = existingNbSplit[name] + found = True + while found: + nameIndex = name + "_%d"%(index) + shape = document.FindObjectByName(nameIndex) + if shape is None: + found = False + else: + print("found %s"%nameIndex) + index = index + 1 + listSplit.append(shape) + return listSplit + def splitShapesAll(document, shapeslist, precision=1.E-2): """ - Split all the shapes in the list by all the other shapes. - return a list of all the other shapes, named after their original shape name, with a sequence suffix _n + Split all the shapes (2D polylines or splines) in the list by all the other shapes. + return a list of all the split shapes, named after their original shape name, with a sequence suffix _n + parameters; + document: current HYDROData document + shapeslist: a list of loaded shapes (2D polylines or splines) + precision: used by the algorithm to detect intersections, default value 1.e-2 + return: + a list of all the split shapes, named after their original shape name, with a sequence suffix _n """ names = [s.GetName() for s in shapeslist] @@ -113,7 +198,7 @@ def splitShapesAll(document, shapeslist, precision=1.E-2): print(existingNbSplit) op = HYDROData_PolylineOperator() - op.SplitAll(document, shapeslist, 1.E-2) + op.SplitAll(document, shapeslist, precision) listSplit = [] for name in names: @@ -131,19 +216,37 @@ def splitShapesAll(document, shapeslist, precision=1.E-2): return listSplit -def importBathymetry(document, bathyName, bathyPath): +def importBathymetry(document, bathyFile): """ + import a bathymetry file (*.xyz or *.asc) + parameters: + document: current HYDROData document + bathyFile: full path of the bathymetry (*.xyz or *.shp) + return: + the bathymetry object """ bathy = document.CreateObject(KIND_BATHYMETRY) + a = os.path.splitext(bathyFile) + bathyName = os.path.basename(a[0]) bathy.SetName(bathyName) bathy.SetAltitudesInverted(0) - if not(bathy.ImportFromFile( os.path.join(bathyPath, bathyName + '.xyz' ))): + if not(bathy.ImportFromFile(bathyFile)): raise ValueError('problem while loading bathymetry') bathy.Update() return bathy def createImmersibleZone(document, imzName, polyLine, bathy, isImmersible, displayLevel): """ + Create an immersible or unsubmersible zone with a closed polyline and a bathymetry. + parameters: + document: current HYDROData document + imzName: the name to give to the zone object + polyline: the closed 2D polyline or spline delimiting the zone + bathy: the bathymetry to associate to the zone + isImmersible: boolean + displayLevel: integer >=0, the higher levels are displayed on top + return: + the zone created """ imz = document.CreateObject(KIND_IMMERSIBLE_ZONE) imz.SetName(imzName) @@ -157,6 +260,15 @@ def createImmersibleZone(document, imzName, polyLine, bathy, isImmersible, displ def mergePolylines(document, polyName, polyLines, isConnectedBySegment = False, tolerance = 1.E-3): """ + Regroup several 2D polylines or spline in one, with several sections + parameters: + document: current HYDROData document + polyName: name to give to the new object + polyLines: a list of loaded shapes (2D polylines or splines) + isConnectedBySegment: boolean, to add a segment connecting the polylines, default False + tolerance: used by the algorithm to detect coincidences, default 1.E-3 + return: + the merged polyline """ op=HYDROData_PolylineOperator() op.Merge(document, polyName, polyLines, isConnectedBySegment, tolerance) @@ -165,11 +277,14 @@ def mergePolylines(document, polyName, polyLines, isConnectedBySegment = False, def createAxis3DDEmbankmentAltiProfile(document, axis3DName, axisXY, altiPts): """ + Create a 3D polyline to be used as an axis for an embankement, using a 2D axis and a list of altitudes along the axis. + parameters: document: current HYDROData_Document axis3DName: name to give to the axis3D created - axisXY: imported polyline, Embankment line - altiPts: list of tuples(x, h) : parametric coordinate, altitude, along the axis - return altiProfile, axis3D + axisXY: 2D polyline (spline), Embankment line + altiPts: list of tuples(x, h) : parametric coordinate, altitude, along the axisXY + return: + altiProfile, axis3D """ altiProfile = document.CreateObject(KIND_PROFILE) altiProfile.SetName("%s_altiProfile"%axis3DName) @@ -187,11 +302,14 @@ def createAxis3DDEmbankmentAltiProfile(document, axis3DName, axisXY, altiPts): def createAxis3DDEmbankmentBathy(document, axis3DName, axisXY, aCloud): """ + Create a 3D polyline to be used as an axis for an embankement, using a 2D axis and a bathymetry to project the axis. + parameters: document: current HYDROData_Document axis3DName: name to give to the axis3D created axisXY: imported polyline, Embankment line aCloud: altimetry, for projection of axisXY - return altiProfile, axis3D + return: + altiProfile, axis3D """ altiProfile = document.CreateObject(KIND_PROFILE) altiProfile.SetName("%s_altiProfile"%axis3DName) @@ -206,13 +324,16 @@ def createAxis3DDEmbankmentBathy(document, axis3DName, axisXY, aCloud): def createEmbankmentSectionA(document, embankmentName, axis3D, sectionPoints, d, displayLevel): """ + Define the section of an embankement and extrude it along a 3D axis. Section is defined with a list of points (axis distance, altitude). + parameters: document: current HYDROData_Document embankmentName: name to give to the embankment axis3D: the 3D axis of the embankment sectionPoints: a list of tuple (x, h) to define a half section, beginning to x=0 (center) d calculation parameter, take 2 or 3 times the section width displayLevel : z level for 2D representation: high values are drawn above low values - return section, embankment + return: + section, embankment """ section = document.CreateObject(KIND_PROFILE) section.SetName("%s_section"%embankmentName) @@ -236,13 +357,16 @@ def createEmbankmentSectionA(document, embankmentName, axis3D, sectionPoints, d, def createEmbankmentSectionB(document, embankmentName, axis3D, LC,DZ,CZ, d, displayLevel): """ + Define the section of an embankement and extrude it along a 3D axis. Section is defined with a width, an height, the position of the axis. + parameters: document: current HYDROData_Document embankmentName: name to give to the embankment axis3D: the 3D axis of the embankment LC, DZ, CZ: width, height, height offset above axis3D d calculation parameter, take 2 or 3 times the section width displayLevel : z level for 2D representation: high values are drawn above low values - return embankment + return: + embankment """ embankment = document.CreateObject(KIND_DIGUE) embankment.SetName(embankmentName)