+// 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_IPolyline_HeaderFile
#define HYDROData_IPolyline_HeaderFile
#include "HYDROData_Entity.h"
-#include <CurveCreator.hxx>
-#include <CurveCreator_ICurve.hxx>
+class gp_XY;
+class TopoDS_Shape;
+class TDataStd_RealList;
+class TDataStd_ExtStringList;
+class TDataStd_BooleanList;
+class TDataStd_IntegerList;
-DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
-
-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:
+ 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,
};
- /**
- * Enumeration of tags corresponding to the operations child lable
- */
- enum OperationsTag
- {
- OperationsTag_Commited,
- OperationsTag_Undoed
- };
+public:
+ DEFINE_STANDARD_RTTIEXT(HYDROData_IPolyline, HYDROData_Entity);
public:
- DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
/**
- * Returns the 3D presentation of all points.
+ * Sets wire color for object.
*/
- HYDRODATA_EXPORT virtual ListAISObjects constructWire() const = 0;
-
-
-public:
+ HYDRODATA_EXPORT virtual void SetWireColor( const QColor& theColor );
- // Implementation of ICurvePolyline interface
-
- /***********************************************/
- /*** Undo/Redo methods ***/
- /***********************************************/
-
- //! Get number of available undo operations
- HYDRODATA_EXPORT virtual int getNbUndo() const;
+ /**
+ * Returns wire color of object.
+ */
+ HYDRODATA_EXPORT virtual QColor GetWireColor() const;
- //! Undo previous operation
- HYDRODATA_EXPORT virtual bool undo();
+ /**
+ * Returns default wire color for new object.
+ */
+ HYDRODATA_EXPORT static QColor DefaultWireColor();
- //! Get number of available redo operations
- HYDRODATA_EXPORT virtual int getNbRedo() const;
+public:
+ /**
+ * Returns number of sections.
+ */
+ HYDRODATA_EXPORT virtual int NbSections() const = 0;
- //! Redo last previously "undone" operation
- HYDRODATA_EXPORT virtual bool redo();
+ /**
+ * 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;
+ /**
+ * Returns name of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
- /***********************************************/
- /*** Point methods ***/
- /***********************************************/
+ /**
+ * 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 the dimension.
- HYDRODATA_EXPORT virtual CurveCreator::Dimension getDimension() const;
+ /**
+ * Returns type of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
+ /**
+ * 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;
- //! Get coordinates of specified point
- HYDRODATA_EXPORT virtual CurveCreator::Coordinates getPoint( const int theISection,
- const int theIPnt ) 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;
/**
- * Get number of points in specified section or (the total number of points
- * in Curve if theISection is equal to -1).
+ * Set closed flag for section with given index.
+ * \param theSectionIndex index of section
+ * \param theIsClosed new closures state
*/
- HYDRODATA_EXPORT virtual int getNbPoints( const int theISection = -1 ) const;
+ HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
+ const bool theIsClosed ) = 0;
+ /**
+ * Removes section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
-protected:
+ /**
+ * Removes all sections.
+ */
+ HYDRODATA_EXPORT virtual void RemoveSections() = 0;
- void startOperation();
- void commitOperation();
+ /**
+ * Return number of profile points.
+ * \return number of points
+ */
+ HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
- void abortOperation();
+ /**
+ * 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;
+ /**
+ * 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 setNbOperations( const int theNb );
+ /**
+ * 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;
- int getNbOperations() const;
-
- void setNbUndoedOperations( const int theNb );
+ /**
+ * 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, bool IsConvertToGlobal = false ) const = 0;
- int getNbUndoedOperations() const;
+ HYDRODATA_EXPORT TopoDS_Shape GetShape() const;
+ HYDRODATA_EXPORT void SetShape( const TopoDS_Shape& theShape );
+protected:
+ void RemovePolylineShape();
void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
Handle(TDataStd_IntegerList)& theTypesList,
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