Salome HOME
Refs #289 - Spline profile is represented in OCC view as polyline profile
[modules/hydro.git] / src / HYDROData / HYDROData_Stream.h
index a8a08ff29b130d304386d66fd8468fe655b2a731..fd340d335c0296bb1ef8d44fd4b1a38f9c8c9929 100644 (file)
@@ -4,10 +4,12 @@
 
 #include "HYDROData_NaturalObject.h"
 #include <TopoDS_Face.hxx>
+#include <Geom_BSplineCurve.hxx>
 DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject)
 
 class Handle(HYDROData_PolylineXY);
 class Handle(HYDROData_Profile);
+class TColStd_Array1OfReal;
 
 /**\class HYDROData_Stream
  * \brief 
@@ -24,6 +26,7 @@ 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
   };
 
 public:
@@ -55,15 +58,58 @@ public:
   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
 
   /**
-   * Update the shape presentations of stream.
+   * Update the profiles order and shape presentations of stream.
    * Call this method whenever you made changes for stream data.
    */
   HYDRODATA_EXPORT virtual void Update();
 
+  /**
+   * Update the shape presentations of stream.
+   */
+  HYDRODATA_EXPORT virtual void UpdatePrs();
+
+  /**
+   * Returns default filling color for new stream.
+   */
+  HYDRODATA_EXPORT static QColor DefaultFillingColor();
+
+  /**
+   * Returns default border color for new stream.
+   */
+  HYDRODATA_EXPORT static QColor DefaultBorderColor();
+
+  /**
+   * Returns true if given polyline can be used as stream axis.
+   */
+  HYDRODATA_EXPORT static bool IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theAxis );
 
 public:      
-  // Public methods to work with Stream
+  // Public methods to work with Stream presentation
   
+  /**
+   * Returns the left edge of the stream.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const;
+
+  /**
+   * Returns the right edge of the stream.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const;
+
+  /**
+   * Returns the inlet edge of the stream.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetInletShape() const;
+
+  /**
+   * Returns the outlet edge of the stream.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetOutletShape() const;
+
+
+public:      
+  // Public methods to work with Stream data fields
+
   /**
    * Sets reference hydraulic axis object for stream.
    */
@@ -79,6 +125,14 @@ public:
    */
   HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
 
+  /**
+   * 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,
+   * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point. 
+   */
+  HYDRODATA_EXPORT static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis, 
+                                                const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
+                                                                                                                       Standard_Real& outPar);
 
   /**
    * Returns true if profile has the intersection with reference hydraulic axis.
@@ -86,7 +140,7 @@ public:
    * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point. 
    */
   HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
-                                                                                               Standard_Real& outPar) const;
+                                                                                                                        Standard_Real& outPar) const;
 
    /**
    * Builds a planar face
@@ -112,20 +166,58 @@ public:
    * Removes all reference profile objects from stream.
    */
   HYDRODATA_EXPORT virtual void RemoveProfiles();
-
-
+  
 protected:
 
   /**
    * Insert one profile in to the stream profiles order.
    */
-  void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile );
+  void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
+                               const int                        theBeforeIndex = -1 );
 
   /**
    * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
    * If hydraulic axis is not set all profiles will be removed from order.
    */
   void updateProfilesOrder();
+  
+  /**
+   * Create all necessary child group objects.
+   */
+  virtual void createGroupObjects();
+
+  /**
+   * Returns the type of child altitude object.
+   * Reimplemented to create stream altitude object.
+   */
+  virtual ObjectKind getAltitudeObjectType() const;
+
+  /**
+   * Builds b-spline using interpolation algorithm.
+   */
+  Handle(Geom_BSplineCurve) buildInterpolationCurve(const   Handle(TColgp_HArray1OfPnt)& theArrayOfPnt);
+
+  /**
+   * Returns default filling color for new object.
+   */
+  virtual QColor getDefaultFillingColor() const;
+
+  /**
+   * Returns default border color for new object.
+   */
+  virtual QColor getDefaultBorderColor() const;
+
+private:
+  
+  void setParametersArray( const TColStd_Array1OfReal& theArray );
+
+  TColStd_Array1OfReal* getParametersArray() const;
+
+  void removeParametersArray();
+
+  int insertParameter( const Standard_Real& theParam );
+
+  void removeParameter( const int& theIndex );
 
 protected: