]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge remote-tracking branch 'remotes/origin/BR_PORTING_OCCT_7' into BR_PORTING_OCCT_7
authorisn <isn@opencascade.com>
Mon, 12 Dec 2016 11:51:07 +0000 (14:51 +0300)
committerisn <isn@opencascade.com>
Mon, 12 Dec 2016 11:51:07 +0000 (14:51 +0300)
30 files changed:
doc/salome/examples/CMakeLists.txt
doc/salome/examples/h016_pilesPontManualMesh.py
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_DTM.h
src/HYDROData/HYDROData_ImmersibleZone.cxx
src/HYDROData/HYDROData_LCM_FaceClassifier.cxx
src/HYDROData/HYDROData_LCM_FaceClassifier.h
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROData/HYDROData_Profile.cxx
src/HYDROData/HYDROData_Profile.h
src/HYDROData/HYDROData_SplitToZonesTool.cxx
src/HYDROGUI/HYDROGUI_ChannelDlg.cxx
src/HYDROGUI/resources/LightApp.xml
src/HYDROPy/HYDROData_CalculationCase.sip
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/TestViewer.h
src/HYDRO_tests/reference_data/CMakeLists.txt
src/HYDRO_tests/reference_data/StreamDlg.png
src/HYDRO_tests/reference_data/cc_int_w_3.png
src/HYDRO_tests/reference_data/pb_1066.cbf [new file with mode: 0644]
src/HYDRO_tests/reference_data/stream_dtm_2d.png
src/HYDRO_tests/test_HYDROData_CalcCase.cxx
src/HYDRO_tests/test_HYDROData_DTM.cxx
src/HYDRO_tests/test_HYDROData_DTM.h
src/HYDRO_tests/test_HYDROData_Stream.cxx

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 f47928f995fa04c49084ab51d415a121b2737651..622a132c3b842f9e11e36eb76de66969f02c6637 100644 (file)
@@ -1128,7 +1128,7 @@ geompy.addToStudyInFather( HYDRO_casGaronne_1, piles, 'piles' )
 #controlGeomProps(geompy, litMineur_pont,   961.8255222,  19618.0787789)
 #controlGeomProps(geompy, litMineur_amont,   22635.6212065,  2548509.17447)
 #controlGeomProps(geompy, riveDroite,  32012.2241814,  26188706.2202)
-ontrolGeomProps(geompy, riveGauche,  29149.1353799,  35949580.6716)
+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)
index 3ed80c06ba75f12cfc2e5ac2414f6fd7e7bf33a6..2e6ac1cc2638a741eeb9f8880fe14b1c1be83cb7 100644 (file)
@@ -85,7 +85,7 @@ double HYDROData_Bathymetry::AltitudePoint::SquareDistance( const HYDROData_Bath
   double d = 0;
   d += sqr( X - p.X );
   d += sqr( Y - p.Y );
-  d += sqr( Z - p.Z );
+  //d += sqr( Z - p.Z );
   return d;
 }
 
index f1b7a564105e49b32db3b81f6ee22fb0ee3b2282..110509437a20d897ac83e98255c5d24bb8c1b98a 100644 (file)
@@ -931,6 +931,18 @@ std::vector<double> HYDROData_CalculationCase::GetStricklerCoefficientForPoints(
   return theCoeffs;
 }
 
+std::vector<int> HYDROData_CalculationCase::GetStricklerTypeForPoints( const std::vector<gp_XY>& thePoints ) const
+{
+  Handle( HYDROData_LandCoverMap ) aLCM = GetLandCoverMap();
+  Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+  std::vector<int> types;
+  if( aLCM.IsNull() || aTable.IsNull() )
+    return types;
+
+  aLCM->ClassifyPoints(thePoints, aTable, types );
+  return types;
+}
+
 Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
 {
   Handle(HYDROData_Region) aResRegion;
@@ -1466,6 +1478,7 @@ void HYDROData_CalculationCase::RemoveInterPolyObject( const Handle(HYDROData_Po
 
   RemoveReferenceObject( theInterPolyline->Label(), DataTag_InterPoly );
 
+  Changed( Geom_2d );
 }
 
 
index 4ee079d6f47be5e7a016eaf22c5ba7d290ef91fb..ad8a5609ff3f752824364c250de9c020e15d3bd1 100644 (file)
@@ -341,6 +341,8 @@ public:
                                                                         double DefValue,
                                                                         bool UseMax ) const;
 
+  HYDRODATA_EXPORT std::vector<int> GetStricklerTypeForPoints( const std::vector<gp_XY>& thePoints ) const;
+
   /**
    * Returns altitudes for given points on given region.
    * \param thePoints the points to examine
index f04cff9751161bf2198d7c3749e9d64b722918a3..4b0a1392cc70a9c3982a6608607818f954833d50 100644 (file)
@@ -491,6 +491,9 @@ void HYDROData_DTM::CreateProfiles(const std::vector<Handle(HYDROData_Profile)>&
     return;
   theOutPoints = Interpolate( theProfiles, theDDZ, theSpatialStep, theOutLeft, theOutRight, theOutMainProfiles, InvInd );
   //note that if Create3dPres is false => Create2dPres flag is meaningless!
+  if( theOutPoints.empty() )
+    return;
+
   if (Create3dPres)
   {
     TopTools_IndexedMapOfOrientedShape ll = Create3DShape( theOutLeft, theOutRight, theOutMainProfiles);
@@ -525,7 +528,6 @@ void HYDROData_DTM::CreateProfiles(const std::vector<Handle(HYDROData_Profile)>&
 
 void HYDROData_DTM::GetProperties( const Handle(HYDROData_Profile)& theProfile,
                     gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
-                    bool isNormalDir,
                     double& theZMin, double& theZMax )
 {
   theLowestPoint = theProfile->GetBottomPoint();
@@ -535,10 +537,7 @@ void HYDROData_DTM::GetProperties( const Handle(HYDROData_Profile)& theProfile,
   theProfile->GetRightPoint( aRight, true, true );
   double x = aRight.X()-aLeft.X();
   double y = aRight.Y()-aLeft.Y();
-  if( isNormalDir )
-    theDir = gp_Vec2d( -y, x );
-  else
-    theDir = gp_Vec2d( x, y );
+  theDir = gp_Vec2d( x, y );
 
   HYDROData_Profile::ProfilePoints points = theProfile->GetProfilePoints();
   int lo = points.Lower();
@@ -614,12 +613,40 @@ Handle(Geom2d_Curve) CurveTo2D( const Handle(Geom_Curve)& theCurve,
   return Handle(Geom2d_Curve)();
 }
 
+#include <GCE2d_MakeSegment.hxx>
+#include <Geom2dAPI_InterCurveCurve.hxx>
+bool IsCooriented( const Handle(HYDROData_Profile)& theProfile1,
+                   const Handle(HYDROData_Profile)& theProfile2 ) 
+{
+  if( theProfile1==theProfile2 )
+    return true;
+  
+  gp_XY lp1, rp1, lp2, rp2;
+  theProfile1->GetLeftPoint(lp1);
+  theProfile1->GetRightPoint(rp1);
+  theProfile2->GetLeftPoint(lp2);
+  theProfile2->GetRightPoint(rp2);
+
+  GCE2d_MakeSegment s1(lp1, lp2);
+  GCE2d_MakeSegment s2(rp1, rp2);
+
+  Geom2dAPI_InterCurveCurve inter;
+  inter.Init(s1.Value(), s2.Value());
+  if (inter.NbPoints() == 0)
+    return true;
+  else
+    return false;
+}
+
 Handle(Geom2d_BSplineCurve) HYDROData_DTM::CreateHydraulicAxis( 
   const std::vector<Handle(HYDROData_Profile)>& theProfiles,
   std::vector<double>& theDistances )
 {
   size_t n = theProfiles.size();
-  Handle(Geom2d_BSplineCurve) aResult;
+  if( n==1 )
+    return Handle_Geom2d_BSplineCurve();
+
+  Handle_Geom2d_BSplineCurve aResult;
 
   Handle(TColgp_HArray1OfPnt2d) points = new TColgp_HArray1OfPnt2d( 1, (int)n );
   TColgp_Array1OfVec2d tangents( 1, (int)n );
@@ -628,16 +655,48 @@ Handle(Geom2d_BSplineCurve) HYDROData_DTM::CreateHydraulicAxis(
   for( size_t i = 1; i <= n; i++ )
   {
     Handle(HYDROData_Profile) aProfile = theProfiles[i-1];
+    Handle(HYDROData_Profile) aPrevProfile = i==1 ? theProfiles[i-1] : theProfiles[i-2];
+    Handle(HYDROData_Profile) aNextProfile = i==n ? theProfiles[i-1] : theProfiles[i];
+
+    if( !IsCooriented( aProfile, aNextProfile ) )
+    {
+      gp_XY lp, rp;
+      aProfile->GetLeftPoint( lp, true );
+      aProfile->GetRightPoint( rp, true );
+      aProfile->SetLeftPoint( rp, true );
+      aProfile->SetRightPoint( lp, true );
+    }
     aProfile->Update();
 
     gp_Pnt aLowest;
-    gp_Vec2d aTangent;
+    gp_Vec2d aNormal;
     double zmin, zmax;
-    GetProperties( aProfile, aLowest, aTangent, true, zmin, zmax );
-    aTangent.Normalize();
+
+    gp_XYZ curP = aProfile->GetBottomPoint();
+    gp_XY curP2d = gp_XY(curP.X(), curP.Y());
+
+    gp_XYZ nextP;
+    if( i==n )
+      nextP = aPrevProfile->GetBottomPoint(true);
+    else
+      nextP = aNextProfile->GetBottomPoint(true);
+
+    gp_XY nextP2d = gp_XY(nextP.X(), nextP.Y());
+
+    gp_Vec2d aPrTangent;
+    GetProperties( aProfile, aLowest, aPrTangent, zmin, zmax );
+    aNormal.SetCoord( -aPrTangent.Y(), aPrTangent.X() );
+
+    gp_Vec2d aDirToNextProfile(nextP2d.X() - curP2d.X(), nextP2d.Y() - curP2d.Y() );
+    if( i==n )
+      aDirToNextProfile.Reverse();
+    if (aNormal.Dot(aDirToNextProfile) < 0)
+      aNormal.Reverse();
+
+    aNormal.Normalize();
 
     points->SetValue( (int)i, gp_Pnt2d( aLowest.X(), aLowest.Y() ) );
-    tangents.SetValue( (int)i, aTangent );
+    tangents.SetValue( (int)i, aNormal );
     flags->SetValue( (int)i, Standard_True );
   }
 
@@ -675,7 +734,7 @@ std::vector<Handle(Geom2d_Curve)> HYDROData_DTM::ProfileToParametric(
   // Transformation of the coordinate systems
   gp_Pnt aLowest;
   double zmin, zmax;
-  GetProperties( theProfile, aLowest, theDir, false, zmin, zmax );
+  GetProperties( theProfile, aLowest, theDir, zmin, zmax );
 
   gp_Ax3 aStd3d( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( 1, 0, 0 ) );
   gp_Ax3 aLocal( gp_Pnt( aLowest.X(), aLowest.Y(), 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) );
@@ -892,8 +951,8 @@ std::vector<HYDROData_Bathymetry::AltitudePoints> HYDROData_DTM::Interpolate
   gp_Pnt lowestA, lowestB;
   gp_Vec2d dirA, dirB;
 
-  GetProperties( theProfileA, lowestA, dirA, false, zminA, zmaxA ); 
-  GetProperties( theProfileB, lowestB, dirB, false, zminB, zmaxB ); 
+  GetProperties( theProfileA, lowestA, dirA, zminA, zmaxA ); 
+  GetProperties( theProfileB, lowestB, dirB, zminB, zmaxB ); 
 
   
   double hmax = max( zmaxA-zminA, zmaxB-zminB );
@@ -1014,7 +1073,7 @@ int HYDROData_DTM::EstimateNbPoints( const std::vector<Handle(HYDROData_Profile)
   gp_Pnt aLowest;
   gp_Vec2d aDir;
   double aZMin, aZMax;
-  GetProperties( theProfiles[0], aLowest, aDir, true, aZMin, aZMax );
+  GetProperties( theProfiles[0], aLowest, aDir, aZMin, aZMax );
   int aNbZSteps = (aZMax-aZMin)/theDDZ;
 
   if( aNbSteps > ( 1<<16 ) || aNbZSteps > ( 1<<16 ) )
index 844e4e8913156f18dc60e77e6503e54f3a779a54..7b67be1a59ff06e93cf35c3953c2ef771457d911 100644 (file)
@@ -124,7 +124,6 @@ protected:
 
   static void GetProperties( const Handle(HYDROData_Profile)& theProfile,
                              gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
-                             bool isNormalDir,
                              double& theZMin, double& theZMax );
 
   static void ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile,
index 75d6eb913c9a44079b3aff579ddbac6bd03583a4..6d0ed1508c738b477167d1d47ec76222eb608ad5 100644 (file)
@@ -104,6 +104,7 @@ void HYDROData_ImmersibleZone::Update()
 {
   HYDROData_NaturalObject::Update();
   
+  RemoveGroupObjects();
   TopoDS_Shape aResShape = generateTopShape();
   SetTopShape( aResShape );
 
index b2c7a11aa9bd16bd076488a801464121eaf7ba8e..adfa27e3ed1c03fc99b3385bff2abd1c80e8232a 100644 (file)
@@ -40,14 +40,11 @@ Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Stan
   if(f.IsNull()) 
     return Standard_False;
 
-  BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
-  
-  TopLoc_Location L;
-  Handle(Geom_Surface) C = BRep_Tool::Surface(f, L);
-  Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(C->Transformed(L.Transformation()));
+  BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);  
+
+  Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(f);
   Standard_Real u, v;
   ElSLib::Parameters(Pl->Pln(), gp_Pnt(myP.X(), myP.Y(), 0.0), u, v);
-
   TopAbs_State aState = class2d->Perform( gp_Pnt2d(u, v), Standard_False );
 
   if (aState == TopAbs_IN)
@@ -66,6 +63,14 @@ Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Stan
 
 }
 
+Handle(Geom_Plane) HYDROData_LCM_FaceClassifier::GetPlane(const TopoDS_Face& F)
+{
+  TopLoc_Location L;
+  Handle(Geom_Surface) S = BRep_Tool::Surface(F, L);
+  Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(S->Transformed(L.Transformation()));
+  return Pl;
+}
+
 void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints, 
                                              std::vector<std::set <QString> >& theTypes,
                                              std::vector<NCollection_Map<TopoDS_Face> >* theFaces) const
@@ -93,8 +98,25 @@ void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints
     Bnd_Box2d B;
     const TopoDS_Face& F = TopoDS::Face(aFaces(i));
     BRepTools::AddUVBounds(F, B);
-    aTreeFiller.Add(i, B);
-    BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 0 );
+
+    //convert 2d space of planar face to the 3d space of given points 
+    //this is more faster way then getting of bnd3d of faces and project them on plane...
+    Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(F);
+    gp_Trsf RT;
+    RT.SetTransformation(Pl->Position());
+    RT.Invert();
+    double xmin, ymin, xmax, ymax; 
+    B.Get(xmin, ymin, xmax, ymax);
+    gp_Pnt MinP(xmin, ymin, 0), MaxP(xmax, ymax, 0);
+    MinP.Transform(RT);
+    MaxP.Transform(RT);
+    gp_Pnt2d MinPT(MinP.X(), MinP.Y());
+    gp_Pnt2d MaxPT(MaxP.X(), MaxP.Y());
+    Bnd_Box2d NB;
+    NB.Update(MinPT.X(), MinPT.Y(), MaxPT.X(), MaxPT.Y() );
+
+    aTreeFiller.Add(i, NB);
+    BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 1E-7 );
     aMapF2Class2d.Add(F, aClass2d);
     fclass2dpointers.push_back(aClass2d);
   }
index 1a83a7efede3c8bee1c7bc8de75bb241eba396ff..2096e8ce9730969286e97f2f80c7a83a61dc605d 100644 (file)
@@ -30,6 +30,7 @@
 #include <NCollection_IndexedDataMap.hxx>
 #include <TopoDS_Face.hxx>
 #include <NCollection_Map.hxx>
+#include <Geom_Plane.hxx>
 
 class BRepTopAdaptor_FClass2d;
 class HYDROData_LandCoverMap;
@@ -93,6 +94,8 @@ public:
     std::vector<std::set <QString> >& theTypes, 
     std::vector<NCollection_Map <TopoDS_Face> >* theFaces) const;
 
+  static Handle(Geom_Plane) GetPlane(const TopoDS_Face& F);
+
 
 private:
   const HYDROData_LandCoverMap* const myLCM;
index 843e35a46f2528f4a4cf10818be51913aa4cbf20..c766e5caf2811dd2ed822a72cd747d432aa48639 100644 (file)
@@ -1272,14 +1272,38 @@ void HYDROData_LandCoverMap::UpdateLocalCS( double theDx, double theDy )
   SetShape( aLocatedShape );
 }
 
-void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints, std::vector<std::set <QString> >& theTypes ) const
+void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,
+                                             std::vector<std::set <QString> >& theTypes ) const
 {
   HYDROData_LCM_FaceClassifier FC(this);
   FC.Classify(thePoints, theTypes, NULL);
 }
 
+void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,
+                                             const Handle(HYDROData_StricklerTable)& theTable,
+                                             std::vector<int>& theTypes ) const
+{
+  std::vector<std::set <QString> > types;
+  HYDROData_LCM_FaceClassifier FC(this);
+  FC.Classify(thePoints, types, NULL);
+
+  size_t n = types.size();
+  theTypes.resize( n );
+  for( size_t i=0; i<n; i++ )
+  {
+    const std::set<QString>& sub_types = types[i];
+    int aType = 0;
+    if( !sub_types.empty() )
+    {
+      const QString& aSType = *sub_types.begin();
+      aType = theTable->GetAttrValue( aSType ).toInt();
+    }
+    theTypes[i] = aType;
+  }
+}
+
 void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,  
-  Handle(HYDROData_StricklerTable) theTable, 
+  const Handle(HYDROData_StricklerTable)& theTable, 
   std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const
 {
   std::vector<std::set <QString> > Types;
index e00eaebd9be20760f0dbfa058d8e1c6b3c77e3a0..1d310ef38735609ec3b90e76d64d675aa8b64c74 100644 (file)
@@ -149,11 +149,16 @@ public:
 
   HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
 
-  HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints, std::vector<std::set <QString> >& theTypes ) const;
+  HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints,
+                                        std::vector<std::set <QString> >& theTypes ) const;
+
+  HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints,
+                                        const Handle(HYDROData_StricklerTable)& theTable,
+                                        std::vector<int>& theTypes ) const;
 
   HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints,
-    Handle(HYDROData_StricklerTable) theTable, 
-    std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const;
+                                        const Handle(HYDROData_StricklerTable)& theTable, 
+                                        std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const;
 
 protected:
   void SetShape( const TopoDS_Shape& );
index d36f5fa115e2c0147d164ae1fa40be0fc21a3273..43fb6799520b45b8e48c4b31bbd961c3d72ccba0 100644 (file)
@@ -50,6 +50,8 @@
 #include <QStringList>
 #include <QColor>
 #include <Geom_BSplineCurve.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <BRepLib_MakeWire.hxx>
 
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
@@ -450,6 +452,7 @@ bool HYDROData_PolylineOperator::Extract( const Handle(HYDROData_Document)& theD
 
   QList<TopoDS_Shape> aBoundShapes;
   QStringList aBoundNames;
+  QMap<QString, TopTools_IndexedMapOfShape> aNameToShMap;
 
   theObject->GetBoundaries( aBoundShapes, aBoundNames );
 
@@ -460,21 +463,52 @@ bool HYDROData_PolylineOperator::Extract( const Handle(HYDROData_Document)& theD
       continue;
 
     QString aBoundName = i<aBoundNames.size() ? aBoundNames[i] : "";
+    
+    if (!aNameToShMap.contains(aBoundName))
+    {
+      TopTools_IndexedMapOfShape IM;
+      IM.Add(aShape);
+      aNameToShMap[aBoundName] = IM;
+    }
+    else
+      aNameToShMap[aBoundName].Add(aShape);
+     
+  }
+
+  foreach( QString K, aNameToShMap.keys() )
+  {
+    const TopTools_IndexedMapOfShape& IM = aNameToShMap.value(K);
+    TopTools_ListOfShape LSE;
+    for (int i = 1; i <= IM.Extent(); i++)
+    {
+      const TopoDS_Edge& E = TopoDS::Edge(IM(i));
+      if (E.IsNull())
+        continue;
+      LSE.Append(E);
+    }
+
+    BRepLib_MakeWire WM;
+    WM.Add(LSE);
+    TopoDS_Shape aShapeW;
+    if (WM.IsDone())
+      aShapeW = WM.Wire();
+    else
+      continue;
 
     Handle( HYDROData_PolylineXY ) aPolyline = 
       Handle( HYDROData_PolylineXY )::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
-    
+
     if( aPolyline.IsNull() )
       return false;
 
-    aPolyline->SetShape( aShape );
+    aPolyline->SetShape( aShapeW );
 
     int anIndex = 0;
-    QString aName = aBoundName;
+    QString aName = K;
     while( !theDocument->FindObjectByName( aName ).IsNull() )
     {
       anIndex++;
-      aName = aBoundName + "_" + QString::number( anIndex );
+      aName = K + "_" + QString::number( anIndex );
     }
     aPolyline->SetName( aName );
   }
index 99412519316018719820d4057e015a934117ba32..0057722b7707d1bf1572393fb48bf378843795c2 100644 (file)
@@ -694,7 +694,7 @@ void HYDROData_Profile::UpdateLocalCS( double theDx, double theDy )
   SetRightPoint( aPnt, false );
 }
 
-HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint() const
+HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint(bool IsConvertToGlobal) const
 {
   ProfilePoint aBottom;
 
@@ -741,7 +741,7 @@ HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint() const
   }
 
   // Find the corresponding profile point
-  ProfilePoints aProfilePoints = GetProfilePoints( false );
+  ProfilePoints aProfilePoints = GetProfilePoints( IsConvertToGlobal );
   if ( aBottomIndex >= 1 && aBottomIndex <= aProfilePoints.Length() ) {
     aBottom = aProfilePoints.Value( aBottomIndex );
   }
index 198cb2411208435553bdcb8ad047f72cc0ddcb9e..658bc8473bf5c801686b47a1199852a35d1517c6 100644 (file)
@@ -192,7 +192,7 @@ public:
    * Return profile point with minimal Z value.
    * \return non-parametric profile point
    */
-  HYDRODATA_EXPORT ProfilePoint GetBottomPoint() const;
+  HYDRODATA_EXPORT ProfilePoint GetBottomPoint(bool IsConvertToGlobal = false) const;
 
   /**
    * Return profile middle point.
index 182c61781ffcc8601989763b74f99d91b5bedbcf..8784a1e5f31f9a008241221c5e86ac2e7e652b30 100644 (file)
@@ -44,6 +44,7 @@
 #include <BOPAlgo_BOP.hxx>
 #include <BOPAlgo_Builder.hxx>
 #include <TopExp.hxx>
+#include <assert.h>
 
 //#define DEB_SPLIT_TO_ZONES 1
 //#define DEB_SPLIT_TO_ZONES_CHECK_PARTITION 1
@@ -246,6 +247,24 @@ HYDROData_SplitToZonesTool::SplitDataList
         anOutputSplitDataList.append(SDI);
       }
 
+#ifndef NDEBUG
+      //check CutFaceByEdges method: ensure that SD.Face() edges fully covered by
+      //history map (OutOrSh2M)
+      if (!OutOrSh2M.IsEmpty())
+      {
+        TopTools_IndexedMapOfShape EE;
+        TopExp::MapShapes(SD.Face(), TopAbs_EDGE, EE);
+        int noncontNb = 0;      
+        for (int i = 1; i <= EE.Extent(); i++)
+        {
+          const TopoDS_Shape& E = EE(i);
+          noncontNb += !OutOrSh2M.Contains(E);
+        }
+        //noncontNb > 0 => some problem with edge history
+        assert(noncontNb == 0);
+      }
+#endif
+
       if(!theGroupsList.IsEmpty() ) 
       {
         SplitDataList ModifInpGroupList;
@@ -256,7 +275,16 @@ HYDROData_SplitToZonesTool::SplitDataList
           if (SData.Type != SplitData::Data_Edge)
             ModifInpGroupList.append(SData); //add as is
           const TopoDS_Shape& SData_sh = SData.Shape;
-          const TopTools_ListOfShape& modif_ls = OutOrSh2M.FindFromKey(SData_sh);
+          TopTools_ListOfShape modif_ls;
+          if (!InterPolys.IsEmpty())
+            if (OutOrSh2M.Contains(SData_sh))
+              modif_ls = OutOrSh2M.FindFromKey(SData_sh);
+            //else TODO -  show message that one of the object should be updated
+
+#ifndef NDEBUG
+          if (!InterPolys.IsEmpty() && OutOrSh2M.IsEmpty())
+            assert (true);
+#endif
           if (modif_ls.IsEmpty())
             ModifInpGroupList.append(SData); //non modified
           else
index 0b55e800b7800adf611506b20b8121127277274f..9c8513ca679971b0e924683193717b8bd9dd6ccc 100644 (file)
@@ -53,7 +53,7 @@ HYDROGUI_ChannelDlg::HYDROGUI_ChannelDlg( HYDROGUI_Module* theModule, const QStr
   myProfiles->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
   myEquiDistance = new QtxDoubleSpinBox( aParamGroup );
-  myEquiDistance->setRange( 0.01, 100 );
+  myEquiDistance->setRange( 0.01, 9999 );
   myEquiDistance->setValue( 1.0 );
   myEquiDistance->setSingleStep( 1.0 );
 
index 8ac6688f6e5e3b725ac66ed241f31239b4fc5cbf..ab879c8b276e0d649828bfc8973c7bf4c38cdb01 100644 (file)
@@ -27,7 +27,7 @@
     <parameter value="HYDRO" name="name" />
     <parameter value="HYDROGUI" name="library" />
     <parameter value="0" name="parameter_test" />
-    <parameter name="version" value="1.5"/>
+    <parameter name="version" value="1.6"/>
     <parameter value="false" name="auto_fit_all"/>
     <parameter name="documentation" value="hydro_help"/>
   </section>
index a70e7f9bd7d824a2b870c82b94d12e69d3222a53..52c09e4f954aa47742ceb3502fa2b00ab380fc3f 100644 (file)
@@ -479,6 +479,26 @@ public:
   %End
 
 
+  std::vector<int> GetStricklerTypeForPoints( const NCollection_Sequence<double>& theCoordsX,
+                                              const NCollection_Sequence<double>& theCoordsY ) const
+  [std::vector<int>( const NCollection_Sequence<gp_XY>& )];
+  %MethodCode
+  std::vector<gp_XY> aPnts;
+  int aLen = qMin( a0->Length(), a1->Length() );
+  for ( int i = 1; i <= aLen; ++i )
+  {
+    gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
+    aPnts.push_back( aPnt );
+  }
+  std::vector<int> aRes;
+  Py_BEGIN_ALLOW_THREADS
+  aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerTypeForPoints( aPnts ) : 
+                         sipCpp->GetStricklerTypeForPoints( aPnts );
+  Py_END_ALLOW_THREADS
+  sipRes = new std::vector<int>( aRes );
+  %End
+
+
   /**
    * Returns altitudes for given points on given zone.
    * \param thePoints the points to examine
index 144545e1b948aaeea7a2e538666d0539be8bbcc2..9630670eb3cc012a4aec9ba7789fa733169ac396 100644 (file)
@@ -43,6 +43,7 @@
 #include <QHash>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
+#include <Prs3d_IsoAspect.hxx>
 
 #include <GEOMUtils.hxx>
 #include <TopTools_ListOfShape.hxx>
@@ -147,11 +148,20 @@ void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject,
   }
 }
 
-void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor )
+void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor,
+  int theUIANb, int theVIANb)
 {
   Handle(AIS_Shape) aShape = new AIS_Shape( theShape );
   if( theShape.ShapeType()==TopAbs_VERTEX )
     aShape->Attributes()->PointAspect()->SetTypeOfMarker( Aspect_TOM_X );
+  if (theShape.ShapeType()==TopAbs_FACE)
+  {
+    context()->DefaultDrawer()->UIsoAspect()->SetNumber(theUIANb);
+    context()->DefaultDrawer()->VIsoAspect()->SetNumber(theVIANb);
+    Handle_Prs3d_Drawer aDrawer = aShape->Attributes();
+    aDrawer->UIsoAspect()->SetNumber(theUIANb);
+    aDrawer->VIsoAspect()->SetNumber(theVIANb);
+  }
   aShape->SetMaterial( Graphic3d_NOM_PLASTIC );
   aShape->SetColor( HYDROData_Tool::toOccColor( theColor ) );
   context()->Display( aShape, theMode, 0, Standard_False );
@@ -162,8 +172,8 @@ void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll,
     viewWindow()->onFitAll();
   }
 }
-
-void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey )
+void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey,
+                       int theUIANb, int theVIANb)
 {
   QString aNewKey = theKey;
   if( !aNewKey.isEmpty() )
@@ -184,7 +194,7 @@ void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll,
   GEOMUtils::SortShapes(aListOfFaces);
   TopTools_ListIteratorOfListOfShape aLF(aListOfFaces);
   for( ; aLF.More(); aLF.Next(), i++)
-    show( aLF.Value(), theMode, false, GetColor(i) );
+    show( aLF.Value(), theMode, false, GetColor(i), theUIANb, theVIANb );
 
   //show all independent wires
   TopTools_ListOfShape aListOfWires;
@@ -370,7 +380,7 @@ bool TestViewer::areScriptsEqual( const QString& theBaseName,
                                   int theLinesToOmit,
                                   QString& theMsg )
 {
-  QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+  QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test";
   anExpectedRefFilePath += "/" + theBaseName;
   
   QString anActualFilePath = QDir::tempPath() + "/" + theBaseName;
index c27e5d36482fe67b1f7a12c48beb5650a3fac2d3..90aac8407416c022026ab94f02608623e11edf2b 100644 (file)
@@ -41,8 +41,10 @@ public:
   static void eraseAll( bool isUpdate );
   static void show( const Handle(AIS_InteractiveObject)& theObject,
                     int theMode, int theSelectionMode, bool isFitAll, const char* theKey );
-  static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor );
-  static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey );
+  static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor,
+                    int theUIANb = 10, int theVIANb = 10);
+  static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey,
+                    int theUIANb = 10, int theVIANb = 10);
   static bool AssertImages( QString& theMessage, const QImage* = 0, const char* theCase = 0 );
   static QColor GetColor(int i);
 
index 1f1f86e7b0f5fefbe829050805fd449b27fcd5d4..d315e492bf8d8dbedb9049569c1182de1ee1efce 100644 (file)
@@ -116,6 +116,7 @@ SET(REFERENCE_DATA
     DTM_2.png
     stream_dtm_2d.png
     stream_dtm_3d.png
+    pb_1066.cbf
 )
 
 # Application tests
index 8371a7bc21f7ed42bcac03d6d18a7983d4fad71a..69df6a0aec371d5cdcb78180fc3c4b6d5c00e13a 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/StreamDlg.png and b/src/HYDRO_tests/reference_data/StreamDlg.png differ
index cdeffb4a98fa91beaa5c00accb4024af3aacce70..53d94fec358b7dfed87a04d8cb7ef12a7b4ed089 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/cc_int_w_3.png and b/src/HYDRO_tests/reference_data/cc_int_w_3.png differ
diff --git a/src/HYDRO_tests/reference_data/pb_1066.cbf b/src/HYDRO_tests/reference_data/pb_1066.cbf
new file mode 100644 (file)
index 0000000..220d577
Binary files /dev/null and b/src/HYDRO_tests/reference_data/pb_1066.cbf differ
index 83044a05066838511c5d82ad996e7eb8fb51b2c7..f42860b178d50f9b26419d29b617f72f77868628 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 af0c74278e8e383dce12396c7daa4523e97474d3..028684913046d63529a264a6f9289b7e4f055971 100644 (file)
@@ -97,7 +97,7 @@ void test_HYDROData_CalcCase::test_add_int_wires()
     TopTools_IndexedDataMapOfShapeShape ls;
     HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
     CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent());
-    TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3" );
+    TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3", 1, 1 );
     CPPUNIT_ASSERT_IMAGES
   }
 
index 7cc7b68212f07515bd6883a388ccb9f7502a09c2..74bf64ba87b192f93add72abc00e2dd9186b3765 100644 (file)
@@ -21,6 +21,7 @@
 #include <HYDROData_Profile.h>
 #include <HYDROData_DTM.h>
 #include <HYDROData_Iterator.h>
+#include <HYDROData_CalculationCase.h>
 #include <Geom2d_Curve.hxx>
 #include <Geom2d_BSplineCurve.hxx>
 #include <gp_XY.hxx>
@@ -305,7 +306,7 @@ void test_HYDROData_DTM::test_profile_properties()
   gp_Pnt lp;
   gp_Vec2d dd;
   double zmin, zmax;
-  HYDROData_DTM::GetProperties( aProfile, lp, dd, false, zmin, zmax );
+  HYDROData_DTM::GetProperties( aProfile, lp, dd, zmin, zmax );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS );
@@ -314,14 +315,14 @@ void test_HYDROData_DTM::test_profile_properties()
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );
 
-  HYDROData_DTM::GetProperties( aProfile, lp, dd, true, zmin, zmax );
/* HYDROData_DTM::GetProperties( aProfile, lp, dd, true, zmin, zmax );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( -15, dd.X(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, dd.Y(), EPS );
   CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS );
-  CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );*/
 
   aDoc->Close();
 }
@@ -620,5 +621,45 @@ void test_HYDROData_DTM::test_garonne()
   TestViewer::showColorScale( ColorScaleIsDisp );
   delete aBathPrs;
   aDoc->Close();
+}
+
+void test_HYDROData_DTM::test_classifier_1()
+{
+  TCollection_AsciiString fname = REF_DATA_PATH.toLatin1().data();
+  fname += "/pb_1066.cbf";
+  CPPUNIT_ASSERT_EQUAL( (int)DocError_OK, (int)HYDROData_Document::Load( fname.ToCString(), 1 ) );
 
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  
+  Handle(HYDROData_CalculationCase) aCase = 
+    Handle(HYDROData_CalculationCase)::DownCast( aDoc->FindObjectByName( "Case_1" ) );
+  CPPUNIT_ASSERT_EQUAL( false, aCase.IsNull() ); 
+  std::vector<gp_XY> points;
+  points.push_back( gp_XY( 43.4842, 3.33176  ) );
+  points.push_back( gp_XY( -125.777, 2.24728 ) );
+  points.push_back( gp_XY( -60.1628, 168.262 ) );
+  points.push_back( gp_XY( 21.8055587645, 154.699344457 ) );
+  points.push_back( gp_XY( -84.4764138524, 79.2606012276 ) );
+  points.push_back( gp_XY( -73.4132070504, 69.7096313266 ) );
+
+  std::vector<double> values = aCase->GetStricklerCoefficientForPoints( points, 0.0, true );
+  CPPUNIT_ASSERT_EQUAL( 6, (int)values.size() );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[0], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[1], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0221, values[2], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[3], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[4], EPS );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[5], EPS );
+
+  std::vector<int> types = aCase->GetStricklerTypeForPoints( points );
+  CPPUNIT_ASSERT_EQUAL( 6, (int)types.size() );
+  CPPUNIT_ASSERT_EQUAL( 123, types[0] );
+  CPPUNIT_ASSERT_EQUAL( 123, types[1] );
+  CPPUNIT_ASSERT_EQUAL( 221, types[2] );
+  CPPUNIT_ASSERT_EQUAL( 123, types[3] );
+  CPPUNIT_ASSERT_EQUAL( 123, types[4] );
+  CPPUNIT_ASSERT_EQUAL( 123, types[5] );
+
+  aDoc->Close();
 }
+
index 5eb53be1bca2b7ff9b73ee18dc5b851698cb95ba..57413786621ed5b642b4fdf15c7e8108c6f6daf6 100644 (file)
@@ -31,6 +31,7 @@ class test_HYDROData_DTM : public CppUnit::TestFixture
   CPPUNIT_TEST( test_curve_to_3d );
   CPPUNIT_TEST( test_presentation );
   CPPUNIT_TEST( test_garonne );
+  CPPUNIT_TEST( test_classifier_1 );
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -47,6 +48,7 @@ public:
   void test_curve_to_3d();
   void test_presentation();
   void test_garonne();
+  void test_classifier_1();
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_DTM );
index 52388f33737ab8df33cf6688dbae9c7b3f227115..86c3d676350d726c6a92a78809a782d6c3ada00c 100644 (file)
@@ -260,7 +260,7 @@ void test_HYDROData_Stream::test_presentation()
   TopoDS_Shape aPrs3d = aStream->GetShape3D();
   TopoDS_Shape aPrs2d = aStream->GetTopShape();
 
-  TestViewer::show( aPrs2d, 0, true, "stream_dtm_2d" );
+  TestViewer::show( aPrs2d, 0, true, "stream_dtm_2d", 1, 1 );
   CPPUNIT_ASSERT_IMAGES;
 
   TestViewer::eraseAll( true );