Salome HOME
Sorting alphabetically.
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline.h
index a75650479eb774fbe191740b662314ffb64dd495..4f9e4008fb1d5eb923a82a09d774c4394a8293bb 100755 (executable)
@@ -9,9 +9,12 @@
 #include <QPainterPath>
 #include <QList>
 
+class TopoDS_Wire;
+
 DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
 
-struct PolylineSection{
+struct PolylineSection
+{
 public:
   enum SectionType{ SECTION_POLYLINE=0, SECTION_SPLINE=1 };
 
@@ -30,6 +33,24 @@ public:
  */
 class HYDROData_Polyline : public HYDROData_Object
 {
+public:
+
+  typedef QList<PolylineSection> 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);
 
@@ -38,18 +59,34 @@ public:
    */
   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
 
+  /**
+   * 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 setPolylineData( const QList<PolylineSection>& theSections );
+  HYDRODATA_EXPORT void setPolylineData( const PolylineData& theSections );
 
   /**
    * Return polyline data
    * \return polyline section list
    */
-  HYDRODATA_EXPORT QList<PolylineSection> getPolylineData();
+  HYDRODATA_EXPORT PolylineData getPolylineData() const;
    
+  /**
+   * Returns true if polyline is closed
+   */
+  HYDRODATA_EXPORT bool isClosed() const;
+
   /**
    * Return polyline dimension
    * \return polyline dimension (2 or 3)
@@ -67,12 +104,27 @@ public:
    */
   HYDRODATA_EXPORT void removeAll();
 
+  /**
+   * Returns the painter path.
+   * Note: currently only the first section of the polyline data is taken into account.
+   */
+  HYDRODATA_EXPORT QPainterPath painterPath() const;
 
   /**
-   * Returns the painter path. The painter path is construct by lines
+   * Sets the wire contour of the object.
    */
-  HYDRODATA_EXPORT QPainterPath painterPath();
+  HYDRODATA_EXPORT void SetWire( const TopoDS_Wire& theWire );
 
+  /**
+   * Returns the wire contour of the object.
+   */
+  HYDRODATA_EXPORT TopoDS_Wire Wire() const;
+
+protected:
+  /**
+   * Update the wire contour on the basis of the polyline data.
+   */
+  void UpdateWire( const PolylineData& theSections );
 
 protected: