]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
lot 11 (linear interpolation of stream) untested
authorisn <isn@opencascade.com>
Wed, 27 Feb 2019 14:49:01 +0000 (17:49 +0300)
committerisn <isn@opencascade.com>
Tue, 19 Mar 2019 17:07:46 +0000 (20:07 +0300)
19 files changed:
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_Iterator.cxx
src/HYDROData/HYDROData_LISM.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_LISM.h [new file with mode: 0644]
src/HYDROData/HYDROData_Profile.cxx
src/HYDROData/HYDROData_Profile.h
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Stream.h
src/HYDROData/HYDROData_StreamLinearInterpolation.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_StreamLinearInterpolation.h [new file with mode: 0644]
src/HYDROData/HYDROData_Tool.cxx
src/HYDROData/HYDROData_Tool.h
src/HYDROGUI/HYDROGUI_StreamDlg.cxx
src/HYDROGUI/HYDROGUI_StreamDlg.h
src/HYDROGUI/HYDROGUI_StreamOp.cxx
src/HYDROGUI/HYDROGUI_StreamOp.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 9c412e8102f69d38a27bc3b26cd3ca77d7accbd6..9594d54647685a16095efa4d70f07983ea07c9a1 100644 (file)
@@ -67,6 +67,8 @@ set(PROJECT_HEADERS
     HYDROData_BCPolygon.h
     HYDROData_BoundaryPolygonTools.h 
     HYDROData_CompleteCalcCase.h 
+    HYDROData_StreamLinearInterpolation.h
+    HYDROData_LISM.h
 )
 
 set(PROJECT_SOURCES 
@@ -132,6 +134,8 @@ set(PROJECT_SOURCES
     HYDROData_BCPolygon.cxx
     HYDROData_BoundaryPolygonTools.cxx
     HYDROData_CompleteCalcCase.cxx
+    HYDROData_StreamLinearInterpolation.cxx
+    HYDROData_LISM.cxx
  )
 
 SET( ECW_INCLUDES $ENV{ECWLIB_ROOT_DIR}/include )
index cef1e9858eeda5bda18b73d5c8dd2c4bf1876176..7084a5be8aab1ff44167dd7d9505b9df658ae4f2 100644 (file)
@@ -148,6 +148,8 @@ QString HYDROData_Entity::Type( ObjectKind theKind )
     return "Land_cover_map";
   case KIND_DTM:
     return "DTM";
+  case KIND_LISM:
+    return "LISM";
   case KIND_BC_POLYGON:
     return "Boundary_Polygon";
   }
index f55fa33acf5ecbc56ec86ecb009dceea6cc8e6c2..a4bcbd36e928cc701cdee7d25d2d475788cc5067 100644 (file)
@@ -77,6 +77,7 @@ const ObjectKind KIND_CHANNEL_ALTITUDE    = 28;
 const ObjectKind KIND_LAND_COVER_MAP      = 29;
 const ObjectKind KIND_DTM                 = 30;
 const ObjectKind KIND_BC_POLYGON          = 31;
+const ObjectKind KIND_LISM                = 32;
 const ObjectKind KIND_LAST                = KIND_BC_POLYGON+1;
 
 class MapOfTreatedObjects : public QMap<QString,Handle(Standard_Transient)>
index 46212c31953d1c34354d63f8efa442fe52cddda1..ef1607569b401b5f12c670910321f425be367279 100644 (file)
@@ -45,6 +45,7 @@
 #include "HYDROData_Zone.h"
 #include "HYDROData_StricklerTable.h"
 #include "HYDROData_DTM.h"
+#include <HYDROData_LISM.h>
 #include "HYDROData_BCPolygon.h"
 #include <TDataStd_Name.hxx>
 #include <TDataStd_NamedData.hxx>
@@ -163,6 +164,7 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel )
     case KIND_LAND_COVER_MAP:     aResult = new HYDROData_LandCoverMap();         break;
     case KIND_DTM:                aResult = new HYDROData_DTM();                  break;
     case KIND_BC_POLYGON:         aResult = new HYDROData_BCPolygon();            break;
+    case KIND_LISM:               aResult = new HYDROData_LISM();                  break;
     default:                       break;
   }
 
diff --git a/src/HYDROData/HYDROData_LISM.cxx b/src/HYDROData/HYDROData_LISM.cxx
new file mode 100644 (file)
index 0000000..f60f03c
--- /dev/null
@@ -0,0 +1,162 @@
+
+#include <HYDROData_LISM.h>
+#include <HYDROData_Profile.h>
+#include <HYDROData_StreamLinearInterpolation.h>
+#include <TopoDS_Face.hxx>
+
+#include <QSet>
+#include <QString>
+
+IMPLEMENT_STANDARD_RTTIEXT( HYDROData_LISM, HYDROData_Bathymetry )
+
+HYDROData_LISM::HYDROData_LISM()
+{
+}
+
+HYDROData_LISM::~HYDROData_LISM()
+{
+}
+
+//
+HYDROData_SequenceOfObjects HYDROData_LISM::GetProfiles() const
+{
+  return GetReferenceObjects( DataTag_Profiles );
+}
+
+void HYDROData_LISM::SetProfiles( const HYDROData_SequenceOfObjects& theProfiles )
+{
+  SetReferenceObjects( theProfiles, DataTag_Profiles );
+  Changed( Geom_3d );
+}
+
+//
+bool HYDROData_LISM::SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank )
+{
+  if (theBank.IsNull())
+    return false;
+
+  if ( !HYDROData_Stream::IsValidAsAxis( theBank ) )
+    return false;
+
+  Handle(HYDROData_PolylineXY) aPrevBank = GetLeftBank();
+  if ( IsEqual( aPrevBank, theBank ) )
+    return true;
+
+  SetReferenceObject( theBank, DataTag_LeftBank );
+  Changed( Geom_3d );
+  return true;
+}
+
+Handle(HYDROData_PolylineXY) HYDROData_LISM::GetLeftBank() const
+{
+  return Handle(HYDROData_PolylineXY)::DownCast(GetReferenceObject( DataTag_LeftBank ) );
+}
+
+bool HYDROData_LISM::SetRightBank( const Handle(HYDROData_PolylineXY)& theBank )
+{
+  if (theBank.IsNull())
+    return false;
+
+  if ( !HYDROData_Stream::IsValidAsAxis( theBank ) )
+    return false;
+
+  Handle(HYDROData_PolylineXY) aPrevBank = GetRightBank();
+  if ( IsEqual( aPrevBank, theBank ) )
+    return true;
+
+  SetReferenceObject( theBank, DataTag_RightBank );
+  Changed( Geom_3d );
+  return true;
+}
+
+bool HYDROData_LISM::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis )
+{
+  if ( !HYDROData_Stream::IsValidAsAxis( theAxis ) )
+    return false;
+
+  Handle(HYDROData_PolylineXY) aPrevAxis = GetHydraulicAxis();
+  if ( IsEqual( aPrevAxis, theAxis ) )
+    return true;
+
+  SetReferenceObject( theAxis, DataTag_HydraulicAxis );
+
+  Changed( Geom_3d );
+  return true;
+}
+
+Handle(HYDROData_PolylineXY) HYDROData_LISM::GetHydraulicAxis() const
+{
+  return Handle(HYDROData_PolylineXY)::DownCast( GetReferenceObject( DataTag_HydraulicAxis ) );
+}
+
+
+Handle(HYDROData_PolylineXY) HYDROData_LISM::GetRightBank() const
+{
+  return Handle(HYDROData_PolylineXY)::DownCast(GetReferenceObject( DataTag_RightBank ) );
+}
+
+int HYDROData_LISM::GetNbProfilePoints() const
+{
+  return GetInteger( DataTag_NbProfilePoints );
+}
+
+void HYDROData_LISM::SetNbProfilePoints( int theNbProints )
+{
+  SetInteger( DataTag_NbProfilePoints, theNbProints );
+  Changed( Geom_3d );
+}
+
+double HYDROData_LISM::GetHaxStep() const
+{
+  return GetDouble( DataTag_HaxStep );
+}
+
+void HYDROData_LISM::SetHaxStep( double theHaxStep )
+{
+  SetDouble( DataTag_HaxStep, theHaxStep );
+  Changed( Geom_3d );
+}
+
+void HYDROData_LISM::Update()
+{
+  AltitudePoints anOutPoints;
+  HYDROData_SequenceOfObjects aRefProfiles = GetProfiles();  
+  int nbprofilepoints = GetNbProfilePoints();
+  double step = GetHaxStep();
+  Handle(HYDROData_PolylineXY) aHAX = GetHydraulicAxis();
+  Handle(HYDROData_PolylineXY) aLB = GetLeftBank();
+  Handle(HYDROData_PolylineXY) aRB = GetRightBank();
+
+  std::vector<std::string> warnings;
+  HYDROData_Stream::PrsDefinition prsDef;
+  HYDROData_StreamLinearInterpolation::Perform(aRefProfiles, nbprofilepoints, step, aHAX, aLB, aRB, anOutPoints, true, false, prsDef, &warnings);
+
+  SetAltitudePoints( anOutPoints );  
+  SetShape( DataTag_LeftBankShape, prsDef.myLeftBank);
+  SetShape( DataTag_RightBankShape, prsDef.myRightBank);
+  SetShape( DataTag_InletShape, prsDef.myInlet);
+  SetShape( DataTag_OutletShape, prsDef.myOutlet );
+  SetShape( DataTag_3DShape, prsDef.myPrs3D );
+  SetShape( DataTag_2DShape, prsDef.myPrs2D );
+
+  HYDROData_Bathymetry::Update();
+}
+
+
+void HYDROData_LISM::GetShapePresentations( HYDROData_Stream::PrsDefinition& prsDef)
+{
+  prsDef.myLeftBank = GetShape( DataTag_LeftBankShape);
+  prsDef.myRightBank = GetShape( DataTag_RightBankShape);
+  prsDef.myInlet = GetShape( DataTag_InletShape);
+  prsDef.myOutlet = GetShape( DataTag_OutletShape );
+  prsDef.myPrs3D = GetShape( DataTag_3DShape );
+  prsDef.myPrs2D  = GetShape( DataTag_2DShape );
+}
+
+
+/*void HYDROData_LISM::GetWarnings(NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>& warnings)
+{
+  warnings = myWarnings;
+}
+   */
\ No newline at end of file
diff --git a/src/HYDROData/HYDROData_LISM.h b/src/HYDROData/HYDROData_LISM.h
new file mode 100644 (file)
index 0000000..d19d66f
--- /dev/null
@@ -0,0 +1,97 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROData_LISM_HeaderFile
+#define HYDROData_LISM_HeaderFile
+
+#include "HYDROData_Bathymetry.h"
+#include "HYDROData_Profile.h"
+
+#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Entity.h>
+#include <HYDROData_Stream.h>
+
+/**\class HYDROData_LISM
+ * \
+ */
+class HYDROData_LISM : public HYDROData_Bathymetry
+{
+protected:
+  /**
+   * Enumeration of tags corresponding to the persistent object parameters.
+   */
+  enum DataTag
+  {
+    DataTag_First = HYDROData_Bathymetry::DataTag_First + 100, ///< first tag, to reserve
+    DataTag_Profiles,
+    DataTag_HaxStep,
+    DataTag_NbProfilePoints,
+    DataTag_HydraulicAxis,    
+    DataTag_LeftBank,
+    DataTag_RightBank,
+    DataTag_LeftBankShape,
+    DataTag_RightBankShape,
+    DataTag_InletShape,
+    DataTag_OutletShape,
+    DataTag_3DShape,
+    DataTag_2DShape 
+  };
+
+public:
+
+  HYDRODATA_EXPORT HYDROData_LISM();
+  virtual HYDRODATA_EXPORT ~HYDROData_LISM();
+
+  DEFINE_STANDARD_RTTIEXT( HYDROData_LISM, HYDROData_Bathymetry );
+
+  HYDRODATA_EXPORT HYDROData_SequenceOfObjects GetProfiles() const;
+  HYDRODATA_EXPORT void SetProfiles( const HYDROData_SequenceOfObjects& );
+
+  HYDRODATA_EXPORT bool SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank );
+  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetLeftBank() const;
+
+  HYDRODATA_EXPORT bool SetRightBank( const Handle(HYDROData_PolylineXY)& theBank );
+  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetRightBank() const;
+                   
+  HYDRODATA_EXPORT bool SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis );
+  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetHydraulicAxis() const;
+
+  HYDRODATA_EXPORT int GetNbProfilePoints() const;
+  HYDRODATA_EXPORT void SetNbProfilePoints( int );
+
+  HYDRODATA_EXPORT double GetHaxStep() const;
+  HYDRODATA_EXPORT void SetHaxStep( double );
+
+  HYDRODATA_EXPORT virtual void Update();
+
+  HYDRODATA_EXPORT void GetShapePresentations( HYDROData_Stream::PrsDefinition& prsDef);
+
+
+
+public:
+
+  //HYDRODATA_EXPORT void GetWarnings(NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>& warnings);
+
+protected:
+    //NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> myWarnings;
+};
+
+
+
+
+#endif
index ae79ef48f73ccf1487d3de92993222db037fcda0..3ec51658388f91e87bb42227d60c85d7de49d490 100644 (file)
@@ -435,19 +435,27 @@ void HYDROData_Profile::SetProfilePoints( const ProfilePoints& thePoints, bool I
 HYDROData_Profile::ProfilePoints HYDROData_Profile::GetProfilePoints
   ( bool IsConvertToGlobal, bool CanUseDefaultLeftRight ) const
 {
-  ProfilePoints aResPoints;
-
   gp_XY aFirstPoint, aLastPoint;
   if ( !GetLeftPoint( aFirstPoint, IsConvertToGlobal, CanUseDefaultLeftRight ) ||
        !GetRightPoint( aLastPoint, IsConvertToGlobal, CanUseDefaultLeftRight ) )
-    return aResPoints;
+    return HYDROData_Profile::ProfilePoints();
 
   HYDROData_ProfileUZ::PointsList aParametricPoints = GetParametricPoints();
-  if ( aParametricPoints.Length() < 2 )
+
+  return CalculateProfilePoints(aParametricPoints, aFirstPoint, aLastPoint);
+}
+
+HYDROData_Profile::ProfilePoints HYDROData_Profile::CalculateProfilePoints(
+  const HYDROData_ProfileUZ::PointsList& theParametricPoints, 
+  const gp_XY& aFirstPoint, const gp_XY& aLastPoint)
+{
+  ProfilePoints aResPoints;
+
+  if ( theParametricPoints.Length() < 2 )
     return aResPoints;
 
-  const HYDROData_ProfileUZ::Point& aFirstParPoint = aParametricPoints.First();
-  const HYDROData_ProfileUZ::Point& aLastParPoint = aParametricPoints.Last();
+  const HYDROData_ProfileUZ::Point& aFirstParPoint = theParametricPoints.First();
+  const HYDROData_ProfileUZ::Point& aLastParPoint = theParametricPoints.Last();
 
   double aFullLength = aLastPoint.X() - aFirstPoint.X();
   double aParFullLength = aLastParPoint.X() - aFirstParPoint.X();
@@ -456,9 +464,9 @@ HYDROData_Profile::ProfilePoints HYDROData_Profile::GetProfilePoints
   aResPoints.Append( ProfilePoint( aFirstPoint.X(), aFirstPoint.Y(), aFirstParPoint.Y() ) );
 
   // Compute all other points
-  for ( int i = 2, n = aParametricPoints.Length(); i < n ; ++i )
+  for ( int i = 2, n = theParametricPoints.Length(); i < n ; ++i )
   {
-    const HYDROData_ProfileUZ::Point& aParPoint = aParametricPoints.Value( i );
+    const HYDROData_ProfileUZ::Point& aParPoint = theParametricPoints.Value( i );
 
     double aParPointDist = aParPoint.X() - aFirstParPoint.X();
     double aRatio = aParPointDist / aParFullLength;
index 94ca5bb27491d031f73aad8ad7d6f74b50db9444..cdac0d31a98beed66ce481f218244d1e6c2c6c21 100644 (file)
@@ -83,6 +83,9 @@ public:
 
   HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
 
+  HYDRODATA_EXPORT static ProfilePoints CalculateProfilePoints(const HYDROData_ProfileUZ::PointsList& theParametricPoints, 
+  const gp_XY& aFirstPoint, const gp_XY& aLastPoint);
+
   /**
    * Returns default filling color for new profile.
    */
index 6ecd009f286947ebf12b33085f997ff6edc42bca..8b458e2a608d075efa342e498e8dc916408e5b10 100644 (file)
@@ -28,6 +28,8 @@
 #include "HYDROData_IProfilesInterpolator.h"
 #include "HYDROData_Tool.h"
 #include "HYDROData_DTM.h"
+#include "HYDROData_LISM.h"
+
 #include <HYDROData_Bathymetry.h>
 
 #include <TDataStd_RealArray.hxx>
@@ -177,27 +179,40 @@ void HYDROData_Stream::GetWarnings(NCollection_DataMap<Handle(HYDROData_Profile)
 
 void HYDROData_Stream::Update()
 {
-  if (!GetHydraulicAxis().IsNull())
-    updateProfilesOrder();
-
-  // Update bottom polyline if exists
-  const Handle(HYDROData_Polyline3D) aBottomPolyline = GetBottomPolyline();
-  if ( !aBottomPolyline.IsNull() ) {
-    if ( GenerateBottomPolyline() ) {
-      Handle(HYDROData_PolylineXY) aPolylineXY = aBottomPolyline->GetPolylineXY();
-      if ( !aPolylineXY.IsNull() ) {
-        aPolylineXY->Update();
+  if (GetInterpolationMethod() == 0)
+  {
+    if (!GetHydraulicAxis().IsNull())
+      updateProfilesOrder();
+
+    // Update bottom polyline if exists
+    const Handle(HYDROData_Polyline3D) aBottomPolyline = GetBottomPolyline();
+    if ( !aBottomPolyline.IsNull() ) {
+      if ( GenerateBottomPolyline() ) {
+        Handle(HYDROData_PolylineXY) aPolylineXY = aBottomPolyline->GetPolylineXY();
+        if ( !aPolylineXY.IsNull() ) {
+          aPolylineXY->Update();
+        }
+        aBottomPolyline->Update();
       }
-      aBottomPolyline->Update();
     }
-  }
 
-  Handle(HYDROData_DTM) dtm = DTM();
-  dtm->Update();
-  UpdatePrs( dtm );
+    Handle(HYDROData_DTM) dtm = DTM();
+    dtm->Update();
+    UpdatePrs( dtm );
+
+    myWarnings.Clear();
+    dtm->GetWarnings(myWarnings);
+  }
+  else
+  {
+    Handle(HYDROData_LISM) lism = LISM();
+    lism->Update();
+    UpdatePrs( lism );
 
-  myWarnings.Clear();
-  dtm->GetWarnings(myWarnings);
+    myWarnings.Clear();
+    //lism->GetWarnings(myWarnings);
+    //TODO warnings
+  }
 
   HYDROData_NaturalObject::Update();
 }
@@ -253,14 +268,8 @@ bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_DTM)& theDTM,
   return true;
 }
 
-void HYDROData_Stream::UpdatePrs( const Handle(HYDROData_DTM)& theDTM )
+void HYDROData_Stream::internalUpdatePrs( const PrsDefinition& aResultPrs )
 {
-  HYDROData_NaturalObject::Update();
-  
-  PrsDefinition aResultPrs;
-  if ( !CreatePresentations( theDTM, aResultPrs ) )
-    return;
-
   SetShape3D( aResultPrs.myPrs3D );
   SetTopShape( aResultPrs.myPrs2D );
 
@@ -290,6 +299,27 @@ void HYDROData_Stream::UpdatePrs( const Handle(HYDROData_DTM)& theDTM )
   anOutGroup->AddShape( aResultPrs.myOutlet );
 }
 
+
+void HYDROData_Stream::UpdatePrs( const Handle(HYDROData_DTM)& theDTM )
+{
+  HYDROData_NaturalObject::Update();
+  
+  PrsDefinition aResultPrs;
+  if ( !CreatePresentations( theDTM, aResultPrs ) )
+    return;
+
+  internalUpdatePrs(aResultPrs);
+}
+
+void HYDROData_Stream::UpdatePrs( const Handle(HYDROData_LISM)& theLISM )
+{
+  HYDROData_NaturalObject::Update();
+  PrsDefinition prsDef;
+  theLISM->GetShapePresentations(prsDef);
+
+  internalUpdatePrs(prsDef);
+}
+
 QColor HYDROData_Stream::DefaultFillingColor() const
 {
   return QColor( Qt::green );
@@ -344,6 +374,12 @@ Handle(HYDROData_DTM) HYDROData_Stream::DTM() const
   return Handle(HYDROData_DTM)::DownCast( GetAltitudeObject() );
 }
 
+Handle(HYDROData_LISM) HYDROData_Stream::LISM() const
+{
+  const_cast<HYDROData_Stream*>( this )->checkAndSetAltitudeObject();
+  return Handle(HYDROData_LISM)::DownCast( GetAltitudeObject() );
+}
+
 double HYDROData_Stream::GetDDZ() const
 {
   return DTM()->GetDDZ();
@@ -354,42 +390,103 @@ void HYDROData_Stream::SetDDZ( double theDDZ )
   DTM()->SetDDZ( theDDZ );
   Changed( Geom_3d );
 }
+
+Handle(HYDROData_PolylineXY) HYDROData_Stream::GetLeftBank() const
+{
+  return LISM()->GetLeftBank();
+}
+
+void HYDROData_Stream::SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank )
+{
+  LISM()->SetLeftBank( theBank );
+  Changed( Geom_3d );
+}
+
+Handle(HYDROData_PolylineXY) HYDROData_Stream::GetRightBank() const
+{
+  return LISM()->GetRightBank();
+}
+
+void HYDROData_Stream::SetRightBank( const Handle(HYDROData_PolylineXY)& theBank )
+{
+  LISM()->SetRightBank( theBank );
+  Changed( Geom_3d );
+}
+  
+  
+double HYDROData_Stream::GetHaxStep() const
+{
+  return LISM()->GetHaxStep();
+}
+
+void HYDROData_Stream::SetHaxStep( double theHaxStep )
+{
+  LISM()->SetHaxStep( theHaxStep );
+  Changed( Geom_3d );
+}
+
+int HYDROData_Stream::GetNbProfilePoints() const
+{
+  return LISM()->GetNbProfilePoints();
+}
+
+void HYDROData_Stream::SetNbProfilePoints( int theNbPoints )
+{
+  LISM()->SetNbProfilePoints( theNbPoints );
+  Changed( Geom_3d );
+}
   
 double HYDROData_Stream::GetSpatialStep() const
 {
-  return DTM()->GetSpatialStep();
+  if (GetInterpolationMethod() == 0)
+    return DTM()->GetSpatialStep();
+  else
+    return LISM()->GetHaxStep();
 }
 
 void HYDROData_Stream::SetSpatialStep( double theSpatialStep )
 {
-  DTM()->SetSpatialStep( theSpatialStep );
+  if (GetInterpolationMethod() == 0 )  
+    DTM()->SetSpatialStep( theSpatialStep );
+  else
+    LISM()->SetHaxStep( theSpatialStep );
   Changed( Geom_3d );
 }
 
 bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis )
 {
-  if ( !IsValidAsAxis( theAxis ) )
-    return false;
+  if (GetInterpolationMethod() == 0)
+  {
+    if ( !IsValidAsAxis( theAxis ) )
+      return false;
 
-  Handle(HYDROData_PolylineXY) aPrevAxis = GetHydraulicAxis();
-  if ( IsEqual( aPrevAxis, theAxis ) )
-    return true;
+    Handle(HYDROData_PolylineXY) aPrevAxis = GetHydraulicAxis();
+    if ( IsEqual( aPrevAxis, theAxis ) )
+      return true;
 
-  SetReferenceObject( theAxis, DataTag_HydraulicAxis );
+    SetReferenceObject( theAxis, DataTag_HydraulicAxis );
 
-  // Update the order of profiles
-  updateProfilesOrder();
+    // Update the order of profiles
+    updateProfilesOrder();
 
-  // Indicate model of the need to update the stream presentation
-  Changed( Geom_3d );
+    // Indicate model of the need to update the stream presentation
+    Changed( Geom_3d );
+  }
+  else
+  {
+    LISM()->SetHydraulicAxis( theAxis );
+    Changed( Geom_3d );
+  }
 
   return true;
 }
 
 Handle(HYDROData_PolylineXY) HYDROData_Stream::GetHydraulicAxis() const
 {
-  return Handle(HYDROData_PolylineXY)::DownCast( 
-           GetReferenceObject( DataTag_HydraulicAxis ) );
+  if (GetInterpolationMethod() == 0)
+    return Handle(HYDROData_PolylineXY)::DownCast( GetReferenceObject( DataTag_HydraulicAxis ) );
+  else
+    return LISM()->GetHydraulicAxis();
 }
 
 void HYDROData_Stream::RemoveHydraulicAxis()
@@ -561,7 +658,10 @@ bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile )
   int aProfileIndex = insertParameter( aPar );
   insertProfileInToOrder( theProfile, aProfileIndex );
 
-  DTM()->SetProfiles( GetProfiles() );
+  if (GetInterpolationMethod()==0)
+    DTM()->SetProfiles( GetProfiles() );
+  else
+    LISM()->SetProfiles( GetProfiles() );
   
   // Indicate model of the need to update the stream presentation
   Changed( Geom_3d );
@@ -616,7 +716,10 @@ bool HYDROData_Stream::SetProfiles( const HYDROData_SequenceOfObjects& theProfil
       Changed( Geom_3d );
   }
 
-  DTM()->SetProfiles( GetProfiles() );
+  if (GetInterpolationMethod()==0)
+    DTM()->SetProfiles( GetProfiles() );
+  else
+    LISM()->SetProfiles( GetProfiles() );
   return true;
 }
 
@@ -673,6 +776,19 @@ void HYDROData_Stream::RemoveProfiles()
   Changed( Geom_3d );
 }
 
+
+int HYDROData_Stream::GetInterpolationMethod() const
+{
+  return GetInteger( DataTag_InterpMethod );
+}
+
+void HYDROData_Stream::SetInterpolationMethod( int theMethod ) //if DTM => 0 ; if LISM => 1
+{
+  SetInteger( DataTag_InterpMethod, theMethod );
+  Changed( Geom_3d );
+}
+
+
 void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
                                                const int                        theBeforeIndex )
 {
@@ -776,7 +892,11 @@ void HYDROData_Stream::updateProfilesOrder()
 
 ObjectKind HYDROData_Stream::getAltitudeObjectType() const
 {
-  return KIND_DTM;
+  int InterpMethod = GetInterpolationMethod();
+  if (InterpMethod == 1)
+    return KIND_LISM;
+  else
+    return KIND_DTM;
 }
 
 void HYDROData_Stream::setParametersArray( const QVector<double>& theArray )
index b297484dc1ed068dd8fbd7e9f1473c7ef447507f..4d57079ab7871faa6ec3b5a059bd8fa0e939a83b 100644 (file)
@@ -31,6 +31,7 @@
 #include <QSet>
 
 class HYDROData_DTM;
+class HYDROData_LISM;
 class HYDROData_PolylineXY;
 class HYDROData_Polyline3D;
 class HYDROData_Profile;
@@ -66,7 +67,8 @@ protected:
     DataTag_HydraulicAxis,     ///< reference hydraulic axis
     DataTag_Profile,           ///< reference profiles
     DataTag_ParamsArray,       ///< parameters array
-    DataTag_BottomPolyline     ///< reference bottom polyline
+    DataTag_BottomPolyline,    ///< reference bottom polyline
+    DataTag_InterpMethod       ///< interpolation method (via DTM(0) or LISM(1))
   };
 
 public:
@@ -119,6 +121,8 @@ public:
    */
   HYDRODATA_EXPORT void UpdatePrs( const Handle(HYDROData_DTM)& );
 
+  HYDRODATA_EXPORT void UpdatePrs( const Handle(HYDROData_LISM)& theLISM );
+
   /**
    *
    */
@@ -183,6 +187,13 @@ public:
    */
   HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
 
+  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetLeftBank() const;
+
+  HYDRODATA_EXPORT void SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank );
+
+  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetRightBank() const;
+
+  HYDRODATA_EXPORT void SetRightBank( const Handle(HYDROData_PolylineXY)& theBank );
   /**
    * Returns true if profile has the intersection with the given hydraulic axis.
    * Returns the parameter of inresection point on axis if axis is presented by one curve,
@@ -262,9 +273,18 @@ public:
   HYDRODATA_EXPORT double GetDDZ() const;
   HYDRODATA_EXPORT void   SetDDZ( double theDDZ );
   
+  HYDRODATA_EXPORT int    GetInterpolationMethod() const;
+  HYDRODATA_EXPORT void   SetInterpolationMethod( int theDDZ );
+
   HYDRODATA_EXPORT double GetSpatialStep() const;
   HYDRODATA_EXPORT void   SetSpatialStep( double theSpatialStep );
 
+  HYDRODATA_EXPORT double GetHaxStep() const;
+  HYDRODATA_EXPORT void   SetHaxStep( double theHaxStep );
+
+  HYDRODATA_EXPORT int    GetNbProfilePoints() const;
+  HYDRODATA_EXPORT void   SetNbProfilePoints( int theNbPoints );  
+
   HYDRODATA_EXPORT void   GetWarnings(NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>& warnings);
 
   
@@ -308,6 +328,10 @@ private:
 
   Handle(HYDROData_DTM) DTM() const;
 
+  Handle(HYDROData_LISM) LISM() const;
+
+  void internalUpdatePrs( const PrsDefinition& aResultPrs );
+  
 
 protected:
   friend class HYDROData_Iterator;
diff --git a/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx b/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx
new file mode 100644 (file)
index 0000000..9cea6d8
--- /dev/null
@@ -0,0 +1,541 @@
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROData_StreamLinearInterpolation.h"
+#include <HYDROData_Profile.h>
+#include <HYDROData_ProfileUZ.h>
+
+#include <gp_Lin2d.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <HYDROData_ShapesTool.h>
+#include <GCPnts_UniformAbscissa.hxx>
+#include <Geom2dAPI_InterCurveCurve.hxx>
+#include <Geom2d_Line.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <HYDROData_Tool.h>
+#include <GCE2d_MakeLine.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRepAlgo.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <assert.h>
+#include <vector>
+#include <map>
+#include <set>
+#include <BRepBuilderAPI_MakeEdge2d.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <TopoDS_Face.hxx>
+#include <gp_Pln.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <gp.hxx>
+#include <gp_Ax2.hxx>
+#include <Geom_Plane.hxx>
+#include <TopoDS_Wire.hxx>
+#include <BRepLib.hxx>
+
+static std::vector<gp_Pnt2d> GetProfileUZPoints(const Handle(HYDROData_Profile)& theProfile)
+{
+  Handle(HYDROData_ProfileUZ) aProfileUZ = theProfile->GetProfileUZ( false );
+  HYDROData_ProfileUZ::PointsList aSectPointsList = aProfileUZ->GetPoints();
+  std::vector<gp_Pnt2d> points;
+  points.reserve(aSectPointsList.Size());
+  for ( int i = 1; i <= aSectPointsList.Size(); i++ )
+  {
+    const HYDROData_ProfileUZ::Point& aSectPoint = aSectPointsList(i);
+    points.push_back( gp_Pnt2d(aSectPoint.X(), aSectPoint.Y()));
+  }
+  return points;
+}
+
+static void GetMaxDist(const std::vector<gp_Pnt2d>& PNTS, 
+  double& dmax, 
+  double& dmax2,
+  int& imax)
+{
+  dmax = 0;
+  dmax2 = 0; 
+  imax = -1;
+  std::vector<double> dist;
+  dist.reserve(PNTS.size()-1);
+  for (int i=0; i<PNTS.size()-1; i++)
+  {
+    //dist.push_back(PNTS[i].Distance(PNTS[i+1])); //via distance between p1/p2 
+    dist.push_back(abs(PNTS[i].X()-PNTS[i+1].X())); //via U-diff of p1/p2
+  }
+  for (int i=0; i<dist.size(); i++)
+  {
+    double d = dist[i];
+    if (d > dmax)
+    {
+      dmax = d;
+      imax = i;
+    }
+  }
+  for (int i=0; i<dist.size(); i++)
+  {
+    double d = dist[i];
+    if (d > dmax2 && d < dmax)
+      dmax2 = d;
+  }
+}
+
+static void InsertPoints(std::vector<gp_Pnt2d>& points, int nbpoints)
+{
+  points.reserve(points.size() + nbpoints);
+  while (nbpoints)
+  {
+    double dmax=0, dmax2=0;
+    int imax=-1;
+    GetMaxDist(points, dmax, dmax2, imax);
+    int nbPins = 0;
+    if (dmax2 != 0)
+      nbPins = floor(dmax/dmax2);
+    else
+      nbPins = nbpoints; //one segment, put all points here
+    //insert nbPins points in [imax, imax+1] segment
+    gp_Pnt2d p1 = points[imax];
+    gp_Pnt2d p2 = points[imax+1];
+    double X0 = p1.X();
+    double Y0 = p1.Y();
+    double X1 = p2.X();
+    double Y1 = p2.Y();
+    for (int i=0;i<nbPins;i++)
+    {
+      double t = ((double)i+1)/((double)nbPins+1);
+      double Xp = X0 + (X1-X0)*t;
+      double Yp = Y0 + (Y1-Y0)*t;
+      gp_Pnt2d P(Xp, Yp);
+      points.insert(points.begin() + imax + 1, P);
+    }
+    nbpoints-=nbPins;
+  }
+}
+
+static void PolyToCurve2d(const Handle(HYDROData_PolylineXY)& poly, Handle(Geom2d_Curve)& c2d)
+{
+  if (poly.IsNull())
+    return;
+  TopoDS_Shape sh = poly->GetShape();
+  if (sh.ShapeType() == TopAbs_COMPOUND)
+  {
+    TopoDS_Iterator it(sh);
+    if (it.More())
+      sh = it.Value();
+  }
+    
+  if (sh.IsNull())
+    return;
+
+  TopoDS_Edge ee;
+  if (sh.ShapeType() == TopAbs_EDGE)
+    ee = TopoDS::Edge(sh);
+  else if (sh.ShapeType() == TopAbs_WIRE)
+    ee = BRepAlgo::ConcatenateWireC0(TopoDS::Wire(sh)); //convert to bspline
+  if (ee.IsNull())
+    return;
+
+  BRepAdaptor_Curve Ad(ee);
+
+  c2d = HYDROData_Tool::BRepAdaptorTo2DCurve(Ad);
+}
+
+static void InterProfilesAndHAX(const HYDROData_SequenceOfObjects& profiles, 
+  const Handle(Geom2d_Curve)& Hax2d, 
+  std::map<double, Handle(HYDROData_Profile)>& profToInterParam,
+  std::vector<std::string>* warnings)
+{
+  for (int i=1;i<=profiles.Size();i++)
+  {
+    Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast(profiles(i)); 
+    gp_XY LP, RP;
+    aProfile->GetLeftPoint( LP, true, true );
+    aProfile->GetRightPoint( RP, true, true );
+    gp_Pnt2d P1(LP), P2(RP);
+    double d = P2.Distance(P1);
+    if (d < gp::Resolution())
+    {
+      if (warnings)
+        warnings->push_back(aProfile->GetName().toStdString() + " is skipped: Left and Right points is the same");
+      continue;
+    }
+    Handle(Geom2d_Line) lin2d = new Geom2d_Line(P1,gp_Dir2d(P2.XY()-P1.XY()));
+
+    Geom2dAdaptor_Curve linAd(lin2d, 0, d);
+    Geom2dAdaptor_Curve haxAd(Hax2d);
+    Geom2dInt_GInter isec( linAd, haxAd, 1.0e-6, 1.0e-6);
+    if (!isec.IsDone())
+    {
+      if (warnings)
+        warnings->push_back(aProfile->GetName().toStdString() + " is skipped: intersection between hydraulic axis & profile is failed");
+      continue;
+    }
+    if (isec.NbPoints() == 0)
+    {
+      if (warnings)
+        warnings->push_back(aProfile->GetName().toStdString() + " is skipped: no intersection between hydraulic axis & profile");
+      continue; 
+    }
+    if (isec.NbPoints() > 1)
+    {
+      if (warnings)
+        warnings->push_back(aProfile->GetName().toStdString() + " is skipped; intersection between hydraulic axis & profile produces more than 1 point");
+      continue; 
+    }
+    double param = isec.Point(1).ParamOnSecond();
+    profToInterParam[param] = aProfile;
+  }
+}
+
+static bool EquidParamsOnHAX(const Handle(Geom2d_Curve)& Hax2d, double step, double fp, double lp, std::set<double>& params)
+{
+  Geom2dAdaptor_Curve ad(Hax2d);
+  GCPnts_UniformAbscissa GUA(ad, step, fp, lp);
+  if (!GUA.IsDone())
+    return false;
+
+  for(int i = 1; i<= GUA.NbPoints(); i++)
+    params.insert(GUA.Parameter(i));
+
+  return true;
+}
+
+static void GetPointsOnBanks(const std::vector<double>& gua_params,
+  const Handle(Geom2d_Curve)& Hax2d,
+  const Handle(Geom2d_Curve)& LB2d, 
+  const Handle(Geom2d_Curve)& RB2d,
+  std::map<double, std::pair<gp_Pnt2d, gp_Pnt2d>>& parToBankPoints,
+  std::vector<std::string>* warnings)
+{ 
+  for(int i = 0; i < gua_params.size(); i++)
+  {
+    double par = gua_params[i];
+    gp_Pnt2d p;
+    gp_Vec2d v;
+    Hax2d->D1(par, p, v); //if non-diff?
+    gp_Pnt2d outpLB, outpRB; 
+          
+    gp_Dir2d n2d(v.X(), v.Y()); //ignore Z (Z==0)
+    n2d.Rotate(M_PI/2);
+    //nLine2d is an orthogonal line to hydr. axis
+    gp_Pnt2d p2d(gp_Pnt2d(p.X(), p.Y()));
+    Handle(Geom2d_Line) nLine2d = new Geom2d_Line(p2d, n2d);
+    //intersect nLine2d with banks
+    Geom2dAPI_InterCurveCurve intL(LB2d, nLine2d);
+    Geom2dAPI_InterCurveCurve intR(RB2d, nLine2d);
+
+    if (warnings && intL.NbPoints()==0 )
+    {
+      std::string coord = (QString::number(p2d.X()) + ", "+QString::number(p2d.Y())).toStdString();
+      warnings->push_back("no intersection between intermediate profile (point on h.axis:("+ coord +")) and left bank found; skipped");
+    }
+
+    if (warnings && intR.NbPoints()==0)
+    {
+      std::string coord = (QString::number(p2d.X()) + ", "+QString::number(p2d.Y())).toStdString();
+      warnings->push_back("no intersection between intermediate profile (point on h.axis:("+ coord +")) and right bank found; skipped");
+    }
+
+    if ( intL.NbPoints()==0 || intR.NbPoints()==0)
+      continue;
+
+    gp_Pnt2d aNearSolL, aNearSolR;
+    double min_sq_dist = Precision::Infinite();
+    for (int j=1;j<=intL.NbPoints();j++)
+    {
+      double sq_dist = p2d.SquareDistance(intL.Point(j));
+      if (min_sq_dist > sq_dist)
+      {
+        min_sq_dist = sq_dist;
+        aNearSolL = intL.Point(j);
+      }
+    }
+    min_sq_dist = Precision::Infinite();
+    for (int j=1;j<=intR.NbPoints();j++)
+    {
+      double sq_dist = p2d.SquareDistance(intR.Point(j));
+      if (min_sq_dist > sq_dist)
+      {
+        min_sq_dist = sq_dist;
+        aNearSolR = intR.Point(j);
+      }
+    }
+
+    std::pair<gp_Pnt2d, gp_Pnt2d> int_pair(aNearSolL, aNearSolR);
+    parToBankPoints[par]=int_pair;
+  }
+}
+
+
+bool GetItersectionParam(const Handle(HYDROData_Profile)& aProfile, const Handle(Geom2d_Curve)& B2d, double& outIntersectionParam)
+{ 
+  gp_XY LP, RP;
+  aProfile->GetLeftPoint( LP, true, true );
+  aProfile->GetRightPoint( RP, true, true );
+  gp_Pnt2d P1(LP), P2(RP);
+  double d = P2.Distance(P1);
+  if (d < gp::Resolution())
+    return false;
+  Handle(Geom2d_Line) lin2d = new Geom2d_Line(P1,gp_Dir2d(P2.XY()-P1.XY()));
+
+  Geom2dAdaptor_Curve linAd(lin2d, 0, d);
+  Geom2dAdaptor_Curve BAd(B2d);
+  Geom2dInt_GInter isec( linAd, BAd, 1.0e-6, 1.0e-6);
+  if (!isec.IsDone())
+    return false;
+  if (isec.NbPoints() == 0)
+    return false;
+  if (isec.NbPoints() > 1)
+    return false;
+  outIntersectionParam = isec.Point(1).ParamOnSecond();
+  return true;
+}
+
+void BuildFace(const Handle(HYDROData_Profile)& F_prof,
+  const Handle(HYDROData_Profile)& S_prof,
+  const Handle(Geom2d_Curve)& LB2d,
+  const Handle(Geom2d_Curve)& RB2d,
+  HYDROData_Stream::PrsDefinition& prsDef)
+{
+  prsDef.myPrs3D.Nullify();
+  prsDef.myPrs2D.Nullify();
+  prsDef.myLeftBank.Nullify();   
+  prsDef.myRightBank.Nullify();  
+  prsDef.myInlet.Nullify();     
+  prsDef.myOutlet.Nullify();  
+
+  bool stat = true;
+  double lb_1, lb_2, rb_1, rb_2;
+  stat = GetItersectionParam(F_prof, LB2d, lb_1) && GetItersectionParam(F_prof, RB2d, rb_1)
+    && GetItersectionParam(S_prof, LB2d, lb_2) && GetItersectionParam(S_prof, RB2d, rb_2);
+  if (stat)
+  {
+    BRepBuilderAPI_MakeEdge2d LEM(LB2d, lb_1, lb_2);
+    if (!LEM.IsDone())
+      return;
+    BRepBuilderAPI_MakeEdge2d REM(RB2d, rb_1, rb_2);
+    if (!REM.IsDone())
+      return;
+    TopoDS_Edge LBE = LEM.Edge();
+    TopoDS_Edge RBE = REM.Edge();
+    if (LBE.IsNull() || RBE.IsNull())
+      return;
+    BRepBuilderAPI_MakeEdge PFEM(BRep_Tool::Pnt(LEM.Vertex1()), BRep_Tool::Pnt(REM.Vertex1()));
+    BRepBuilderAPI_MakeEdge PLEM(BRep_Tool::Pnt(LEM.Vertex2()), BRep_Tool::Pnt(REM.Vertex2()));
+    if (!PFEM.IsDone())
+      return;
+    if (!PLEM.IsDone())
+      return;
+    TopoDS_Edge FProfE = PFEM.Edge();
+    TopoDS_Edge SProfE = PLEM.Edge();
+    BRepBuilderAPI_MakeWire WM(FProfE, LBE, SProfE, RBE);
+    if (WM.IsDone())
+    {
+      TopoDS_Wire W = WM.Wire();
+      BRepLib::BuildCurves3d(W);
+      BRepBuilderAPI_MakeFace FM(Geom_Plane(gp::XOY()).Pln(), WM.Wire()); 
+      if (FM.IsDone())
+      {
+        prsDef.myPrs2D = FM.Face();
+        prsDef.myLeftBank = LBE;
+        prsDef.myRightBank = RBE;
+        prsDef.myInlet = FProfE;
+        prsDef.myOutlet = SProfE;
+      }
+    }
+  }
+}
+
+void HYDROData_StreamLinearInterpolation::Perform(const HYDROData_SequenceOfObjects& profiles,
+  int pointsToInsert,
+  double stepOnHA, 
+  const Handle(HYDROData_PolylineXY)& hax,  
+  const Handle(HYDROData_PolylineXY)& LB, 
+  const Handle(HYDROData_PolylineXY)& RB,
+  HYDROData_Bathymetry::AltitudePoints& outBathypoints,
+  bool buildPresentationShapes,
+  bool estimateWarnOnly,
+  HYDROData_Stream::PrsDefinition& prsDef,
+  std::vector<std::string>* warnings)
+{
+  //intersect profiles with given hydr.axis
+  if (hax.IsNull() || LB.IsNull() || RB.IsNull())
+    return;
+
+  Handle(Geom2d_Curve) Hax2d;
+  PolyToCurve2d(hax, Hax2d);
+  if (Hax2d->IsClosed()) //can't be closed
+  {
+    if (warnings)
+      warnings->push_back(hax->GetName().toStdString() + " is closed; abort");
+    return;
+  }
+
+  std::map<double, Handle(HYDROData_Profile)> InterParamToProf;
+  //profToInterParam is output param map: profile to intersection param on hydr.axis
+  InterProfilesAndHAX(profiles, Hax2d, InterParamToProf, warnings);
+  //
+  std::vector<std::vector<gp_Pnt2d>> profilesPoints;
+  profilesPoints.reserve(InterParamToProf.size());
+  int maxNbPoints = 0;
+  
+  //for (int i=1;i<=InterParamToProf.Extent();i++)
+  for( std::map<double, Handle(HYDROData_Profile)>::iterator it = InterParamToProf.begin(); it != InterParamToProf.end(); ++it )
+  {
+    //ordered by param on hydr axis
+    Handle(HYDROData_Profile) aProfile = it->second; 
+    const std::vector<gp_Pnt2d>& profile_points = GetProfileUZPoints(aProfile);
+    profilesPoints.push_back(profile_points);
+    if (profile_points.size() > maxNbPoints)
+      maxNbPoints = profile_points.size();
+  }
+  std::set<double> paramsOnHAX;
+
+  if (InterParamToProf.size() <= 1)
+  {
+    if (warnings)
+      warnings->push_back("Insufficient count of correct input profiles; abort");
+    return;
+  }
+
+  EquidParamsOnHAX(Hax2d, stepOnHA, InterParamToProf.begin()->first, 
+    InterParamToProf.rbegin()->first, paramsOnHAX);
+
+  //prepare ParamsPerSegm - number of interm.profiles for profile_points
+  std::vector<std::vector<double>> ParamsPerSegm;
+  std::set<double>::iterator it_params_hax = paramsOnHAX.begin();
+  std::map<double, Handle(HYDROData_Profile)>::iterator it_p = InterParamToProf.begin();
+  it_p++; 
+  ParamsPerSegm.resize(profilesPoints.size()-1);
+  for( int k=0; it_p != InterParamToProf.end(); )
+  {
+    if (*it_params_hax < it_p->first)
+    {
+      ParamsPerSegm[k].push_back(*it_params_hax);
+      it_params_hax++;     
+    }
+    else
+    {
+      it_p++;
+      k++;
+    }
+  }
+  ParamsPerSegm.back().push_back(*paramsOnHAX.rbegin());
+  //
+  std::map<double, std::pair<gp_Pnt2d, gp_Pnt2d>> parToBankPoints;
+  std::vector<double> paramHAXVec;
+  paramHAXVec.reserve(paramsOnHAX.size());
+  for( std::set<double>::iterator it = paramsOnHAX.begin(); it != paramsOnHAX.end(); ++it )
+    paramHAXVec.push_back(*it);
+  //
+  Handle(Geom2d_Curve) LB2d, RB2d;
+  PolyToCurve2d(LB, LB2d);
+  PolyToCurve2d(RB, RB2d);
+  GetPointsOnBanks( paramHAXVec, Hax2d, LB2d, RB2d, parToBankPoints, warnings);
+
+  if (buildPresentationShapes)
+  {
+    Handle(HYDROData_Profile) F_prof = InterParamToProf.begin()->second;
+    Handle(HYDROData_Profile) S_prof = InterParamToProf.rbegin()->second;
+    BuildFace(F_prof, S_prof, LB2d, RB2d, prsDef);
+  }
+  //
+
+  if (estimateWarnOnly)
+    return;
+
+  maxNbPoints = Max(pointsToInsert, maxNbPoints);
+
+  //insert points to profiles
+  for (int i=0;i<profilesPoints.size();i++)
+  {
+    int nbPointsToInsert = maxNbPoints - profilesPoints[i].size();
+    //insert nbPointsToInsert points to current profile
+    InsertPoints(profilesPoints[i], nbPointsToInsert);
+  }
+
+  for (int i=0;i<profilesPoints.size()-1;i++)
+  {
+    const std::vector<gp_Pnt2d>& prof1 = profilesPoints[i];
+    const std::vector<gp_Pnt2d>& prof2 = profilesPoints[i+1];
+    std::vector<std::vector<gp_Pnt2d>> IntermProf;
+
+    std::map<int, double> indToParam; //index of im.profile to param on hax. ()
+    for (int j=0;j<ParamsPerSegm[i].size();j++)
+    {
+      double param = ParamsPerSegm[i][j];
+      if (parToBankPoints.count(param) > 0) //not intersected with banks; skip this
+        indToParam[j]=param;
+    }
+    int NbIntermProf = indToParam.size();
+    IntermProf.resize(NbIntermProf);
+
+    for (int l=0;l<NbIntermProf;l++)
+      IntermProf[l].resize(prof1.size());
+    //calc interm. between prof1 & prof2
+    assert (prof1.size() == prof2.size());
+    for (int j=0;j<prof1.size();j++)
+    {
+      gp_Pnt2d P1 = prof1[j];
+      gp_Pnt2d P2 = prof2[j];
+      double X0 = P1.X();
+      double Y0 = P1.Y();
+      double X1 = P2.X();
+      double Y1 = P2.Y();
+      std::map<int, double>::iterator it = indToParam.begin();
+      for ( int m=0; it != indToParam.end(); it++, m++ )
+      {
+        int ind = it->first;
+        double t = ((double)ind+1)/((double)NbIntermProf+1);
+        double Xp = X0 + (X1-X0)*t;
+        double Yp = Y0 + (Y1-Y0)*t;
+        gp_Pnt2d P(Xp, Yp);
+        IntermProf[m][j] = P;
+      }
+    }
+    std::map<int, double>::iterator it = indToParam.begin();
+    for ( int m=0; it != indToParam.end(); it++, m++ )
+    {
+      const std::vector<gp_Pnt2d>& im_prof = IntermProf[m];
+      double param = it->second;
+      const std::pair<gp_Pnt2d, gp_Pnt2d>& BB = parToBankPoints[param]; //param is included in map; no checks
+      gp_Pnt2d LP = BB.first;
+      gp_Pnt2d RP = BB.second;
+      HYDROData_ProfileUZ::PointsList pl;
+      for (int k=0;k<im_prof.size();k++)
+        pl.Append(im_prof[k].XY());
+      HYDROData_Profile::ProfilePoints profile_points3d = HYDROData_Profile::CalculateProfilePoints(pl, LP.XY(), RP.XY());
+      for (int k=1;k<=profile_points3d.Length();k++)
+      {
+        HYDROData_Bathymetry::AltitudePoint AP(profile_points3d(k).X(), profile_points3d(k).Y(), profile_points3d(k).Z());
+        outBathypoints.push_back(AP);
+      }
+    }
+  }
+  //outBathy->SetAltitudePoints(bathypoints);
+}
+
+
+
diff --git a/src/HYDROData/HYDROData_StreamLinearInterpolation.h b/src/HYDROData/HYDROData_StreamLinearInterpolation.h
new file mode 100644 (file)
index 0000000..557f578
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _HYDROData_HYDRODATA_STREAMLINEARINTERPOLATION_HXX_
+#define _HYDROData_HYDROData_STREAMLINEARINTERPOLATION_HXX_
+
+#include <HYDROData_Entity.h>
+#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Bathymetry.h>
+#include <HYDROData_Stream.h>
+#include <string>
+class TopoDS_Face;
+
+class HYDROData_StreamLinearInterpolation
+{
+public:
+
+HYDRODATA_EXPORT static void Perform(const HYDROData_SequenceOfObjects& profiles,
+  int pointsToInsert,
+  double stepOnHA, 
+  const Handle(HYDROData_PolylineXY)& hax,  
+  const Handle(HYDROData_PolylineXY)& LB, 
+  const Handle(HYDROData_PolylineXY)& RB,
+  HYDROData_Bathymetry::AltitudePoints& outBathypoints,  
+  bool buildPresentationShapes,
+  bool estimateWarnOnly,
+  HYDROData_Stream::PrsDefinition& prsDef,
+  std::vector<std::string>* warnings = NULL);
+};
+
+#endif
index f5b1acfc0e4942c06bc3950c203f99939c95a26e..4cd66c6a1e8e6ca6638f200824ebfc710b9d3d38 100755 (executable)
 #include <HYDROData_PolylineXY.h>
 #include <HYDROData_Polyline3D.h>
 #include <HYDROData_Bathymetry.h>
-
+#include <Geom_Line.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+#include <Standard_Type.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom_BSplineCurve.hxx>
+
+#include <GeomAPI.hxx>
+#include <gp.hxx>
+#include <Geom_Plane.hxx>
 #include <QFileInfo>
 #define BLOCK_SIZE 10000
 
@@ -899,6 +908,38 @@ bool HYDROData_Tool::importPolylineFromXYZ(QString aFileName, Handle(HYDROData_D
 }
 
 
+
+
+Handle(Geom2d_Curve) HYDROData_Tool::BRepAdaptorTo2DCurve( const BRepAdaptor_Curve& ad )
+{
+  if( ad.GetType() == GeomAbs_Line)
+  {
+    double f = ad.FirstParameter();
+    double l = ad.LastParameter();
+    return new Geom2d_TrimmedCurve( GeomAPI::To2d(ad.Curve().Curve(), Geom_Plane(gp::XOY()).Pln()), f, l );
+  }
+
+  if( ad.GetType() == GeomAbs_BSplineCurve )
+  {
+    //just ignore Z coord, without projecting
+    Handle(Geom_BSplineCurve) aSpline = ad.Curve().BSpline();
+    if (aSpline.IsNull())
+      return Handle(Geom2d_Curve)();
+    TColgp_Array1OfPnt poles3d = aSpline->Poles();
+    TColgp_HArray1OfPnt2d poles2d(poles3d.Lower(), poles3d.Upper());
+    for (int i=poles3d.Lower(); i<=poles3d.Upper();i++)
+    {
+      gp_XY p2d(poles3d(i).X(), poles3d(i).Y()); 
+      poles2d(i).SetXY(p2d);
+    }
+    const TColStd_Array1OfReal& knots = aSpline->Knots();
+    const TColStd_Array1OfInteger& multiplicities = aSpline->Multiplicities();
+    int aDegree = aSpline->Degree();
+    return new Geom2d_BSplineCurve( poles2d, knots, multiplicities, aDegree );
+  }
+  return Handle(Geom2d_Curve)();
+}
+
 std::ostream& operator<<( std::ostream& theStream, const QString& theText )
 {
   theStream << theText.toStdString();
index c7bd4fe6a53831e8e96d7f98700f487726c90831..f8bec7dff7a16342b47d0b0dac4769a85f4614ea 100755 (executable)
@@ -26,6 +26,9 @@
 #include <TopTools_SequenceOfShape.hxx>
 #include <NCollection_IndexedDataMap.hxx>
 #include <Message_ProgressIndicator.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <BRepAdaptor_Curve.hxx>
 
 
 class HYDROData_PolylineXY;
@@ -160,6 +163,7 @@ public:
   static bool importPolylineFromXYZ(QString aFilename, Handle(HYDROData_Document) theDocument, 
                                     bool importXY, NCollection_Sequence<Handle(HYDROData_Entity)>& importedEntities);
   
+  static Handle(Geom2d_Curve) BRepAdaptorTo2DCurve( const BRepAdaptor_Curve& ad );
 
   static void SetSIProgress(const Handle(Message_ProgressIndicator)& thePI);
   static const Handle(Message_ProgressIndicator)& GetSIProgress();
@@ -174,6 +178,11 @@ private:
   static Handle(Message_ProgressIndicator)& StricklerInterpolationProgress();
   static Handle(Message_ProgressIndicator)& BathymetryInterpolationProgress();
   static ExecStatus myTriangulationStatus;
+  
+
+
+
+  
 };
 
 inline bool ValuesEquals( const double& theFirst, const double& theSecond )
index 3a06ca02ff602e90f09c2eac493cea74ba439fe5..df7f384477b7f6dab20b1acf85a5cbc586eb743f 100644 (file)
@@ -37,6 +37,7 @@
 #include <QPushButton>
 #include <QDoubleSpinBox>
 #include <QTextEdit>
+#include <QRadioButton>
 
 HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QString& theTitle )
 : HYDROGUI_InputPanel( theModule, theTitle )
@@ -57,6 +58,17 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
 
   myAxes = new QComboBox( aParamGroup );
   myAxes->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  myLeftBanks = new QComboBox( aParamGroup );
+  myLeftBanks->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  myRightBanks = new QComboBox( aParamGroup );
+  myRightBanks->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  myProfilePoints = new QSpinBox();
+  myProfilePoints->setRange(3, 99999);
+  myProfilePoints->setValue(100);
+
   myDDZ = new QDoubleSpinBox( aParamGroup );
   myDDZ->setRange( 0.01, 100 );
   myDDZ->setSingleStep( 0.1 );
@@ -67,15 +79,39 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   mySpatialStep->setSingleStep( 0.1 );
   mySpatialStep->setValue( 1 );
   mySpatialStep->setDecimals( 2 );
-
+  
+  myModeButton = new QRadioButton( tr( "VIA_DTM" ), myObjectNameGroup );
+  myModeButton->setAutoExclusive(true);
+  myModeButton2 = new QRadioButton( tr( "VIA_LISM" ), myObjectNameGroup );
+  myModeButton2->setAutoExclusive(true);
+  myModeButton->setChecked(true);
+  myModeButton2->setChecked(false);
+  
   QGridLayout* aParam1Layout = new QGridLayout();
+
+  aParam1Layout->addWidget( myModeButton, 0, 0 );
+  aParam1Layout->addWidget( myModeButton2, 0, 1 );
+
+  myDDZLabel = new QLabel( tr( "STREAM_DDZ" ) );
   aParam1Layout->setMargin( 0 );
-  aParam1Layout->addWidget( new QLabel( tr( "STREAM_HYDRAULIC_AXIS" ) ), 0, 0 );
-  aParam1Layout->addWidget( myAxes, 0, 1 );
-  aParam1Layout->addWidget( new QLabel( tr( "STREAM_DDZ" ) ), 1, 0 );
-  aParam1Layout->addWidget( myDDZ, 1, 1 );
-  aParam1Layout->addWidget( new QLabel( tr( "STREAM_SPATIAL_STEP" ) ), 2, 0 );
-  aParam1Layout->addWidget( mySpatialStep, 2, 1 );
+  aParam1Layout->addWidget( new QLabel( tr( "STREAM_HYDRAULIC_AXIS" ) ), 1, 0 );
+  aParam1Layout->addWidget( myAxes, 1, 1 );
+  aParam1Layout->addWidget( myDDZLabel, 2, 0 );
+  aParam1Layout->addWidget( myDDZ, 2, 1 );
+  aParam1Layout->addWidget( new QLabel( tr( "STREAM_SPATIAL_STEP" ) ), 3, 0 );
+  aParam1Layout->addWidget( mySpatialStep, 3, 1 );
+
+  ///line. intr method widgets
+  myLeftBanksLabel = new QLabel( tr( "STREAM_LEFT_BANK" ) );
+  myRightBanksLabel = new QLabel( tr( "STREAM_RIGHT_BANK" ) );
+  myProfilePointsLabel =  new QLabel( tr( "STREAM_PROFILE_POINTS" ) );
+
+  aParam1Layout->addWidget( myLeftBanksLabel, 4, 0 );
+  aParam1Layout->addWidget( myLeftBanks, 4, 1 );
+  aParam1Layout->addWidget( myRightBanksLabel, 5, 0 );
+  aParam1Layout->addWidget( myRightBanks, 5, 1 );
+  aParam1Layout->addWidget( myProfilePointsLabel, 6, 0 );
+  aParam1Layout->addWidget( myProfilePoints, 6, 1 );
 
   myProfiles = new HYDROGUI_OrderedListWidget( aParamGroup, 0 );
   myProfiles->setHiddenObjectsShown(true);
@@ -132,6 +168,17 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   connect( myRemoveButton, SIGNAL( clicked() ), this, SLOT( onRemoveProfiles() ) );
   connect( myDDZ, SIGNAL( valueChanged (double) ), this, SLOT (onDDZValueChanged(double)));
   connect( mySpatialStep, SIGNAL( valueChanged (double) ), this, SLOT (onSSValueChanged(double)));
+  ///
+  connect( myLeftBanks, SIGNAL( currentIndexChanged( const QString & ) ), this, SIGNAL( LeftBankChanged( const QString& ) ) );
+  connect( myRightBanks, SIGNAL( currentIndexChanged( const QString & ) ), this, SIGNAL( RightBankChanged( const QString& ) ) );
+  connect( myProfilePoints, SIGNAL( valueChanged (int) ), this, SIGNAL (ProfilePointsChanged(int)));
+
+  connect( myModeButton, SIGNAL( toggled( bool ) ), this, SIGNAL( ModeChanged( bool ) ) );
+  connect( myModeButton, SIGNAL( toggled( bool ) ), this, SLOT( ModeChangedDlg( bool ) ) );
+
+  ModeChangedDlg(true);
+
+  //myModeButton->setChecked(false);
 }
 
 HYDROGUI_StreamDlg::~HYDROGUI_StreamDlg()
@@ -145,13 +192,22 @@ void HYDROGUI_StreamDlg::reset()
   myObjectName->clear();
 
   myAxes->clear();
+  myLeftBanks->clear();
+  myRightBanks->clear();
+
   myProfiles->setObjects( HYDROGUI_ListModel::Object2VisibleList() );
+
   myAddButton->setEnabled( true );
   myRemoveButton->setEnabled( true );
 
   blockSignals( isBlocked );
 }
 
+QList<Handle(HYDROData_Entity)> HYDROGUI_StreamDlg::getProfiles()
+{
+  return myProfiles->getObjects();
+}
+
 void HYDROGUI_StreamDlg::setObjectName( const QString& theName )
 {
   myObjectName->setText( theName );
@@ -172,6 +228,26 @@ void HYDROGUI_StreamDlg::setAxisNames( const QStringList& theAxises )
   blockSignals( isBlocked );
 }
 
+void HYDROGUI_StreamDlg::setLeftBankNames( const QStringList& theBanks )
+{
+  bool isBlocked = blockSignals( true );
+
+  myLeftBanks->clear();
+  myLeftBanks->addItems( theBanks );
+
+  blockSignals( isBlocked );
+}
+
+void HYDROGUI_StreamDlg::setRightBankNames( const QStringList& theBanks )
+{
+  bool isBlocked = blockSignals( true );
+
+  myRightBanks->clear();
+  myRightBanks->addItems( theBanks );
+
+  blockSignals( isBlocked );
+}
+
 void HYDROGUI_StreamDlg::setAxisName( const QString& theName )
 {
   bool isBlocked = blockSignals( true );
@@ -185,11 +261,48 @@ void HYDROGUI_StreamDlg::setAxisName( const QString& theName )
   blockSignals( isBlocked );
 }
 
+void HYDROGUI_StreamDlg::setLeftBankName( const QString& theName )
+{
+  bool isBlocked = blockSignals( true );
+
+  int aNewId = myLeftBanks->findText( theName );
+  if ( aNewId != myLeftBanks->currentIndex() ) {
+    myLeftBanks->setCurrentIndex( aNewId );
+  }
+  //myAddButton->setEnabled( myAxes->currentIndex() > -1 );
+
+  blockSignals( isBlocked );
+}
+
+void HYDROGUI_StreamDlg::setRightBankName( const QString& theName )
+{
+  bool isBlocked = blockSignals( true );
+
+  int aNewId = myRightBanks->findText( theName );
+  if ( aNewId != myRightBanks->currentIndex() ) {
+    myRightBanks->setCurrentIndex( aNewId );
+  }
+  //myAddButton->setEnabled( myAxes->currentIndex() > -1 );
+
+  blockSignals( isBlocked );
+}
+
+
 QString HYDROGUI_StreamDlg::getAxisName() const
 {
   return myAxes->currentText();
 }
 
+QString HYDROGUI_StreamDlg::getLeftBankName() const
+{
+  return myLeftBanks->currentText();
+}
+
+QString HYDROGUI_StreamDlg::getRightBankName() const
+{
+  return myRightBanks->currentText();
+}
+
 void HYDROGUI_StreamDlg::setProfiles( const QStringList& theProfiles )
 {
   bool isBlocked = blockSignals( true );
@@ -257,6 +370,17 @@ double HYDROGUI_StreamDlg::getSpatialStep() const
   return mySpatialStep->value();
 }
 
+void HYDROGUI_StreamDlg::setNbProfilePoints( const int theNbPoints )
+{
+  myProfilePoints->setValue( theNbPoints );
+}
+
+int HYDROGUI_StreamDlg::getNbProfilePoints() const
+{
+  return myProfilePoints->value();
+}
+
+
 void HYDROGUI_StreamDlg::setBackgroundColorForProfileList (int theInd, QColor theColor)
 {
   myProfiles->setBackgroundColor(theInd, theColor);
@@ -287,3 +411,54 @@ void HYDROGUI_StreamDlg::clearWarnings()
   myWarnText->clear();
 }
 
+
+void HYDROGUI_StreamDlg::ModeChangedDlg(bool mode)
+{
+  if ( signalsBlocked() )
+    return;
+  if (mode)
+  {
+    myProfilePoints->setVisible(false);
+    myProfilePointsLabel->setVisible(false);
+
+    myLeftBanks->setVisible(false);
+    myLeftBanksLabel->setVisible(false);
+
+    myRightBanks->setVisible(false);
+    myRightBanksLabel->setVisible(false);
+
+    myDDZ->setVisible(true);
+    myDDZLabel->setVisible(true);
+  }
+  else
+  {
+    myProfilePoints->setVisible(true);
+    myProfilePointsLabel->setVisible(true);
+
+    myLeftBanks->setVisible(true);
+    myLeftBanksLabel->setVisible(true);
+
+    myRightBanks->setVisible(true);
+    myRightBanksLabel->setVisible(true);
+
+    myDDZ->setVisible(false);
+    myDDZLabel->setVisible(false);
+  }
+
+}
+
+int HYDROGUI_StreamDlg::getMode()
+{
+  bool isCh = myModeButton->isChecked();
+  return isCh ? 0 : 1;
+}
+
+void HYDROGUI_StreamDlg::setMode(int mode)
+{
+  bool checkState = mode == 0;
+  myModeButton->setChecked(checkState);
+  myModeButton2->setChecked(!checkState);
+}
+
+
+
index adb087bf2ead55c13fd87481bc68d42bc83f45f1..b8fbeaf3d6f6cfdefb211af375dc1cf3eb6fc8a7 100644 (file)
@@ -20,6 +20,7 @@
 #define HYDROGUI_StreamDlg_H
 
 #include "HYDROGUI_InputPanel.h"
+#include <HYDROData_Entity.h>
 
 class HYDROGUI_OrderedListWidget;
 
@@ -30,6 +31,9 @@ class QListWidget;
 class QPushButton;
 class QDoubleSpinBox;
 class QTextEdit;
+class QRadioButton;
+class QSpinBox;
+class QLabel;
 
 class HYDROGUI_StreamDlg : public HYDROGUI_InputPanel
 {
@@ -45,9 +49,16 @@ public:
   QString                    getObjectName() const;
 
   void                       setAxisNames( const QStringList& theAxises );
+  void                       setLeftBankNames( const QStringList& theAxises );
+  void                       setRightBankNames( const QStringList& theAxises );
 
   void                       setAxisName( const QString& thePolyline );
+  void                       setLeftBankName( const QString& theName );
+  void                       setRightBankName( const QString& theName );
+
   QString                    getAxisName() const;
+  QString                    getLeftBankName() const;
+  QString                    getRightBankName() const;
 
   void                       setProfiles( const QStringList& theProfiles );
 
@@ -57,14 +68,23 @@ public:
   void                       setSpatialStep( const double );
   double                     getSpatialStep() const;
 
+  void                       setNbProfilePoints( const int );
+  int                        getNbProfilePoints() const;  
+
   void                       addWarning( const QString& theWarnMess );
   void                       clearWarnings();
 
+  QList<Handle(HYDROData_Entity)> getProfiles();
+
   void                       setBackgroundColorForProfileList (int theInd, QColor theColor);
   void                       setBackgroundColorForProfileList (QString name, QColor theColor);
   QColor                     getBackgroundColorForProfileList (int theInd) const;
   void                       clearAllBackgroundColorsForProfileList ();
 
+  int                        getMode();
+  void                       setMode(int mode);
+
+
 signals:
   void                       AddProfiles();
   void                       RemoveProfiles( const QStringList& );
@@ -72,22 +92,42 @@ signals:
   void                       DDZValueChanged (double d);
   void                       SSValueChanged (double d);
 
+  void                       LeftBankChanged( const QString& ) ;
+  void                       RightBankChanged( const QString& );
+  void                       ProfilePointsChanged (int);
+  void                       ModeChanged(bool);
+
 private slots:
   void                       onRemoveProfiles();
   void                       onDDZValueChanged(double d);
   void                       onSSValueChanged(double d);
+  void                       ModeChangedDlg(bool);
+
+
 
 private:
   QGroupBox*                  myObjectNameGroup;
   QLineEdit*                  myObjectName;
   QDoubleSpinBox*             myDDZ;
   QDoubleSpinBox*             mySpatialStep;
+  QSpinBox*                   myProfilePoints;
 
   QComboBox*                  myAxes;
+
+  QComboBox*                  myLeftBanks;
+  QComboBox*                  myRightBanks;
+
   HYDROGUI_OrderedListWidget* myProfiles;
   QPushButton*                myRemoveButton;
   QPushButton*                myAddButton;
   QTextEdit*                  myWarnText;
+  QRadioButton*               myModeButton;
+  QRadioButton*               myModeButton2;
+
+  QLabel*                     myDDZLabel;
+  QLabel*                     myLeftBanksLabel;
+  QLabel*                     myRightBanksLabel;
+  QLabel*                     myProfilePointsLabel;
 
 };
 
index 87322f42e8db506ad01e820a1390d49dde571c3c..74835af2d009779e4aed792d47735c9cd0cb7806 100755 (executable)
@@ -55,6 +55,7 @@
 #include <TopoDS.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
 #include <QSet>
+#include <HYDROData_StreamLinearInterpolation.h>
 
 void insertProfileInToOrder( const QString& theProfileName,
                              const double&  theProfilePar,
@@ -97,6 +98,7 @@ HYDROGUI_StreamOp::~HYDROGUI_StreamOp()
 void HYDROGUI_StreamOp::startOperation()
 {
   HYDROGUI_Operation::startOperation();
+  int mode = 0; //DTM mode by def
 
   if ( !myIsEdit || isApplyAndClose() )
     myEditedObject.Nullify();
@@ -115,8 +117,10 @@ void HYDROGUI_StreamOp::startOperation()
       myEditedObject =
         Handle(HYDROData_Stream)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
     if ( !myEditedObject.IsNull() )
-    {
+    {          
+      mode = myEditedObject->GetInterpolationMethod();
       anObjectName = myEditedObject->GetName();
+      //aPanel->setMode(mode);
 
       // Hydraulic axis
       Handle(HYDROData_PolylineXY) aHydraulicAxis = myEditedObject->GetHydraulicAxis();
@@ -157,15 +161,30 @@ void HYDROGUI_StreamOp::startOperation()
   // set the existing 2D polylines names to the panel
   aPanel->setAxisNames( HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_POLYLINEXY ) );
 
+  aPanel->setLeftBankNames( HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_POLYLINEXY ) );
+  aPanel->setRightBankNames( HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_POLYLINEXY ) );
+
+  bool isBlocked = aPanel->blockSignals( true );
   if (myIsEdit)
   {
-    aPanel->setDDZ( myEditedObject->GetDDZ() );
+    if (mode == 0)
+    {
+      aPanel->setDDZ( myEditedObject->GetDDZ() );
+    }
+    else
+    {
+      aPanel->setNbProfilePoints( myEditedObject->GetNbProfilePoints() );
+      aPanel->setLeftBankName(myEditedObject->GetLeftBank()->GetName());
+      aPanel->setRightBankName(myEditedObject->GetRightBank()->GetName());
+    }
     aPanel->setSpatialStep( myEditedObject->GetSpatialStep() );
-  }
+  }  
+  
+  aPanel->setMode(mode);
+  aPanel->blockSignals( isBlocked );
 
   // synchronize the panel state with the edited object state
   updatePanelData();
-
   // Create preview
   createPreview();
 }
@@ -194,6 +213,17 @@ HYDROGUI_InputPanel* HYDROGUI_StreamOp::createInputPanel() const
 
   connect( aPanel, SIGNAL( DDZValueChanged( double ) ),  this, SLOT( onDDZValueChanged( double ) ) );
   connect( aPanel, SIGNAL( SSValueChanged( double ) ),  this, SLOT( onSSValueChanged( double ) ) );
+
+  connect( aPanel, SIGNAL( LeftBankChanged( const QString& ) ), 
+    this, SLOT( onLeftBankChanged( const QString& ) ) );
+
+  connect( aPanel, SIGNAL( RightBankChanged( const QString& ) ), 
+    this, SLOT( onRightBankChanged( const QString& ) ) );
+
+  connect( aPanel, SIGNAL( ProfilePointsChanged( int ) ),  this, SLOT( onProfilePointsChanged( int ) ) );
+
+  connect( aPanel, SIGNAL( ModeChanged( bool ) ), this, SLOT( onModeChanged( bool ) ) );
+
   return aPanel;
 }
 
@@ -248,7 +278,7 @@ void HYDROGUI_StreamOp::apply()
 
   } 
 }
-
+//#include <HYDROData_StreamLinearInterpolation.h>
 bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
                                       QString& theErrorMsg,
                                       QStringList& theBrowseObjectsEntries )
@@ -305,26 +335,48 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
     return false;
   }
 
-  bool ToOrder = true;
+  int InterpMethod = aPanel->getMode();
 
-  if (aHydAxis.IsNull())
-    ToOrder = false;
+  myEditedObject->SetInterpolationMethod(InterpMethod);
 
-  myEditedObject->SetProfiles (aRefProfiles, ToOrder) ;
-  myEditedObject->SetName( anObjectName );
-
-  if (!aHydAxis.IsNull())
-    myEditedObject->SetHydraulicAxis( aHydAxis );
-  myEditedObject->SetProfiles( aRefProfiles, false );
-  myEditedObject->SetDDZ( aPanel->getDDZ() );
-  myEditedObject->SetSpatialStep( aPanel->getSpatialStep() );
+  if (InterpMethod == 0)
+  {
+    //DTM
+    bool ToOrder = !aHydAxis.IsNull();
+    myEditedObject->SetProfiles (aRefProfiles, ToOrder) ;
+    myEditedObject->SetName( anObjectName );
+
+    if (!aHydAxis.IsNull())
+      myEditedObject->SetHydraulicAxis( aHydAxis );
+    myEditedObject->SetProfiles( aRefProfiles, false );
+    myEditedObject->SetDDZ( aPanel->getDDZ() );
+    myEditedObject->SetSpatialStep( aPanel->getSpatialStep() );
+  }
+  else if (InterpMethod == 1)
+  {
+    //LISM
+    myEditedObject->SetProfiles (aRefProfiles, false) ;
+    myEditedObject->SetName( anObjectName );
+    if (!aHydAxis.IsNull())
+      myEditedObject->SetHydraulicAxis( aHydAxis );
+    Handle(HYDROData_PolylineXY) aLeftBank = Handle(HYDROData_PolylineXY)::DownCast(
+      HYDROGUI_Tool::FindObjectByName( module(), aPanel->getLeftBankName(), KIND_POLYLINEXY ) );
+    Handle(HYDROData_PolylineXY) aRightBank = Handle(HYDROData_PolylineXY)::DownCast(
+      HYDROGUI_Tool::FindObjectByName( module(), aPanel->getRightBankName(), KIND_POLYLINEXY ) );
+    //myEditedObject->Se
+    myEditedObject->SetLeftBank(aLeftBank);
+    myEditedObject->SetRightBank(aRightBank);
+
+    myEditedObject->SetNbProfilePoints( aPanel->getNbProfilePoints() );
+    myEditedObject->SetHaxStep( aPanel->getSpatialStep() );
+  }
 
   if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
   {
     myEditedObject->Update();
-    NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> warnings;
-    myEditedObject->GetWarnings(warnings);
-    QString totalWarning;
+    //NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> warnings;
+    //myEditedObject->GetWarnings(warnings);
+    //QString totalWarning;
    //for (NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>::Iterator it(warnings); it.More(); it.Next())
    //{
    //  const QSet<QString>& V = it.Value();
@@ -367,11 +419,14 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
 
 void HYDROGUI_StreamOp::createPreview()
 {
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  int mode = aPanel->getMode();
+
   LightApp_Application* anApp = module()->getApp();
   if ( !getPreviewManager() )
   {
     setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>( 
-                       anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+      anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
   }
 
   OCCViewer_ViewManager* aViewManager = getPreviewManager();
@@ -401,83 +456,113 @@ void HYDROGUI_StreamOp::createPreview()
   if ( !aViewManager || !myPreviewPrs )
     return;
 
-  Handle(HYDROData_PolylineXY) aHydAxis = Handle(HYDROData_PolylineXY)::DownCast(
-    HYDROGUI_Tool::FindObjectByName( module(), myHydAxis, KIND_POLYLINEXY ) );
-
-  HYDROData_SequenceOfObjects aRefProfiles;
-  //std::vector<Handle(HYDROData_Profile)> aRefProfiles;
-  int plen = myProfiles.length();
-  for ( int i = 0; i < plen; ++i )
+  if (mode == 0)
   {
-    QString aProfileName = myProfiles.value( i );
+    Handle(HYDROData_PolylineXY) aHydAxis = Handle(HYDROData_PolylineXY)::DownCast(
+      HYDROGUI_Tool::FindObjectByName( module(), myHydAxis, KIND_POLYLINEXY ) );
 
-    Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast(
-      HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) );
-    if ( !aProfile.IsNull() )
-      aRefProfiles.Append( aProfile );
-  }
+    HYDROData_SequenceOfObjects aRefProfiles;
+    //std::vector<Handle(HYDROData_Profile)> aRefProfiles;
+    int plen = myProfiles.length();
+    for ( int i = 0; i < plen; ++i )
+    {
+      QString aProfileName = myProfiles.value( i );
+
+      Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast(
+        HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) );
+      if ( !aProfile.IsNull() )
+        aRefProfiles.Append( aProfile );
+    }
 
-  HYDROData_Stream::PrsDefinition aPrsDef;
+    HYDROData_Stream::PrsDefinition aPrsDef;
 
-  TopoDS_Shape Out3dPres;
-  TopoDS_Shape Out2dPres;
-  TopoDS_Shape OutLeftB;
-  TopoDS_Shape OutRightB;
-  TopoDS_Shape OutInlet;
-  TopoDS_Shape OutOutlet;
+    TopoDS_Shape Out3dPres;
+    TopoDS_Shape Out2dPres;
+    TopoDS_Shape OutLeftB;
+    TopoDS_Shape OutRightB;
+    TopoDS_Shape OutInlet;
+    TopoDS_Shape OutOutlet;
 
-  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
-  double ddz = aPanel->getDDZ();
-  double ss = aPanel->getSpatialStep();
+    double ddz = aPanel->getDDZ();
+    double ss = aPanel->getSpatialStep();
 
-  std::set<int> InvInd;
+    std::set<int> InvInd;
 
 #ifdef _DEBUG
-  const int MAX_POINTS_IN_PREVIEW = 50000;
+    const int MAX_POINTS_IN_PREVIEW = 50000;
 #else
-  const int MAX_POINTS_IN_PREVIEW = 500000;
+    const int MAX_POINTS_IN_PREVIEW = 500000;
 #endif
 
-  HYDROData_Bathymetry::AltitudePoints points;
-
-  bool ProjStat = true;
-  NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> warnings;
-  bool ToEstimateWarnings = false;
-  HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB,
-    OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, ProjStat, warnings, ToEstimateWarnings );
-
-  aPanel->clearAllBackgroundColorsForProfileList();
- // for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
- //   aPanel->setBackgroundColorForProfileList(*it, QColor(Qt::yellow));
-
-  aPrsDef.myInlet = OutInlet;
-  aPrsDef.myOutlet = OutOutlet;
-  aPrsDef.myLeftBank = OutLeftB;
-  aPrsDef.myRightBank = OutRightB;
-  if (ProjStat)
-    aPrsDef.myPrs2D = Out2dPres;
-  aPrsDef.myPrs3D = Out3dPres;
+    HYDROData_Bathymetry::AltitudePoints points;
 
-  aPanel->clearWarnings();
-  if (!ProjStat)
-    aPanel->addWarning(tr("STREAM_PROJECTION_FAILED"));
-
-  for (NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>::Iterator it(warnings); it.More(); it.Next())
-  {
-    const QSet<QString>& V = it.Value();
-    if (V.empty())
-      continue;
-    const Handle(HYDROData_Profile)& K = it.Key();
-    QString ProfName = K->GetName();
-    foreach (QString str, V)
+    bool ProjStat = true;
+    NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> warnings;
+    bool ToEstimateWarnings = false;
+    HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB,
+      OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, ProjStat, warnings, ToEstimateWarnings );
+
+    aPanel->clearAllBackgroundColorsForProfileList();
+    // for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
+    //   aPanel->setBackgroundColorForProfileList(*it, QColor(Qt::yellow));
+
+    aPrsDef.myInlet = OutInlet;
+    aPrsDef.myOutlet = OutOutlet;
+    aPrsDef.myLeftBank = OutLeftB;
+    aPrsDef.myRightBank = OutRightB;
+    if (ProjStat)
+      aPrsDef.myPrs2D = Out2dPres;
+    aPrsDef.myPrs3D = Out3dPres;
+
+    aPanel->clearWarnings();
+    if (!ProjStat)
+      aPanel->addWarning(tr("STREAM_PROJECTION_FAILED"));
+
+    for (NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>::Iterator it(warnings); it.More(); it.Next())
     {
-      aPanel->addWarning("Profile: " + ProfName + ":  " + str);    
+      const QSet<QString>& V = it.Value();
+      if (V.empty())
+        continue;
+      const Handle(HYDROData_Profile)& K = it.Key();
+      QString ProfName = K->GetName();
+      foreach (QString str, V)
+      {
+        aPanel->addWarning("Profile: " + ProfName + ":  " + str);    
+      }
+
+      aPanel->setBackgroundColorForProfileList(ProfName, QColor(Qt::yellow));
     }
 
-    aPanel->setBackgroundColorForProfileList(ProfName, QColor(Qt::yellow));
+    myPreviewPrs->setShape( aPrsDef.myPrs2D );
+  }
+  else //mode == 1
+  {
+    aPanel->clearAllBackgroundColorsForProfileList();
+    aPanel->clearWarnings();
+    int nbProfPoints = aPanel->getNbProfilePoints();
+    double ss = aPanel->getSpatialStep();
+    QString axisName = aPanel->getAxisName();
+    QString leftBankName = aPanel->getLeftBankName();
+    QString rightBankName = aPanel->getRightBankName();
+    QList<Handle(HYDROData_Entity)> listProf = aPanel->getProfiles();
+    HYDROData_SequenceOfObjects seqProf;
+    foreach (Handle(HYDROData_Entity) ent, listProf)
+      seqProf.Append(ent);
+
+    Handle(HYDROData_PolylineXY) axis = Handle(HYDROData_PolylineXY)::DownCast(  HYDROGUI_Tool::FindObjectByName( module(), axisName, KIND_POLYLINEXY ) );
+    Handle(HYDROData_PolylineXY) LB = Handle(HYDROData_PolylineXY)::DownCast(  HYDROGUI_Tool::FindObjectByName( module(), leftBankName, KIND_POLYLINEXY ) );
+    Handle(HYDROData_PolylineXY) RB = Handle(HYDROData_PolylineXY)::DownCast(  HYDROGUI_Tool::FindObjectByName( module(), rightBankName, KIND_POLYLINEXY ) );
+    HYDROData_Bathymetry::AltitudePoints outBathypoints;
+
+    std::vector<std::string> warnings;
+    HYDROData_Stream::PrsDefinition prsDef;
+
+    HYDROData_StreamLinearInterpolation::Perform(seqProf, 500, 1, axis, LB, RB, outBathypoints, true, true, prsDef, &warnings); 
+    //TODO for prs3d??
+    myPreviewPrs->setShape( prsDef.myPrs2D );
+    for (int i=0;i<warnings.size();i++)
+      aPanel->addWarning(warnings[i].c_str());
   }
-
-  myPreviewPrs->setShape( aPrsDef.myPrs2D );
 }
 
 void HYDROGUI_StreamOp::erasePreview()
@@ -491,6 +576,7 @@ void HYDROGUI_StreamOp::erasePreview()
 
 void HYDROGUI_StreamOp::onAddProfiles()
 {
+  //TODO skip if mode == 1??
   Handle(HYDROData_PolylineXY) aHydAxis = Handle(HYDROData_PolylineXY)::DownCast(
     HYDROGUI_Tool::FindObjectByName( module(), myHydAxis, KIND_POLYLINEXY ) );
   //if ( aHydAxis.IsNull() )
@@ -616,16 +702,26 @@ void HYDROGUI_StreamOp::onRemoveProfiles( const QStringList& theProfilesToRemove
 
 void HYDROGUI_StreamOp::onDDZValueChanged( double d )
 {
-   createPreview();
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  if (!aPanel)
+    return;
+  if (aPanel->getMode() == 0)
+    createPreview();
 }
 
 void HYDROGUI_StreamOp::onSSValueChanged( double d )
 {
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  if (!aPanel)
+    return;
    createPreview();
 }
 
 void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis )
 {
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  if (!aPanel)
+    return;
   // Get axis object   
   Handle(HYDROData_PolylineXY) aNewAxis = Handle(HYDROData_PolylineXY)::DownCast(
     HYDROGUI_Tool::FindObjectByName( module(), theNewAxis, KIND_POLYLINEXY ) );
@@ -704,6 +800,38 @@ void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis )
   }
 }
 
+void HYDROGUI_StreamOp::onLeftBankChanged( const QString& theNewAxis )
+{
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  if (!aPanel)
+    return;
+  if (aPanel->getMode() == 1)
+    createPreview();
+}
+
+void HYDROGUI_StreamOp::onRightBankChanged( const QString& theNewAxis )
+{
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  if (!aPanel)
+    return;
+  if (aPanel->getMode() == 1)
+    createPreview();
+}
+
+void HYDROGUI_StreamOp::onProfilePointsChanged( int d )
+{
+  HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
+  if (!aPanel)
+    return;
+  if (aPanel->getMode() == 1)
+    createPreview();
+}
+
+void HYDROGUI_StreamOp::onModeChanged( bool mode )
+{
+  createPreview();
+}
+
 void HYDROGUI_StreamOp::updatePanelData()
 {
   HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
@@ -712,4 +840,5 @@ void HYDROGUI_StreamOp::updatePanelData()
 
   aPanel->setAxisName( myHydAxis );
   aPanel->setProfiles( myProfiles );
+
 }
index 5e3a91604460a1d834d3d8eef723d799fd5be64e..2f2616d74f8e751ce3cd32a320ef9f5bb605f47b 100755 (executable)
@@ -55,6 +55,12 @@ private slots:
   void                         onAxisChanged( const QString& );
   void                         onDDZValueChanged( double d );
   void                         onSSValueChanged( double d );
+  void                         onLeftBankChanged( const QString& );
+  void                         onRightBankChanged( const QString& );
+  void                         onProfilePointsChanged( int ); 
+  void                         onModeChanged( bool ); 
+
+
 
 private:
   void                         createPreview();
@@ -70,6 +76,9 @@ private:
   QString                      myHydAxis;
   QStringList                  myProfiles;
   QList<double>                myProfileParams;
+  //QString                      myLeftBank;
+  //QString                      myRightBank;
+
 };
 
 #endif
index 545516e2239276404081fe193d52fa8cba6d2ba7..1e87f9f18e4a1f7c8315ee7f71f80c606ba5ae89 100755 (executable)
@@ -3001,8 +3001,24 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>Stream ddz</translation>\r
     </message>\r
     <message>\r
-      <source>STREAM_SPATIAL_STEP</source>\r
-      <translation>Stream spatial step</translation>\r
+      <source>VIA_DTM</source>\r
+      <translation>via DTM</translation>\r
+    </message>\r
+    <message>\r
+      <source>VIA_LISM</source>\r
+      <translation>via Linear Interpolation</translation>\r
+    </message>\r
+    <message>\r
+      <source>STREAM_LEFT_BANK</source>\r
+      <translation>Left Bank</translation>\r
+    </message>\r
+    <message>\r
+      <source>STREAM_RIGHT_BANK</source>\r
+      <translation>Right Bank</translation>\r
+    </message>\r
+    <message>\r
+      <source>STREAM_PROFILE_POINTS</source>\r
+      <translation>Number of points on profiles</translation>\r
     </message>\r
 \r
     <message>\r