]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
The polyline object has deen moved to new realisation.
authoradv <adv@opencascade.com>
Wed, 27 Nov 2013 06:32:36 +0000 (06:32 +0000)
committeradv <adv@opencascade.com>
Wed, 27 Nov 2013 06:32:36 +0000 (06:32 +0000)
44 files changed:
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_IPolyline.cxx
src/HYDROData/HYDROData_IPolyline.h
src/HYDROData/HYDROData_ImmersibleZone.cxx
src/HYDROData/HYDROData_ImmersibleZone.h
src/HYDROData/HYDROData_Iterator.cxx
src/HYDROData/HYDROData_Polyline.cxx
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_PolylineXY.h
src/HYDROData/HYDROData_ProfileUZ.cxx
src/HYDROData/HYDROData_ProfileUZ.h
src/HYDROData/HYDROData_SplitToZonesTool.cxx
src/HYDROData/HYDROData_SplitToZonesTool.h
src/HYDROData/test_HYDROData_OperationsFactory.cxx
src/HYDROData/test_HYDROData_Polyline.cxx [deleted file]
src/HYDROData/test_HYDROData_Polyline.h [deleted file]
src/HYDROData/test_HYDROData_PolylineXY.cxx [new file with mode: 0644]
src/HYDROData/test_HYDROData_PolylineXY.h [new file with mode: 0755]
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DeleteOp.cxx
src/HYDROGUI/HYDROGUI_Displayer.cxx
src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx
src/HYDROGUI/HYDROGUI_PolylineOp.cxx
src/HYDROGUI/HYDROGUI_PolylineOp.h
src/HYDROGUI/HYDROGUI_PrsPolylineDriver.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx
src/HYDROPy/CMakeLists.txt
src/HYDROPy/HYDROData.sip
src/HYDROPy/HYDROData_Document.sip
src/HYDROPy/HYDROData_Entity.sip
src/HYDROPy/HYDROData_IPolyline.sip [new file with mode: 0644]
src/HYDROPy/HYDROData_ImmersibleZone.sip
src/HYDROPy/HYDROData_Object.sip
src/HYDROPy/HYDROData_Polyline.sip [deleted file]
src/HYDROPy/HYDROData_PolylineXY.sip [new file with mode: 0644]
src/HYDROPy/HYDROData_ProfileUZ.sip [new file with mode: 0644]

index 63ee232dde5f0f55743cb1b491abb4bffc3fc405..bd03c1f1c226cf1230f5b128db30c02120f0cb26 100644 (file)
@@ -23,7 +23,7 @@ set(PROJECT_HEADERS
     HYDROData_Object.h
     HYDROData_Obstacle.h
     HYDROData_OperationsFactory.h
-    HYDROData_Polyline.h
+#    HYDROData_Polyline.h
     HYDROData_PolylineXY.h
     HYDROData_Profile.h
     HYDROData_ProfileUZ.h
@@ -58,7 +58,7 @@ set(PROJECT_SOURCES
     HYDROData_Object.cxx
     HYDROData_Obstacle.cxx
     HYDROData_OperationsFactory.cxx
-    HYDROData_Polyline.cxx
+#    HYDROData_Polyline.cxx
     HYDROData_PolylineXY.cxx
     HYDROData_Profile.cxx
     HYDROData_ProfileUZ.cxx
@@ -105,7 +105,7 @@ if(SALOME_BUILD_TESTS)
     test_HYDROData_Image.h
     test_HYDROData_Iterator.h
     test_HYDROData_OperationsFactory.h
-    test_HYDROData_Polyline.h
+    test_HYDROData_PolylineXY.h
   )
 
   set(TEST_SOURCES 
@@ -118,7 +118,7 @@ if(SALOME_BUILD_TESTS)
     test_HYDROData_Image.cxx
     test_HYDROData_Iterator.cxx
     test_HYDROData_OperationsFactory.cxx
-    test_HYDROData_Polyline.cxx
+    test_HYDROData_PolylineXY.cxx
   )
   
   set(TEST_EXE test_HYDROData)
index e6976786bf3c1df5c4f3d67b8782a8cab972935f..3441d309b83d1d5a41c56415ee27cff13b20274c 100644 (file)
@@ -5,7 +5,7 @@
 #include "HYDROData_Document.h"
 #include "HYDROData_Iterator.h"
 #include "HYDROData_NaturalObject.h"
-#include "HYDROData_Polyline.h"
+#include "HYDROData_PolylineXY.h"
 #include "HYDROData_SplitToZonesTool.h"
 #include "HYDROData_Region.h"
 #include "HYDROData_Tool.h"
@@ -138,7 +138,7 @@ void HYDROData_CalculationCase::SplitGeometryObjects()
   if ( aDocument.IsNull() )
     return;
 
-  Handle(HYDROData_Polyline) aBoundaryPolyline = GetBoundaryPolyline();
+  Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
   HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
   if ( aGeomObjects.IsEmpty() )
     return;
@@ -229,9 +229,9 @@ void HYDROData_CalculationCase::RemoveGeometryObjects()
   SetToUpdate( true );
 }
 
-void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
 {
-  Handle(HYDROData_Polyline) aPrevPolyline = GetBoundaryPolyline();
+  Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
 
   SetReferenceObject( thePolyline, DataTag_Polyline );
 
@@ -239,15 +239,15 @@ void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_Poly
   SetToUpdate( !IsEqual( aPrevPolyline, thePolyline ) || IsMustBeUpdated() );
 }
 
-Handle(HYDROData_Polyline) HYDROData_CalculationCase::GetBoundaryPolyline() const
+Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
 {
-  return Handle(HYDROData_Polyline)::DownCast( 
+  return Handle(HYDROData_PolylineXY)::DownCast( 
            GetReferenceObject( DataTag_Polyline ) );
 }
 
 void HYDROData_CalculationCase::RemoveBoundaryPolyline()
 {
-  Handle(HYDROData_Polyline) aPrevPolyline = GetBoundaryPolyline();
+  Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
 
   ClearReferenceObjects( DataTag_Polyline );
 
index 1b6d4bfbeef34bac283ea1d3cf381bb8dd3cb0a3..12e0704a341a73ac3c28d4574549d903f92ba4d0 100644 (file)
@@ -10,7 +10,7 @@ class TopoDS_Shell;
 class Handle(HYDROData_Object);
 class Handle(HYDROData_Region);
 class Handle(HYDROData_Zone);
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_PolylineXY);
 
 DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
 
@@ -89,12 +89,12 @@ public:
   /**
    * Sets reference boundary polyline object for calculation case.
    */
-  HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+  HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
 
   /**
    * Returns reference boundary polyline object of calculation case.
    */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetBoundaryPolyline() const;
+  HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
 
   /**
    * Remove reference boundary polyline object from calculation case.
index 20fe2099ea3e0d96f04f8cf927a3ac8707ecde4b..687318cc064b4d81262b0323f33b98339e7c65e6 100755 (executable)
@@ -3,8 +3,16 @@
 
 #include <gp_XY.hxx>
 
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_IntegerList.hxx>
 #include <TDataStd_RealList.hxx>
 
+#include <TopoDS_Shape.hxx>
+
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
 IMPLEMENT_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IPolyline, HYDROData_Entity)
 
@@ -22,6 +30,61 @@ int HYDROData_IPolyline::NbPoints( const int theSectionIndex ) const
   return GetPoints( theSectionIndex ).Length();
 }
 
+TopoDS_Shape HYDROData_IPolyline::getPolylineShape() const
+{
+  TDF_Label aShapeLabel = myLab.FindChild( DataTag_PolylineShape, false );
+  if ( !aShapeLabel.IsNull() )
+  {
+    Handle(TNaming_NamedShape) aNamedShape;
+    if ( aShapeLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+      return aNamedShape->Get();
+  }
+  return TopoDS_Shape();
+}
+
+void HYDROData_IPolyline::setPolylineShape( const TopoDS_Shape& theShape )
+{
+  TNaming_Builder aBuilder( myLab.FindChild( DataTag_PolylineShape ) );
+  aBuilder.Generated( theShape );
+}
+
+void HYDROData_IPolyline::removePolylineShape()
+{
+  TDF_Label aShapeLabel = myLab.FindChild( DataTag_PolylineShape, false );
+  if ( !aShapeLabel.IsNull() )
+    aShapeLabel.ForgetAllAttributes();
+}
+
+void HYDROData_IPolyline::getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
+                                            Handle(TDataStd_IntegerList)&   theTypesList,
+                                            Handle(TDataStd_BooleanList)&   theClosuresList,
+                                            const bool                      theIsCreate ) const
+{
+  theNamesList.Nullify();
+  theTypesList.Nullify();
+  theClosuresList.Nullify();
+
+  TDF_Label aSectLabel = myLab.FindChild( DataTag_Sections, theIsCreate );
+  if ( aSectLabel.IsNull() )
+    return;
+
+  if ( !aSectLabel.FindAttribute( TDataStd_ExtStringList::GetID(), theNamesList ) && theIsCreate )
+    theNamesList = TDataStd_ExtStringList::Set( aSectLabel );
+
+  if ( !aSectLabel.FindAttribute( TDataStd_IntegerList::GetID(), theTypesList ) && theIsCreate )
+    theTypesList = TDataStd_IntegerList::Set( aSectLabel );
+
+  if ( !aSectLabel.FindAttribute( TDataStd_BooleanList::GetID(), theClosuresList ) && theIsCreate )
+    theClosuresList = TDataStd_BooleanList::Set( aSectLabel );
+}
+
+void HYDROData_IPolyline::removeSectionsLists()
+{
+  TDF_Label aSectsLabel = myLab.FindChild( DataTag_Sections, false );
+  if ( !aSectsLabel.IsNull() )
+    aSectsLabel.ForgetAllAttributes();
+}
+
 void HYDROData_IPolyline::getPointsLists( const int                  theSectionIndex,
                                           Handle(TDataStd_RealList)& theListX,
                                           Handle(TDataStd_RealList)& theListY,
@@ -59,7 +122,14 @@ void HYDROData_IPolyline::removePointsLists( const int theSectionIndex ) const
   if ( aLabel.IsNull() )
     return;
 
-  TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false );
-  if ( !aSectLabel.IsNull() )
-    aSectLabel.ForgetAllAttributes();
+  if ( theSectionIndex < 0 )
+  {
+    aLabel.ForgetAllAttributes();
+  }
+  else
+  {
+    TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false );
+    if ( !aSectLabel.IsNull() )
+      aSectLabel.ForgetAllAttributes();
+  }
 }
index 9155f6930bb12d49058ac50e8d9ed6e1ca4d4eff..0d3d7442ce8f2e074fa37880ee370cb9f346cc44 100644 (file)
@@ -8,8 +8,12 @@
 DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
 
 class gp_XY;
-class TopoDS_Wire;
+class TopoDS_Shape;
 class Handle(TDataStd_RealList);
+class Handle(TDataStd_ExtStringList);
+class Handle(TDataStd_BooleanList);
+class Handle(TDataStd_IntegerList);
+
 
 /**\class HYDROData_IPolyline
  * \brief Base class that stores/retreives information about the 2D points.
@@ -18,6 +22,8 @@ class HYDROData_IPolyline : public HYDROData_Entity
 {
 public:
 
+  enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
+
   typedef gp_XY                       Point;
   typedef NCollection_Sequence<Point> PointsList;
 
@@ -29,6 +35,8 @@ protected:
   {
     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
     DataTag_Points,
+    DataTag_Sections,
+    DataTag_PolylineShape,
   };
 
 public:
@@ -37,7 +45,7 @@ public:
   /**
    * Returns the 3D presentation of all points.
    */
-  HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const = 0;
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() = 0;
 
 
   /**
@@ -47,9 +55,41 @@ public:
 
   /**
    * Adds new one section.
-   * \param theIsClosed flag indicates type of polyline
+   * \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;
+
+  /**
+   * 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;
+
+  /**
+   * Returns type of section with given index.
+   * \param theSectionIndex index of section
    */
-  HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed ) = 0;
+  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;
 
   /**
    * Returns true if section with given index is closed.
@@ -57,6 +97,14 @@ public:
    */
   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
 
+  /**
+   * 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;
+
   /**
    * Removes section with given index.
    * \param theSectionIndex index of section
@@ -88,12 +136,12 @@ public:
   /**
    * Replaces point for section with index "theSectionIndex".
    * \param theSectionIndex index of section
-   * \param thePointIndex index of point to replace
    * \param thePoint new point
+   * \param thePointIndex index of point to replace
    */
   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
-                                          const int    thePointIndex,
-                                          const Point& thePoint ) = 0;
+                                          const Point& thePoint,
+                                          const int    thePointIndex ) = 0;
 
   /**
    * Removes point from section with index "theSectionIndex".
@@ -114,12 +162,26 @@ public:
 
 protected:
 
+  TopoDS_Shape getPolylineShape() const;
+
+  void setPolylineShape( const TopoDS_Shape& theShape );
+
+  void removePolylineShape();
+
+
+  void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
+                         Handle(TDataStd_IntegerList)&   theTypesList,
+                         Handle(TDataStd_BooleanList)&   theClosuresList,
+                         const bool                      theIsCreate = true ) const;
+
+  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 ) const;
+  void removePointsLists( const int theSectionIndex = -1 ) const;
 
 protected:
 
@@ -127,12 +189,12 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDROData_IPolyline();
+  HYDRODATA_EXPORT HYDROData_IPolyline();
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
    */
-  ~HYDROData_IPolyline();
+  HYDRODATA_EXPORT ~HYDROData_IPolyline();
 };
 
 #endif
index c31dac1161c812757e326e82a4bd5052674bcc0b..e35a1f17329e979055cfc591572cf4c200a839fb 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "HYDROData_Bathymetry.h"
 #include "HYDROData_Document.h"
-#include "HYDROData_Polyline.h"
+#include "HYDROData_PolylineXY.h"
 
 #include <BRepBuilderAPI_MakeFace.hxx>
 
@@ -67,7 +67,7 @@ QStringList HYDROData_ImmersibleZone::DumpToPython( MapOfTreatedObjects& theTrea
   Handle(HYDROData_Bathymetry) aRefBathymetry = GetBathymetry();
   setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetBathymetry" );
 
-  Handle(HYDROData_Polyline) aRefPolyline = GetPolyline();
+  Handle(HYDROData_PolylineXY) aRefPolyline = GetPolyline();
   setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
 
   return aResList;
@@ -77,10 +77,10 @@ TopoDS_Shape HYDROData_ImmersibleZone::GetTopShape() const
 {
   TopoDS_Shape aResShape = TopoDS_Face();
 
-  Handle(HYDROData_Polyline) aPolyline = GetPolyline();
+  Handle(HYDROData_PolylineXY) aPolyline = GetPolyline();
   if( !aPolyline.IsNull() )
   {
-    TopoDS_Shape aPolylineShape = aPolyline->GetTopShape();
+    TopoDS_Shape aPolylineShape = aPolyline->GetShape();
     TopTools_ListOfShape aWiresList;
 
     if ( !aPolylineShape.IsNull() && 
@@ -141,14 +141,14 @@ QColor HYDROData_ImmersibleZone::DefaultBorderColor()
   return QColor( Qt::transparent );
 }
 
-void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
 {
   SetReferenceObject( thePolyline, DataTag_Polyline );
 }
 
-Handle(HYDROData_Polyline) HYDROData_ImmersibleZone::GetPolyline() const
+Handle(HYDROData_PolylineXY) HYDROData_ImmersibleZone::GetPolyline() const
 {
-  return Handle(HYDROData_Polyline)::DownCast( 
+  return Handle(HYDROData_PolylineXY)::DownCast( 
            GetReferenceObject( DataTag_Polyline ) );
 }
 
index c540574c60123a90957c6b5e3d77b00132c1c81a..04616f48f923d6a430f395fba570b89b7a72262a 100644 (file)
@@ -6,7 +6,7 @@
 
 DEFINE_STANDARD_HANDLE(HYDROData_ImmersibleZone, HYDROData_NaturalObject)
 
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_PolylineXY);
 
 /**\class HYDROData_ImmersibleZone
  * \brief 
@@ -60,12 +60,12 @@ public:
   /**
    * Sets reference polyline object for zone.
    */
-  HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+  HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
 
   /**
    * Returns reference polyline object of zone.
    */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetPolyline() const;
+  HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetPolyline() const;
 
   /**
    * Remove reference polyline object of zone.
index f33065fab44a56230b684b79524d472d473a986d..b29eec52cc9645442d8332cd36400bbeb82acdee 100644 (file)
@@ -10,7 +10,6 @@
 #include "HYDROData_Image.h"
 #include "HYDROData_ImmersibleZone.h"
 #include "HYDROData_Obstacle.h"
-#include "HYDROData_Polyline.h"
 #include "HYDROData_PolylineXY.h"
 #include "HYDROData_Profile.h"
 #include "HYDROData_ProfileUZ.h"
@@ -107,9 +106,9 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel )
     case KIND_IMAGE:
       aResult = new HYDROData_Image();
       break;
-    case KIND_POLYLINE:
-      aResult = new HYDROData_Polyline();
-      break;
+    //case KIND_POLYLINE:
+      //aResult = new HYDROData_Polyline();
+      //break;
     case KIND_BATHYMETRY:
       aResult = new HYDROData_Bathymetry();
       break;
index c88500016d63b6b7988316f23ba52ef6bbdd3042..3f561c5d302f3a090a7e2aebb6c8c4a17b36453d 100755 (executable)
@@ -28,9 +28,6 @@
 
 #include <QStringList>
 
-// tage of the child of my label that contains information about the operator
-static const Standard_GUID GUID_MUST_BE_UPDATED("6647e1f7-1971-4c5a-86c7-11ff0291452d");
-
 #define PYTHON_POLYLINE_ID "KIND_POLYLINE"
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
index f651ac2a4c33e3cce6c7bbca930023c275cd9a96..04039c96a9f4a9591437404d3247bae5f60824f4 100755 (executable)
@@ -1,16 +1,39 @@
 
 #include "HYDROData_PolylineXY.h"
 
+#include "HYDROData_BSplineOperation.h"
+#include "HYDROData_Document.h"
 #include "HYDROData_Tool.h"
 
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+
+#include <ImageComposer_MetaTypes.h>
+
+#include <gp_Pnt.hxx>
 #include <gp_XY.hxx>
 
+#include <NCollection_Map.hxx>
+
+#include <TCollection_ExtendedString.hxx>
+
+#include <TDataStd_ListIteratorOfListOfByte.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <TColStd_ListIteratorOfListOfReal.hxx>
 
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_IntegerList.hxx>
+#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
 #include <TDataStd_RealList.hxx>
 
-#include <TopoDS_Wire.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+#include <QPainterPath>
+#include <QVariant>
 
+#define PYTHON_POLYLINEXY_ID "KIND_POLYLINEXY"
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_PolylineXY, HYDROData_IPolyline)
@@ -24,155 +47,621 @@ HYDROData_PolylineXY::~HYDROData_PolylineXY()
 {
 }
 
-TopoDS_Wire HYDROData_PolylineXY::GetWire() const
+QStringList HYDROData_PolylineXY::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  // TODO
-  return TopoDS_Wire();
+  QStringList aResList;
+
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  if ( aDocument.IsNull() )
+    return aResList;
+                             
+  QString aDocName = aDocument->GetDocPyName();
+  QString aPolylineName = GetName();
+
+  aResList << QString( "%1 = %2.CreateObject( %3 );" )
+              .arg( aPolylineName ).arg( aDocName ).arg( PYTHON_POLYLINEXY_ID );
+  aResList << QString( "%1.SetName( \"%1\" );" ).arg( aPolylineName );
+
+  // Set polilyne data
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  GetSections( aSectNames, aSectTypes, aSectClosures );
+
+  for ( int i = 1, n = aSectNames.Size(); i <= n; ++i )
+  {
+    const TCollection_AsciiString& aSectName = aSectNames.Value( i );
+    const SectionType& aSectType = aSectTypes.Value( i );
+    bool aSectClosure = aSectClosures.Value( i );
+
+    aResList << QString( "%1.AddSection( \"%2\", %3, %4 );" ).arg( aPolylineName )
+                .arg( aSectName.ToCString() ).arg( aSectType ).arg( aSectClosure );
+
+    HYDROData_PolylineXY::PointsList aSectPointsList = GetPoints( i );
+    for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+    {
+      const HYDROData_PolylineXY::Point& aSectPoint = aSectPointsList.Value( k );
+
+      aResList << QString( "%1.AddPoint( %2, QPointF( %3, %4 ) );" ).arg( aPolylineName )
+        .arg( i - 1 ).arg( aSectPoint.X() ).arg( aSectPoint.Y() );
+    }
+  }
+
+  return aResList;
 }
 
-int HYDROData_PolylineXY::NbSections() const
+QVariant HYDROData_PolylineXY::GetDataVariant()
 {
-  return 1;
+  QPainterPath aPath = GetPainterPath();
+
+  QVariant aVarData;
+  aVarData.setValue<QPainterPath>( aPath );
+  
+  return aVarData;
 }
 
-void HYDROData_PolylineXY::AddSection( const bool /*theIsClosed*/ )
+TopoDS_Shape HYDROData_PolylineXY::GetShape()
 {
+  return getPolylineShape();
 }
 
-bool HYDROData_PolylineXY::IsClosedSection( const int /*theSectionIndex*/ ) const
+void HYDROData_PolylineXY::Update()
 {
-  return false;
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  GetSections( aSectNames, aSectTypes, aSectClosures );
+
+  BRepBuilderAPI_MakeWire aMakeWire;
+
+  TopTools_ListOfShape aSectionWiresList;
+
+  for ( int aSectionId = 1, aNbSects = aSectNames.Size(); aSectionId <= aNbSects; aSectionId++ )
+  {
+    TCollection_AsciiString aSectName = aSectNames.Value( aSectionId );
+    SectionType aSectionType = aSectTypes.Value( aSectionId );
+    bool anIsSectionClosed = aSectClosures.Value( aSectionId );
+
+    PointsList aSectPointsList = GetPoints( aSectionId - 1 );
+    if ( aSectPointsList.IsEmpty() )
+      continue;
+
+    BRepBuilderAPI_MakeWire aMakeSectionWire;
+    if( aSectionType == SECTION_POLYLINE )
+    {
+      for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
+      {
+        const Point& aFirstPoint = aSectPointsList.Value( i );
+
+        Point aLastPoint;
+        if ( i == n )
+        {
+          if( anIsSectionClosed )
+            aLastPoint = aSectPointsList.Value( 1 );
+          else
+            break;
+        }
+        else
+        {
+          aLastPoint = aSectPointsList.Value( i + 1 );
+        }
+
+        gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0.0 );
+        gp_Pnt aPnt2( aLastPoint.X(), aLastPoint.Y(), 0.0 );
+
+        TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
+        aMakeSectionWire.Add( anEdge );
+      }
+    }
+    else //if( aSectionType == PolylineSection::SECTION_SPLINE )
+    {
+      QList<double> aPoints;
+      for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
+      {
+        const Point& aSectPoint = aSectPointsList.Value( i );
+        aPoints << aSectPoint.X() << aSectPoint.Y();
+      }
+
+      HYDROData_BSplineOperation aBSpline( aPoints, 0.0, anIsSectionClosed );
+
+      TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
+      aMakeSectionWire.Add( anEdge );
+    }
+   
+    TopoDS_Wire aSectionWire = aMakeSectionWire.Wire();
+    aSectionWiresList.Append( aSectionWire );
+    aMakeWire.Add( aSectionWire );
+  }
+
+  TopoDS_Shape aShape;
+
+  if ( aMakeWire.IsDone() )
+  {
+    aShape = aMakeWire.Shape();
+  }
+  else if ( !aSectionWiresList.IsEmpty() )
+  {
+    // build compound
+    TopoDS_Compound aCompound;
+    
+    BRep_Builder aBuilder;
+    aBuilder.MakeCompound( aCompound );
+    
+    TopTools_ListIteratorOfListOfShape anIter( aSectionWiresList );
+    for ( ; anIter.More(); anIter.Next() )
+    {
+      aBuilder.Add( aCompound, anIter.Value() );
+    }
+    
+    aShape = aCompound;
+  }
+
+  setPolylineShape( aShape );
 }
 
-void HYDROData_PolylineXY::RemoveSection( const int /*theSectionIndex*/ )
+/**
+ * Returns true if polyline is closed
+ */
+bool HYDROData_PolylineXY::IsClosed() const
 {
-  RemoveSections();
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  GetSections( aSectNames, aSectTypes, aSectClosures );
+  if( aSectNames.IsEmpty() )
+    return false;
+
+  bool anIsClosed = true;
+  for( int i = 1, n = aSectClosures.Size(); i <= n && anIsClosed; ++i )
+    anIsClosed = anIsClosed && aSectClosures.Value( i );
+
+  return anIsClosed;
 }
 
-void HYDROData_PolylineXY::RemoveSections()
+int HYDROData_PolylineXY::NbSections() const
 {
-  removePointsLists( 0 );
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList)   aTypesList;
+  Handle(TDataStd_BooleanList)   aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+
+  return !aClosuresList.IsNull() ? aClosuresList->Extent() : 0;
 }
 
-void HYDROData_PolylineXY::AddPoint( const int    /*theSectionIndex*/,
-                                    const Point& thePoint,
-                                    const int    thePointIndex )
+TCollection_ExtendedString getUniqueSectionName( const Handle(TDataStd_ExtStringList)& theNamesList )
 {
-  double aNewCoordU = thePoint.X();
-  double aNewCoordZ = thePoint.Y();
+  NCollection_Map<TCollection_ExtendedString> aNamesMap;
+
+  TDataStd_ListIteratorOfListOfExtendedString aNamesIter( theNamesList->List() );
+  for ( ; aNamesIter.More(); aNamesIter.Next() )
+    aNamesMap.Add( aNamesIter.Value() );
 
-  Handle(TDataStd_RealList) aListU, aListZ;
-  getPointsLists( 0, aListU, aListZ );
+  TCollection_ExtendedString aResName;
 
-  if ( aListU->IsEmpty() || aNewCoordU > aListU->Last() )
+  int aPrefIdx = 1;
+  do
   {
-    aListU->Append( aNewCoordU );
-    aListZ->Append( aNewCoordZ );
-    return;
+    aResName = "Section_" + aPrefIdx;
+    ++aPrefIdx;
   }
-  else if ( aNewCoordU < aListU->First() )
+  while ( aNamesMap.Contains( aResName ) );
+
+  return aResName;
+}
+
+void HYDROData_PolylineXY::AddSection( const TCollection_AsciiString& theSectName,
+                                       const SectionType              theSectionType,
+                                       const bool                     theIsClosed )
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList)   aTypesList;
+  Handle(TDataStd_BooleanList)   aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList );
+
+  TCollection_ExtendedString aSectName( theSectName );
+  if ( aSectName.Length() <= 0 )
+    aSectName = getUniqueSectionName( aNamesList );
+
+  aNamesList->Append( aSectName );
+  aTypesList->Append( theSectionType );
+  aClosuresList->Append( theIsClosed );
+}
+
+TCollection_AsciiString HYDROData_PolylineXY::GetSectionName( const int theSectionIndex ) const
+{
+  TCollection_AsciiString aResName;
+
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
+    return aResName;
+
+  TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+  for ( int i = 0; aNamesIter.More() && i != theSectionIndex; aNamesIter.Next(), ++i );
+
+  if ( aNamesIter.More() )
+    aResName = aNamesIter.Value();
+
+  return aResName;
+}
+
+void HYDROData_PolylineXY::SetSectionName( const int                      theSectionIndex, 
+                                           const TCollection_AsciiString& theSectionName )
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
+    return;
+
+  TDataStd_ListOfExtendedString anOldNamesList;
+  anOldNamesList = aNamesList->List();
+
+  // Refill the existing list
+  aNamesList->Clear();
+
+  TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+  for ( int i = 0; aNamesIter.More(); aNamesIter.Next(), ++i )
+    aNamesList->Append( i == theSectionIndex ? theSectionName : aNamesIter.Value() );
+}
+
+HYDROData_PolylineXY::SectionType HYDROData_PolylineXY::GetSectionType( const int theSectionIndex ) const
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
+    return SECTION_POLYLINE;
+
+  TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
+  for ( int i = 0; aTypesIter.More() && i != theSectionIndex; aTypesIter.Next(), ++i );
+
+  return aTypesIter.More() ? (SectionType)aTypesIter.Value() : SECTION_POLYLINE;
+}
+
+void HYDROData_PolylineXY::SetSectionType( const int         theSectionIndex, 
+                                           const SectionType theSectionType )
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
+    return;
+
+  TColStd_ListOfInteger anOldTypesList;
+  anOldTypesList = aTypesList->List();
+
+  // Refill the existing list
+  aTypesList->Clear();
+
+  TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
+  for ( int i = 0; aTypesIter.More(); aTypesIter.Next(), ++i )
+    aTypesList->Append( i == theSectionIndex ? theSectionType : aTypesIter.Value() );
+}
+
+bool HYDROData_PolylineXY::IsClosedSection( const int theSectionIndex ) const
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
+    return false;
+
+  TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
+  for ( int i = 0; aClosuresIter.More() && i != theSectionIndex; aClosuresIter.Next(), ++i );
+
+  return aClosuresIter.More() ? (bool)aClosuresIter.Value() : false;
+}
+
+void HYDROData_PolylineXY::SetSectionClosed( const int  theSectionIndex, 
+                                             const bool theIsClosed )
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
+    return;
+
+  TDataStd_ListOfByte anOldClosuresList;
+  anOldClosuresList = aClosuresList->List();
+
+  // Refill the existing list
+  aClosuresList->Clear();
+
+  TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
+  for ( int i = 0; aClosuresIter.More(); aClosuresIter.Next(), ++i )
+    aClosuresList->Append( i == theSectionIndex ? theIsClosed : (bool)aClosuresIter.Value() );
+}
+
+void HYDROData_PolylineXY::GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
+                                        NCollection_Sequence<SectionType>&             theSectTypes,
+                                        NCollection_Sequence<bool>&                    theSectClosures ) const
+{
+  theSectNames.Clear();
+  theSectTypes.Clear();
+  theSectClosures.Clear();
+
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList) aTypesList;
+  Handle(TDataStd_BooleanList) aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aNamesList.IsNull() || aTypesList.IsNull() || aClosuresList.IsNull() )
+    return;
+
+  TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+  TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
+  TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
+  for ( ; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
+          aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next() )
   {
-    aListU->Prepend( aNewCoordU );
-    aListZ->Prepend( aNewCoordZ );
+    const TCollection_ExtendedString& aSectName = aNamesIter.Value();
+    SectionType aSectType = (SectionType)aTypesIter.Value();
+    bool aSectClosures = aClosuresIter.Value();
+
+    theSectNames.Append( aSectName );
+    theSectTypes.Append( aSectType );
+    theSectClosures.Append( aSectClosures );
+  }
+}
+
+void HYDROData_PolylineXY::RemoveSection( const int theSectionIndex )
+{
+  Handle(TDataStd_ExtStringList) aNamesList;
+  Handle(TDataStd_IntegerList)   aTypesList;
+  Handle(TDataStd_BooleanList)   aClosuresList;
+  getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+  if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
     return;
+
+  if ( aNamesList->Extent() == 1 )
+  {
+    removeSectionsLists();
+    removePointsLists();
   }
+  else
+  {
+    TDataStd_ListOfExtendedString anOldNamesList;
+    anOldNamesList = aNamesList->List();
 
-  TColStd_ListOfReal anOldListU;
-  anOldListU = aListU->List();
+    TColStd_ListOfInteger anOldTypesList;
+    anOldTypesList = aTypesList->List();
 
-  TColStd_ListOfReal anOldListZ;
-  anOldListZ = aListZ->List();
+    TDataStd_ListOfByte anOldClosuresList;
+    anOldClosuresList = aClosuresList->List();
 
-  // Crsat new lists
-  removePointsLists( 0 );
-  getPointsLists( 0, aListU, aListZ );
+    // Refill the existing lists
+    aNamesList->Clear();
+    aTypesList->Clear();
+    aClosuresList->Clear();
 
-  bool anIsInserted = false;
-  TColStd_ListIteratorOfListOfReal anIterU( anOldListU );
-  TColStd_ListIteratorOfListOfReal anIterZ( anOldListZ );
-  for ( ; anIterU.More() && anIterZ.More(); anIterU.Next(), anIterZ.Next() )
+    TDataStd_ListIteratorOfListOfExtendedString aNamesIter( anOldNamesList );
+    TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
+    TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
+    for ( int i = 0; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
+                     aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next(), ++i )
+    {
+      if ( i == theSectionIndex )
+        continue; // skip index to remove
+
+      aNamesList->Append( aNamesIter.Value() );
+      aTypesList->Append( aTypesIter.Value() );
+      aClosuresList->Append( (bool)aClosuresIter.Value() );
+    }
+
+    // Remove points that belongs to removed section
+    removePointsLists( theSectionIndex );
+  }
+}
+
+void HYDROData_PolylineXY::RemoveSections()
+{
+  removeSectionsLists();
+  removePointsLists();
+}
+
+void HYDROData_PolylineXY::AddPoint( const int    theSectionIndex,
+                                     const Point& thePoint,
+                                     const int    thePointIndex )
+{
+  Handle(TDataStd_RealList) aListX, aListY;
+  getPointsLists( theSectionIndex, aListX, aListY );
+
+  if ( thePointIndex < 0 || thePointIndex >= aListX->Extent() )
+  {
+    aListX->Append( thePoint.X() );
+    aListY->Append( thePoint.Y() );
+  }
+  else
   {
-    double aCoordU = anIterU.Value();
-    double aCoordZ = anIterZ.Value();
+    TColStd_ListOfReal anOldListX;
+    anOldListX = aListX->List();
+
+    TColStd_ListOfReal anOldListY;
+    anOldListY = aListY->List();
+
+    // Refill the existing lists
+    aListX->Clear();
+    aListY->Clear();
 
-    if ( !anIsInserted )
+    TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
+    TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
+    for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
     {
-      if ( ValuesEquals( aNewCoordU, aCoordU ) )
-      {
-        // Just update Z value
-        aCoordZ = aNewCoordZ;
-        anIsInserted = true;
-      }
-      else if ( aNewCoordU < aCoordU )
+      double aCoordX = anIterX.Value();
+      double aCoordY = anIterY.Value();
+
+      if ( i == thePointIndex )
       {
-        // Insert new point
-        aListU->Append( aNewCoordU );
-        aListZ->Append( aNewCoordZ );
-        anIsInserted = true;
+        // Insert our new point
+        aListX->Append( thePoint.X() );
+        aListY->Append( thePoint.Y() );
       }
-    }
 
-    aListU->Append( aCoordU );
-    aListZ->Append( aCoordZ );
+      aListX->Append( aCoordX );
+      aListY->Append( aCoordY );
+    }
   }
 }
 
 void HYDROData_PolylineXY::SetPoint( const int    theSectionIndex,
-                                    const int    /*thePointIndex*/,
-                                    const Point& thePoint )
+                                     const Point& thePoint,
+                                     const int    thePointIndex )
 {
-  AddPoint( theSectionIndex, thePoint );
+  Handle(TDataStd_RealList) aListX, aListY;
+  getPointsLists( theSectionIndex, aListX, aListY );
+
+  if ( thePointIndex < 0 )
+  {
+    aListX->Prepend( thePoint.X() );
+    aListY->Prepend( thePoint.Y() );
+  }
+  else if ( thePointIndex >= aListX->Extent() )
+  {
+    aListX->Append( thePoint.X() );
+    aListY->Append( thePoint.Y() );
+  }
+  else
+  {
+    TColStd_ListOfReal anOldListX;
+    anOldListX = aListX->List();
+
+    TColStd_ListOfReal anOldListY;
+    anOldListY = aListY->List();
+
+    // Refill the existing lists
+    aListX->Clear();
+    aListY->Clear();
+
+    TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
+    TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
+    for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
+    {
+      double aCoordX = anIterX.Value();
+      double aCoordY = anIterY.Value();
+
+      if ( i == thePointIndex )
+      {
+        // Insert our new point instead of old one
+        aCoordX = thePoint.X();
+        aCoordY = thePoint.Y();
+      }
+
+      aListX->Append( aCoordX );
+      aListY->Append( aCoordY );
+    }
+  }
 }
 
-void HYDROData_PolylineXY::RemovePoint( const int /*theSectionIndex*/,
-                                       const int thePointIndex )
+void HYDROData_PolylineXY::RemovePoint( const int theSectionIndex,
+                                        const int thePointIndex )
 {
-  Handle(TDataStd_RealList) aListU, aListZ;
-  getPointsLists( 0, aListU, aListZ, false );
-  if ( aListU.IsNull() || aListZ.IsNull() || aListU->IsEmpty() )
+  Handle(TDataStd_RealList) aListX, aListY;
+  getPointsLists( theSectionIndex, aListX, aListY, false );
+  if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
     return;
 
-  TColStd_ListOfReal anOldListU;
-  anOldListU = aListU->List();
+  if ( aListX->Extent() == 1 )
+  {
+    removePointsLists( theSectionIndex );
+  }
+  else
+  {
+    TColStd_ListOfReal anOldListX;
+    anOldListX = aListX->List();
 
-  TColStd_ListOfReal anOldListZ;
-  anOldListZ = aListZ->List();
+    TColStd_ListOfReal anOldListY;
+    anOldListY = aListY->List();
 
-  // Creat new lists
-  removePointsLists( 0 );
-  getPointsLists( 0, aListU, aListZ );
+    // Refill the existing lists
+    aListX->Clear();
+    aListY->Clear();
 
-  bool anIsInserted = false;
-  TColStd_ListIteratorOfListOfReal anIterU( anOldListU );
-  TColStd_ListIteratorOfListOfReal anIterZ( anOldListZ );
-  for ( int i = 0; anIterU.More() && anIterZ.More(); anIterU.Next(), anIterZ.Next(), ++i )
-  {
-    if ( i == thePointIndex )
-      continue; // skip index to remove
+    TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
+    TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
+    for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
+    {
+      if ( i == thePointIndex )
+        continue; // skip index to remove
 
-    aListU->Append( anIterU.Value() );
-    aListZ->Append( anIterZ.Value() );
+      aListX->Append( anIterX.Value() );
+      aListY->Append( anIterY.Value() );
+    }
   }
 }
 
-HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int /*theSectionIndex*/ ) const
+HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex ) const
 {
   PointsList aResList;
 
-  Handle(TDataStd_RealList) aListU, aListZ;
-  getPointsLists( 0, aListU, aListZ, false );
-  if ( aListU.IsNull() || aListZ.IsNull() )
+  Handle(TDataStd_RealList) aListX, aListY;
+  getPointsLists( theSectionIndex, aListX, aListY, false );
+  if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
     return aResList;
 
-  TColStd_ListIteratorOfListOfReal anIterU( aListU->List() );
-  TColStd_ListIteratorOfListOfReal anIterZ( aListZ->List() );
-  for ( ; anIterU.More() && anIterZ.More(); anIterU.Next(), anIterZ.Next() )
+  TColStd_ListIteratorOfListOfReal anIterX( aListX->List() );
+  TColStd_ListIteratorOfListOfReal anIterY( aListY->List() );
+  for ( ; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next() )
   {
-    Point aPoint( anIterU.Value(), anIterZ.Value() );
+    Point aPoint( anIterX.Value(), anIterY.Value() );
     aResList.Append( aPoint );
   }
 
   return aResList;
 }
 
+QPainterPath HYDROData_PolylineXY::GetPainterPath() const
+{
+  QPainterPath aPath;
+
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  GetSections( aSectNames, aSectTypes, aSectClosures );
+  if( aSectNames.IsEmpty() )
+    return aPath;
+
+  PointsList aSectPointsList = GetPoints( 0 );
+  if( aSectPointsList.IsEmpty() )
+    return aPath;
+
+  SectionType aSectionType = aSectTypes.Value( 1 );
+  bool anIsSectionClosed = aSectClosures.Value( 1 );
+
+  if ( aSectionType == SECTION_POLYLINE )
+  {
+    aPath.moveTo( aSectPointsList.Value( 1 ).X(), aSectPointsList.Value( 1 ).Y() );
+
+    for( int i = 2, n = aSectPointsList.Size(); i <= n; ++i )
+    {
+      const Point& aSectPoint = aSectPointsList.Value( i );
+
+      aPath.lineTo( aSectPoint.X(), aSectPoint.Y() );
+    }
+
+    if( anIsSectionClosed )
+      aPath.closeSubpath();
+  }
+  else
+  {
+    QList<double> aPoints;
+    for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
+    {
+      const Point& aSectPoint = aSectPointsList.Value( i );
+      aPoints << aSectPoint.X() << aSectPoint.Y();
+    }
+
+    HYDROData_BSplineOperation aBSpline( aPoints, 0, anIsSectionClosed );
+    aPath = aBSpline.ComputePath();
+  }
+
+  return aPath;
+}
+
 
index ae8c848f3737408a01ed1253d0e1056bd34503cd..315fe7f1932d9988ca6ca8893b1040509df203d2 100644 (file)
@@ -6,6 +6,8 @@
 
 DEFINE_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
 
+class QPainterPath;
+
 /**\class HYDROData_PolylineXY
  * \brief Class that stores/retreives information about the 
  *        parametric profile points.
@@ -30,15 +32,37 @@ public:
    */
   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINEXY;}
 
+  /**
+   * 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();
 
 public:
 
   /**
    * Returns the 3D presentation of all points.
    */
-  HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const;
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
 
+  /**
+   * Update the wire contour on the basis of the polyline data.
+   * Call this method whenever you made changes for polyline data.
+   */
+  HYDRODATA_EXPORT virtual void Update();
+
+
+   /**
+   * Returns true if polyline is closed
+   */
+  HYDRODATA_EXPORT bool IsClosed() const;
 
+  
   /**
    * Returns number of sections.
    */
@@ -46,9 +70,41 @@ public:
 
   /**
    * Adds new one section.
-   * \param theIsClosed flag indicates type of polyline
+   * \param theSectName name of the section
+   * \param theSectionType type of section
+   * \param theIsClosed flag indicates closures of section
    */
-  HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed );
+  HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
+                                            const SectionType              theSectionType,
+                                            const bool                     theIsClosed );
+
+  /**
+   * Returns name of section with given index.
+   * \param theSectionIndex index of section
+   */
+  HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
+
+  /**
+   * 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 );
+
+  /**
+   * Returns type of section with given index.
+   * \param theSectionIndex index of section
+   */
+  HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
+
+  /**
+   * 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 );
 
   /**
    * Returns true if section with given index is closed.
@@ -56,6 +112,24 @@ public:
    */
   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
 
+  /**
+   * 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 );
+
+  /**
+   * 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 GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
+                                             NCollection_Sequence<SectionType>&             theSectTypes,
+                                             NCollection_Sequence<bool>&                    theSectClosures ) const;
+
   /**
    * Removes section with given index.
    * \param theSectionIndex index of section
@@ -81,12 +155,12 @@ public:
   /**
    * Replaces point for section with index "theSectionIndex".
    * \param theSectionIndex index of section
-   * \param thePointIndex index of point to replace
    * \param thePoint new point
+   * \param thePointIndex index of point to replace
    */
   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
-                                          const int    thePointIndex,
-                                          const Point& thePoint );
+                                          const Point& thePoint,
+                                          const int    thePointIndex );
 
   /**
    * Removes point from section with index "theSectionIndex".
@@ -105,6 +179,15 @@ public:
    */
   HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
 
+
+  /**
+   * Returns the painter path.
+   * Note: currently only the first section of the polyline data is taken into account.
+   * \return polyline painter path.
+   */
+  HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
+
+
 protected:
 
   friend class HYDROData_Profile;
index 36ce31c6a528c9b03c6534072d23fa43c11e3c3d..d8ccba4e236cad9d0652b775da8e489342ec95bc 100755 (executable)
@@ -9,7 +9,7 @@
 
 #include <TDataStd_RealList.hxx>
 
-#include <TopoDS_Wire.hxx>
+#include <TopoDS_Shape.hxx>
 
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_ProfileUZ, HYDROData_IPolyline)
@@ -24,10 +24,10 @@ HYDROData_ProfileUZ::~HYDROData_ProfileUZ()
 {
 }
 
-TopoDS_Wire HYDROData_ProfileUZ::GetWire() const
+TopoDS_Shape HYDROData_ProfileUZ::GetShape()
 {
   // TODO
-  return TopoDS_Wire();
+  return TopoDS_Shape();
 }
 
 int HYDROData_ProfileUZ::NbSections() const
@@ -35,7 +35,29 @@ int HYDROData_ProfileUZ::NbSections() const
   return 1;
 }
 
-void HYDROData_ProfileUZ::AddSection( const bool /*theIsClosed*/ )
+void HYDROData_ProfileUZ::AddSection( const TCollection_AsciiString& /*theSectName*/,
+                                      const SectionType              /*theSectionType*/,
+                                      const bool                     /*theIsClosed*/ )
+{
+}
+
+TCollection_AsciiString HYDROData_ProfileUZ::GetSectionName( const int /*theSectionIndex*/ ) const
+{
+  return "Section_1";
+}
+
+void HYDROData_ProfileUZ::SetSectionName( const int                      /*theSectionIndex*/, 
+                                          const TCollection_AsciiString& /*theSectionName*/ )
+{
+}
+
+HYDROData_ProfileUZ::SectionType HYDROData_ProfileUZ::GetSectionType( const int /*theSectionIndex*/ ) const
+{
+  return SECTION_POLYLINE;
+}
+
+void HYDROData_ProfileUZ::SetSectionType( const int         /*theSectionIndex*/, 
+                                          const SectionType /*theSectionType*/ )
 {
 }
 
@@ -44,6 +66,11 @@ bool HYDROData_ProfileUZ::IsClosedSection( const int /*theSectionIndex*/ ) const
   return false;
 }
 
+void HYDROData_ProfileUZ::SetSectionClosed( const int  /*theSectionIndex*/, 
+                                            const bool /*theIsClosed*/ )
+{
+}
+
 void HYDROData_ProfileUZ::RemoveSection( const int /*theSectionIndex*/ )
 {
   RemoveSections();
@@ -118,8 +145,8 @@ void HYDROData_ProfileUZ::AddPoint( const int    /*theSectionIndex*/,
 }
 
 void HYDROData_ProfileUZ::SetPoint( const int    theSectionIndex,
-                                    const int    /*thePointIndex*/,
-                                    const Point& thePoint )
+                                    const Point& thePoint,
+                                    const int    /*thePointIndex*/ )
 {
   AddPoint( theSectionIndex, thePoint );
 }
index 22441a568104903cececcb86a9a07812d3675e21..3ec8fabcca118782ec206729e4b2436770f17a55 100644 (file)
@@ -35,7 +35,7 @@ public:
   /**
    * Returns the 3D presentation of all points.
    */
-  HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const;
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
 
 
   /**
@@ -45,9 +45,41 @@ public:
 
   /**
    * Adds new one section.
-   * \param theIsClosed flag indicates type of polyline
+   * \param theSectName name of the section
+   * \param theSectionType type of section
+   * \param theIsClosed flag indicates closures of section
    */
-  HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed );
+  HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
+                                            const SectionType              theSectionType,
+                                            const bool                     theIsClosed );
+
+  /**
+   * Returns name of section with given index.
+   * \param theSectionIndex index of section
+   */
+  HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
+
+  /**
+   * 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 );
+
+  /**
+   * Returns type of section with given index.
+   * \param theSectionIndex index of section
+   */
+  HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
+
+  /**
+   * 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 );
 
   /**
    * Returns true if section with given index is closed.
@@ -55,6 +87,14 @@ public:
    */
   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
 
+  /**
+   * 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 );
+
   /**
    * Removes section with given index.
    * \param theSectionIndex index of section
@@ -80,12 +120,12 @@ public:
   /**
    * Replaces point for section with index "theSectionIndex".
    * \param theSectionIndex index of section
-   * \param thePointIndex index of point to replace
    * \param thePoint new point
+   * \param thePointIndex index of point to replace
    */
   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
-                                          const int    thePointIndex,
-                                          const Point& thePoint );
+                                          const Point& thePoint,
+                                          const int    thePointIndex );
 
   /**
    * Removes point from section with index "theSectionIndex".
index 24e53396744d51f6a70987aa41ebf1689d1946fc..0990ef4c1ddfee9d748ebd502834ff7e3c843b93 100644 (file)
@@ -1,7 +1,7 @@
 
 #include "HYDROData_SplitToZonesTool.h"
 
-#include "HYDROData_Polyline.h"
+#include "HYDROData_PolylineXY.h"
 
 #include <BRepAlgoAPI_Common.hxx>
 #include <BRepAlgoAPI_Cut.hxx>
@@ -36,7 +36,7 @@ TopoDS_Face HYDROData_SplitToZonesTool::SplitData::Face() const
 
 HYDROData_SplitToZonesTool::SplitDataList
 HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList,
-                                          const Handle(HYDROData_Polyline)&  thePolyline )
+                                          const Handle(HYDROData_PolylineXY)&  thePolyline )
 {
   SplitDataList anOutputSplitDataList;
 
@@ -106,7 +106,7 @@ HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& the
   // Step 2. Take into account the boundary polyline.
   if( !thePolyline.IsNull() )
   {
-    TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetTopShape() );
+    TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetShape() );
     if( !aWire.IsNull() )
     {
       BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
index 4552dd8c1910820af1fe832bbc5aa36089782edd..4d7780f3ba882fbb1858e963d519a6e8573b850f 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <QStringList>
 
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_PolylineXY);
 
 /**
  * \class HYDROData_SplitToZonesTool
@@ -42,7 +42,7 @@ public:
 public:
 
   static SplitDataList       SplitToZones( const HYDROData_SequenceOfObjects& theObjectList,
-                                           const Handle(HYDROData_Polyline)&  thePolyline );
+                                           const Handle(HYDROData_PolylineXY)&  thePolyline );
 
 private:
 
index b5d068fe53273fdbe88a52ae17cd8cf4c53f34db..b54ce7ee83d278b04bbf9f4e92472138db734570 100644 (file)
@@ -2,11 +2,13 @@
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 #include <HYDROData_OperationsFactory.h>
 
 #include <ImageComposer_CropOperator.h>
 
+#include <gp_XY.hxx>
+
 #include <QPainter>
 
 void test_HYDROData_OperationsFactory::testCreate()
@@ -46,21 +48,15 @@ void test_HYDROData_OperationsFactory::testCrop()
   QImage aTestImage = TestImage();
   anOriImage->SetImage( aTestImage );
 
-  Handle(HYDROData_Polyline) aCropPolyline = 
-    Handle(HYDROData_Polyline)::DownCast( aDoc->CreateObject( KIND_POLYLINE ) );
-
-  HYDROData_Polyline::PolylineData aPolylineData;
-
-  PolylineSection aPolylineSect;
-
-  aPolylineSect.myCoords << 25 <<  0 << 0;
-  aPolylineSect.myCoords <<  0 << 20 << 0;
-  aPolylineSect.myCoords << 25 << 40 << 0;
-  aPolylineSect.myCoords << 50 << 20 << 0;
+  Handle(HYDROData_PolylineXY) aCropPolyline = 
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
 
-  aPolylineData << aPolylineSect;
+  aCropPolyline->AddSection( "", HYDROData_PolylineXY::SECTION_POLYLINE, true );
 
-  aCropPolyline->SetPolylineData( aPolylineData );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 0  ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 0,  20 ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 40 ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 50, 20 ) );
 
   // prepare Composer Operation
   ImageComposer_Operator* aCropOp = 
diff --git a/src/HYDROData/test_HYDROData_Polyline.cxx b/src/HYDROData/test_HYDROData_Polyline.cxx
deleted file mode 100755 (executable)
index 8899ee2..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#include<test_HYDROData_Polyline.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Polyline.h>
-
-#include <QList>
-#include <QPointF>
-
-void test_HYDROData_Polyline::testPolyline()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Polyline) aPolyline = 
-    Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
-  // empty image
-
-  int aDim = aPolyline->GetDimension();
-  CPPUNIT_ASSERT(aDim == 0 );
-
-  aPolyline->SetDimension(2);
-  aDim = aPolyline->GetDimension();
-  CPPUNIT_ASSERT( aDim == 2 );
-
-  aPolyline->SetDimension(3);
-  aDim = aPolyline->GetDimension();
-  CPPUNIT_ASSERT( aDim == 3 );
-
-  PolylineSection aSect1;
-  aSect1.mySectionName = "Section_1";
-  aSect1.myType = PolylineSection::SECTION_POLYLINE;
-  aSect1.myIsClosed = false;
-
-  QList<PolylineSection> aSections;
-  aSections << aSect1;
-
-  PolylineSection aSect2;
-  aSect1.mySectionName = "Section_2";
-  aSect1.myType = PolylineSection::SECTION_SPLINE;
-  aSect1.myIsClosed = true;
-  aSections << aSect2;
-
-  aPolyline->SetPolylineData( aSections );
-  QList<PolylineSection> aRestoredSect = aPolyline->GetPolylineData();
-  int aRestSize = aRestoredSect.size();
-  CPPUNIT_ASSERT( aRestSize == 2 );
-  
-//  printf("Sect1.Name=%s RestName=%s\n", aSect1.mySectionName, aRestoredSect[0].mySectionName );
-  CPPUNIT_ASSERT( aRestoredSect[0].myType == PolylineSection::SECTION_POLYLINE );
-  CPPUNIT_ASSERT( aRestoredSect[0].myIsClosed == false );
-  CPPUNIT_ASSERT( aRestoredSect[0].mySectionName.IsLess( aSect1.mySectionName ) == false );
-  CPPUNIT_ASSERT( aRestoredSect[0].mySectionName.IsGreater( aSect1.mySectionName ) == false );
-  CPPUNIT_ASSERT( aRestoredSect[0].myCoords.size() == 0 );
-
-  CPPUNIT_ASSERT( aRestoredSect[1].myType == PolylineSection::SECTION_SPLINE );
-  CPPUNIT_ASSERT( aRestoredSect[1].myIsClosed == true );
-  CPPUNIT_ASSERT( aRestoredSect[1].mySectionName.IsLess( aSect2.mySectionName ) == false );
-  CPPUNIT_ASSERT( aRestoredSect[1].mySectionName.IsGreater( aSect2.mySectionName ) == false );
-  CPPUNIT_ASSERT( aRestoredSect[1].myCoords.size() == 0 );
-
-  aDoc->Close();
-}
-
-
-void test_HYDROData_Polyline::testCopy()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  Handle(HYDROData_Polyline) aPolyline1 = 
-    Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
-
-
-//  aPolyline1->setPoints(aPoints);
-
-  Handle(HYDROData_Polyline) aPolyline2 = 
-    Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
-
-  aPolyline1->CopyTo(aPolyline2);
-
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Polyline.h b/src/HYDROData/test_HYDROData_Polyline.h
deleted file mode 100755 (executable)
index 30c8e89..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_Polyline : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Polyline);
-  CPPUNIT_TEST(testPolyline);
-  CPPUNIT_TEST(testCopy);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks save/restore QImages information
-  void testPolyline();
-
-  // checks the image properties copy/paste
-  void testCopy();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Polyline);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Polyline, "HYDROData_Polyline");
diff --git a/src/HYDROData/test_HYDROData_PolylineXY.cxx b/src/HYDROData/test_HYDROData_PolylineXY.cxx
new file mode 100644 (file)
index 0000000..7218703
--- /dev/null
@@ -0,0 +1,55 @@
+#include<test_HYDROData_PolylineXY.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_PolylineXY.h>
+
+#include <QList>
+#include <QPointF>
+
+void test_HYDROData_PolylineXY::testPolyline()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+  Handle(HYDROData_PolylineXY) aPolyline = 
+    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+  aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
+  aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
+
+  int aNbSections = aPolyline->NbSections();
+  CPPUNIT_ASSERT( aNbSections == 2 );
+  
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
+
+  CPPUNIT_ASSERT( aSectNames.Value( 0 ) == "Section_1" );
+  CPPUNIT_ASSERT( aSectTypes.Value( 0 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
+  CPPUNIT_ASSERT( aSectClosures.Value( 0 ) == false );
+
+  CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_2" );
+  CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_SPLINE );
+  CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == true );
+
+  aDoc->Close();
+}
+
+
+void test_HYDROData_PolylineXY::testCopy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  Handle(HYDROData_PolylineXY) aPolyline1 = 
+    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+
+//  aPolyline1->setPoints(aPoints);
+
+  Handle(HYDROData_PolylineXY) aPolyline2 = 
+    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+  aPolyline1->CopyTo(aPolyline2);
+
+
+  aDoc->Close();
+}
diff --git a/src/HYDROData/test_HYDROData_PolylineXY.h b/src/HYDROData/test_HYDROData_PolylineXY.h
new file mode 100755 (executable)
index 0000000..425b4da
--- /dev/null
@@ -0,0 +1,25 @@
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_PolylineXY : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_PolylineXY);
+  CPPUNIT_TEST(testPolyline);
+  CPPUNIT_TEST(testCopy);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks save/restore QImages information
+  void testPolyline();
+
+  // checks the image properties copy/paste
+  void testCopy();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_PolylineXY, "HYDROData_PolylineXY");
index 707a308655bc1726839d9f5aa9a70db953a4e33b..0ded37300fa1e7f28d539dc2f850508c8e586f8e 100644 (file)
@@ -30,7 +30,7 @@
 #include "HYDROGUI_Zone.h"
 #include "HYDROGUI_Region.h"
 
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 #include <HYDROData_Iterator.h>
 #include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Object.h>
@@ -85,17 +85,17 @@ void HYDROGUI_CalculationOp::startOperation()
   // Get all polylines
   aList.clear();
   anEntryList.clear();
-  HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
-  Handle(HYDROData_Polyline) aPolylineObj;
+  HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY );
+  Handle(HYDROData_PolylineXY) aPolylineObj;
   QString aPolylineName;
   for ( ; anIter.More(); anIter.Next() )
   {
-    aPolylineObj = Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
+    aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() );
 
     if ( !aPolylineObj.IsNull() && aPolylineObj->IsClosed() )
     { 
       // Check the polyline shape
-      TopoDS_Shape aPolylineShape = aPolylineObj->GetTopShape();
+      TopoDS_Shape aPolylineShape = aPolylineObj->GetShape();
       if ( !aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE ) {
         aPolylineName = aPolylineObj->GetName();
         if ( !aPolylineName.isEmpty() )
@@ -214,7 +214,7 @@ HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const
 void HYDROGUI_CalculationOp::onBoundarySelected ( const QString & theObjName )
 {
   // Set the selected boundary polyline to the calculation case
-  Handle(HYDROData_Polyline) anObject;
+  Handle(HYDROData_PolylineXY) anObject;
   Handle(AIS_InteractiveContext) aCtx;
   if ( myPreviewViewManager ) 
   {
@@ -238,10 +238,10 @@ void HYDROGUI_CalculationOp::onBoundarySelected ( const QString & theObjName )
   else
   {
     Handle(HYDROData_Entity) anEntity = 
-      HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINE );
+      HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINEXY );
     if ( !anEntity.IsNull() )
     {
-      anObject = Handle(HYDROData_Polyline)::DownCast( anEntity );
+      anObject = Handle(HYDROData_PolylineXY)::DownCast( anEntity );
       if ( !anObject.IsNull() )
       {
         myEditedObject->SetBoundaryPolyline( anObject );
index 9432c01c02f2cd996db52aad98d688073acce22c..f3440a44f4371644ad9da531366e8a0142e99612 100644 (file)
@@ -34,7 +34,7 @@
 #include <HYDROData_Image.h>
 #include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Iterator.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 #include <HYDROData_Profile.h>
 #include <HYDROData_VisualState.h>
 #include <HYDROData_Region.h>
@@ -250,7 +250,7 @@ void HYDROGUI_DataModel::update( const int theStudyId )
   LightApp_DataObject* aCalculRootObj = createObject( aRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) );
 
   // POLYLINES
-  LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINE ).toAscii() ) );
+  LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINEXY ).toAscii() ) );
 
   // PROFILES
   LightApp_DataObject* aProfileRootObj = createObject( aRootObj, tr( partitionName( KIND_PROFILE ).toAscii() ) );
@@ -343,10 +343,10 @@ void HYDROGUI_DataModel::update( const int theStudyId )
 
         break;
       }
-      case KIND_POLYLINE:
+      case KIND_POLYLINEXY:
       {
-        Handle(HYDROData_Polyline) aPolylineObj =
-          Handle(HYDROData_Polyline)::DownCast( anObj );
+        Handle(HYDROData_PolylineXY) aPolylineObj =
+          Handle(HYDROData_PolylineXY)::DownCast( anObj );
         if( !aPolylineObj.IsNull() ) {
           createObject( aPolylineRootObj, aPolylineObj );
         }
@@ -595,7 +595,7 @@ QString HYDROGUI_DataModel::partitionName( const ObjectKind theObjectKind )
   switch( theObjectKind )
   {
     case KIND_IMAGE:             return "IMAGES";
-    case KIND_POLYLINE:          return "POLYLINES";
+    case KIND_POLYLINEXY:        return "POLYLINES";
     case KIND_PROFILE:           return "PROFILES";
     case KIND_VISUAL_STATE:      return "VISUAL_STATES";
     case KIND_BATHYMETRY:        return "BATHYMETRIES";
@@ -697,7 +697,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
     LightApp_DataObject* aPolylineSect = 
       createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
 
-    Handle(HYDROData_Polyline) aPolyline = aZoneObj->GetPolyline();
+    Handle(HYDROData_PolylineXY) aPolyline = aZoneObj->GetPolyline();
     if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
       createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
 
index 704fa4e34d8b55b88748fa0e440cb34c39cf03f4..deb1542d37a5bac138f982ac19b3bdc2bd436395 100644 (file)
@@ -63,7 +63,7 @@ void HYDROGUI_DeleteOp::startOperation()
 
         // collect the back-references
         ObjectKind aKind = anObject->GetKind();
-        if( aKind == KIND_IMAGE || aKind == KIND_POLYLINE )
+        if( aKind == KIND_IMAGE || aKind == KIND_POLYLINEXY )
         {
           HYDROData_SequenceOfObjects anObjects;
           QStringList aNames;
index 045b7db3c5e904f43d05d5d7f27497ac51058f89..548f5e47953bf70b5ac697f2499f2718aaa39bec 100644 (file)
@@ -201,7 +201,7 @@ HYDROGUI_PrsDriver* HYDROGUI_Displayer::getDriver( const Handle(HYDROData_Entity
       case KIND_IMAGE:
         aDriver = new HYDROGUI_PrsImageDriver();
         break;
-      case KIND_POLYLINE:
+      case KIND_POLYLINEXY:
         aDriver = new HYDROGUI_PrsPolylineDriver();
         break;
       case KIND_ZONE:
index ecf6b2836e40ca5ef1e841bbde1ffe0f7c62fef8..92bcc38c6c0ee49734688ed2090f30e47f79f38e 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <HYDROData_Bathymetry.h>
 #include <HYDROData_Iterator.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 
 #include <OCCViewer_ViewManager.h>
 #include <OCCViewer_ViewModel.h>
@@ -86,7 +86,7 @@ void HYDROGUI_ImmersibleZoneOp::startOperation()
       aFillingColor = myEditedObject->GetFillingColor();
       aBorderColor = myEditedObject->GetBorderColor();
 
-      Handle(HYDROData_Polyline) aRefPolyline = myEditedObject->GetPolyline();
+      Handle(HYDROData_PolylineXY) aRefPolyline = myEditedObject->GetPolyline();
       if ( !aRefPolyline.IsNull() )
         aSelectedPolyline = aRefPolyline->GetName();
 
@@ -99,11 +99,11 @@ void HYDROGUI_ImmersibleZoneOp::startOperation()
   // collect information about existing closed polylines
   QStringList aPolylines;
 
-  HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
+  HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY );
   for ( ; anIter.More(); anIter.Next() )
   {
-    Handle(HYDROData_Polyline) aPolylineObj = 
-      Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
+    Handle(HYDROData_PolylineXY) aPolylineObj = 
+      Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() );
     if ( aPolylineObj.IsNull() || !aPolylineObj->IsClosed() )
       continue;
 
@@ -195,14 +195,14 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags,
   if ( aZoneObj.IsNull() )
     return false;
 
-  Handle(HYDROData_Polyline) aZonePolyline;
+  Handle(HYDROData_PolylineXY) aZonePolyline;
   Handle(HYDROData_Bathymetry) aZoneBathymetry;
 
   QString aPolylineName = aPanel->getPolylineName();
   if ( !aPolylineName.isEmpty() )
   {
-    aZonePolyline = Handle(HYDROData_Polyline)::DownCast(
-      HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
+    aZonePolyline = Handle(HYDROData_PolylineXY)::DownCast(
+      HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINEXY ) );
   }
 
   QString aBathymetryName = aPanel->getBathymetryName();
@@ -241,11 +241,11 @@ void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName
   TopoDS_Wire aWire;
   TopoDS_Shape aShape;
 
-  Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast(
-    HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINE ) );
+  Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast(
+    HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINEXY ) );
   if ( !aPolyline.IsNull() )
   {
-    aShape = aPolyline->GetTopShape();
+    aShape = aPolyline->GetShape();
     if ( aShape.ShapeType() == TopAbs_WIRE ) {
       aWire = TopoDS::Wire( aShape );
     }
index 4a3ad4ca8ebfca32b45dbb6c886d571ce29315fc..c7f9eff53515debda29984d15081a58e1dc05cb5 100644 (file)
@@ -279,7 +279,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
           }
         }
       }
-      else if( anObject->GetKind() == KIND_POLYLINE )
+      else if( anObject->GetKind() == KIND_POLYLINEXY )
         anIsPolyline = true;
       else if( anObject->GetKind() == KIND_PROFILE )
         anIsProfile = true;
@@ -313,7 +313,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         case KIND_IMAGE:
           theMenu->addAction( action( ImportImageId ) );
           break;
-        case KIND_POLYLINE:
+        case KIND_POLYLINEXY:
           theMenu->addAction( action( CreatePolylineId ) );
           break;
         case KIND_PROFILE:
index 602cb5cb5cd00ab7a2a967c84f0de611fde56c30..faf46892d0e4c70af36683fa1f5e0b3a5d43fd6e 100644 (file)
@@ -101,7 +101,7 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int
 
   ObjectKind anObjectKind = theObject->GetKind();
   if ( anObjectKind != KIND_IMAGE &&
-       anObjectKind != KIND_POLYLINE &&
+       anObjectKind != KIND_POLYLINEXY &&
        anObjectKind != KIND_IMMERSIBLE_ZONE &&
        anObjectKind != KIND_REGION &&
        anObjectKind != KIND_ZONE &&
index 5932efc5882f118181575d28d7c7c075aef4d08f..ce078a5f2cd3f04f3d46f789424a7b723ea1cdbb 100755 (executable)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-#include "HYDROGUI_Module.h"
+
 #include "HYDROGUI_PolylineOp.h"
+
+#include "HYDROGUI_Module.h"
 #include "HYDROGUI_PolylineDlg.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
 
-#include "HYDROData_Document.h"
-#include "HYDROData_Polyline.h"
-#include "CurveCreator_Curve.hxx"
-#include "CurveCreator_Displayer.h"
+#include <HYDROData_Document.h>
+
+#include <CurveCreator_Curve.hxx>
+#include <CurveCreator_Displayer.h>
 
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 //static int ZValueIncrement = 0;
 
 HYDROGUI_PolylineOp::HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool theIsEdit )
-: HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit), myCurve(NULL), 
-  myViewManager(NULL)
+: HYDROGUI_Operation( theModule ), 
+  myIsEdit( theIsEdit ),
+  myCurve( NULL ), 
+  myViewManager( NULL )
 {
   setName( theIsEdit ? tr( "EDIT_POLYLINE" ) : tr( "CREATE_POLYLINE" ) );
 }
@@ -77,10 +81,9 @@ bool HYDROGUI_PolylineOp::deleteEnabled()
 void HYDROGUI_PolylineOp::startOperation()
 {
   if( myCurve )
-  {
     delete myCurve;
-    myCurve = 0;
-  }
+
+  myCurve = new CurveCreator_Curve( CurveCreator::Dim2d );
 
   HYDROGUI_Operation::startOperation();
 
@@ -93,39 +96,48 @@ void HYDROGUI_PolylineOp::startOperation()
   aPanel->setOCCViewer( myViewManager ? myViewManager->getOCCViewer() : 0 );
 
   if( myIsEdit )
-    myEditedObject = Handle(HYDROData_Polyline)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+    myEditedObject = Handle(HYDROData_PolylineXY)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+
+  QString aPolylineName;
   if( !myEditedObject.IsNull() )
   {
-    int anIntDim = myEditedObject->GetDimension();
-    CurveCreator::Dimension aDim = CurveCreator::Dim3d;
-    if( anIntDim == 2 )
-      aDim = CurveCreator::Dim2d;
-    myCurve = new CurveCreator_Curve(aDim);
-    QList<PolylineSection> aPolylineData = myEditedObject->GetPolylineData();
-
-    for( int i = 0 ; i < aPolylineData.size() ; i++ ){
-      std::string aName = HYDROGUI_Tool::ToQString(aPolylineData[i].mySectionName).toStdString();
-      bool isClosed = aPolylineData[i].myIsClosed;
-      CurveCreator::SectionType aType = CurveCreator::Polyline;
-      if( aPolylineData[i].myType == PolylineSection::SECTION_SPLINE ){
-        aType = CurveCreator::Spline;
-      }
-      CurveCreator::Coordinates aCoords;
-      for( int j = 0 ; j < aPolylineData[i].myCoords.size() ; j++ ){
-        aCoords.push_back(aPolylineData[i].myCoords[j]);
+    NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+    NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+    NCollection_Sequence<bool>                              aSectClosures;
+    myEditedObject->GetSections( aSectNames, aSectTypes, aSectClosures );
+
+    for ( int i = 1, n = aSectNames.Size(); i <= n; ++i )
+    {
+      QString aSectName = HYDROGUI_Tool::ToQString( aSectNames.Value( i ) );
+      HYDROData_PolylineXY::SectionType aSectType = aSectTypes.Value( i );
+      bool aSectClosure = aSectClosures.Value( i );
+
+      CurveCreator::SectionType aCurveType = CurveCreator::Polyline;
+      if( aSectType == HYDROData_PolylineXY::SECTION_SPLINE )
+        aCurveType = CurveCreator::Spline;
+
+      CurveCreator::Coordinates aCurveCoords;
+
+      HYDROData_PolylineXY::PointsList aSectPointsList = myEditedObject->GetPoints( i - 1 );
+      for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+      {
+        const HYDROData_PolylineXY::Point& aSectPoint = aSectPointsList.Value( k );
+        aCurveCoords.push_back( aSectPoint.X() );
+        aCurveCoords.push_back( aSectPoint.Y() );
       }
-      myCurve->addSectionInternal( aName, aType, isClosed, aCoords );
+
+      myCurve->addSectionInternal( aSectName.toStdString(), aCurveType, aSectClosure, aCurveCoords );
     }
-    aPanel->setPolylineName( myEditedObject->GetName() );
 
+    aPolylineName = myEditedObject->GetName();
   }
-  else{
-    myCurve = new CurveCreator_Curve(CurveCreator::Dim2d);
-    //aPanel->setCurve(myCurve);
-    QString aNewName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_POLYLINE_NAME" ) );
-    aPanel->setPolylineName(aNewName);
+  else
+  {
+    aPolylineName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_POLYLINE_NAME" ) );
   }
-  aPanel->setCurve(myCurve);
+
+  aPanel->setPolylineName( aPolylineName );
+  aPanel->setCurve( myCurve );
 
   displayPreview();
 }
@@ -168,12 +180,14 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
   if( aDocument.IsNull() )
     return false;
 
-  Handle(HYDROData_Polyline) aPolylineObj;
-  if( myIsEdit ){
+  Handle(HYDROData_PolylineXY) aPolylineObj;
+  if( myIsEdit )
+  {
     aPolylineObj = myEditedObject;
+    aPolylineObj->RemoveSections();
   }
   else{
-    aPolylineObj = Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) );
+    aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( aDocument->CreateObject( KIND_POLYLINEXY ) );
 
     //double aZValue = double( ++ZValueIncrement ) * 1e-2; // empiric value, to be revised
     //aPolylineObj->SetZValue( aZValue );
@@ -184,36 +198,59 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
 
   QString aPolylineName = aPanel->getPolylineName();
   aPolylineObj->SetName(aPolylineName);
-  int aDimInt = 3;
-  if( myCurve->getDimension() == CurveCreator::Dim2d )
-    aDimInt = 2;
-  aPolylineObj->SetDimension(aDimInt);
-  QList<PolylineSection> aPolylineData;
-  for( int i=0 ; i < myCurve->getNbSections() ; i++ ){
-    PolylineSection aSect;
-    aSect.mySectionName = HYDROGUI_Tool::ToExtString( QString::fromLocal8Bit(myCurve->getSectionName(i).c_str()));
-    aSect.myIsClosed = myCurve->isClosed(i);
-    aSect.myType = PolylineSection::SECTION_POLYLINE;
-    if( myCurve->getSectionType(i) == CurveCreator::Spline ){
-      aSect.myType = PolylineSection::SECTION_SPLINE;
-    }
-    CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
-    for( int j = 0 ; j < aCoords.size() ; j++ ){
-      aSect.myCoords << aCoords.at(j);
+
+  for ( int i = 0 ; i < myCurve->getNbSections() ; i++ )
+  {
+    TCollection_AsciiString aSectName = HYDROGUI_Tool::ToAsciiString( myCurve->getSectionName( i ).c_str() );
+    CurveCreator::SectionType aCurveType =  myCurve->getSectionType( i );
+    bool aSectClosure = myCurve->isClosed( i );
+
+    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+
+    if ( aCurveType == CurveCreator::Spline )
+      aSectType = HYDROData_PolylineXY::SECTION_SPLINE;
+
+    aPolylineObj->AddSection( aSectName, aSectType, aSectClosure );
+
+    // Add the points fro section
+    CurveCreator::Coordinates aCurveCoords = myCurve->getPoints( i );
+    for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
+    {
+      HYDROData_PolylineXY::Point aSectPoint;
+
+      aSectPoint.SetX( aCurveCoords.at( k ) );
+      k++;
+      aSectPoint.SetY( aCurveCoords.at( k ) );
+
+      aPolylineObj->AddPoint( i, aSectPoint );
     }
-    aPolylineData << aSect;
   }
-  aPolylineObj->SetPolylineData(aPolylineData);
+
+  // Update the wire of polyline
+  aPolylineObj->Update();
 
   // the viewer should be release from the widget before the module update it
   // because it has an opened local context and updated presentation should not be displayed in it
   if ( aPanel )
     aPanel->setOCCViewer( 0 );
 
-  if( !myIsEdit )
-    module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aPolylineObj, true );
+  theUpdateFlags = UF_Model;
+
+  size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+  if ( anActiveViewId != 0 )
+  {
+    theUpdateFlags |= UF_Viewer | UF_GV_Forced;
+  }
+  else
+  {
+    anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
+    theUpdateFlags |= UF_OCCViewer | UF_OCC_Forced;
+  }
 
-  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+  if( !myIsEdit )
+  {
+    module()->setObjectVisible( anActiveViewId, aPolylineObj, true );
+  }  
 
   return true;
 }
index aebd8be05d6e912378811ef172d53e739292b261..2192aa5fe4df7aa955b62f43dcd8efde547b9b34 100755 (executable)
@@ -25,7 +25,7 @@
 
 #include "HYDROGUI_Operation.h"
 
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 
 class OCCViewer_ViewManager;
 class CurveCreator_Curve;
@@ -58,11 +58,11 @@ private:
   void                       erasePreview();
 
 private:
-  OCCViewer_ViewManager*     myViewManager;
+  OCCViewer_ViewManager*       myViewManager;
 
-  bool                       myIsEdit;
-  Handle(HYDROData_Polyline) myEditedObject;
-  CurveCreator_Curve*        myCurve;
+  bool                         myIsEdit;
+  Handle(HYDROData_PolylineXY) myEditedObject;
+  CurveCreator_Curve*          myCurve;
 };
 
 #endif
index 5bb2ba290b1b0f799da5cd2b7e1cf2409b64958d..d7304e9efbbd1ea8ee19b55534fd303df37b6a7a 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "HYDROGUI_PrsPolyline.h"
 
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 
 HYDROGUI_PrsPolylineDriver::HYDROGUI_PrsPolylineDriver()
 :HYDROGUI_PrsDriver()
@@ -43,7 +43,7 @@ bool HYDROGUI_PrsPolylineDriver::Update( const Handle(HYDROData_Entity)& theObj,
   if( theObj.IsNull() )
     return false;
 
-  Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast( theObj );
+  Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( theObj );
   if( aPolyline.IsNull() )
     return false;
 
index 534a57ce1135b1a831cefcebb6031ec62cf4d895..d1de7c3c142610e103109ca306b1e0402e73a194 100644 (file)
@@ -40,7 +40,7 @@
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
 #include <HYDROData_ImmersibleZone.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 #include <HYDROData_Region.h>
 #include <HYDROData_Zone.h>
 #include <HYDROData_Obstacle.h>
@@ -139,12 +139,12 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
       setFillingColor( aFillingColor, false, false );
       setBorderColor( aBorderColor, false, false );
     }
-    else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline) ) )
+    else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_PolylineXY) ) )
     {
-      Handle(HYDROData_Polyline) aPolyline =
-        Handle(HYDROData_Polyline)::DownCast( myObject );
+      Handle(HYDROData_PolylineXY) aPolyline =
+        Handle(HYDROData_PolylineXY)::DownCast( myObject );
 
-      TopoDS_Shape aPolylineShape = aPolyline->GetTopShape();
+      TopoDS_Shape aPolylineShape = aPolyline->GetShape();
 
       if ( !aPolylineShape.IsNull() ) {
         if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
index 45214704940a3249db75562b91414809bc3839be..51126a3c04a9d9798fa10ce24975839f1710125a 100644 (file)
@@ -214,7 +214,7 @@ void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule,
       Handle(HYDROData_Entity) anObject = anIterator.Current();
       if( !anObject.IsNull() && ( 
         ( anObject->GetKind() == KIND_IMAGE ) ||
-        ( anObject->GetKind() == KIND_POLYLINE ) ||
+        ( anObject->GetKind() == KIND_POLYLINEXY ) ||
         ( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) ||
         ( anObject->GetKind() == KIND_REGION ) ||
         ( anObject->GetKind() == KIND_BATHYMETRY ) ||
index 4ed150204c503e569e7815e1ac385e7017b902a8..1ba4a66897f3d1fd30992ee7251faaa36805bd3e 100644 (file)
@@ -62,7 +62,7 @@ HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const
   myImage2 = new HYDROGUI_ObjSelector( theModule, KIND_IMAGE, aParamGroup );
 
   myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
-  myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINE, aParamGroup );
+  myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
 
   QFrame* aBackgroundFrame = new QFrame( aParamGroup );
   QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), aBackgroundFrame );
index 38375491e69589af4e8b15b80029f11cfd1affd1..def6f125d65f33131c22b13850072e659661ecda 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
 
 #include <HYDROData_OperationsFactory.h>
 
index 151f7ad05b492f32547bf12292e725c64a2caa62..73dc14259c459f68fb2d5d486de7923e1a132d2b 100644 (file)
@@ -55,10 +55,12 @@ SET(_sip_files
 SET(_sip_files2
   HYDROData_Entity.sip
   HYDROData_Object.sip
+  HYDROData_IPolyline.sip
+  HYDROData_ProfileUZ.sip
+  HYDROData_PolylineXY.sip
   HYDROData_ArtificialObject.sip
   HYDROData_NaturalObject.sip
   HYDROData_Image.sip
-  HYDROData_Polyline.sip
   HYDROData_Bathymetry.sip
   HYDROData_ImmersibleZone.sip
   HYDROData_Zone.sip
index 3166f0504033079551c1281633b3c8cbbd2944e8..ccd6aa89d01f4ec02eb8f76020bb0847a00d8da6 100644 (file)
@@ -53,10 +53,13 @@ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 %Include HYDROData_Entity.sip
 %Include HYDROData_Object.sip
+%Include HYDROData_IPolyline.sip
+%Include HYDROData_ProfileUZ.sip
+%Include HYDROData_PolylineXY.sip
 %Include HYDROData_ArtificialObject.sip
 %Include HYDROData_NaturalObject.sip
 %Include HYDROData_Image.sip
-%Include HYDROData_Polyline.sip
+%Include HYDROData_PolylineXY.sip
 %Include HYDROData_Bathymetry.sip
 %Include HYDROData_ImmersibleZone.sip
 %Include HYDROData_Zone.sip
index 2cbfbbc715def25c2dd6ddf53c540ed5799eaee1..37bd970f7f72dc08b7a7a144d6b1d781b50d8e7a 100644 (file)
@@ -67,11 +67,6 @@ class HYDROData_Document
         aRes = new HYDROData_Image( *dynamic_cast<HYDROData_Image*>( theObject ) );
         break;
       }
-      case KIND_POLYLINE:
-      {
-        aRes = new HYDROData_Polyline( *dynamic_cast<HYDROData_Polyline*>( theObject ) );
-        break;
-      }
       case KIND_BATHYMETRY:
       {
         aRes = new HYDROData_Bathymetry( *dynamic_cast<HYDROData_Bathymetry*>( theObject ) );
@@ -82,6 +77,16 @@ class HYDROData_Document
         aRes = new HYDROData_ImmersibleZone( *dynamic_cast<HYDROData_ImmersibleZone*>( theObject ) );
         break;
       }
+      case KIND_PROFILEUZ:
+      {
+        aRes = new HYDROData_ProfileUZ( *dynamic_cast<HYDROData_ProfileUZ*>( theObject ) );
+        break;
+      }
+      case KIND_POLYLINEXY:
+      {
+        aRes = new HYDROData_PolylineXY( *dynamic_cast<HYDROData_PolylineXY*>( theObject ) );
+        break;
+      }
       case KIND_CALCULATION:
       {
         aRes = new HYDROData_CalculationCase( *dynamic_cast<HYDROData_CalculationCase*>( theObject ) );
index e148402d38d1f60d1279feaefd2577fa8194adaa..3bba4c53cb946bcc08eebbc7f189e6febd537534 100644 (file)
@@ -30,7 +30,17 @@ const ObjectKind KIND_UNKNOWN;
 const ObjectKind KIND_IMAGE;
 const ObjectKind KIND_POLYLINE;
 const ObjectKind KIND_BATHYMETRY;
+const ObjectKind KIND_ALTITUDE;
 const ObjectKind KIND_IMMERSIBLE_ZONE;
+const ObjectKind KIND_RIVER;
+const ObjectKind KIND_STREAM;
+const ObjectKind KIND_CONFLUENCE;
+const ObjectKind KIND_CHANNEL;
+const ObjectKind KIND_OBSTACLE;
+const ObjectKind KIND_DIGUE;
+const ObjectKind KIND_PROFILE;
+const ObjectKind KIND_PROFILEUZ;
+const ObjectKind KIND_POLYLINEXY;
 const ObjectKind KIND_CALCULATION;
 const ObjectKind KIND_ZONE;
 const ObjectKind KIND_REGION;
@@ -49,8 +59,8 @@ class HYDROData_Entity
         sipClass = sipClass_HYDROData_Image;
         break;
 
-      case KIND_POLYLINE:
-        sipClass = sipClass_HYDROData_Polyline;
+      case KIND_POLYLINEXY:
+        sipClass = sipClass_HYDROData_PolylineXY;
         break;
 
       case KIND_BATHYMETRY:
diff --git a/src/HYDROPy/HYDROData_IPolyline.sip b/src/HYDROPy/HYDROData_IPolyline.sip
new file mode 100644 (file)
index 0000000..1e0e9c7
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+
+%ExportedHeaderCode
+#include <HYDROData_IPolyline.h>
+%End
+
+class HYDROData_IPolyline : HYDROData_Entity /Abstract/
+{
+
+%TypeHeaderCode
+#include <HYDROData_IPolyline.h>
+%End
+
+%ConvertToSubClassCode
+    switch ( sipCpp->GetKind() )
+    {
+      case KIND_POLYLINEXY:
+        sipClass = sipClass_HYDROData_PolylineXY;
+        break;
+
+      case KIND_PROFILEUZ:
+        sipClass = sipClass_HYDROData_ProfileUZ;
+        break;
+
+      default:
+        // We don't recognise the type.
+        sipClass = NULL;
+    }
+%End
+
+public:
+
+  enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
+
+public:      
+
+
+protected:
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_IPolyline();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_IPolyline();
+};
+
+
index 5346eb3b85dfcab5a17bfb24c98c01dad9e6380e..326dd5cbdbeb9ad62646a69bc0d24bab7b314d0f 100644 (file)
@@ -69,11 +69,11 @@ public:
   /**
    * Sets reference polyline object for zone.
    */
-  void SetPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)];
+  void SetPolyline( HYDROData_PolylineXY thePolyline ) [void (const Handle_HYDROData_PolylineXY&)];
   %MethodCode
 
-    Handle(HYDROData_Polyline) aRefPolyline =
-      Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) );
+    Handle(HYDROData_PolylineXY) aRefPolyline =
+      Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
     if ( !aRefPolyline.IsNull() )
     {
       Py_BEGIN_ALLOW_THREADS
@@ -87,17 +87,17 @@ public:
   /**
    * Returns reference polyline object of zone.
    */
-  HYDROData_Polyline GetPolyline() const [Handle_HYDROData_Polyline ()];
+  HYDROData_PolylineXY GetPolyline() const [Handle_HYDROData_PolylineXY ()];
   %MethodCode
 
-    Handle(HYDROData_Polyline) aRefPolyline;
+    Handle(HYDROData_PolylineXY) aRefPolyline;
     
     Py_BEGIN_ALLOW_THREADS
     aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::GetPolyline() : 
                                    sipCpp->GetPolyline();
     Py_END_ALLOW_THREADS
     
-    sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline );
+    sipRes = (HYDROData_PolylineXY*)createPointer( aRefPolyline );
   
   %End
 
index c93dd51d66f89e058a37377b3b0458512f4db81c..6a9e89b45b74d498404ab83d3f16b40cf4b279af 100644 (file)
@@ -40,10 +40,6 @@ class HYDROData_Object : HYDROData_Entity /Abstract/
       // HYDROData_Object sub-classes provide a unique kind ID.
       switch ( sipCpp->GetKind() )
       {
-        case KIND_POLYLINE:
-          sipClass = sipClass_HYDROData_Polyline;
-          break;
-
         case KIND_UNKNOWN:
           sipClass = sipClass_HYDROData_Object;
           break;
diff --git a/src/HYDROPy/HYDROData_Polyline.sip b/src/HYDROPy/HYDROData_Polyline.sip
deleted file mode 100644 (file)
index 6ab0378..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// 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.
-//
-// 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
-//
-
-%ExportedHeaderCode
-#include <HYDROData_Polyline.h>
-%End
-
-class HYDROData_Polyline : HYDROData_Object
-{
-
-%TypeHeaderCode
-#include <HYDROData_Polyline.h>
-%End
-
-%ConvertToSubClassCode
-    switch ( sipCpp->GetKind() )
-    {
-      case KIND_POLYLINE:
-        sipClass = sipClass_HYDROData_Polyline;
-        break;
-
-      default:
-        // We don't recognise the type.
-        sipClass = NULL;
-    }
-%End
-
-public:      
-
-  /**
-   * Return polyline dimension
-   * \return polyline dimension (2 or 3)
-   */
-  int GetDimension() const;
-
-  /**
-   * Set polyline dimension (2 or 3)
-   * \param theDimension the polyline dimension
-   */
-  void SetDimension( int theDimension );
-
-  /**
-   * Remove all sections from polyline
-   */
-  void RemoveAll();
-
-
-  /**
-   * Returns the painter path. The painter path is construct by lines
-   */
-  QPainterPath GetPainterPath();
-
-
-  /**
-   * Sets the z value for polyline.
-   */
-  void SetZValue( const double theZValue );
-  
-  /**
-   * Returns the z value for polyline.
-   */
-  double ZValue() const;
-
-protected:
-
-  /**
-   * Creates new object in the internal data structure. Use higher level objects 
-   * to create objects with real content.
-   */
-  HYDROData_Polyline();
-
-  /**
-   * Destructs properties of the object and object itself, removes it from the document.
-   */
-  ~HYDROData_Polyline();
-};
-
-
diff --git a/src/HYDROPy/HYDROData_PolylineXY.sip b/src/HYDROPy/HYDROData_PolylineXY.sip
new file mode 100644 (file)
index 0000000..37dadf7
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+
+%ExportedHeaderCode
+#include <HYDROData_PolylineXY.h>
+%End
+
+class HYDROData_PolylineXY : HYDROData_IPolyline
+{
+
+%TypeHeaderCode
+#include <HYDROData_PolylineXY.h>
+%End
+
+%ConvertToSubClassCode
+    switch ( sipCpp->GetKind() )
+    {
+      case KIND_POLYLINEXY:
+        sipClass = sipClass_HYDROData_PolylineXY;
+        break;
+
+      default:
+        // We don't recognise the type.
+        sipClass = NULL;
+    }
+%End
+
+public:      
+
+protected:
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_PolylineXY();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_PolylineXY();
+};
+
+
diff --git a/src/HYDROPy/HYDROData_ProfileUZ.sip b/src/HYDROPy/HYDROData_ProfileUZ.sip
new file mode 100644 (file)
index 0000000..bb31535
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+
+%ExportedHeaderCode
+#include <HYDROData_ProfileUZ.h>
+%End
+
+class HYDROData_ProfileUZ : HYDROData_IPolyline
+{
+
+%TypeHeaderCode
+#include <HYDROData_ProfileUZ.h>
+%End
+
+%ConvertToSubClassCode
+    switch ( sipCpp->GetKind() )
+    {
+      case KIND_PROFILEUZ:
+        sipClass = sipClass_HYDROData_ProfileUZ;
+        break;
+
+      default:
+        // We don't recognise the type.
+        sipClass = NULL;
+    }
+%End
+
+public:      
+
+protected:
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_ProfileUZ();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_ProfileUZ();
+};
+
+