X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Polyline.h;h=4f9e4008fb1d5eb923a82a09d774c4394a8293bb;hb=f108c7fd8c3b2dbb8c263b14456a31f8dd1d0921;hp=641ade902f5a3b6085e374b88a35c1b19d7e1ff3;hpb=94f079c9197f9655e023e5047feffea452b4a1fe;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Polyline.h b/src/HYDROData/HYDROData_Polyline.h index 641ade90..4f9e4008 100755 --- a/src/HYDROData/HYDROData_Polyline.h +++ b/src/HYDROData/HYDROData_Polyline.h @@ -3,12 +3,28 @@ #include +#include + #include #include #include +class TopoDS_Wire; + DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object) +struct PolylineSection +{ +public: + enum SectionType{ SECTION_POLYLINE=0, SECTION_SPLINE=1 }; + + PolylineSection(){ myIsClosed=true; myType=SECTION_POLYLINE; mySectionName="Section";} + TCollection_ExtendedString mySectionName; + SectionType myType; + bool myIsClosed; + QList myCoords; +}; + /**\class HYDROData_Polyline * \brief Class that stores/retreives information about the painter path. * @@ -17,6 +33,24 @@ DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object) */ class HYDROData_Polyline : public HYDROData_Object { +public: + + typedef QList PolylineData; + +protected: + /** + * Enumeration of tags corresponding to the persistent object parameters. + */ + enum DataTag + { + DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve + DataTag_SectionsName, + DataTag_SectionsClosed, + DataTag_SectionsSize, + DataTag_SectionsType, + DataTag_Wire + }; + public: DEFINE_STANDARD_RTTI(HYDROData_Polyline); @@ -26,53 +60,71 @@ public: HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;} /** - * Replace current array by points list - * \param thePoint the point to add + * Dump object to Python script representation. + */ + HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const; + + /** + * Returns data of object wrapped to QVariant. + * Reimplemented to wrap and return saved path. + */ + HYDRODATA_EXPORT virtual QVariant GetDataVariant(); + + /** + * Replace current polyline data by new sections list + * \param theSections the sections list */ - HYDRODATA_EXPORT void setPoints( QList thePointsList ); + HYDRODATA_EXPORT void setPolylineData( const PolylineData& theSections ); /** - * Add point to the end of point list - * \param thePoint the point to add + * Return polyline data + * \return polyline section list */ - HYDRODATA_EXPORT void addPoint( const QPointF& thePoint ); + HYDRODATA_EXPORT PolylineData getPolylineData() const; /** - * Add point to the point list at the specified position - * \param theIndex the index of the list the point will insert after + * Returns true if polyline is closed */ - HYDRODATA_EXPORT void insertPoint( int theIndex, const QPointF& thePoint); + HYDRODATA_EXPORT bool isClosed() const; /** - * Remove point from polyline - * \param theIndex the point index + * Return polyline dimension + * \return polyline dimension (2 or 3) */ - HYDRODATA_EXPORT void removePoint( int theIndex ); + HYDRODATA_EXPORT int getDimension() const; /** - * Remove all points from polyline - * \param theIndex the point index + * Set polyline dimension (2 or 3) + * \param theDimension the polyline dimension */ - HYDRODATA_EXPORT void removeAllPoints(); + HYDRODATA_EXPORT void setDimension( int theDimension ); /** - * Return list point count - * \return list point count + * Remove all sections from polyline */ - HYDRODATA_EXPORT int pointsCount(); + HYDRODATA_EXPORT void removeAll(); /** - * Returns list of points - * \return list of points + * Returns the painter path. + * Note: currently only the first section of the polyline data is taken into account. */ - HYDRODATA_EXPORT QList points(); + HYDRODATA_EXPORT QPainterPath painterPath() const; + /** + * Sets the wire contour of the object. + */ + HYDRODATA_EXPORT void SetWire( const TopoDS_Wire& theWire ); /** - * Returns the painter path. The painter path is construct by lines + * Returns the wire contour of the object. */ - HYDRODATA_EXPORT QPainterPath painterPathLinear(); + HYDRODATA_EXPORT TopoDS_Wire Wire() const; +protected: + /** + * Update the wire contour on the basis of the polyline data. + */ + void UpdateWire( const PolylineData& theSections ); protected: @@ -88,7 +140,6 @@ protected: * Destructs properties of the object and object itself, removes it from the document. */ ~HYDROData_Polyline(); - }; #endif