#include "HYDROData_Entity.h"
-#include <CurveCreator.hxx>
-#include <CurveCreator_ICurve.hxx>
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<Point> PointsList;
protected:
/**
enum DataTag
{
DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
- DataTag_Sections,
DataTag_Points,
- DataTag_Operations
+ DataTag_Sections,
+ DataTag_PolylineShape,
+ DataTag_WireColor,
};
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
+
+public:
+
/**
- * Enumeration of tags corresponding to the operations child lable
+ * Sets wire color for object.
*/
- enum OperationsTag
- {
- OperationsTag_Commited,
- OperationsTag_Undoed
- };
+ HYDRODATA_EXPORT virtual void SetWireColor( const QColor& theColor );
+
+ /**
+ * Returns wire color of object.
+ */
+ HYDRODATA_EXPORT virtual QColor GetWireColor() const;
+
+ /**
+ * Returns default wire color for new object.
+ */
+ HYDRODATA_EXPORT static QColor DefaultWireColor();
public:
- DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
/**
* Returns the 3D presentation of all points.
*/
- HYDRODATA_EXPORT virtual ListAISObjects constructWire() const = 0;
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() 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 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;
-protected:
+ /**
+ * 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;
- 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,
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:
* Destructs properties of the object and object itself, removes it from the document.
*/
HYDRODATA_EXPORT ~HYDROData_IPolyline();
-
-protected:
-
- bool myIsOperation;
};
#endif