Salome HOME
The data model has been rolled back to previous version.
[modules/hydro.git] / src / HYDROData / HYDROData_IPolyline.h
index ebb57a313b47d99ab2d95d4a9a6232be80914333..9155f6930bb12d49058ac50e8d9ed6e1ca4d4eff 100644 (file)
@@ -4,22 +4,22 @@
 
 #include "HYDROData_Entity.h"
 
-#include <CurveCreator.hxx>
-#include <CurveCreator_ICurve.hxx>
 
 DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
 
+class gp_XY;
 class TopoDS_Wire;
 class Handle(TDataStd_RealList);
-class Handle(TDataStd_ExtStringList);
-class Handle(TDataStd_IntegerList);
-class Handle(TDataStd_BooleanList);
 
 /**\class HYDROData_IPolyline
  * \brief Base class that stores/retreives information about the 2D points.
  */
-class HYDROData_IPolyline : public HYDROData_Entity, public CurveCreator_ICurve
+class HYDROData_IPolyline : public HYDROData_Entity
 {
+public:
+
+  typedef gp_XY                       Point;
+  typedef NCollection_Sequence<Point> PointsList;
 
 protected:
   /**
@@ -28,18 +28,7 @@ protected:
   enum DataTag
   {
     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
-    DataTag_Sections,
     DataTag_Points,
-    DataTag_Operations
-  };
-
-  /**
-   * Enumeration of tags corresponding to the operations child lable
-   */
-  enum OperationsTag
-  {
-    OperationsTag_Commited,
-    OperationsTag_Undoed
   };
 
 public:
@@ -48,82 +37,89 @@ public:
   /**
    * Returns the 3D presentation of all points.
    */
-  HYDRODATA_EXPORT virtual ListAISObjects constructWire() const = 0;
+  HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const = 0;
 
 
-public:
+  /**
+   * Returns number of sections.
+   */
+  HYDRODATA_EXPORT virtual int NbSections() const = 0;
 
-  // Implementation of ICurvePolyline interface
-  
-  /***********************************************/
-  /***          Undo/Redo methods              ***/
-  /***********************************************/
+  /**
+   * Adds new one section.
+   * \param theIsClosed flag indicates type of polyline
+   */
+  HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed ) = 0;
 
-  //! Get number of available undo operations
-  HYDRODATA_EXPORT virtual int getNbUndo() const;
+  /**
+   * Returns true if section with given index is closed.
+   * \param theSectionIndex index of section
+   */
+  HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
 
-  //! Undo previous operation
-  HYDRODATA_EXPORT virtual bool undo();
+  /**
+   * Removes section with given index.
+   * \param theSectionIndex index of section
+   */
+  HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
 
-  //! Get number of available redo operations
-  HYDRODATA_EXPORT virtual int getNbRedo() const;
+  /**
+   * Removes all sections.
+   */
+  HYDRODATA_EXPORT virtual void RemoveSections() = 0;
 
-  //! Redo last previously "undone" operation
-  HYDRODATA_EXPORT virtual bool redo();
 
+  /**
+   * Return number of profile points.
+   * \return number of points
+   */
+  HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
 
-  /***********************************************/
-  /***           Point methods                 ***/
-  /***********************************************/
+  /**
+   * Adds new point for section with index "theSectionIndex".
+   * \param theSectionIndex index of section
+   * \param thePoint point to add
+   * \param theBeforeIndex if not equal -1 then insert point before this index
+   */
+  HYDRODATA_EXPORT virtual void AddPoint( const int    theSectionIndex,
+                                          const Point& thePoint,
+                                          const int    theBeforeIndex = -1 ) = 0;
 
-  //! Get the dimension.
-  HYDRODATA_EXPORT virtual CurveCreator::Dimension getDimension() const;
+  /**
+   * Replaces point for section with index "theSectionIndex".
+   * \param theSectionIndex index of section
+   * \param thePointIndex index of point to replace
+   * \param thePoint new point
+   */
+  HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
+                                          const int    thePointIndex,
+                                          const Point& thePoint ) = 0;
 
+  /**
+   * Removes point from section with index "theSectionIndex".
+   * \param theSectionIndex index of section
+   * \param thePointIndex index of point
+   */
+  HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
+                                             const int thePointIndex ) = 0;
 
-  //! Get coordinates of specified point
-  HYDRODATA_EXPORT virtual CurveCreator::Coordinates getPoint( const int theISection, 
-                                                               const int theIPnt ) const;
 
   /**
-   *  Get number of points in specified section or (the total number of points
-   *  in Curve if theISection is equal to -1).
+   * Returns list of points.
+   * \param theSectionIndex if not equal -1 then list of points returned
+   *                        only for section with this index
+   * \return list of points
    */
-  HYDRODATA_EXPORT virtual int getNbPoints( const int theISection = -1 ) const;
-
+  HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
 
 protected:
 
-  void startOperation();
-
-  void commitOperation();
-
-  void abortOperation();
-
-
-  void setNbOperations( const int theNb );
-
-  int  getNbOperations() const;
-
-  
-  void setNbUndoedOperations( const int theNb );
-
-  int  getNbUndoedOperations() const;
-
-
-  void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
-                         Handle(TDataStd_IntegerList)&   theTypesList,
-                         Handle(TDataStd_BooleanList)&   theClosuresList,
-                         const bool                      theIsCreate = true ) const;
-
-  void removeSectionsLists();
-
-
   void getPointsLists( const int                  theSectionIndex,
                        Handle(TDataStd_RealList)& theListX,
                        Handle(TDataStd_RealList)& theListY,
                        const bool                 theIsCreate = true ) const;
 
-  void removePointsLists( const int theSectionIndex = -1 );
+  void removePointsLists( const int theSectionIndex ) const;
 
 protected:
 
@@ -131,16 +127,12 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDRODATA_EXPORT HYDROData_IPolyline();
+  HYDROData_IPolyline();
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
    */
-  HYDRODATA_EXPORT ~HYDROData_IPolyline();
-
-protected:
-
-  bool myIsOperation;
+  ~HYDROData_IPolyline();
 };
 
 #endif