Salome HOME
Merge commit '0d956a814' into pre/IMPS_2016
[modules/hydro.git] / src / HYDROData / HYDROData_Stream.h
index f44f2d2452e7d9302f2baf6df02c52077f16496c..77d9bb5fc13e9ed8b9123ad58fb50e351f28f3e6 100644 (file)
@@ -1,3 +1,20 @@
+// 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_Stream_HeaderFile
 #define HYDROData_Stream_HeaderFile
 
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
 
 #include <Geom_BSplineCurve.hxx>
+#include <vector>
 
 DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject)
 
 class Handle(HYDROData_PolylineXY);
+class Handle(HYDROData_Polyline3D);
 class Handle(HYDROData_Profile);
+class HYDROData_IProfilesInterpolator;
 class TColStd_Array1OfReal;
+class Handle(TopTools_HArray1OfShape);
+class Handle_HYDROData_DTM;
+class TopTools_ListOfShape;
+
 
 /**\class HYDROData_Stream
  * \brief 
@@ -27,10 +52,10 @@ public:
   {
     TopoDS_Shape myPrs3D;
     TopoDS_Shape myPrs2D;
-    TopoDS_Edge  myLeftBank;
-    TopoDS_Edge  myRightBank;
-    TopoDS_Edge  myInlet;
-    TopoDS_Edge  myOutlet;
+    TopoDS_Shape myLeftBank;   // 3d curve of the left bank
+    TopoDS_Shape myRightBank;  // 3d curve of the right bank
+    TopoDS_Shape myInlet;      // first (inlet) 2d profile 
+    TopoDS_Shape myOutlet;     // last (inlet) 2d profile 
   };
 
 protected:
@@ -42,7 +67,8 @@ protected:
     DataTag_First = HYDROData_NaturalObject::DataTag_First + 100, ///< first tag, to reserve
     DataTag_HydraulicAxis,     ///< reference hydraulic axis
     DataTag_Profile,           ///< reference profiles
-    DataTag_ParamsArray        ///< parameters array
+    DataTag_ParamsArray,       ///< parameters array
+    DataTag_BottomPolyline     ///< reference bottom polyline
   };
 
 public:
@@ -54,9 +80,13 @@ public:
   /**
    * Creates the presentations(2D and 3D) by given hydraulic axis and profiles.
    */
-  HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis,
-                                                    const HYDROData_SequenceOfObjects&  theProfiles,
-                                                    PrsDefinition&                      thePrs );
+  HYDRODATA_EXPORT static bool CreatePresentations( const Handle_HYDROData_DTM& theDTM,
+                                                    PrsDefinition&              thePrs );
+
+  HYDRODATA_EXPORT static void CreatePresentations( const Handle(TColgp_HArray1OfPnt)     theArrayOfFPnt,
+                                                    const Handle(TColgp_HArray1OfPnt)     theArrayOfLPnt,
+                                                    const Handle(TopTools_HArray1OfShape) theArrOfProfiles,
+                                                    PrsDefinition&                        thePrs );
 
 public:
 
@@ -68,23 +98,14 @@ public:
   /**
    * Dump object to Python script representation.
    */
-  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
+                                                     MapOfTreatedObjects& theTreatedObjects ) const;
 
   /**
    * Returns the list of all reference objects of this object.
    */
   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
 
-  /**
-   * Returns the top shape of the object.
-   */
-  HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
-
-  /**
-   * Returns the 3d shape of the object.
-   */
-  HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
-
   /**
    * Update the profiles order and shape presentations of stream.
    * Call this method whenever you made changes for stream data.
@@ -99,17 +120,24 @@ public:
   /**
    * Update the shape presentations of stream.
    */
-  HYDRODATA_EXPORT virtual void UpdatePrs();
+  HYDRODATA_EXPORT void UpdatePrs( const Handle_HYDROData_DTM& );
+
+  /**
+   *
+   */
+  HYDRODATA_EXPORT virtual void CopyTo( const Handle(HYDROData_Entity)& theDestination,
+                                        bool isGenerateNewName ) const;
+
 
   /**
    * Returns default filling color for new stream.
    */
-  HYDRODATA_EXPORT static QColor DefaultFillingColor();
+  HYDRODATA_EXPORT virtual QColor DefaultFillingColor() const;
 
   /**
    * Returns default border color for new stream.
    */
-  HYDRODATA_EXPORT static QColor DefaultBorderColor();
+  HYDRODATA_EXPORT virtual QColor DefaultBorderColor() const;
 
   /**
    * Returns true if given polyline can be used as stream axis.
@@ -180,8 +208,7 @@ public:
   /**
   * Builds a planar face
   */
-  HYDRODATA_EXPORT static bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis,
-                                          TopoDS_Face&                        thePlane );
+  HYDRODATA_EXPORT static void BuildRefFace( TopoDS_Face& thePlane );
 
   /**
    * Add new one reference profile object for stream.
@@ -208,6 +235,38 @@ public:
    * Removes all reference profile objects from stream.
    */
   HYDRODATA_EXPORT virtual void RemoveProfiles();
+
+  /**
+   * Generates bottom polyline for stream or update the existing bottom polyline.
+   * \return true in case of success
+   */
+  HYDRODATA_EXPORT virtual bool GenerateBottomPolyline();
+
+  /**
+   * Returns reference bottom polyline object of stream.
+   */
+  HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline3D) GetBottomPolyline() const;
+  
+  /**
+   * Sets reference bottom polyline object for stream.
+   * \param theBottom the polyline 3D
+   * \return true in case of success
+   */
+  HYDRODATA_EXPORT virtual bool SetBottomPolyline( const Handle(HYDROData_Polyline3D)& theBottom );
+
+  /**
+   * Add interpolated profiles into the stream.
+   * \param theInterpolator the interpolator
+   * \return true in case of success
+   */
+  HYDRODATA_EXPORT virtual bool Interpolate( HYDROData_IProfilesInterpolator* theInterpolator );
+  
+
+  HYDRODATA_EXPORT double GetDDZ() const;
+  HYDRODATA_EXPORT void   SetDDZ( double theDDZ );
+  
+  HYDRODATA_EXPORT double GetSpatialStep() const;
+  HYDRODATA_EXPORT void   SetSpatialStep( double theSpatialStep );
   
 protected:
 
@@ -235,16 +294,6 @@ protected:
   static Handle(Geom_BSplineCurve) buildInterpolationCurve(
     const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt );
 
-  /**
-   * Returns default filling color for new object.
-   */
-  HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
-
-  /**
-   * Returns default border color for new object.
-   */
-  HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
-
 private:
   
   void setParametersArray( const TColStd_Array1OfReal& theArray );
@@ -257,9 +306,12 @@ private:
 
   void removeParameter( const int& theIndex );
 
-protected:
+  Handle_HYDROData_DTM DTM() const;
 
+
+protected:
   friend class HYDROData_Iterator;
+  friend class test_HYDROData_Stream;
 
   /**
    * Creates new object in the internal data structure. Use higher level objects