X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FHYDROData%2FHYDROData_IPolyline.h;h=0d3d7442ce8f2e074fa37880ee370cb9f346cc44;hb=1c6465288cda49e75392724ddc01aba7cfe4ef68;hp=ebb57a313b47d99ab2d95d4a9a6232be80914333;hpb=7e825ec456c9331ef0df1cb59865cc55f0d8516a;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_IPolyline.h b/src/HYDROData/HYDROData_IPolyline.h index ebb57a31..0d3d7442 100644 --- a/src/HYDROData/HYDROData_IPolyline.h +++ b/src/HYDROData/HYDROData_IPolyline.h @@ -4,22 +4,28 @@ #include "HYDROData_Entity.h" -#include -#include DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity) -class TopoDS_Wire; +class gp_XY; +class TopoDS_Shape; class Handle(TDataStd_RealList); class Handle(TDataStd_ExtStringList); -class Handle(TDataStd_IntegerList); class Handle(TDataStd_BooleanList); +class Handle(TDataStd_IntegerList); + /**\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: + + enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 }; + + typedef gp_XY Point; + typedef NCollection_Sequence PointsList; protected: /** @@ -28,18 +34,9 @@ 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 + DataTag_Sections, + DataTag_PolylineShape, }; public: @@ -48,66 +45,128 @@ public: /** * Returns the 3D presentation of all points. */ - HYDRODATA_EXPORT virtual ListAISObjects constructWire() const = 0; + HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() = 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 theSectName name of the section + * \param theSectionType type of section + * \param theIsClosed flag indicates closures of section + */ + HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName, + const SectionType theSectionType, + const bool theIsClosed ) = 0; - //! Get number of available undo operations - HYDRODATA_EXPORT virtual int getNbUndo() const; + /** + * Returns name of section with given index. + * \param theSectionIndex index of section + */ + HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0; - //! Undo previous operation - HYDRODATA_EXPORT virtual bool undo(); + /** + * Set name for section with given index. + * \param theSectionIndex index of section + * \param theSectionName new section name + */ + HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex, + const TCollection_AsciiString& theSectionName ) = 0; - //! Get number of available redo operations - HYDRODATA_EXPORT virtual int getNbRedo() const; + /** + * Returns type of section with given index. + * \param theSectionIndex index of section + */ + HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0; - //! Redo last previously "undone" operation - HYDRODATA_EXPORT virtual bool redo(); + /** + * Set type for section with given index. + * \param theSectionIndex index of section + * \param theSectionType new section type + */ + HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex, + const SectionType theSectionType ) = 0; + /** + * Returns true if section with given index is closed. + * \param theSectionIndex index of section + */ + HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0; - /***********************************************/ - /*** Point methods ***/ - /***********************************************/ + /** + * Set closed flag for section with given index. + * \param theSectionIndex index of section + * \param theIsClosed new closures state + */ + HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex, + const bool theIsClosed ) = 0; - //! Get the dimension. - HYDRODATA_EXPORT virtual CurveCreator::Dimension getDimension() const; + /** + * Removes section with given index. + * \param theSectionIndex index of section + */ + HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0; + /** + * Removes all sections. + */ + HYDRODATA_EXPORT virtual void RemoveSections() = 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). + * Return number of profile points. + * \return number of points */ - HYDRODATA_EXPORT virtual int getNbPoints( const int theISection = -1 ) const; + HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const; + /** + * 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; -protected: - - void startOperation(); + /** + * Replaces point for section with index "theSectionIndex". + * \param theSectionIndex index of section + * \param thePoint new point + * \param thePointIndex index of point to replace + */ + HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex, + const Point& thePoint, + const int thePointIndex ) = 0; - void commitOperation(); + /** + * 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; - void abortOperation(); + /** + * 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 PointsList GetPoints( const int theSectionIndex = -1 ) const = 0; - void setNbOperations( const int theNb ); +protected: - int getNbOperations() const; + TopoDS_Shape getPolylineShape() const; - - void setNbUndoedOperations( const int theNb ); + void setPolylineShape( const TopoDS_Shape& theShape ); - int getNbUndoedOperations() const; + void removePolylineShape(); void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList, @@ -117,13 +176,12 @@ protected: 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 = -1 ) const; protected: @@ -137,10 +195,6 @@ protected: * Destructs properties of the object and object itself, removes it from the document. */ HYDRODATA_EXPORT ~HYDROData_IPolyline(); - -protected: - - bool myIsOperation; }; #endif