Salome HOME
Merge branch 'BR_HYDRO_IMPS_2016' into pre/IMPS_2016
authorPaul RASCLE <paul.rascle@edf.fr>
Fri, 25 Nov 2016 10:16:45 +0000 (11:16 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Fri, 25 Nov 2016 10:16:45 +0000 (11:16 +0100)
52 files changed:
doc/salome/CMakeLists.txt
doc/salome/examples/CMakeLists.txt
doc/salome/examples/h008_simpleCase.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/h016_pilesPontManualMesh.py
doc/salome/examples/h017_interpolationLineaire.py
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_Bathymetry.h
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_DTM.h
src/HYDROData/HYDROData_Document.cxx
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDROData/HYDROData_QuadtreeNode.cxx
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Tool.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx
src/HYDROGUI/HYDROGUI_ExportCalculationOp.h
src/HYDROGUI/HYDROGUI_ImagePrs.cxx
src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Polyline.cxx
src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx
src/HYDROGUI/HYDROGUI_StreamDlg.cxx
src/HYDROGUI/HYDROGUI_StreamDlg.h
src/HYDROGUI/HYDROGUI_StreamOp.cxx
src/HYDROGUI/HYDROGUI_StreamOp.h
src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROPy/HYDROData_LandCoverMap.sip
src/HYDRO_tests/TestShape.cxx
src/HYDRO_tests/TestShape.h
src/HYDRO_tests/reference_data/Channel.png
src/HYDRO_tests/reference_data/DTM_2.png
src/HYDRO_tests/reference_data/Extraction_Channel.png
src/HYDRO_tests/reference_data/st_dump.py
src/HYDRO_tests/reference_data/stream_dtm_2d.png
src/HYDRO_tests/reference_data/stream_dtm_3d.png
src/HYDRO_tests/test_HYDROData_Bathymetry.cxx
src/HYDRO_tests/test_HYDROData_DTM.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_PolylineXY.cxx
src/HYDRO_tests/test_HYDROData_Stream.cxx
src/HYDRO_tests/test_HYDROGUI_Shape.cxx

index 2a1bc39ab9ef093a77ece6145dbbc6114b99db90..a466cf9ec0aee6134d998d0c370ef71620a88a2e 100644 (file)
@@ -20,7 +20,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-ADD_SUBDIRECTORY(gui)
+#ADD_SUBDIRECTORY(gui)
 ADD_SUBDIRECTORY(examples)
-ADD_SUBDIRECTORY(tutorial)
-ADD_SUBDIRECTORY(tui)
+#ADD_SUBDIRECTORY(tutorial)
+#ADD_SUBDIRECTORY(tui)
index 71eac864be086c0618e7172d5da49f78ddc41787..5c89302e763cf7bdffe37083f5ca7d0d7bc6a22c 100644 (file)
@@ -58,7 +58,7 @@ SET(HYDRO_SAMPLES
 
 # Application tests
 
-SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
+SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/HYDRO)
 INSTALL(FILES ${EXAMPLES_TESTS} ${HYDRO_SAMPLES} DESTINATION ${TEST_INSTALL_DIRECTORY})
 
 INSTALL(FILES CTestTestfileInstall.cmake
index 3779bc9701920ff345e63a4dee323f09ae560cb8..c36b818017bb736c495f12ed5934cf56388be2e2 100644 (file)
@@ -83,7 +83,7 @@ Case_1_geom = salome.IDToObject( str( Case_1_entry ) )
 print "Geom shape:", Case_1_geom
 print "Geom shape name:", Case_1_geom.GetName()
 
-controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
+controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918)
    
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index f44f63b25d364511e96bad0fa8e6ab135c2536b4..0cc76679e6546dadf5e169c699c385a07ceeea61 100644 (file)
@@ -326,8 +326,8 @@ geompy.addToStudyInFather( HYDRO_garonne_1, litMineur, 'litMineur' )
 geompy.addToStudyInFather( HYDRO_garonne_1, riveDroite, 'riveDroite' )
 
 controlGeomProps(geompy, riveGauche,  29149.36918,  35948828.352061)
-controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
-controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
+controlGeomProps(geompy, litMineur,   30337.5484919,  3263628.55399)
+controlGeomProps(geompy, riveDroite,  32012.3432411, 26177085.4601)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index 4b205db5bfbbfef11eada01366c71157b65d67ee..4d5913507d319ad31e0ce31d20ebfedbaac64456 100644 (file)
@@ -343,13 +343,20 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomain
 
 # --- basic properties control: edges length, surfaces
 controlGeomProps(geompy, riveGauche,  29149.36918,  35948828.352061)
-controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
-controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
-
+controlGeomProps(geompy, litMineur,   30337.5484919,  3263628.55399)
+controlGeomProps(geompy, riveDroite,  32012.3432411, 26177085.4601)
 #----------------------
 # --- Meshing 
 #----------------------
 
+med_file = r'/garonne_1.med'
+
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
+
 import  SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats
@@ -416,12 +423,12 @@ bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine
 SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
 
 garonne_1.SetAutoColor( 1 )
-garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
-controlMeshStats(garonne_1, 3888, 475, 7597)
-controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2342)
-controlSubMeshStats(riveGauche_1, 2871)
+controlMeshStats(garonne_1, 1763, 180, 3360)
+controlSubMeshStats(litMineur_2, 48)
+controlSubMeshStats(riveDroite_1, 1360)
+controlSubMeshStats(riveGauche_1, 1952)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index 071974fb54a9c415b9bb4d6cef4651de4a4ff97f..70b756b91f9676b50524cdc4efb455ed5ae5509f 100644 (file)
@@ -342,14 +342,22 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordGaucheDomaine, 'bordGaucheDomain
 geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomaine' )
 
 # --- basic properties control: edges length, surfaces
+
 controlGeomProps(geompy, riveGauche,  29149.36918,  35948828.352061)
-controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
-controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
+controlGeomProps(geompy, litMineur,   30337.5484919,  3263628.55399)
+controlGeomProps(geompy, riveDroite,  32012.3432411, 26177085.4601)
 
 #----------------------
 # --- Meshing 
 #----------------------
 
+med_file = r'/garonne_1.med'
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
+
 import  SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats
@@ -416,12 +424,12 @@ bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine
 SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
 
 garonne_1.SetAutoColor( 1 )
-garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
-controlMeshStats(garonne_1, 3888, 475, 7597)
-controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2342)
-controlSubMeshStats(riveGauche_1, 2871)
+controlMeshStats(garonne_1, 1763, 180, 3360)
+controlSubMeshStats(litMineur_2, 48)
+controlSubMeshStats(riveDroite_1, 1360)
+controlSubMeshStats(riveGauche_1, 1952)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
@@ -437,7 +445,7 @@ from salome.hydrotools.controls import controlStatZ
 nomCas = 'garonne_1'
 
 # --- med file 2D(x,y) of the case produced by SMESH
-fichierMaillage = '/tmp/garonne_1.med'
+fichierMaillage = med_file
 
 # --- dictionary [med group name] = region name
 dicoGroupeRegion= dict(litMineur  = 'garonne_1_litMineur',
index 7bb8be11243da51e62a1a21f4e7966d5aa8585a8..10928b3979e19bd4bdc0bc472afc67e1da05cd3e 100644 (file)
@@ -395,10 +395,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, digue, 'digue' )
 geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' )
 geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' )
 
-controlGeomProps(geompy, riveGauche,  39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue,       10343.901103,   103037.738504)
-controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
-controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
+controlGeomProps(geompy, riveGauche,  39489.5116033, 35889668.8348)
+controlGeomProps(geompy, digue,       10340.1424233,   102887.6201)
+controlGeomProps(geompy, litMineur,   30337.5484919,  3646827.74981)
+controlGeomProps(geompy, riveDroite,  32012.3432411,  26177085.4601)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index 234958df88c038db6ac318db550b8c7368a2ceb9..032dc23459bcf16176e83fe8c3a51965be3a4f86 100644 (file)
@@ -417,10 +417,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' )
 #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
 #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48])
 
-controlGeomProps(geompy, riveGauche,  39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue,       10343.901103,   103037.738504)
-controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
-controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
+controlGeomProps(geompy, riveGauche,  39489.5116033, 35889668.8348)
+controlGeomProps(geompy, digue,       10340.1424233,   102887.6201)
+controlGeomProps(geompy, litMineur,   30337.5484919,  3646827.74981)
+controlGeomProps(geompy, riveDroite,  32012.3432411,  26177085.4601)
 
 #----------------------
 # --- Meshing 
@@ -506,14 +506,22 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE)
 #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
 SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
 
+
+med_file = r'/garonne_2.med'
+
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
 garonne_2.SetAutoColor( 1 )
-garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
-controlMeshStats(garonne_2, 6190, 691, 12201)
+controlMeshStats(garonne_2, 5247, 717, 10075)
 controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2400)
-controlSubMeshStats(riveGauche_1, 6585)
-controlSubMeshStats(digue_1, 832)
+controlSubMeshStats(riveDroite_1, 2348)
+controlSubMeshStats(riveGauche_1, 5343)
+controlSubMeshStats(digue_1, 0)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index ec45d24942a2f490a3999c544ba24657aced87d9..ca0c24572395c745eee4c2f27ff783c41a4b9325 100644 (file)
@@ -417,10 +417,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' )
 #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
 #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48])
 
-controlGeomProps(geompy, riveGauche,  39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue,       10343.901103,   103037.738504)
-controlGeomProps(geompy, litMineur,   30337.548492,  3488480.304388)
-controlGeomProps(geompy, riveDroite,  32012.343241, 25998769.23615)
+controlGeomProps(geompy, riveGauche,  39489.5116033, 35889668.8348)
+controlGeomProps(geompy, digue,       10340.1424233,   102887.6201)
+controlGeomProps(geompy, litMineur,   30337.5484919,  3646827.74981)
+controlGeomProps(geompy, riveDroite,  32012.3432411,  26177085.4601)
 
 #----------------------
 # --- Meshing 
@@ -506,14 +506,23 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE)
 #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
 SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
 
+
+med_file = r'/garonne_2.med'
+
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
+
 garonne_2.SetAutoColor( 1 )
-garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
-controlMeshStats(garonne_2, 6190, 691, 12201)
+controlMeshStats(garonne_2, 5247, 717, 10075)
 controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2400)
-controlSubMeshStats(riveGauche_1, 6585)
-controlSubMeshStats(digue_1, 832)
+controlSubMeshStats(riveDroite_1, 2348)
+controlSubMeshStats(riveGauche_1, 5343)
+controlSubMeshStats(digue_1, 0)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
@@ -529,7 +538,7 @@ from salome.hydrotools.controls import controlStatZ
 nomCas = 'garonne_2'
 
 # --- med file 2D(x,y) of the case produced by SMESH
-fichierMaillage = '/tmp/garonne_2.med'
+fichierMaillage = med_file
 
 # --- dictionary [med group name] = region name
 dicoGroupeRegion= dict(litMineur  = 'garonne_2_litMineur',
index 35a4e795b0fe3d911d9bb471481b7042caadc505..7bbdb91b701b6858f71123ad6e16d5915aa5eb3e 100644 (file)
@@ -1123,11 +1123,11 @@ geompy.addToStudyInFather( HYDRO_casGaronne_1, bordGauche, 'bordGauche' )
 geompy.addToStudyInFather( HYDRO_casGaronne_1, piles, 'piles' )
 
 # --- basic properties control: edges length, surfaces
-controlGeomProps(geompy, riveGauche,  29149.1353799,  35949580.6716)
-controlGeomProps(geompy, litMineur_aval,   7965.23431497,  935955.786347)
-controlGeomProps(geompy, litMineur_pont,   961.8255222,  19618.016847)
-controlGeomProps(geompy, litMineur_amont,   22635.6212065,  2531409.65041)
-controlGeomProps(geompy, riveDroite,  32012.2241814, 25998085.6892)
+controlGeomProps(geompy, riveGauche,  29149.1353799,  35950762.8967)
+controlGeomProps(geompy, litMineur_aval,   7965.23431497,  938890.904721)
+controlGeomProps(geompy, litMineur_pont,   961.8255222,  19618.0787789)
+controlGeomProps(geompy, litMineur_amont,   22635.6212065,  2548509.17447)
+controlGeomProps(geompy, riveDroite,  32012.2241814,  26188706.2202)
 
 ###
 ### SMESH component
@@ -1218,15 +1218,23 @@ smesh.SetName(nbseg_litMineur_aval, 'nbseg_litMineur_aval')
 smesh.SetName(nbseg_litMineur_amont, 'nbseg_litMineur_amont')
 smesh.SetName(sections_1, 'sections')
 
+med_file = r'/casGaronne_1.med'
+
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
+
 casGaronne_1.SetAutoColor( 1 )
-casGaronne_1.ExportMED( r'/tmp/casGaronne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
+casGaronne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 
-controlMeshStats(casGaronne_1, 6985, 745, 13761)
-controlSubMeshStats(litMineur_pont_2, 185)
+controlMeshStats(casGaronne_1, 7040, 746, 13871)
+controlSubMeshStats(litMineur_pont_2, 204)
 controlSubMeshStats(litMineur_amont_2, 3000)
 controlSubMeshStats(litMineur_aval_2, 2000)
-controlSubMeshStats(riveDroite_1, 3941)
-controlSubMeshStats(riveGauche_1, 4635)
+controlSubMeshStats(riveDroite_1, 4040)
+controlSubMeshStats(riveGauche_1, 4627)
 
 
 if salome.sg.hasDesktop():
index 63073d54b1f57a8cacfa7e818f338fa881f7200e..9d313a69eec96acbf6465080c7e345add565aa06 100644 (file)
@@ -316,8 +316,17 @@ isDone = relief.Compute()
 domaine_1 = relief.GroupOnGeom(domaine,'domaine',SMESH.FACE)
 domaine_2 = relief.GroupOnGeom(domaine,'domaine',SMESH.NODE)
 smesh.SetName(relief, 'relief')
+
+med_file = r'/relief.med'
+
+try:
+  os.remove(med_file)
+except OSError:
+  pass
+
+
 try:
-  relief.ExportMED( r'/tmp/relief.med', 0, SMESH.MED_V2_2, 1, None ,1)
+  relief.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
 except:
   print 'ExportToMEDX() failed. Invalid file name?'
 
@@ -344,7 +353,7 @@ from salome.hydrotools.controls import controlStatZ
 nomCas = 'etude'
 
 # --- fichier med 2D(x,y) du cas, produit par SMESH
-fichierMaillage = '/tmp/relief.med'
+fichierMaillage = med_file
 
 # --- dictionnaire: (clé = nom de groupe med, valeur= nom de région)
 dicoGroupeRegion= dict(domaine  = 'etude_Reg_1',
index f7d31037c98ff71954ad8b203b6e975a10ba5736..f0a871a30983d5e36769ddea4ba8a80eaac19ac9 100644 (file)
@@ -71,6 +71,24 @@ std::map<int, HYDROData_QuadtreeNode*> HYDROData_Bathymetry::myQuadtrees;
 std::map<int, vtkPolyData*> HYDROData_Bathymetry::myDelaunay2D;
 #endif
 
+inline double sqr( double x )
+{
+  return x*x;
+}
+
+HYDROData_Bathymetry::AltitudePoint::AltitudePoint( double x, double y, double z )
+{
+  X=x; Y=y; Z=z;
+}
+
+double HYDROData_Bathymetry::AltitudePoint::SquareDistance( const HYDROData_Bathymetry::AltitudePoint& p ) const
+{
+  double d = 0;
+  d += sqr( X - p.X );
+  d += sqr( Y - p.Y );
+  d += sqr( Z - p.Z );
+  return d;
+}
 
 HYDROData_Bathymetry::HYDROData_Bathymetry()
 : HYDROData_IAltitudeObject()
@@ -169,7 +187,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
   // if (myQuadtree->isEmpty() )
   if (myQuadtrees.find(labkey) == myQuadtrees.end())
     {
-      DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
+      //DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
       HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.);
       myQuadtrees[labkey] = aQuadtree;
       TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
@@ -195,7 +213,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
           index++;
           aListOfNodes->push_back(aPoint);
         }
-      DEBTRACE("  GetQuadtreeNodes call setNodesAndCompute");
+      //DEBTRACE("  GetQuadtreeNodes call setNodesAndCompute");
       aQuadtree->setNodesAndCompute(aListOfNodes);
       return aQuadtree;
     }
@@ -214,7 +232,7 @@ vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const
   //DEBTRACE("GetVtkDelaunay2D this labkey altkey "<<this<<" "<<labkey<<" "<<altkey);
   if (myDelaunay2D.find(labkey) == myDelaunay2D.end())
     {
-      DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
+      //DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
 
       TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
       if (aLabel.IsNull())
@@ -237,7 +255,7 @@ vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const
         }
       vtkPolyData* profile = vtkPolyData::New();
       profile->SetPoints(points);
-      DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
+      //DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
 
       vtkDelaunay2D* delaunay2D = vtkDelaunay2D::New();
       delaunay2D->SetInputData(profile);
@@ -321,7 +339,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t
   int nbPts = triangle->GetNumberOfIds();
   if (nbPts != 3)
     {
-      DEBTRACE("not a triangle ?");
+      //DEBTRACE("not a triangle ?");
       return false;
     }
   vtkIdType s[3];
@@ -341,7 +359,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t
   double det = (v[1][1]-v[2][1])*(v[0][0]-v[2][0]) + (v[2][0]-v[1][0])*(v[0][1]-v[2][1]);
   if (det == 0)
     {
-      DEBTRACE("flat triangle ?");
+      //DEBTRACE("flat triangle ?");
       return false;
     }
 
@@ -367,7 +385,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t
 
 double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const
 {
-  DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
+  //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
   double anInvalidAltitude = GetInvalidAltitude();
   double aResAltitude = anInvalidAltitude;
 
@@ -376,7 +394,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
   HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes();
   if (!aQuadtree)
     {
-      DEBTRACE("  no Quadtree");
+      //DEBTRACE("  no Quadtree");
       return aResAltitude;
     }
 
@@ -385,13 +403,13 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
   while (dist2nodes.size() == 0)
     {
       aQuadtree->setPrecision(aQuadtree->getPrecision() *2);
-      DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
+      //DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
       aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
     }
   std::map<double, const gpi_XYZ*>::const_iterator it = dist2nodes.begin();
   aResAltitude = it->second->Z();
   int nodeIndex = it->second->getIndex();
-  DEBTRACE("  number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
+  //DEBTRACE("  number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
 
   // --- for coarse bathymetry clouds (when the TELEMAC mesh is more refined than the bathymetry cloud)
   //     interpolation is required.
@@ -413,7 +431,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
       points->Allocate(64);
       aDelaunay2D->GetPointCells(nodeIndex, cells);
       vtkIdType nbCells = cells->GetNumberOfIds();
-      DEBTRACE("  triangles on nearest point: " << nbCells);
+      //DEBTRACE("  triangles on nearest point: " << nbCells);
       bool isInside = false;
       for (int i=0; i<nbCells; i++)
         {
@@ -423,11 +441,14 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM
           if (isInside)
             {
               aResAltitude = z;
-              DEBTRACE("  interpolated z: " << z);
+              //DEBTRACE("  interpolated z: " << z);
               break;
             }
         }
-      if (!isInside) DEBTRACE("  point outside triangles, nearest z kept");
+      if (!isInside)
+      {
+      //    DEBTRACE("  point outside triangles, nearest z kept");
+      }
     }
   #endif
   return aResAltitude;
index 3797f19586eee6ace4c51b6fd59a6e90f985a371..8a0d8504aa2b07546d355556f0bd56ef973d7522 100644 (file)
@@ -41,12 +41,14 @@ DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
 class HYDROData_Bathymetry : public HYDROData_IAltitudeObject
 {
 public:
-  struct AltitudePoint
+  struct HYDRODATA_EXPORT AltitudePoint
   {
-    AltitudePoint( double x=0, double y=0, double z=0 ) { X=x; Y=y; Z=z; }
+    AltitudePoint( double x=0, double y=0, double z=0 );
     double X;
     double Y;
     double Z;
+
+    double SquareDistance( const AltitudePoint& ) const;
   };
   typedef std::vector<AltitudePoint> AltitudePoints;
 
index 610e96a12bdb70606d38955d917eb5c08119afce..ebfd1803afdbaa9bed23409cbe04798429ca7f06 100644 (file)
@@ -1046,7 +1046,8 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const
   SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId );
   
   QString aGeomObjEntry, anErrorMsg;
-  bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg );
+  QString statMess;
+  bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg, statMess );
   return isOK ? aGeomObjEntry : QString();
 #endif
 }
@@ -1055,7 +1056,8 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const
 bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var  theGeomEngine,
                                         SALOMEDS::Study_ptr theStudy,
                                         QString& theGeomObjEntry,
-                                        QString& theErrorMsg ) const
+                                        QString& theErrorMsg,
+                                        QString& statMess) const
 {
   HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs;
 
@@ -1122,7 +1124,9 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var  theGeomEngine,
   if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() )
   {
     QString aTelemacFileName = GetName() + ".telemac";
-    aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable() );
+    aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable(), statMess );
+    if (!aRes)
+      theErrorMsg = QString( "The export to TELEMAC %1 failed" ).arg( aTelemacFileName );
   }
   return aRes;
 }
@@ -1446,6 +1450,8 @@ bool HYDROData_CalculationCase::AddInterPoly( const Handle(HYDROData_PolylineXY)
 
   AddReferenceObject( theInterPolyline, aDataTag );
 
+  Changed( Geom_2d );
+
   return true;
 }
 
index 242a8b6832138f0be4360ecdacfe269687639f9b..b88a108ea4b7bdd4f63ef35784acfd20972718c7 100644 (file)
@@ -301,7 +301,8 @@ public:
   HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var  theGeomEngine,
                                         SALOMEDS::Study_ptr theStudy,
                                         QString& theGeomObjEntry,
-                                        QString& theErrorMsg ) const;
+                                        QString& theErrorMsg,
+                                        QString& statMess) const;
 #endif
 
 public:      
index 5134765d3184e6668f1658b176d0c581acc72e2f..bdbac0cb3c9b6d8280907a2a491dd7bce96c1d6b 100644 (file)
 #include <BRepLib_MakeEdge.hxx>
 #include <BRepLib_MakeWire.hxx>
 #include <BRep_Builder.hxx>
+#include <ShapeAnalysis_Wire.hxx>
+#include <BRepAlgo_NormalProjection.hxx>
 
 
 
 IMPLEMENT_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
 IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry )
 
-
-HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir )
-  : myXcurv( theXCurv ), myProfileDir( theProfileDir )
+HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ )
+  : myXcurv( theXCurv ), myProfileDir( theProfileDir ), myDeltaZ( theDeltaZ )
 {
 }
 
@@ -72,10 +73,19 @@ gp_Vec2d HYDROData_DTM::CurveUZ::ProfileDir() const
   return myProfileDir;
 }
 
+double HYDROData_DTM::CurveUZ::DeltaZ() const
+{
+  return myDeltaZ;
+}
+
 HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) const
 {
-  HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir() );
-  size_t n = size();
+  HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir(), DeltaZ() + c.DeltaZ() );
+  size_t n = size(), n1 = c.size();
+  if( n!=n1 )
+  {
+    std::cout << "Warning: different number of points in curves: " << n << ", " << n1 << std::endl;
+  }
   res.reserve( n );
   for( int i=0; i<n; i++ )
   {
@@ -89,7 +99,7 @@ HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) c
 
 HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator * ( double d ) const
 {
-  HYDROData_DTM::CurveUZ res( Xcurv()*d, ProfileDir()*d );
+  HYDROData_DTM::CurveUZ res( Xcurv()*d, ProfileDir()*d, DeltaZ()*d );
   size_t n = size();
   res.reserve( n );
   for( int i=0; i<n; i++ )
@@ -121,6 +131,7 @@ HYDROData_SequenceOfObjects HYDROData_DTM::GetProfiles() const
 void HYDROData_DTM::SetProfiles( const HYDROData_SequenceOfObjects& theProfiles )
 {
   SetReferenceObjects( theProfiles, DataTag_Profiles );
+  Changed( Geom_3d );
 }
 
 double HYDROData_DTM::GetDDZ() const
@@ -131,6 +142,7 @@ double HYDROData_DTM::GetDDZ() const
 void HYDROData_DTM::SetDDZ( double theDDZ )
 {
   SetDouble( DataTag_DDZ, theDDZ );
+  Changed( Geom_3d );
 }
 
 double HYDROData_DTM::GetSpatialStep() const
@@ -141,6 +153,7 @@ double HYDROData_DTM::GetSpatialStep() const
 void HYDROData_DTM::SetSpatialStep( double theSpatialStep )
 {
   SetDouble( DataTag_SpatialStep, theSpatialStep );
+  Changed( Geom_3d );
 }
 
 void HYDROData_DTM::PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W )
@@ -202,7 +215,8 @@ void HYDROData_DTM::Update()
   double ddz = GetDDZ();
   double step = GetSpatialStep();
   std::set<int> InvInd;
-  CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd );
+  bool WireIntersections; //__TODO
+  CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd, -1, WireIntersections );
   SetAltitudePoints( points );  
 
   SetShape( DataTag_LeftBankShape, OutLeftB);
@@ -230,7 +244,6 @@ void HYDROData_DTM::GetPresentationShapes( TopoDS_Shape& Out3dPres,
   Out3dPres = GetShape( DataTag_3DShape );
   Out2dPres = GetShape( DataTag_2DShape );
 }
-
 void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& InpProfiles,
                                            double ddz,
                                            double step, 
@@ -243,9 +256,10 @@ void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& In
                                            TopoDS_Shape& OutOutlet,
                                            bool Create3dPres,
                                            bool Create2dPres,
-                                           std::set<int>& InvInd)
+                                           std::set<int>& InvInd,
+                                           int thePntsLimit,
+                                           bool& WireIntersections)
 {
-
   int aLower = InpProfiles.Lower(), anUpper = InpProfiles.Upper();
   size_t n = anUpper - aLower + 1;
 
@@ -262,15 +276,21 @@ void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& In
   AltitudePoints right;
   std::vector<AltitudePoints> main_profiles;
 
+  if( thePntsLimit > 0 )
+  {
+    int aNbPoints = EstimateNbPoints( profiles, ddz, step );
+    if( aNbPoints < 0 || aNbPoints > thePntsLimit )
+      return;
+  }
+
   if( ddz>EPS && step>EPS )
     CreateProfiles(profiles, ddz, step, left, right, points, main_profiles, 
-    Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, Create3dPres, Create2dPres, InvInd );
+    Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, Create3dPres, Create2dPres, InvInd, WireIntersections );
 }
 
 void HYDROData_DTM::ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geom_Plane& RefPlane, TopoDS_Wire& outWire)
 {
-  //its also possible to use BrepAlgo_NormalProjection here!
-  BRepTools_WireExplorer ex(TopoDS::Wire(inpWire.Oriented(TopAbs_FORWARD)));
+  /*BRepTools_WireExplorer ex(TopoDS::Wire(inpWire.Oriented(TopAbs_FORWARD)));
   BRepLib_MakeWire WM;
   for (;ex.More();ex.Next())
   {
@@ -278,15 +298,39 @@ void HYDROData_DTM::ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geo
     double f, l;
     Handle(Geom_Curve) C3d = BRep_Tool::Curve(CE, f, l);
     Handle(Geom_Curve) ProjectedCurve = GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d, f, l), RefPlane, RefPlane->Position().Direction(), Standard_True);
-    TopoDS_Edge ProjEdge = BRepLib_MakeEdge(ProjectedCurve);
-    WM.Add(ProjEdge); //auto sharing between edges if vertex is coincident
-  }
+    if (!ProjectedCurve.IsNull())
+    {
+      TopoDS_Edge ProjEdge = BRepLib_MakeEdge(ProjectedCurve, f, l );
+      if (!BRep_Tool::Degenerated(ProjEdge))
+        WM.Add(ProjEdge); //auto sharing between edges if vertex is coincident
+    }
+  }*/
+
+  BRep_Builder BB;
+  TopoDS_Face F;
+  BB.MakeFace(F, RefPlane, Precision::Confusion());
+  BRepLib_MakeWire WM;
+
+  BRepAlgo_NormalProjection nproj(F);
+  nproj.Add(inpWire);
+  nproj.SetDefaultParams();
+  nproj.Build();
+  if(!nproj.IsDone())
+    return;
+  TopoDS_Shape projRes = nproj.Projection();
+  TopExp_Explorer exp(projRes, TopAbs_EDGE);
+  TopTools_ListOfShape llE;
+  for (;exp.More();exp.Next())
+    llE.Append(exp.Current());
+
+  WM.Add(llE);
   outWire = WM.Wire();
+
   outWire.Orientation(inpWire.Orientation()); //take from the original wire
 }
 
 
-void HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF )
+bool HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF )
 {
   Handle_Geom_Plane refpl = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
   BRepLib_MakeWire WM;
@@ -312,9 +356,13 @@ void HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face&
 
   TopoDS_Wire outW;
   ProjWireOnPlane(WM.Wire(), refpl, outW);
-  BRepBuilderAPI_MakeFace mf(refpl, outW); //check inside is true by def
+  BRepBuilderAPI_MakeFace mf(refpl, outW, true); //check inside is true by def
   outF = mf.Face();
 
+  ShapeAnalysis_Wire WA(outW, outF, Precision::Confusion());
+  bool res = WA.CheckSelfIntersection();
+  return res;
+
   ///!!! the internal wires cant be added with 'internal' ori.
   // it's possible to do with brep builder yet the result will not be correct!
   // more proper way is to use BOP operation here.
@@ -342,7 +390,8 @@ void HYDROData_DTM::CreateProfiles(const std::vector<Handle_HYDROData_Profile>&
                                    TopoDS_Shape& OutOutlet,
                                    bool Create3dPres,
                                    bool Create2dPres,
-                                   std::set<int>& InvInd)
+                                   std::set<int>& InvInd,
+                                   bool& WireIntersections)
 {
   if (theProfiles.empty())
     return;
@@ -371,7 +420,7 @@ void HYDROData_DTM::CreateProfiles(const std::vector<Handle_HYDROData_Profile>&
     if (Create2dPres)
     {
       TopoDS_Face outF;
-      Get2dFaceFrom3dPres(cmp, outF);
+      WireIntersections = Get2dFaceFrom3dPres(cmp, outF); //__TODO
       Out2dPres = outF;
     };
   }
@@ -535,7 +584,7 @@ std::vector<Handle_Geom2d_Curve> HYDROData_DTM::ProfileToParametric(
   GetProperties( theProfile, aLowest, theDir, false, zmin, zmax );
 
   gp_Ax3 aStd3d( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( 1, 0, 0 ) );
-  gp_Ax3 aLocal( aLowest, gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) );
+  gp_Ax3 aLocal( gp_Pnt( aLowest.X(), aLowest.Y(), 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) );
 
   gp_Trsf aTransf;
   aTransf.SetTransformation( aStd3d, aLocal );
@@ -562,18 +611,19 @@ std::vector<Handle_Geom2d_Curve> HYDROData_DTM::ProfileToParametric(
 }
 
 
-bool CalcMidWidth( const std::vector<gp_Pnt2d>& intersections, double& theMid, double& theWid )
+bool CalcMidWidth( const std::set<double>& intersections, double& theMid, double& theWid )
 {
   double umin = std::numeric_limits<double>::max(),
          umax = -umin;
 
   size_t n = intersections.size();
-  if( n <= 1 )
+  if( n <= 0 )
     return false;
 
-  for( size_t i = 0; i < n; i++ )
+  std::set<double>::const_iterator it = intersections.begin(), last = intersections.end();
+  for( ; it!=last; it++ )
   {
-    double u = intersections[i].X();
+    double u = *it;
     if( u<umin )
       umin = u;
     if( u>umax )
@@ -617,32 +667,33 @@ void HYDROData_DTM::ProfileDiscretization( const Handle_HYDROData_Profile& thePr
   curves.push_back( aT2 );
   
   int psize = ( int )( ( theMaxZ-theMinZ ) / theDDZ + 1 );
-  theMidPointCurve = CurveUZ( theXCurv, aProfileDir );
+  theMidPointCurve = CurveUZ( theXCurv, aProfileDir, theMinZ );
   theMidPointCurve.reserve( psize );
-  theWidthCurve = CurveUZ( theXCurv, aProfileDir );
+  theWidthCurve = CurveUZ( theXCurv, aProfileDir, theMinZ );
   theWidthCurve.reserve( psize );
 
   n = curves.size();
   // for each discrete value of z we search intersection with profile
-  for( double z = theMinZ; z <= theMaxZ; z += theDDZ )
+  for( double z1 = theMinZ; z1 <= theMaxZ; z1 += theDDZ )
   {
-    Handle(Geom2d_Line) aLine = new Geom2d_Line( gp_Pnt2d( 0, z ), gp_Dir2d( 1, 0 ) );
-    std::vector<gp_Pnt2d> intersections;
+    Handle(Geom2d_Line) aLine = new Geom2d_Line( gp_Pnt2d( 0, z1 ), gp_Dir2d( 1, 0 ) );
+    std::set<double> intersections;
     for( size_t i = 0; i < n; i++ )
     {
       Handle_Geom2d_Curve aCurve = curves[i];
       Geom2dAPI_InterCurveCurve anIntersect( aCurve, aLine, theTolerance );
       for( int k=1, m=anIntersect.NbPoints(); k<=m; k++ )
-        intersections.push_back( anIntersect.Point( k ) );
+        intersections.insert( anIntersect.Point( k ).X() );
     }
 
     intersection_nb = intersections.size();
-    if( intersection_nb >= 2 )
+    if( intersection_nb >= 1 )
     {
       double u_mid, u_wid;
       if( !CalcMidWidth( intersections, u_mid, u_wid ) )
         continue;
 
+      double z = z1 - theMinZ;
       PointUZ p_mid;
       p_mid.U = u_mid;
       p_mid.Z = z;
@@ -677,7 +728,7 @@ void HYDROData_DTM::Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCur
 #include <BRepLib_MakeEdge2d.hxx>
 void HYDROData_DTM::CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
                                const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
-                               AltitudePoints& thePoints, double dz )
+                               AltitudePoints& thePoints )
 {
   Geom2dAdaptor_Curve anAdaptor( theHydraulicAxis );
   TopoDS_Edge E2d = BRepLib_MakeEdge2d(theHydraulicAxis).Edge();
@@ -687,7 +738,7 @@ void HYDROData_DTM::CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxi
   gp_Pnt2d point;
   anAdaptor.D0( aParam, point );
   gp_Vec2d profile_dir = theMidCurve.ProfileDir();
-  gp_Dir tangent_n( -profile_dir.Y(), profile_dir.X(), dz );
+  //gp_Dir tangent_n( -profile_dir.Y(), profile_dir.X(), dz );
   profile_dir.Normalize();
   
   size_t n = theMidCurve.size();
@@ -700,7 +751,7 @@ void HYDROData_DTM::CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxi
     gp_Pnt2d p1 = point.Translated( param1 * profile_dir);
     gp_Pnt2d p2 = point.Translated( param2 * profile_dir);
 
-    double z = theMidCurve[i].Z;
+    double z = theMidCurve[i].Z + theMidCurve.DeltaZ();
 
     AltitudePoint p3d_1( p1.X(), p1.Y(), z ), p3d_2( p2.X(), p2.Y(), z );
 
@@ -709,9 +760,11 @@ void HYDROData_DTM::CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxi
   }
 
   thePoints.reserve( sorted_points.size() );
+  const double EPS = 1E-12;
   std::map<double, AltitudePoint>::const_iterator it = sorted_points.begin(), last = sorted_points.end();
   for( ; it!=last; it++ )
-    thePoints.push_back( it->second );
+    if( thePoints.empty() || thePoints.back().SquareDistance( it->second ) > EPS )
+      thePoints.push_back( it->second );
 }
 
 inline double max( double a, double b )
@@ -722,6 +775,14 @@ inline double max( double a, double b )
     return b;
 }
 
+inline double min( double a, double b )
+{
+  if( a<b )
+    return a;
+  else
+    return b;
+}
+
 #include <BRepLib_MakeWire.hxx>
 
 std::vector<HYDROData_Bathymetry::AltitudePoints> HYDROData_DTM::Interpolate
@@ -740,16 +801,18 @@ std::vector<HYDROData_Bathymetry::AltitudePoints> HYDROData_DTM::Interpolate
   GetProperties( theProfileA, lowestA, dirA, false, zminA, zmaxA ); 
   GetProperties( theProfileB, lowestB, dirB, false, zminB, zmaxB ); 
 
-  double dz = zminB - zminA;
+  
+  double hmax = max( zmaxA-zminA, zmaxB-zminB );
 
-  double zmin = max( zminA, zminB );
-  double zmax = max( zmaxA, zmaxB );
+  //double dz = zminB - zminA;
+  //double zmin = min( zminA, zminB );
+  //double zmax = max( zmaxA, zmaxB );
 
-  CurveUZ midA(0, gp_Vec2d()), midB(0, gp_Vec2d());
-  CurveUZ widA(0, gp_Vec2d()), widB(0, gp_Vec2d());
+  CurveUZ midA(0, gp_Vec2d(), 0), midB(0, gp_Vec2d(), 0);
+  CurveUZ widA(0, gp_Vec2d(), 0), widB(0, gp_Vec2d(), 0);
 
-  ProfileDiscretization( theProfileA, theXCurvA, zmin, zmax, theDDZ, midA, widA, inter_nb_1 ); 
-  ProfileDiscretization( theProfileB, theXCurvB, zmin, zmax, theDDZ, midB, widB, inter_nb_2 );
+  ProfileDiscretization( theProfileA, theXCurvA, zminA, zminA+hmax, theDDZ, midA, widA, inter_nb_1 ); 
+  ProfileDiscretization( theProfileB, theXCurvB, zminB, zminB+hmax, theDDZ, midB, widB, inter_nb_2 );
 
   std::vector<CurveUZ> mid, wid;
   Interpolate( midA, midB, theNbSteps, mid, isAddSecond );
@@ -763,7 +826,7 @@ std::vector<HYDROData_Bathymetry::AltitudePoints> HYDROData_DTM::Interpolate
   for( size_t i=0; i<p; i++ )
   {
     points[i].reserve( q );
-    CurveTo3D( theHydraulicAxis, mid[i], wid[i], points[i], dz );
+    CurveTo3D( theHydraulicAxis, mid[i], wid[i], points[i] );
   }
 
   return points;
@@ -801,10 +864,10 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_DTM::Interpolate
       theProfiles[i+1], distances[i+1], theDDZ, aNbSteps, isAddSecond, inter_nb_1, inter_nb_2 );
     int lps = local_points.size();
 
-    if (inter_nb_1 >= 2)
+    if (inter_nb_1 > 2)
       invalInd.insert(i);
 
-    if (inter_nb_2 >= 2)
+    if (inter_nb_2 > 2)
       invalInd.insert(i+1);
 
     // 2. Put all points into the global container
@@ -837,3 +900,31 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_DTM::Interpolate
   }
   return points;
 }
+
+int HYDROData_DTM::EstimateNbPoints( const std::vector<Handle_HYDROData_Profile>& theProfiles,
+                                     double theDDZ, double theSpatialStep )
+{
+  size_t n = theProfiles.size();
+  if( n<=1 )
+    return 0;
+  if( theDDZ<1E-6 || theSpatialStep<1E-6 )
+    return 1 << 20;
+
+  std::vector<double> distances;
+  Handle_Geom2d_BSplineCurve aHydraulicAxis = CreateHydraulicAxis( theProfiles, distances );
+  if( aHydraulicAxis.IsNull() )
+    return 0;
+
+  double aCompleteDistance = distances[n-1];
+  int aNbSteps = int( aCompleteDistance / theSpatialStep ) + 1;
+  gp_Pnt aLowest;
+  gp_Vec2d aDir;
+  double aZMin, aZMax;
+  GetProperties( theProfiles[0], aLowest, aDir, true, aZMin, aZMax );
+  int aNbZSteps = (aZMax-aZMin)/theDDZ;
+
+  if( aNbSteps > ( 1<<16 ) || aNbZSteps > ( 1<<16 ) )
+    return 1 << 20;
+
+  return aNbSteps * aNbZSteps;
+}
index 4835cef14578d30dc088a1b6ebe8acdbfca3a4d6..2a60f75a9335caa10c45e3b01fb009dc37f35ec0 100644 (file)
@@ -85,11 +85,12 @@ public:
   class CurveUZ : public std::vector<PointUZ>
   {
   public:
-    CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir = gp_Vec2d() );
+    CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir, double theDeltaZ );
     ~CurveUZ();
 
     double Xcurv() const;
-    gp_Vec2d ProfileDir() const; 
+    gp_Vec2d ProfileDir() const;
+    double DeltaZ() const;
 
     CurveUZ operator + ( const CurveUZ& ) const;
     CurveUZ operator * ( double ) const;
@@ -97,6 +98,7 @@ public:
   private:
     double myXcurv;
     gp_Vec2d myProfileDir;
+    double myDeltaZ;
   };
 
 protected:
@@ -129,7 +131,7 @@ protected:
 
   static void CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
                          const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
-                         AltitudePoints& thePoints, double dz );
+                         AltitudePoints& thePoints );
   
   static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, 
                            int theNbSteps, std::vector<CurveUZ>& theInterpolation,
@@ -174,10 +176,14 @@ protected:
                              TopoDS_Shape& OutOutlet,
                              bool Create3dPres,
                              bool Create2dPres,
-                             std::set<int>& InvInd );
+                             std::set<int>& InvInd,
+                             bool& WireIntersections);
+
+  static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
+  
+  static int EstimateNbPoints( const std::vector<Handle_HYDROData_Profile>& theProfiles,
+                               double theDDZ, double theSpatialStep );
 
-  static void Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
-    
   void GetPresentationShapes( TopoDS_Shape& Out3dPres,
                               TopoDS_Shape& Out2dPres,
                               TopoDS_Shape& OutLeftB,
@@ -198,7 +204,9 @@ public:
                                                        TopoDS_Shape& OutOutlet,
                                                        bool Create3dPres,
                                                        bool Create2dPres,
-                                                       std::set<int>& InvInd );
+                                                       std::set<int>& InvInd,
+                                                       int thePntsLimit,
+                                                       bool& WireIntersections);
 };
 
 
index 3f3942a6ebb538ed2259642fcf15587ae576c8c2..5e38d577b6bb8093a71184ec00a93f38c3b3db9a 100644 (file)
@@ -237,7 +237,7 @@ bool HYDROData_Document::DumpToPython( const QString& thePyScriptPath,
 {
   // Try to open the file
   QFile aFile( thePyScriptPath );
-  if ( !aFile.open( QIODevice::WriteOnly ) )
+  if ( !aFile.open( QIODevice::WriteOnly | QFile::Text ) )
     return false;
 
   MapOfTreatedObjects aTreatedObjects;
index c582b16fcc4143a2842f97b97fa89f57f3de270b..046e61fd8126f4142eae4f4e3d7e5cf1d3ac81a0 100644 (file)
@@ -62,6 +62,7 @@
 #include <TopTools_DataMapOfShapeListOfShape.hxx>
 #include <NCollection_DoubleMap.hxx>
 #include <HYDROData_LCM_FaceClassifier.h>
+#include <QDir>
 
 #include <stdexcept>
 
@@ -367,7 +368,8 @@ bool EdgeDiscretization( const TopoDS_Edge& theEdge,
 */
 bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName,
                                             double theDeflection,
-                                            const Handle(HYDROData_StricklerTable)& theTable ) const
+                                            const Handle(HYDROData_StricklerTable)& theTable,
+                                            QString& statMessage) const
 {
   TopoDS_Shape aLandCoverMapShape = GetShape();
   TopTools_ListOfShape aListOfFaces;
@@ -418,7 +420,19 @@ bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName,
 
   QFile aFile( theFileName );
   if( !aFile.open( QFile::WriteOnly | QFile::Text ) )
-    return false;
+  {
+    QString homeFilePath = QDir::home().absoluteFilePath( theFileName );
+    aFile.setFileName(homeFilePath);
+    if (aFile.open( QFile::WriteOnly | QFile::Text ) )
+      statMessage = "Telemac file have been exported to the home directory: " + homeFilePath;
+    else
+      return false;
+  }
+  else
+  {
+    QString absFilePath = QDir::current().absoluteFilePath( theFileName );
+    statMessage = "Telemac file have been exported to the current directory: " + absFilePath;
+  }
 
   QTextStream aStream( &aFile );
   aStream << "# nodes\n";
index e009351a2baa6e20176ca49c3baa0b7218103401..f6e681b04bff09cdf79d04060799c3d498635004 100644 (file)
@@ -111,7 +111,8 @@ public:
 
   HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName,
                                        double theDeflection,
-                                       const Handle_HYDROData_StricklerTable& theTable ) const;
+                                       const Handle_HYDROData_StricklerTable& theTable,
+                                       QString& statMessage) const;
 
   HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
   HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
index 547b8a47daf3165c6f7d0a33ff8550ecdd71fd1e..11fe12cd2e51c99fa5a3a253be6d05728662b266 100644 (file)
@@ -49,12 +49,12 @@ HYDROData_QuadtreeNode::HYDROData_QuadtreeNode(Nodes_3D* theNodes,
                                                const double minBoxSize) :
     HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes), myPrecision(0.25)
 {
-  DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
+  //DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
    if (myNodes)
     {
-      DEBTRACE(" --- start compute");
+      //DEBTRACE(" --- start compute");
       compute();
-      DEBTRACE(" --- end compute");
+      //DEBTRACE(" --- end compute");
     }
 }
 
@@ -88,11 +88,11 @@ void HYDROData_QuadtreeNode::setNodesAndCompute(Nodes_3D* theNodes)
   myNodes = theNodes;
   if (myNodes)
     {
-      DEBTRACE(" --- start compute");
+      //DEBTRACE(" --- start compute");
       compute();
-      DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
-      DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " "  << this->myBox->CornerMin().Y());
-      DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " "  << this->myBox->CornerMax().Y());
+      //DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
+      //DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " "  << this->myBox->CornerMin().Y());
+      //DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " "  << this->myBox->CornerMax().Y());
     }
 }
 
index d4a04ef4b5ed4140aea4d6b99b1fc8a72ce6feb2..022cc30664aecc4bf3708c748afc7dab995dd0f0 100644 (file)
@@ -185,6 +185,8 @@ void HYDROData_Stream::Update()
   Handle_HYDROData_DTM dtm = DTM();
   dtm->Update();
   UpdatePrs( dtm );
+
+  HYDROData_NaturalObject::Update();
 }
 
 bool HYDROData_Stream::IsHas2dPrs() const
@@ -337,6 +339,7 @@ double HYDROData_Stream::GetDDZ() const
 void HYDROData_Stream::SetDDZ( double theDDZ )
 {
   DTM()->SetDDZ( theDDZ );
+  Changed( Geom_3d );
 }
   
 double HYDROData_Stream::GetSpatialStep() const
@@ -347,6 +350,7 @@ double HYDROData_Stream::GetSpatialStep() const
 void HYDROData_Stream::SetSpatialStep( double theSpatialStep )
 {
   DTM()->SetSpatialStep( theSpatialStep );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis )
@@ -1087,6 +1091,6 @@ void HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt)
 
   thePrs.myPrs3D = newCmp;
 
-  HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D) );
+  HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D) ); //__TODO
 
 }
\ No newline at end of file
index 7d1339241db68abd290f6b348fa52791943294ba..091b31d5baffde792726463859456397aacd00c6 100644 (file)
@@ -56,7 +56,7 @@ void HYDROData_Tool::WriteStringsToFile( QFile&             theFile,
     return;
 
   QTextStream anOutStream( &theFile );
-  anOutStream << aWriteStr << theSep << theSep;
+  anOutStream << aWriteStr.toUtf8() << theSep << theSep;
 }
 
 QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
index 024b5487b5ca5f12000663da4f73477320b8f30c..734964c9fa2199390477d3713b69ac47ae955ea6 100644 (file)
@@ -154,7 +154,10 @@ void HYDROGUI_CalculationOp::startOperation()
         aPanel->setBoundary( aPolylineName );
       }
 
-      aSeq = myEditedObject->GetGeometryObjects();
+      aSeq = myEditedObject->GetGeometryObjects();      
+      HYDROData_SequenceOfObjects anInterPolyList = myEditedObject->GetInterPolyObjects();
+      aSeq.Append(anInterPolyList);
+
       getNamesAndEntries( aSeq, aList, anEntryList );
       aPanel->includeGeomObjects( aList );
 
index 93467ea163c0cb457549bfa8ef3c3a4b4a20040f..77978ee51bc52b9902ac70383030e6603f3f16eb 100644 (file)
@@ -65,7 +65,7 @@ void HYDROGUI_ExportCalculationOp::commitOperation()
 
 bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
                                                  QString& theErrorMsg,
-                                                 QStringList& theBrowseObjectsEntries )
+                                                 QStringList& theBrowseObjectsEntries)
 {
   // Get the selected calculation case
   Handle(HYDROData_CalculationCase) aCalculation = 
@@ -84,12 +84,13 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
     dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
 
   // Export
+  myStatMess.clear();
   QString anErrorMsg;
   if ( aStudy ) {
     SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() );
     GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen();
     QString anEntry;
-    if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg ) ) {
+    if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg, myStatMess ) ) {
       theUpdateFlags = UF_ObjBrowser;
       isOk = true;
     }
@@ -132,7 +133,7 @@ void HYDROGUI_ExportCalculationOp::onApply()
     // Show message box
     SUIT_MessageBox::information( module()->getApp()->desktop(),
                                   tr( "EXPORT_STATUS" ),
-                                  tr( "EXPORT_FINISHED") ); 
+                                  tr( "EXPORT_FINISHED") + "\n" + getStatMess() ); 
   } 
   else {
     abort();
@@ -147,3 +148,8 @@ void HYDROGUI_ExportCalculationOp::onApply()
                                anErrorMsg ); 
   }
 }
+
+QString HYDROGUI_ExportCalculationOp::getStatMess()
+{
+  return myStatMess;
+}
index f7c0d0b30330cbdda6d6f5b57be8f391efe4eefc..e73883ce3adfca22fb7af1764ffea13181fd8758 100644 (file)
@@ -38,6 +38,10 @@ protected:
   virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
                                            QStringList& theBrowseObjectsEntries );
   virtual void               onApply();
+
+  QString                    getStatMess();
+
+  QString                    myStatMess;
 };
 
 #endif
\ No newline at end of file
index d9c0076ab1fc81f21b0d5374332f5023927da264..b85450ebf4b54bff6e1147044b0d78d1334f9bfd 100644 (file)
@@ -113,6 +113,9 @@ void HYDROGUI_ImagePrs::Compute( const Handle(PrsMgr_PresentationManager3d)&,
     aPrs->Clear();
     Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs );
 
+    if( myImage.IsNull() )
+      return;
+
     if ( aMode == 0 )
     {
         Handle(Graphic3d_ArrayOfPolylines) aSegments = new Graphic3d_ArrayOfPolylines( 5 );
index e130caa1d0586b19c4228b5eca98a84f0a1ee88c..238acf07171cad4f11bbff689be2e91b03f077d9 100644 (file)
@@ -117,7 +117,7 @@ void HYDROGUI_ImportPolylineOp::onApply()
   {
     commitDocOperation();
     commit();
-    module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
+    module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init | UF_OCCViewer );
   }
   else
     abort();
index cd5a630bade3cce8eeb1f689d8131f6715a04dae..38090fe5441884545f6a71db1a63a3e70a8c014c 100644 (file)
@@ -1821,7 +1821,7 @@ void HYDROGUI_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn
 
   setObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject(), vis );
 
-  update( UF_OCCViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
+  update( UF_OCCViewer | UF_VTKViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
 }
 
 Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const int theViewId ) const
index 532c6071cd15b4023ccdae15d41dd4943c68a316..ccd259aaad68daa94cfcbbb0fd82307f8e6ed7a8 100644 (file)
@@ -87,10 +87,20 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
   Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth );
 
   TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE );
+  Bnd_Box BB;
+  BRepBndLib::AddClose(myshape, BB);
+  double xmin, xmax, ymin, ymax, zmin, zmax;
+  double devCoeff = 0.1;
+  if (!BB.IsVoid())
+  {
+    BB.Get(xmin, ymin, zmin, xmax, ymax, zmax); //ignore Z coord
+    double minSide = Min(Abs(xmax - xmin), Abs(ymax - ymin));
+    devCoeff = minSide > 50 ? 0.1 : minSide / 500;
+  }
   for ( ; Exp1.More(); Exp1.Next() )
   {
     TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() );
-    Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 );
+    Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, devCoeff );
     if( !anArray.IsNull() )
     {
       aGroup->SetPrimitivesAspect( anAspect );
@@ -154,7 +164,8 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
     
     gp_Pnt aPnt1 = C->Value (aMaxRatioStep);
     gp_Vec aDir;
-    if (!UseD1) {
+    if (!UseD1) 
+    {
       GCPnts_AbscissaPoint aAbsPoint(aAdC, -aArrLen, aMaxRatioStep);
       double aParam = aAbsPoint.Parameter();      
       gp_Pnt aPnt2 = C->Value (aParam);
@@ -162,7 +173,8 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
       D.Subtract (aPnt2.XYZ());
       aDir = D;
     }
-    else
+
+    if (UseD1 || aDir.IsEqual (gp_Vec(0,0,0), Precision::Confusion(), Precision::Angular()))
       C->D1(aMaxRatioStep, aPnt1, aDir);
   
     if ( anEdge.Orientation() == TopAbs_REVERSED )
index 0575b94616ac63c8dddbc34f0afc00aa8a3d9680..e8e7941b670df5490036037941cc70b95161a62b 100644 (file)
@@ -48,7 +48,7 @@ void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivate
 
   Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
 
-  if ( !aBath.IsNull() )
+  if ( !aBath.IsNull() && !aBath->GetAltitudePoints().empty())
   {
     buildShape();
     updateShape( false, false );
@@ -104,6 +104,8 @@ void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const
 
 void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(Aspect_ColorScale)& theColorScale )
 {
+  if (!myCoords)
+    return;
   for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ )
   {
     double z = myCoords->Value( i ).Z();
index 9a4419ab69747e1af5dc394110d97fd9263c6556..a07c5fe7e79b5e5a178bfead856e8a6a2bf7e62c 100644 (file)
@@ -36,6 +36,7 @@
 #include <QListWidget>
 #include <QPushButton>
 #include <QDoubleSpinBox>
+#include <QTextEdit>
 
 HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QString& theTitle )
 : HYDROGUI_InputPanel( theModule, theTitle )
@@ -100,9 +101,18 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   
   aParamGroup->setLayout( aParamLayout );
 
+  // Warnings
+  QGroupBox* aWarnGroup = new QGroupBox( tr( "STREAM_WARNINGS" ), mainFrame() );
+  myWarnText = new QTextEdit(); 
+  myWarnText->setReadOnly(true);
+  QBoxLayout* aWarnLayout = new QVBoxLayout();
+  aWarnLayout->addWidget( myWarnText );  
+  aWarnGroup->setLayout( aWarnLayout );
+
   // Common
   addWidget( myObjectNameGroup );
   addWidget( aParamGroup );
+  addWidget( aWarnGroup );
   addStretch();
 
   // Create selector
@@ -262,3 +272,13 @@ void HYDROGUI_StreamDlg::clearAllBackgroundColorsForProfileList ()
   myProfiles->clearAllBackgroundColors();
 }
 
+void HYDROGUI_StreamDlg::addWarning( const QString& theWarnMess )
+{
+  myWarnText->append( theWarnMess );
+}
+
+void HYDROGUI_StreamDlg::clearWarnings()
+{
+  myWarnText->clear();
+}
+
index 2e4e4626d7459c5f7cd1558056fb1b0ffed56827..3d49be1befa6c561d42b612297ed7c5551285c06 100644 (file)
@@ -29,6 +29,7 @@ class QLineEdit;
 class QListWidget;
 class QPushButton;
 class QDoubleSpinBox;
+class QTextEdit;
 
 class HYDROGUI_StreamDlg : public HYDROGUI_InputPanel
 {
@@ -56,6 +57,9 @@ public:
   void                       setSpatialStep( const double );
   double                     getSpatialStep() const;
 
+  void                       addWarning( const QString& theWarnMess );
+  void                       clearWarnings();
+
   void setBackgroundColorForProfileList (int theInd, QColor theColor);
   QColor getBackgroundColorForProfileList (int theInd) const;
   void clearAllBackgroundColorsForProfileList ();
@@ -82,6 +86,8 @@ private:
   HYDROGUI_OrderedListWidget* myProfiles;
   QPushButton*                myRemoveButton;
   QPushButton*                myAddButton;
+  QTextEdit*                  myWarnText;
+
 };
 
 #endif
index 72702a6a063d41525f5a69d6509bb9c65d554300..2a178d83f96d97b3fb4936f6331e8c98c96f3b48 100755 (executable)
@@ -38,6 +38,8 @@
 #include <SUIT_MessageBox.h>
 #include <SUIT_Desktop.h>
 #include <QColor>
+#include <QApplication>
+
 
 #include <OCCViewer_ViewManager.h>
 #include <OCCViewer_ViewModel.h>
@@ -117,32 +119,33 @@ void HYDROGUI_StreamOp::startOperation()
 
       // Hydraulic axis
       Handle(HYDROData_PolylineXY) aHydraulicAxis = myEditedObject->GetHydraulicAxis();
+      
+      TopoDS_Face aPlane;
+      HYDROData_Stream::BuildRefFace( aPlane ) ;
       if ( !aHydraulicAxis.IsNull() )
-      {
         myHydAxis = aHydraulicAxis->GetName();
 
-        TopoDS_Face aPlane;
-        HYDROData_Stream::BuildRefFace( aPlane ) ;
-
-        // Stream profiles
-        HYDROData_SequenceOfObjects aStreamProfiles = myEditedObject->GetProfiles();
-        for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i )
-        {
-          Handle(HYDROData_Profile) aProfile = 
-            Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) );
-          if ( aProfile.IsNull() )
-            continue;
+      // Stream profiles
+      HYDROData_SequenceOfObjects aStreamProfiles = myEditedObject->GetProfiles();
+      for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i )
+      {
+        Handle(HYDROData_Profile) aProfile = 
+          Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) );
+        if ( aProfile.IsNull() )
+          continue;
 
-          QString aProfileName = aProfile->GetName();
+        QString aProfileName = aProfile->GetName();        
+        myProfiles      << aProfileName;
 
+        if (!aHydraulicAxis.IsNull())
+        {
           Standard_Real aProfilePar = 0.0;
           HYDROData_Stream::HasIntersection( aHydraulicAxis, aProfile, aPlane, aProfilePar );
-
-          myProfiles      << aProfileName;
           myProfileParams << aProfilePar;
-
         }
-      }
+
+      }      
+
     }
   }
 
@@ -193,6 +196,58 @@ HYDROGUI_InputPanel* HYDROGUI_StreamOp::createInputPanel() const
   return aPanel;
 }
 
+void HYDROGUI_StreamOp::apply()
+{
+  QApplication::setOverrideCursor( Qt::WaitCursor );
+
+  startDocOperation();
+
+  int anUpdateFlags = 0;
+  QString anErrorMsg;
+
+  bool aResult = false;
+  QStringList aBrowseObjectsEntries;
+
+  try
+  {
+    aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries );
+  }
+  catch ( Standard_Failure )
+  {
+    Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
+    anErrorMsg = aFailure->GetMessageString();
+    aResult = false;
+  }
+  catch ( ... )
+  {
+    aResult = false;
+  }
+  
+  QApplication::restoreOverrideCursor();
+
+  if ( aResult )
+  {
+    module()->update( anUpdateFlags );
+    commitDocOperation();
+    commit();
+    browseObjects( aBrowseObjectsEntries );
+  }
+  else
+  {
+    myEditedObject->Remove();
+    module()->setObjectRemoved( myEditedObject );  
+
+    if ( isToAbortOnApply() )
+      abortDocOperation();
+
+    abort();
+    SUIT_MessageBox::critical( module()->getApp()->desktop(),
+                               tr( "CREATE_STREAM_ERROR" ),
+                               anErrorMsg ); 
+
+  } 
+}
+
 bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
                                       QString& theErrorMsg,
                                       QStringList& theBrowseObjectsEntries )
@@ -356,10 +411,18 @@ void HYDROGUI_StreamOp::createPreview()
   double ss = aPanel->getSpatialStep();
 
   std::set<int> InvInd;
-    
+
+#ifdef _DEBUG
+  const int MAX_POINTS_IN_PREVIEW = 50000;
+#else
+  const int MAX_POINTS_IN_PREVIEW = 500000;
+#endif
+
   HYDROData_Bathymetry::AltitudePoints points;
+
+  bool WireIntersections = false;
   HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB,
-    OutInlet, OutOutlet, true, true, InvInd);
+    OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, WireIntersections );
 
   aPanel->clearAllBackgroundColorsForProfileList();
   for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
@@ -369,9 +432,13 @@ void HYDROGUI_StreamOp::createPreview()
   aPrsDef.myOutlet = TopoDS::Wire(OutOutlet);
   aPrsDef.myLeftBank = TopoDS::Wire(OutLeftB);
   aPrsDef.myRightBank = TopoDS::Wire(OutRightB);
-  aPrsDef.myPrs2D = Out2dPres;
+  if (!WireIntersections)
+    aPrsDef.myPrs2D = Out2dPres;
   aPrsDef.myPrs3D = Out3dPres;
 
+  if (WireIntersections)
+    aPanel->addWarning(tr("STREAM_SELF_INTERSECTIONS"));
+
   myPreviewPrs->setShape( aPrsDef.myPrs2D );
 }
 
index cb45e50dc0cd10b46b68996520c42581d1d39720..5e3a91604460a1d834d3d8eef723d799fd5be64e 100755 (executable)
@@ -47,6 +47,8 @@ protected:
 
   virtual bool                 isToAbortOnApply() const { return false; }
 
+  virtual void                 apply();
+
 private slots:
   void                         onAddProfiles();
   void                         onRemoveProfiles( const QStringList& );
index 08f6ef08da0b5d0361a22bf73065a16c41944848..6833acec714a898feb6e226e969ab106b4f9303c 100644 (file)
@@ -87,7 +87,7 @@ void HYDROGUI_VTKPrsBathymetry::compute()
 
       double aZ;
       int anInvalidZ = InvalidZValue();
-      for (int i = 1; i <= aNbPoints; i++ )
+      for (int i = 0; i < aNbPoints; i++ )
       {
         anAltPnt = anAltPoints[i];
         aZ = anAltPnt.Z;
index 94f9b019ac5ff1dec3008012dde2495eeb88867e..e19e9fad620280277b88133f4742e4af7bc5ed9e 100644 (file)
@@ -250,6 +250,14 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
       <source>STREAM_PROFILES</source>
       <translation>Profiles</translation>
     </message>
+    <message>
+      <source>STREAM_WARNINGS</source>
+      <translation>Stream Warnings</translation>
+    </message>
+     <message>
+      <source>STREAM_SELF_INTERSECTIONS</source>
+      <translation>Warning: intersection(s) of banks/profiles are found</translation>
+    </message>
     <message>
       <source>PREF_TAB_GENERAL</source>
       <translation>General</translation>
@@ -2694,6 +2702,10 @@ file cannot be correctly imported for an Obstacle definition.</translation>
   <context>
     <name>HYDROGUI_StreamOp</name>
     <message>
+      <source>CREATE_STREAM_ERROR</source>
+      <translation>Stream creation error</translation>
+    </message>
+     <message>
       <source>CREATE_STREAM</source>
       <translation>Create stream</translation>
     </message>
index a502140da27786672c47cfa8c0fc08964689fc9a..b20417de3d7b4b9dba31add8b0ac42aae5a1a260 100644 (file)
@@ -75,8 +75,9 @@ public:
     if ( !aRef.IsNull() )
     {
       Py_BEGIN_ALLOW_THREADS
-      sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef ):
-                               sipCpp->ExportTelemac( *a0, a1, aRef );
+         QString messStat;
+      sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef, messStat ):
+                               sipCpp->ExportTelemac( *a0, a1, aRef, messStat );
       Py_END_ALLOW_THREADS
     }
   %End
index 3cf4ea201cb6c14099f32aba13c8102ea212c56d..70ce0866aca0b77dbe89918a6da28062b0225556 100644 (file)
@@ -27,7 +27,7 @@
 #include <GeomAPI_Interpolate.hxx>
 #include <gp_Circ.hxx>
 
-TopoDS_Edge Edge( const QList<double>& theXYList, bool isClosed )
+TopoDS_Edge Edge2d( const QList<double>& theXYList, bool isClosed )
 {
   int n = theXYList.size()/2;
   Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
@@ -50,14 +50,48 @@ TopoDS_Edge Edge( const QList<double>& theXYList, bool isClosed )
     return TopoDS_Edge();
 }
 
-TopoDS_Wire Wire( const QList<double>& theXYList, bool isClosed )
+TopoDS_Wire Wire2d( const QList<double>& theXYList, bool isClosed )
 {
-  return BRepBuilderAPI_MakeWire( Edge( theXYList, isClosed ) ).Wire();
+  return BRepBuilderAPI_MakeWire( Edge2d( theXYList, isClosed ) ).Wire();
 }
 
-TopoDS_Face Face( const QList<double>& theXYList )
+TopoDS_Edge Edge3d( const QList<double>& theXYZList, bool isClosed )
 {
-  return BRepBuilderAPI_MakeFace( Wire( theXYList, true ), Standard_True ).Face();
+  int n = theXYZList.size()/3;
+  Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
+  for( int i=1; i<=n; i++ )
+  {
+    double x = theXYZList[3*i-3];
+    double y = theXYZList[3*i-2];
+    double z = theXYZList[3*i-1];
+    gp_Pnt aPnt( x, y, z );
+    aPointsArray->SetValue( i, aPnt );
+  }
+  GeomAPI_Interpolate anInterpolator( aPointsArray, isClosed, 1E-3 );
+  anInterpolator.Perform();
+  bool aResult = anInterpolator.IsDone() == Standard_True;
+  if( aResult )
+  {
+    Handle( Geom_BSplineCurve ) aCurve = anInterpolator.Curve();
+    return BRepBuilderAPI_MakeEdge( aCurve ).Edge();
+  }
+  else
+    return TopoDS_Edge();
+}
+
+TopoDS_Wire Wire3d( const QList<double>& theXYZList, bool isClosed )
+{
+  return BRepBuilderAPI_MakeWire( Edge3d( theXYZList, isClosed ) ).Wire();
+}
+
+TopoDS_Face Face2d( const QList<double>& theXYList )
+{
+  return BRepBuilderAPI_MakeFace( Wire2d( theXYList, true ), Standard_True ).Face();
+}
+
+TopoDS_Face Face3d( const QList<double>& theXYZList )
+{
+  return BRepBuilderAPI_MakeFace( Wire3d( theXYZList, true ), Standard_True ).Face();
 }
 
 TopoDS_Wire WireCirc( const gp_Pnt& theCenter, double theRadius )
index b1e12378c68b553ffd65abfc0b0d2db2233ecee6..470d30494d030a5615ad81b415ceea4e32f2ae72 100644 (file)
@@ -25,8 +25,14 @@ class TopoDS_Wire;
 class TopoDS_Face;
 class gp_Pnt;
 
-TopoDS_Edge Edge( const QList<double>& theXYList, bool isClosed = false );
-TopoDS_Wire Wire( const QList<double>& theXYList, bool isClosed = false );
+TopoDS_Edge Edge2d( const QList<double>& theXYList, bool isClosed = false );
+TopoDS_Wire Wire2d( const QList<double>& theXYList, bool isClosed = false );
+
+TopoDS_Edge Edge3d( const QList<double>& theXYZList, bool isClosed = false );
+TopoDS_Wire Wire3d( const QList<double>& theXYZList, bool isClosed = false );
+
+
 TopoDS_Wire WireCirc( const gp_Pnt& theCenter, double theRadius );
-TopoDS_Face Face( const QList<double>& theXYList );
 
+TopoDS_Face Face2d( const QList<double>& theXYList );
+TopoDS_Face Face3d( const QList<double>& theXYZList );
index de597b4034db3a4cce239a9eac55dfaace89f6f4..028435ec70e4db8ebc7a7eb1ee14a9745b54b327 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/Channel.png and b/src/HYDRO_tests/reference_data/Channel.png differ
index 02660014bc1017564255e50c4e9c69912d78713c..612a4be5cad90e51fe53a5b6e01c1f11ed12f0f7 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/DTM_2.png and b/src/HYDRO_tests/reference_data/DTM_2.png differ
index 09ce9a9eb97971885e11b01d9cb174d3f96356c1..9ef6188a053eadbe1d5122c28868cc276f66c49a 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/Extraction_Channel.png and b/src/HYDRO_tests/reference_data/Extraction_Channel.png differ
index 9051a8ef0dbc262fbe0effbfc0194dea90d0e806..bedd58fa6b7972dc0ab84996fe69024f576aec3d 100644 (file)
@@ -1,4 +1,4 @@
-from HYDROPy import *
+from HYDROPy import *
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
index 2da077fde7de1f4bf8a56b4e80af70f8c89bc31f..83044a05066838511c5d82ad996e7eb8fb51b2c7 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/stream_dtm_2d.png and b/src/HYDRO_tests/reference_data/stream_dtm_2d.png differ
index b4aafc80c097fcb11e8274494b5973c6a67edd10..caa7ef13f8b81c4e25624160ea84ba077cf72402 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/stream_dtm_3d.png and b/src/HYDRO_tests/reference_data/stream_dtm_3d.png differ
index 202d1a7137356ca2a1f9ea1b270b70121d6837a6..1c0fc6edaef330264ede9456b75f64278ca925f3 100644 (file)
@@ -136,7 +136,7 @@ void test_HYDROData_Bathymetry::testFileImport()
 
   aTestPoint = gp_XY( 0.5, 0.5 );
   anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.7127, anAltitude, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS );
 
   aTestPoint = gp_XY( 1.5, 1 );
   anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
@@ -144,15 +144,15 @@ void test_HYDROData_Bathymetry::testFileImport()
 
   aTestPoint = gp_XY( 1.5, 0.7 );
   anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(  -0.4116, anAltitude, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS );
 
   aTestPoint = gp_XY( 1.5, -0.7 );
   anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.0479, anAltitude, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.271267, anAltitude, EPS );
 
   aTestPoint = gp_XY( 2, 3.5 );
   anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.2525, anAltitude, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.9454, anAltitude, EPS );
 
   aDoc->Close();
 }
index 153f3c44292eda3e1e7cfec5875706b422ef2577..3a84e0bc8f86ad9f8e83cc288ad24c15f38dcea1 100644 (file)
@@ -338,7 +338,7 @@ void test_HYDROData_DTM::test_profile_discretization_polyline()
   aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
   aProfile->SetRightPoint( gp_XY( 20, 20 ) );
 
-  HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
+  HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 );
   int dummy = 0;
   HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy );
   CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
@@ -376,7 +376,7 @@ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
   aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
   aProfile->SetRightPoint( gp_XY( 20, 20 ) );
 
-  HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
+  HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 );
   int dummy = 0 ;
   HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy );
   CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
@@ -431,7 +431,7 @@ void operator << ( std::ostream& s, const HYDROData_DTM::CurveUZ& c )
 
 void test_HYDROData_DTM::test_curves_interpolation()
 {
-  HYDROData_DTM::CurveUZ A(1.0), B(2.0);
+  HYDROData_DTM::CurveUZ A(1.0, gp_Vec2d(), 0), B(2.0, gp_Vec2d(), 0);
   A.push_back( HYDROData_DTM::PointUZ( 0, 0 ) );
   A.push_back( HYDROData_DTM::PointUZ( 1, 1 ) );
   A.push_back( HYDROData_DTM::PointUZ( 2, 2 ) );
@@ -498,13 +498,13 @@ void test_HYDROData_DTM::test_curve_to_3d()
 
   Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances );
   HYDROData_DTM::AltitudePoints points;
-  HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10) );
+  HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10), 0 );
   mid.push_back( HYDROData_DTM::PointUZ( 0, 5 ) );
   mid.push_back( HYDROData_DTM::PointUZ( 1, 6 ) );
-  HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10) );
+  HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10), 0 );
   wid.push_back( HYDROData_DTM::PointUZ( 2, 5 ) );
   wid.push_back( HYDROData_DTM::PointUZ( 6, 6 ) );
-  HYDROData_DTM::CurveTo3D( HA, mid, wid, points, 0.0 );
+  HYDROData_DTM::CurveTo3D( HA, mid, wid, points );
 
   CPPUNIT_ASSERT_EQUAL( 4, (int)points.size() );
   CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 16.380, -2.186, 6.0 ), points[0] );
@@ -600,7 +600,7 @@ void test_HYDROData_DTM::test_garonne()
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS );
   DTM->Update();
   
-  CPPUNIT_ASSERT_EQUAL( 275690, (int)DTM->GetAltitudePoints().size() ); 
+  CPPUNIT_ASSERT_EQUAL( 282338, (int)DTM->GetAltitudePoints().size() ); 
 
   Handle_AIS_InteractiveContext aContext = TestViewer::context();
   HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM );
index 074748771701e180e2e8c2073368cd935d4d9486..96d6705793b33d413e4ca09d2359ddb3c0005ce2 100644 (file)
@@ -61,11 +61,11 @@ void test_HYDROData_LandCoverMap::test_add_2_objects()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   //DEBTRACE("--- ajout test1 " << aLC1);
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
   //DEBTRACE("--- ajout test2 " << aLC2);
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
 
@@ -107,12 +107,12 @@ void test_HYDROData_LandCoverMap::test_split()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
 
   Handle(HYDROData_PolylineXY) aPolyline =
     Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
-  TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false );
+  TopoDS_Wire aWire = Wire2d( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false );
   aPolyline->SetShape( aWire );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
@@ -142,12 +142,12 @@ void test_HYDROData_LandCoverMap::test_incomplete_split()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
 
   Handle(HYDROData_PolylineXY) aPolyline =
     Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
-  TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10, false );
+  TopoDS_Wire aWire = Wire2d( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10, false );
   aPolyline->SetShape( aWire );
 
   CPPUNIT_ASSERT_EQUAL( false, aMap->Split( aPolyline ) );
@@ -174,17 +174,17 @@ void test_HYDROData_LandCoverMap::test_merge()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
 
-  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+  TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
 
@@ -279,17 +279,17 @@ void test_HYDROData_LandCoverMap::test_remove()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
 
-  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+  TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
 
@@ -552,11 +552,11 @@ void test_HYDROData_LandCoverMap::test_import_dbf()
   // aST.size() == aDBFV.size()!!
   Handle(HYDROData_PolylineXY) aPolyline =
     Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
-  TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 );
+  TopoDS_Wire aWire = Wire2d( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 );
   aPolyline->SetShape( aWire );
   for (int i = 0; i < 3; i++)
     aMap->Add(aPolyline, "");
-  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
   
   CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
@@ -581,16 +581,16 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types()
   Handle(HYDROData_LandCoverMap) aMap =
     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Zones de champs cultivé à végétation haute")) );
 
-  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+  TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) );
 
@@ -617,16 +617,16 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff()
   Handle(HYDROData_LandCoverMap) aMap =
     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Zones de champs cultivé à végétation haute")) );
 
-  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+  TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) );
 
@@ -656,17 +656,17 @@ void test_HYDROData_LandCoverMap::test_dump_python()
 
   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
 
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
 
-  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+  TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
 
@@ -706,8 +706,8 @@ void test_HYDROData_LandCoverMap::test_transparent_prs()
 
   Handle(HYDROData_LandCoverMap) aMap =
     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
-  aMap->LocalPartition( Face( QList<double>() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
-  aMap->LocalPartition( Face( QList<double>() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
+  aMap->LocalPartition( Face2d( QList<double>() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
+  aMap->LocalPartition( Face2d( QList<double>() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
   aMap->SetName( "test_LCM" );
 
   TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" );
@@ -1085,22 +1085,23 @@ void test_HYDROData_LandCoverMap::test_export_telemac()
   Handle(HYDROData_LandCoverMap) aMap =
     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêt et végétation arbustive en mutation")) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de conifères")) );
 
-  TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+  TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
                                             127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Forêts de feuillus")) );
 
   QString aTmpFileName = "test.telemac";
   QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName;
-  CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable ) );
+  QString messStat;
+  CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable, messStat ) );
   CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 );
 
   aDoc->Close();
@@ -1114,10 +1115,10 @@ void test_HYDROData_LandCoverMap::test_copy()
     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
   aMap->SetName( "map_1" );
 
-  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
+  TopoDS_Face aLC1 = Face2d( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêts de conifères")) );
 
-  TopoDS_Face aLC2 = Face( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
+  TopoDS_Face aLC2 = Face2d( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
   CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de feuillus")) );
 
   Handle(HYDROData_LandCoverMap) aMap2 =
index 1ec755ff99871e3a40a56f56005fa51976b76931..57d6435fcfd3cc192ab2167e50cea74e5cf22722 100644 (file)
@@ -102,7 +102,7 @@ void test_HYDROData_PolylineXY::test_split_refs_624()
   aPolyline->SetName( "test" );
 
   QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
-  TopoDS_Wire aWire = Wire( aCoords, true );
+  TopoDS_Wire aWire = Wire2d( aCoords, true );
   aPolyline->SetShape( aWire );
 
   gp_Pnt2d aPnt( 20, 20 );
@@ -135,7 +135,7 @@ void test_HYDROData_PolylineXY::test_extraction_immersible_zone()
   aPolyline->SetName( "test" );
 
   QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
-  TopoDS_Wire aWire = Wire( aCoords, true );
+  TopoDS_Wire aWire = Wire2d( aCoords, true );
   aPolyline->SetShape( aWire );
 
   Handle(HYDROData_ImmersibleZone) aZone = 
@@ -175,7 +175,7 @@ void test_HYDROData_PolylineXY::test_extraction_channel_refs_611()
   aPolyline3d->SetPolylineXY( aPolyline2d );
 
   QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
-  TopoDS_Wire aWire = Wire( aCoords, false );
+  TopoDS_Wire aWire = Wire2d( aCoords, false );
   aPolyline2d->SetShape( aWire );
   aPolyline3d->SetTopShape( aWire );
   aPolyline3d->SetShape3D( aWire );
@@ -184,8 +184,8 @@ void test_HYDROData_PolylineXY::test_extraction_channel_refs_611()
     Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
   aProfile->SetName( "profile_1" );
 
-  QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.5 << 0.0 << 1.0 << 0.1;
-  TopoDS_Wire aWirePr = Wire( aCoordsPr, false );
+  QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.0 << 0.0 << 1.0 << 0.0;
+  TopoDS_Wire aWirePr = Wire3d( aCoordsPr, false );
   aProfile->SetTopShape( aWirePr );
   aProfile->SetShape3D( aWirePr );
 
@@ -273,7 +273,7 @@ void test_HYDROData_PolylineXY::test_split_refs_627()
   aPolyline->SetName( "test" );
 
   QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
-  TopoDS_Wire aWire = Wire( aCoords, false );
+  TopoDS_Wire aWire = Wire2d( aCoords, false );
   aPolyline->SetShape( aWire );
   aPolyline->SetWireColor( Qt::red );
 
@@ -338,7 +338,7 @@ void test_HYDROData_PolylineXY::test_custom_polylines()
   CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() );
 
   CPPUNIT_ASSERT_EQUAL( false, aPolyline2->IsCustom() );
-  aPolyline2->SetShape( Wire( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
+  aPolyline2->SetShape( Wire2d( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
   CPPUNIT_ASSERT_EQUAL( true, aPolyline2->IsCustom() );
   HYDROData_PolylineXY::PointsList aPointsList = aPolyline2->GetPoints( 0 );
 
index 3341e77ac61923f81be4bec325cf3419e7261a80..6bf3c37d404a47aacebfbaeec1f83b7f3322a604 100644 (file)
@@ -73,6 +73,8 @@ void test_HYDROData_Stream::test_alt_object()
     Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) );
 
   CPPUNIT_ASSERT_EQUAL( false, (bool)aStream.IsNull() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aStream->GetAltitudeObject().IsNull() );
+  CPPUNIT_ASSERT_EQUAL( false, (bool)aStream->DTM().IsNull() );
   CPPUNIT_ASSERT_EQUAL( false, (bool)aStream->GetAltitudeObject().IsNull() );
   CPPUNIT_ASSERT_EQUAL( KIND_DTM, aStream->getAltitudeObjectType() );
 
@@ -90,7 +92,7 @@ void test_HYDROData_Stream::test_params_sync()
   Handle(HYDROData_Stream) aStream = 
     Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) );
   Handle(HYDROData_DTM) aDTM = 
-    Handle(HYDROData_DTM)::DownCast( aStream->GetAltitudeObject() );
+    Handle(HYDROData_DTM)::DownCast( aStream->DTM() );
   CPPUNIT_ASSERT_EQUAL( false, (bool)aDTM.IsNull() );
 
   Handle(HYDROData_Profile) aProfile1 = 
index e99db415502041c6fda173b347b041e70fb6c847..2d696144c83a411bbeac89a63de8e8c7796f7446 100644 (file)
@@ -26,7 +26,7 @@
 
 void test_HYDROGUI_Shape::test_face_in_preview()
 {
-  TopoDS_Face aFace = Face( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+  TopoDS_Face aFace = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
                                               44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
                                              128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
                                               31 << 114 );