Salome HOME
Merge branch 'BR_PY3'
authorYoann AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Tue, 3 Mar 2020 08:29:19 +0000 (09:29 +0100)
committerYoann AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Tue, 3 Mar 2020 08:29:19 +0000 (09:29 +0100)
19 files changed:
1  2 
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDROData/HYDROData_ShapeFile.cxx
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_DataBrowser.cxx
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx
src/HYDROGUI/HYDROGUI_ListModel.cxx
src/HYDROGUI/HYDROGUI_ListModel.h
src/HYDROGUI/HYDROGUI_PriorityWidget.cxx
src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_Tool.h
src/HYDROPy/HYDROData_Entity.sip
src/HYDRO_tests/CMakeLists.txt
src/HYDRO_tests/ExternalFiles.cmake
src/HYDRO_tests/test_HYDROData_Main.cxx

index 9aaa587e017c5acf992af6d75141f1fe1902c392,16d303da2cb04f3e08ac6950254a08c42303541c..da1e1e2ed50a9d86e28ba7191deb70886732471e
@@@ -223,7 -342,7 +342,7 @@@ void HYDROData_Entity::CopyTo( const Ha
  
    TDF_CopyLabel aCopy(myLab, theDestination->Label());
    aCopy.Perform();
--         
++
    if( isGenerateNewName )
    {
      // generate a new unique name for the clone object:
@@@ -287,9 -406,10 +406,10 @@@ bool HYDROData_Entity::GetZLevel( Stand
    return false;
  }
  
 -void HYDROData_Entity::SetZLevel( const Standard_Integer& theLevel )
 +void HYDROData_Entity::SetZLevel( int theLevel )
  {
-   TDataStd_Integer::Set( myLab.FindChild( DataTag_ZLevel ), theLevel );
+   Handle(TDataStd_Integer) A = TDataStd_Integer::Set( myLab.FindChild( DataTag_ZLevel ), theLevel );
+   A->SetID(TDataStd_Integer::GetID());
  }
  
  void HYDROData_Entity::RemoveZLevel()
  
  void HYDROData_Entity::SetLabel( const TDF_Label& theLabel )
  {
 -  myLab = theLabel; 
 +  myLab = theLabel;
  }
  
--void HYDROData_Entity::SaveByteArray( const int   theTag, 
++void HYDROData_Entity::SaveByteArray( const int   theTag,
                                        const char* theData,
                                        const int   theLen )
  {
      for(int a = 0; a < theLen; a++)
        aNewData->SetValue(a + 1, theData[a]);
      aData->ChangeArray(aNewData);
-   } else {
-     for(int a = 0; a < theLen; a++)
-       aData->SetValue(a + 1, theData[a]);
 -  } 
++  }
+   else
+   {
+   //  for(int a = 0; a < theLen; a++)
+   //    aData->SetValue(a + 1, theData[a]);
    }
  }
  
@@@ -409,7 -535,7 +535,7 @@@ void HYDROData_Entity::SetReferenceObje
      aRefs = getReferenceList( theTag, true ); // because reference list can be removed
      if ( !aBeforeObj.IsNull() )
        aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
--    else 
++    else
        aRefs->Append( theObj->Label() );
    }
  }
@@@ -436,7 -562,7 +562,7 @@@ void HYDROData_Entity::InsertReferenceO
      Handle(HYDROData_Entity) aBeforeObj = GetReferenceObject( theTag, theBeforeIndex );
      if ( !aBeforeObj.IsNull() )
        aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
--    else 
++    else
        aRefs->Append( theObj->Label() );
    }
  }
@@@ -502,7 -629,7 +629,7 @@@ void HYDROData_Entity::RemoveReferenceO
      return;
  
    if ( aRefs->Extent() == 1 )
--  { 
++  {
      // remove all if only one
      ClearReferenceObjects( theTag );
      return;
@@@ -519,7 -646,7 +646,7 @@@ void HYDROData_Entity::RemoveReferenceO
      return;
  
    if ( aRefs->Extent() == 1 && theIndex == 0 )
--  { 
++  {
      // remove all if only one
      ClearReferenceObjects( theTag );
      return;
@@@ -766,3 -946,34 +946,34 @@@ double HYDROData_Entity::GetDouble( in
  
    return anAttr->Get();
  }
 -bool HYDROData_Entity::CompareLabels(const Handle(HYDROData_Entity)& theOtherObj) 
+ void HYDROData_Entity::SetInteger( int theTag, int theValue )
+ {
+   Handle(TDataStd_Integer) anAttr;
+   TDF_Label aLabel = myLab.FindChild( theTag );
+   if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
+   {
+     anAttr = new TDataStd_Integer();
+     anAttr->SetID(TDataStd_Integer::GetID());
+     aLabel.AddAttribute(anAttr);
+   }
+   anAttr->Set( theValue );
+ }
+ int HYDROData_Entity::GetInteger( int theTag, int theDefValue ) const
+ {
+   Handle(TDataStd_Integer) anAttr;
+   TDF_Label aLabel = myLab.FindChild( theTag );
+   if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
+     return theDefValue;
+   return anAttr->Get();
+ }
 -} 
++bool HYDROData_Entity::CompareLabels(const Handle(HYDROData_Entity)& theOtherObj)
+ {
+   if ( !theOtherObj.IsNull() )
+     return this->Label() == theOtherObj->Label();
+   return false;
++}
index 91f74803e7a2c736a0c05c1792ebd848003ae609,a4bcbd36e928cc701cdee7d25d2d475788cc5067..78c0d9e32a6c8601e89a761e1b97b19007d7b694
@@@ -87,7 -99,7 +99,7 @@@ HYDRODATA_EXPORT bool IsEqual(const Han
   * \brief Generic class of any object in the data model.
   *
   * Interface for getting access to the object that belong to the data model.
-- * Managed by Document. Provides access to the common properties: 
++ * Managed by Document. Provides access to the common properties:
   * kind of an object, name.
   */
  class HYDROData_Entity : public MMgt_TShared
@@@ -198,7 -219,7 +219,7 @@@ public
  
    /**
     * Returns flag indicating that object can be removed or not.
--   * Reimplement this method in class which can't be removed 
++   * Reimplement this method in class which can't be removed
     * separately with it parent object.
     * Base implementaiton returns always TRUE.
     */
     * \param theDefColor default color to return if attribute has not been set before
     */
    HYDRODATA_EXPORT QColor GetColor( const QColor& theDefColor, const int theTag = 0 ) const;
-  
+   /* Internal method that used to retreive the color attribute
+     * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+    * \param theOutColor color to return if attribute has been set before
+    * \return true if attribute is present
+    */
+   HYDRODATA_EXPORT bool GetColor( QColor& theOutColor,
+                                   const int     theTag ) const;
 - 
++
  protected:
  
    friend class HYDROData_Iterator;
  
    /**
--   * Creates new object in the internal data structure. Use higher level objects 
++   * Creates new object in the internal data structure. Use higher level objects
     * to create objects with real content.
     */
    HYDRODATA_EXPORT HYDROData_Entity( Geometry );
     * Internal method that used to retreive the content of byte array attribute
     * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
     * \param theLen number of bytes in byte array
--   * \returns pointer to the internal data structure wit harray content, 
++   * \returns pointer to the internal data structure wit harray content,
     *          or NULL if array size is zero
     */
    const char* ByteArray(const int theTag, int& theLen) const;
     * Internal method that used to store the reference object label attribute
     * \param theObj pointer to reference object
     * \param theTag tag of a label to store attribute (for 0 this is myLab)
--   * \param theIndex index in the list of references 
++   * \param theIndex index in the list of references
               - if more that len then just append it to the end of list
               - if less than zero then prepend to the list
               - indexing starts from 0
     * Internal method that used to store the reference object label attribute
     * \param theObj pointer to reference object
     * \param theTag tag of a label to store attribute (for 0 this is myLab)
--   * \param theBeforeIndex index in the list of references 
++   * \param theBeforeIndex index in the list of references
               - if more that len then just append it to the end of list
               - if less than zero then prepend to the list
               - indexing starts from 0
    /**
     * Internal method that used to retreive the reference object(s) attribute
     * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
--   * \param theIndex index in the list of references 
++   * \param theIndex index in the list of references
     *        - indexing starts from 0
     * \returns pointer to reference object or NULL if label is not set
     */
    /**
     * Internal method that used to remove the reference object attribute
     * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
--   * \param theIndex index in the list of references 
++   * \param theIndex index in the list of references
     *        - indexing starts from 0
     */
    void RemoveReferenceObject( const int theTag = 0, const int theIndex = 0 );
     * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
     */
    void ClearReferenceObjects( const int theTag = 0 );
-   
+ public:
+    HYDRODATA_EXPORT virtual bool CompareLabels(const Handle(HYDROData_Entity)& theOtherObj);
 -  
++
  protected:
  
    /**
     * Dump the initial object creation to a Python script.
--   * You should call it from DumpToPython implementation before 
++   * You should call it from DumpToPython implementation before
     * dumping fields of the object.
     */
    HYDRODATA_EXPORT virtual QStringList dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const;
@@@ -430,7 -471,7 +471,7 @@@ protected
  
    Handle(TDataStd_ReferenceList) getReferenceList( const int  theTag,
                                                     const bool theIsCreate ) const;
--  
++
    void SetShape( int theTag, const TopoDS_Shape& theShape );
    TopoDS_Shape GetShape( int theTag ) const;
  
index ebaeb1e743c04da1b2a06112b0186758edcc7b13,1d310ef38735609ec3b90e76d64d675aa8b64c74..5f82cd21fc80a271bd8639cf9c1581f7f7986de5
@@@ -114,9 -114,9 +114,10 @@@ public
    HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
    HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
  
+   using HYDROData_Entity::Remove;
    HYDRODATA_EXPORT bool Remove( const TopoDS_Face& );
    HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& );
 +  using HYDROData_Entity::Remove;
  
    HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& );
    HYDRODATA_EXPORT bool Split( const TopoDS_Shape& );
index 30a39620a51f79ea15de6cd2675ed94b4f57bb03,fc09314676e99f62905d66bc3fc6a250454fc19b..d372e18e5c02214e7b1497c905290be89ae10f58
    #pragma warning( disable: 4996 )
  #endif
  
--//SHP->TFaces (Import) 
++//SHP->TFaces (Import)
  #define OSD_TIMER
  
  HYDROData_ShapeFile::HYDROData_ShapeFile() : myHSHP(NULL)
--{ 
++{
  }
  
  HYDROData_ShapeFile::~HYDROData_ShapeFile()
@@@ -86,9 -87,9 +87,9 @@@ void HYDROData_ShapeFile::Export(Handle
    SHPHandle hSHPHandle;
    if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty())
    {
--    hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARC );        
++    hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARC );
      for (int i = 1; i <= aPolyXYSeq.Size(); i++)
-       if (WriteObjectPolyXY(hSHPHandle, aPolyXYSeq(i)) != 1)
+       if (WriteObjectPolyXY(theDocument, hSHPHandle, aPolyXYSeq(i)) != 1)
          aNonExpList.append(aPolyXYSeq(i)->GetName());
    }
    else if (aPolyXYSeq.IsEmpty() && !aPoly3DSeq.IsEmpty())
@@@ -144,8 -150,8 +150,8 @@@ int HYDROData_ShapeFile::WriteObjectPol
    SHPObject   *aSHPObj;
    std::vector<double> x, y;
    std::vector<int> anPartStart;
--  
--  for (int i = 0; i < thePoly->NbSections(); i++)    
++
++  for (int i = 0; i < thePoly->NbSections(); i++)
      if (thePoly->GetSectionType(i) == HYDROData_IPolyline::SECTION_SPLINE)
        return -1;
  
      }
      if (thePoly->IsClosedSection(i))
      {
-       x.push_back( aPointList(1).X());
-       y.push_back( aPointList(1).Y()); 
+       gp_XY P = aPointList(1);
+       //theDocument->Transform(P, false);
+       x.push_back( P.X());
+       y.push_back( P.Y());
      }
    }
--    
-   aSHPObj = SHPCreateObjectSHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
++
+   aSHPObj = SHPCreateObject (SHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
    SHPWriteObject( theShpHandle, -1, aSHPObj );
    SHPDestroyObject( aSHPObj );
    return 1;
  }
  
- int HYDROData_ShapeFile::WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROData_Polyline3D thePoly )
+ int HYDROData_ShapeFile::WriteObjectPoly3D(Handle(HYDROData_Document) theDocument,
+                                            SHPHandle theShpHandle,
+                                            Handle(HYDROData_Polyline3D) thePoly )
  {
-   SHPObject   *aSHPObj;
+   SHPObject *aSHPObj;
    std::vector<double> x, y, z;
    std::vector<int> anPartStart;
+   anPartStart.push_back(0); //one section only
  
-   for (int i = 0; i < thePoly->GetPolylineXY()->NbSections(); i++)    
-     if (thePoly->GetPolylineXY()->GetSectionType(i) == HYDROData_IPolyline::SECTION_SPLINE)
-       return -1;
-   
-   for (int i = 0; i < thePoly->GetPolylineXY()->NbSections(); i++)
-   {
-     anPartStart.push_back(x.size());
-     HYDROData_PolylineXY::PointsList aPointList = thePoly->GetPolylineXY()->GetPoints(i);
-     for (int j = 1; j <= aPointList.Size(); j++)
-     {
-       x.push_back( aPointList(j).X());
-       y.push_back( aPointList(j).Y()); 
-       z.push_back(thePoly->GetAltitudeObject()->GetAltitudeForPoint(gp_XY (aPointList(j).X(), aPointList(j).Y())));
-     }
-     if ( thePoly->GetPolylineXY()->IsClosedSection(i))
-     {
-       x.push_back( aPointList(1).X());
-       y.push_back( aPointList(1).Y()); 
-       z.push_back(thePoly->GetAltitudeObject()->GetAltitudeForPoint(gp_XY (aPointList(1).X(), aPointList(1).Y())));
+   if (thePoly->GetPolylineXY()->GetSectionType(0) == HYDROData_IPolyline::SECTION_SPLINE)
 -    return -1;  
++    return -1;
  
-     }
+   HYDROData_Polyline3D::Polyline3DPoints aPointList3D = thePoly->GetProfilePoints3D(true);
+   for (int j = 1; j <= aPointList3D.Size(); j++)
+   {
+     const gp_XYZ& P = aPointList3D(j);
+     //theDocument->Transform(P, false);
+     x.push_back(P.X());
+     y.push_back(P.Y());
+     z.push_back(P.Z());
    }
-   
-   aSHPObj = SHPCreateObject( SHPT_ARCZ, -1, thePoly->GetPolylineXY()->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], &z[0], NULL );
+   if ( thePoly->GetPolylineXY()->IsClosedSection(0))
+   {
+     const gp_XYZ& P = aPointList3D(1);
+     //theDocument->Transform(P, false);
+     x.push_back(P.X());
+     y.push_back(P.Y());
+     z.push_back(P.Z());
+   }
+   aSHPObj = SHPCreateObject( SHPT_ARCZ, -1, 1, &anPartStart[0], NULL, x.size(), &x[0], &y[0], &z[0], NULL );
    SHPWriteObject( theShpHandle, -1, aSHPObj );
    SHPDestroyObject( aSHPObj );
    return 1;
@@@ -219,22 -232,24 +232,24 @@@ int HYDROData_ShapeFile::WriteObjectPol
    else if (theInputShape.ShapeType() == TopAbs_COMPOUND)
    {
      TopExp_Explorer Ex(theInputShape, TopAbs_FACE);
--    for (; Ex.More(); Ex.Next()) 
++    for (; Ex.More(); Ex.Next())
      {
--      TopoDS_Face aF = TopoDS::Face(Ex.Current());   
++      TopoDS_Face aF = TopoDS::Face(Ex.Current());
        if (aF.IsNull())
          continue;
-       ProcessFace(aF, theShpHandle, bUseDiscr, theDefl);
+       ProcessFace(theDocument, aF, theShpHandle, bUseDiscr, theDefl);
      }
    }
    else
      return 0;
  
    return 1;
-- 
++
  }
  
- void HYDROData_ShapeFile::ProcessFace(const TopoDS_Face& theFace, SHPHandle theShpHandle,
+ void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument,
+                                       const TopoDS_Face& theFace,
+                                       SHPHandle theShpHandle,
                                        bool bUseDiscr, double theDefl )
  {
    if (theFace.ShapeType() != TopAbs_FACE)
    NCollection_Sequence<TopoDS_Wire> aWires;
  
    //write an outer wire first
--  aWires.Append(OuterW); 
--  TopExp_Explorer Ex(theFace, TopAbs_WIRE);  
--  for (; Ex.More(); Ex.Next()) 
++  aWires.Append(OuterW);
++  TopExp_Explorer Ex(theFace, TopAbs_WIRE);
++  for (; Ex.More(); Ex.Next())
    {
      TopoDS_Wire aW = TopoDS::Wire(Ex.Current());
      if (aW.IsEqual(OuterW))
        continue;
--    aWires.Append(aW); 
++    aWires.Append(aW);
    }
  
    int NbWires = 0;
--  for (int k = 1; k <= aWires.Length(); k++) 
++  for (int k = 1; k <= aWires.Length(); k++)
    {
--    TopoDS_Wire aW = aWires(k);   
++    TopoDS_Wire aW = aWires(k);
      if (aW.IsNull())
        continue;
      NbWires++;
      if (aW.Orientation() == TopAbs_INTERNAL)
        //cant write internal wires/edges
--      continue; 
++      continue;
      // Try to reorder edges
      Handle(ShapeFix_Wire) aSFW = new ShapeFix_Wire( aW, theFace, Precision::Confusion() );
      aSFW->ModifyTopologyMode() = Standard_False;
      aNPnts.Append(aPnts.First());
      for (int j = 1; j <= aPnts.Size() - 1; j++)
      {
--      if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion())) 
++      if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion()))
          aNPnts.Append(aPnts(j + 1));
      }
  
      //External wire will be written in clockwise direction
      //any other wires (holes) - in anticlockwise direction
      for (int j = aNPnts.Size(); j >= 1; j--)
--    { 
-       x.push_back( aNPnts(j).X());
-       y.push_back( aNPnts(j).Y()); 
++    {
+       gp_XY P = gp_XY(aNPnts(j).X(), aNPnts(j).Y());
+       theDocument->Transform(P, false);
+       x.push_back( P.X());
+       y.push_back( P.Y());
      }
      //first point is same as the last one => closed polygon
-     x.push_back( aNPnts.Last().X());
-     y.push_back( aNPnts.Last().Y()); 
+     gp_XY P = gp_XY(aNPnts.Last().X(), aNPnts.Last().Y());
+     theDocument->Transform(P, false);
+     x.push_back( P.X());
+     y.push_back( P.Y());
  
    }
--  
++
    aSHPObj = SHPCreateObject( SHPT_POLYGON, -1, NbWires, &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
    SHPWriteObject( theShpHandle, -1, aSHPObj );
    SHPDestroyObject( aSHPObj );
@@@ -354,12 -373,13 +373,13 @@@ bool HYDROData_ShapeFile::Parse(SHPHand
    int aShapeType;
    mySHPObjects.clear();
    SHPGetInfo( theHandle, NULL, &aShapeType, NULL, NULL );
-   theShapeTypeOfFile = aShapeType;
-   bool ToRead = (theType == ShapeType_Polyline && (aShapeType == 3 || aShapeType == 13 || aShapeType == 23)) ||
+   //theShapeTypeOfFile = aShapeType;
 -  bool ToRead = (theType == ShapeType_Polyline && 
++  bool ToRead = (theType == ShapeType_Polyline &&
+     (aShapeType == 3 || aShapeType == 13 || aShapeType == 23 || aShapeType == 5)) ||
     (theType == ShapeType_Polygon && aShapeType == 5);
--  if (ToRead) 
++  if (ToRead)
    {
--    for (int i = 0; i < theHandle->nRecords; i++) 
++    for (int i = 0; i < theHandle->nRecords; i++)
        mySHPObjects.push_back(SHPReadObject(theHandle, i));
      return true;
    }
@@@ -371,9 -391,9 +391,9 @@@ void HYDROData_ShapeFile::ReadSHPPolygo
  {
    if (!anObj)
      return;
--  TopoDS_Edge E; 
++  TopoDS_Edge E;
    int nParts = anObj->nParts;
-   Handle_Geom_Plane aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
+   Handle(Geom_Plane) aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
  
    BRep_Builder BB;
    BB.MakeFace(F);
  
    TopTools_SequenceOfShape aWires;
    for ( int i = 0 ; i < nParts ; i++ )
--  { 
++  {
      BRepBuilderAPI_MakeWire aBuilder;
      int StartIndex = anObj->panPartStart[i];
      int EndIndex;
      TopoDS_Wire W;
      BB.MakeWire(W);
  
--    //First point is same as the last point 
++    //First point is same as the last point
      int NbPnts = EndIndex - StartIndex - 1;
      NCollection_Array1<TopoDS_Vertex> VPoints(0, NbPnts);
      int j = NbPnts;
        VPoints.ChangeValue(j) = BRepLib_MakeVertex(P).Vertex();
        j--;
      }
--      
++
      for ( int k = 0; k < VPoints.Size() - 1; k++ )
      {
        gp_Pnt P1 = BRep_Tool::Pnt(VPoints(k));
          Standard_Real jXmax, jXmin, jYmax, jYmin;
          BBs(i).Get(iXmin, iYmin, z0, iXmax, iYmax, z1);
          BBs(j).Get(jXmin, jYmin, z0, jXmax, jYmax, z1);
--        if (!(iXmin > jXmin && 
++        if (!(iXmin > jXmin &&
              iYmin > jYmin &&
              iXmax < jXmax &&
              iYmax < jYmax))
      BB.UpdateFace(DF, aPlaneSur, TopLoc_Location(), Precision::Confusion());
      //
      BRepTopAdaptor_FClass2d FClass(DF, Precision::PConfusion());
--    if ( i == OutWIndex && FClass.PerformInfinitePoint() == TopAbs_IN) 
++    if ( i == OutWIndex && FClass.PerformInfinitePoint() == TopAbs_IN)
        W.Reverse();
--    if ( i != OutWIndex && FClass.PerformInfinitePoint() == TopAbs_OUT) 
++    if ( i != OutWIndex && FClass.PerformInfinitePoint() == TopAbs_OUT)
        W.Reverse();
      //
      BB.Add(F, W);
    }
--  
++
    //Add surface to the face
    BB.UpdateFace(F, aPlaneSur, TopLoc_Location(), Precision::Confusion());
    F.Closed(Standard_True);
  }
  
- int HYDROData_ShapeFile::ImportPolygons(const QString theFileName, QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces, int& theShapeTypeOfFile)
 -int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName, 
++int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName,
+   QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces)
  {
    Free();
    int Stat = TryOpenShapeFile(theFileName);
      return 0;
    for (size_t i = 0; i < mySHPObjects.size(); i++)
      thePolygonsList.append("polygon_" + QString::number(i + 1));
--   
++
    TopoDS_Face aF;
    if (myHSHP->nShapeType == 5)
    {
      OSD_Timer timer;
      timer.Start();
  #endif
--    for (size_t i = 0; i < mySHPObjects.size(); i++) 
++    for (size_t i = 0; i < mySHPObjects.size(); i++)
      {
-        ReadSHPPolygon(mySHPObjects[i], i, aF);
+        ReadSHPPolygon(theDocument, mySHPObjects[i], i, aF);
         theFaces.Append(aF);
      }
  #ifdef OSD_TIMER
  }
  
  void HYDROData_ShapeFile::Free()
--{  
++{
    for (size_t i = 0; i < mySHPObjects.size(); i++ )
      free (mySHPObjects[i]);
  
    if (myHSHP != NULL)
    {
      SHPClose(myHSHP);
--    myHSHP = NULL; 
++    myHSHP = NULL;
    }
  }
  
  
--void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, 
-   int theInd, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
++void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
+   int theInd, NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities, bool bReadAsPolyline)
  {
    Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
--  
++
    int nParts = anObj->nParts;
    for ( int i = 0 ; i < nParts ; i++ )
    {
      else
        EndIndex = anObj->nVertices;
  
-     bool IsClosed = false;
--    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; 
-     if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
-         anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] )
++    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+     if (!bReadAsPolyline)
      {
-       IsClosed = true;
-       aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true);
+       bool IsClosed = false;
+       if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
+         anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] )
+       {
+         IsClosed = true;
+         aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true);
+       }
+       else
+         aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false);
+       if (IsClosed)
+         EndIndex--;
      }
      else
-       aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false);
-     
-     if (IsClosed)
+     {
+       //polygon; contours always closed
+       aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true);
        EndIndex--;
+     }
      for ( int k = StartIndex; k < EndIndex ; k++ )
      {
-       HYDROData_PolylineXY::Point aSectPoint;
-       aSectPoint.SetX( anObj->padfX[k] );
-       aSectPoint.SetY( anObj->padfY[k] );
+       HYDROData_PolylineXY::Point aSectPoint = gp_XY(anObj->padfX[k], anObj->padfY[k]);
+       theDocument->Transform(aSectPoint, true);
        aPolylineXY->AddPoint( i, aSectPoint );
      }
  
    }
--  
++
    aPolylineXY->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
    aPolylineXY->SetName( theFileName + "_PolyXY_" + QString::number(theInd) );
--  
++
    aPolylineXY->Update();
    theEntities.Append(aPolylineXY);
 -void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, 
 -  const Handle(HYDROData_PolylineXY)& aPolylineXY, 
+ }
 -    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; 
++void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj,
++  const Handle(HYDROData_PolylineXY)& aPolylineXY,
+   NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
+ {
+   Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( theDocument->CreateObject( KIND_POLYLINE ) );
+   Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( theDocument->CreateObject( KIND_BATHYMETRY ) );
+   HYDROData_Bathymetry::AltitudePoints aAPoints;
+   int nParts = anObj->nParts;
+   for ( int i = 0 ; i < nParts ; i++ )
+   {
+     //bool aSectClosure = true;
+     int StartIndex = anObj->panPartStart[i];
+     int EndIndex;
+     if (i != nParts - 1)
+       EndIndex = anObj->panPartStart[i + 1];
+     else
+       EndIndex = anObj->nVertices;
 -      anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])    
++    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+     if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
+       anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] &&
 -      aAPoints.push_back(p);      
++      anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])
+       EndIndex--;
+     for ( int k = StartIndex ; k < EndIndex ; k++ )
+     {
+       gp_XYZ xyz(anObj->padfX[k], anObj->padfY[k], anObj->padfZ[k]);
+       theDocument->Transform(xyz, true);
+       HYDROData_Bathymetry::AltitudePoint p;
+       p.X = xyz.X();
+       p.Y = xyz.Y();
+       p.Z = xyz.Z();
 -  
++      aAPoints.push_back(p);
+     }
+   }
+   QString PolyXYName = aPolylineXY->GetName();
+   QString aPoly3DName = PolyXYName, aBathyName = PolyXYName;
+   aPoly3DName.replace(PolyXYName.lastIndexOf("_PolyXY_"), 8, "_Poly3D_");
+   aBathyName.replace(PolyXYName.lastIndexOf("_Bath_"), 6, "_Poly3D_");
++
+   aBath->SetAltitudePoints(aAPoints);
+   aBath->SetName( aBathyName );
+   aPolylineObj->SetPolylineXY (aPolylineXY, false);
+   aPolylineObj->SetAltitudeObject(aBath);
+   aPolylineObj->SetBorderColor( aPolylineObj->DefaultBorderColor() );
+   aPolylineObj->SetName( aPoly3DName );
+   aPolylineObj->Update();
  
+   theEntities.Append(aPolylineObj);
  }
  
- void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, 
-   int theInd, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+ /*
 -void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, 
++void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
+   int theInd, bool XYOnly, NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
  {
    Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
  
        EndIndex = anObj->nVertices;
  
      bool IsClosed = false;
--    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; 
++    HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
      if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
          anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] &&
          anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])
      }
      else
        aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false  );
--    
++
      if (IsClosed)
        EndIndex--;
      for ( int k = StartIndex ; k < EndIndex ; k++ )
@@@ -662,6 -778,27 +778,27 @@@ int HYDROData_ShapeFile::OpenAndParse(c
    if (aStat != 0)
      return aStat;
  
 -  
+   //SHPHandle aHSHP;
+   myHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" );
+   if (myHSHP == NULL)
+     return -1;
+   if (!Parse(myHSHP, HYDROData_ShapeFile::ShapeType_Polyline))
+     return -1;
 -int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, 
 -  const QString& theFileName, 
 -  NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*>& theEntitiesToSHPObj, 
++
+   return 1;
+   //sh_type = aHSHP->nShapeType;
+ }
++int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument,
++  const QString& theFileName,
++  NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*>& theEntitiesToSHPObj,
+   ImportShapeType theShapeTypesToImport)
+ {
+   int aStat = -1;
+   int sh_type = myHSHP->nShapeType;
+   QFileInfo aFileInfo(theFileName);
+   QString aBaseFileName = aFileInfo.baseName();
    HYDROData_Iterator anIter( theDocument );
    int anInd = 0;
    QStringList anExistingNames;
    for( ; anIter.More(); anIter.Next() )
      anExistingNames.push_back(anIter.Current()->GetName());
  
-   SHPHandle aHSHP;
-   aHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" );
-   
-   QFileInfo aFileInfo(theFileName);
-   QString aBaseFileName = aFileInfo.baseName();
-   if (!Parse(aHSHP, HYDROData_ShapeFile::ShapeType_Polyline, theShapeTypeOfFile))
-     return 0;
-   if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23)
+   NCollection_Sequence<Handle(HYDROData_Entity)> Ents;
 -  if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
 -    theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline) 
++  if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
++    theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline)
+     && (sh_type == 3 || sh_type == 23))
    {
-     anInd = 0;
-     for (;anAllowedIndexes.size() < mySHPObjects.size();)
-     {
-       if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd)))
-       {
-         anAllowedIndexes.push_back(anInd);
-         anInd++;
-       }
-       else
-         anInd++;
-     }
-     
+     size_t anObjsSize = mySHPObjects.size();
+     GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName);
 - 
++
      for (size_t i = 0; i < mySHPObjects.size(); i++ )
      {
-       ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities);
+       ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false);
+       for (int k=1;k<=Ents.Size();k++)
+         theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]);
      }
      aStat = 1;
    }
-   else if (aHSHP->nShapeType == 13)
 -  else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
++  else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
+     theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13)
    {
      anInd = 0;
      for (;anAllowedIndexes.size() < mySHPObjects.size();)
          anInd++;
      }
      for (size_t i = 0; i < mySHPObjects.size(); i++ )
-       ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities);
+     {
 -      //ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], false, theEntities); 
 -      ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); //TODO check Z coord on closeness 
++      //ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], false, theEntities);
++      ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); //TODO check Z coord on closeness
+       for (int k=1;k<=Ents.Size();k++)
+         theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]);
+     }
      aStat = 1;
    }
-   else  
 -  else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
++  else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
+     theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polygon) && sh_type == 5)
+   {
+     //import polygon's contours as polylines
+     size_t anObjsSize = mySHPObjects.size();
+     GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName);
 - 
++
+     for (size_t i = 0; i < mySHPObjects.size(); i++ )
+     {
+       ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, true);
+       for (int k=1;k<=Ents.Size();k++)
+         theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]);
+     }
+     aStat = 2;
+   }
 -  else  
++  else
    {
      aStat = 0;
    }
--  
-   for (size_t i = 0; i < mySHPObjects.size(); i++ )
-     free (mySHPObjects[i]);
 +
-   mySHPObjects.clear();
-   SHPClose(aHSHP);
    return aStat;
  }
  
 -  else 
+ int HYDROData_ShapeFile::GetShapeType() const
+ {
+   if (myHSHP != NULL)
+     return myHSHP->nShapeType;
 -int HYDROData_ShapeFile::ImportPolylines3D(Handle(HYDROData_Document) theDocument, 
 -                                           NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*> thePolyXYToObj, 
++  else
+     return -1;
+ }
 -  if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
++int HYDROData_ShapeFile::ImportPolylines3D(Handle(HYDROData_Document) theDocument,
++                                           NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*> thePolyXYToObj,
+                                            NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities,
+                                            ImportShapeType theShapeTypesToImport)
+ {
+   int aStat = -1;
+   int sh_type = myHSHP->nShapeType;
 -      ReadSHPPoly3D(theDocument, thePolyXYToObj(i), aPolylineXY, theEntities); 
++  if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
+     theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13)
+   {
+     //for (size_t i = 0; i < mySHPObjects.size(); i++ )
+     for (int i = 1; i <= thePolyXYToObj.Extent(); i++ )
+     {
+       Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( thePolyXYToObj.FindKey(i) );
 -  else  
++      ReadSHPPoly3D(theDocument, thePolyXYToObj(i), aPolylineXY, theEntities);
+     }
+     aStat = 1;
+   }
 -  
++  else
+     aStat = 0;
++
+   return aStat;
+ }
  QString HYDROData_ShapeFile::GetShapeTypeName(int theType)
  {
    switch (theType)
@@@ -787,7 -961,7 +961,7 @@@ int HYDROData_ShapeFile::TryOpenShapeFi
      if (pFileSHX == NULL)
        return -2;
    }
--  
++
    fclose (pFileSHP);
    fclose (pFileSHX);
    return 0;
@@@ -805,7 -979,7 +979,7 @@@ bool HYDROData_ShapeFile::CheckDBFFileE
    {
      return false;
    }
--  
++
    fclose (pFileDBF);
    thePathToDBFFile = aDBFfile;
    return true;
@@@ -884,9 -1058,9 +1058,9 @@@ void HYDROData_ShapeFile::DBF_GetAttrib
  {
    int nWidth, nDecimals;
    char chField[12];
--  
++
    for( int i = 0; i < DBFGetRecordCount(myHDBF); i++ )
--  {      
++  {
      DBFFieldType eType;
      DBF_AttrValue anAttr;
      eType = DBFGetFieldInfo( myHDBF, theIndexOfField, chField, &nWidth, &nDecimals );
            anAttr.myStrVal = QString(chAttr);
            break;
          }
--       
++
          case FTInteger:
          {
            int iAttr = DBFReadIntegerAttribute( myHDBF, i, theIndexOfField );
            anAttr.myIntVal = iAttr;
            break;
          }
--          
++
          case FTDouble:
          {
            double dAttr = DBFReadDoubleAttribute( myHDBF, i, theIndexOfField );
@@@ -960,8 -1134,8 +1134,8 @@@ bool HYDROData_ShapeFile::DBF_WriteFiel
    hDBF = DBFCreate( theFileName.toStdString().c_str() );
    if( hDBF == NULL )
          return false;
--  
--  if (theType != DBF_FieldType_String && theType != DBF_FieldType_Integer && theType != DBF_FieldType_Double) 
++
++  if (theType != DBF_FieldType_String && theType != DBF_FieldType_Integer && theType != DBF_FieldType_Double)
    {
      DBFClose( hDBF );
      return false; //cant handle any other cases
        DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTString, nWidth, 0);
        break;
      }
--   
++
      case DBF_FieldType_Integer:
      {
        DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTInteger, nWidth, 0);
        break;
      }
--      
++
      case DBF_FieldType_Double:
      {
        DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTDouble, nWidth, 0);
        break;
    }
  
--  if (DBFGetFieldCount( hDBF ) != 1) 
++  if (DBFGetFieldCount( hDBF ) != 1)
    {
      DBFClose( hDBF );
      return false;
              stat = DBFWriteStringAttribute(hDBF, (int)i, 0, theAttrV[i].myStrVal.toStdString().c_str());
              break;
            }
--         
++
            case DBF_FieldType_Integer:
            {
              stat = DBFWriteIntegerAttribute(hDBF, (int)i, 0, theAttrV[i].myIntVal);
              break;
            }
--            
++
            case DBF_FieldType_Double:
            {
              stat = DBFWriteDoubleAttribute(hDBF, (int)i, 0, theAttrV[i].myDoubleVal);
index 5a04636ad64bf7d86f4362318520ceab12013117,ba89018fc9f70564683aab85c2cc2fd79f49733c..d767ede7954c277b68a48578bff0091fc81551c1
mode 100644,100755..100755
@@@ -1,12 -1,8 +1,8 @@@
  include(../../CMake/Common.cmake)
+ include(../../CMake/UseQT4EXT.cmake)
+ INCLUDE(UseQtExt)
  
- IF (SalomeGUI_VERSION VERSION_LESS "8.0.0")
-   INCLUDE(UseQt4Ext)
- ELSE()
-   INCLUDE(UseQtExt)
- ENDIF()
-  
--set(PROJECT_HEADERS 
++set(PROJECT_HEADERS
      HYDROGUI.h
      HYDROGUI_AbstractDisplayer.h
      HYDROGUI_AISShape.h
      HYDROGUI_LandCoverColoringOp.h
      HYDROGUI_SetTransparencyOp.h
      HYDROGUI_TransparencyDlg.h
+     HYDROGUI_Overview.h
+     HYDROGUI_PolylineStyleOp.h
+     HYDROGUI_PolylineStyleDlg.h
+     HYDROGUI_ZoneTool.h
+     HYDROGUI_RegenerateRegionColorsOp.h
+     HYDROGUI_ZoneSetColorOp.h
+     HYDROGUI_PolyAttrDlg.h
+     HYDROGUI_ShowAttrPolyOp.h
+     HYDROGUI_SetBoundaryTypePolygonOp.h
+     HYDROGUI_SetBoundaryTypePolygonDlg.h
+     HYDROGUI_MeasurementToolOp.h
+     HYDROGUI_MeasurementToolDlg.h
+     HYDROGUI_SIProgressIndicator.h
+     HYDROGUI_ZIProgressIndicator.h
+     HYDROGUI_ImportPolylineDlg.h
+     HYDROGUI_ImportSinusXDlg.h
  )
  
- IF(NOT SALOME_GUI_BUILD_WITH_QT5)
-   QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
- ELSE()
-   QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
- ENDIF()
+ QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
  
--set(PROJECT_SOURCES 
++set(PROJECT_SOURCES
      HYDROGUI_AbstractDisplayer.cxx
      HYDROGUI_AISShape.cxx
      HYDROGUI_AISTrihedron.cxx
@@@ -325,7 -355,7 +355,7 @@@ include_directories
  add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC})
  target_link_libraries(HYDROGUI HYDROData shapelib
      ${CAS_TKV3d} ${CAS_TKTopAlgo} ${CAS_TKBrep} ${CAS_TKBO}
--    ${GUI_LightApp} ${GUI_CAM} ${GUI_suit} ${GUI_qtx} ${GUI_ObjBrowser} ${GUI_GraphicsView} ${GUI_std} 
++    ${GUI_LightApp} ${GUI_CAM} ${GUI_suit} ${GUI_qtx} ${GUI_ObjBrowser} ${GUI_GraphicsView} ${GUI_std}
      ${GUI_Event} ${GUI_OCCViewer} ${GEOM_GEOM} ${GEOM_GEOMBase} ${GEOM_CurveCreator}
      ${VTK_LIBRARIES} ${SVTK} ${SalomeObject} ${SalomePrs}
      )
index bfb178a459d326b24461dc808ecc7dc5b27ea456,66eec4f6f2873b067adee2bb296915a4afc3e624..b5c0f6303cf6acf052ddd53ebf0f00e26f2a27ac
@@@ -31,7 -30,7 +31,7 @@@
  #include <SUIT_ResourceMgr.h>
  #include <SUIT_SelectionMgr.h>
  #include <SUIT_DataObjectIterator.h>
--        
++
  #define VISIBILITY_COLUMN_WIDTH 25
  
  
@@@ -153,7 -152,7 +153,7 @@@ void HYDROGUI_OBSelector::setSelection
    }
  
    DataObjectList objList;
--  for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin(); 
++  for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin();
          it != theList.end(); ++it ) {
      const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*it).operator->() );
  
@@@ -234,7 -233,7 +234,7 @@@ HYDROGUI_DataBrowser::HYDROGUI_DataBrow
    // Mantis issue 0020136: Drag&Drop in OB
    SUIT_ProxyModel* proxyModel = dynamic_cast<SUIT_ProxyModel*>(treeModel);
    if ( proxyModel ) {
--    connect( proxyModel, 
++    connect( proxyModel,
        SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
        SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
  
      SUIT_TreeModel* aMiniModel = dynamic_cast<SUIT_TreeModel*>( proxyModel->sourceModel() );
      if ( aMiniModel )
      {
--      connect( aMiniModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), 
++      connect( aMiniModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
          SIGNAL( dataChanged() ) );
      }
  
          if ( aPModel )
          {
            SUIT_TreeModel* aModel = dynamic_cast<SUIT_TreeModel*>(aPModel->sourceModel());
--          //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), 
++          //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
            //  aPModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ) );
--          //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), 
++          //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
            //  aModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ) );
            connect( proxyModel, SIGNAL( modelUpdated() ), aModel, SIGNAL( modelUpdated() ) );
          }
index d2acbf8816d74c3d4f6e0ed061b9124b43044319,fe650d28fb0a754ff14d22e1247faa5dad744561..38c283fc6c7e3d4adc167adb46a73574a1223de3
@@@ -122,7 -131,7 +131,7 @@@ bool HYDROGUI_DataModel::open( const QS
      {
        res = DocError_UnknownProblem;
      }
--    
++
      if ( res != DocError_OK )
      {
        module()->application()->putInfo( tr( "LOAD_ERROR" ) );
  
  bool HYDROGUI_DataModel::save( QStringList& theFileList )
  {
+   DEBTRACE("save");
    if( !module()->application()->activeStudy() )
      return false;
--  
++
    LightApp_DataModel::save( theFileList );
  
    QString aTmpDir;
    // save module data to temporary files
    LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
    aTmpDir = aStudy->GetTmpDir( myStudyURL.toLatin1().constData(), isMultiFile ).c_str();
--  
++
    // save OCAF data to a temporary file
    QString aDataFileName = SUIT_Tools::file( myStudyURL, false ) + "_HYDRO.cbf";
    QString aDataFullPath = aTmpDir + aDataFileName;
@@@ -479,8 -514,79 +514,79 @@@ void HYDROGUI_DataModel::update( const 
    //  anObjectBrowser->openLevels();
    //}
  
-   HYDROGUI_DataModelSync aSync( aNewRootObj );
    SUIT_DataObject* aRoot = root();
 -          //new root - remove children 
+   if (aRoot)
+   {
+     std::map<std::string, SUIT_DataObject*> entry2ObjNewRoot;
+     SUIT_DataObjectIterator::DetourType dt = SUIT_DataObjectIterator::DepthLeft;
+     for ( SUIT_DataObjectIterator it( aNewRootObj, dt ); it.current(); ++it )
+     {
+       LightApp_DataObject* aCurObjN = dynamic_cast<LightApp_DataObject*>(it.current());
+       if (aCurObjN)
+         entry2ObjNewRoot[aCurObjN->entry().toStdString()] = it.current();
+     }
+     for ( SUIT_DataObjectIterator it( aRoot, dt ); it.current(); ++it )
+     {
+       LightApp_DataObject* aCurObjO = dynamic_cast<LightApp_DataObject*>(it.current());
+       if (aCurObjO && aCurObjO->childCount() > 0)
+       {
+         std::string entry = aCurObjO->entry().toStdString();
+         SUIT_DataObject* newNode = entry2ObjNewRoot[entry];
+         if (newNode && aCurObjO->childCount() > 0)
+         {
+           DataObjectList newchildren;
+           newNode->children(newchildren);
 -          aCurObjO->children(oldchildren);  
++          //new root - remove children
+           std::map<std::string, SUIT_DataObject*> newNode2Entries;
+           for ( DataObjectList::const_iterator it = newchildren.begin(); it != newchildren.end(); ++it )
+           {
+             SUIT_DataObject* cc = *it;
+             LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>(cc);
+             newNode2Entries[obj->entry().toStdString()] = cc;
+             newNode->removeChild(cc);
+           }
+           //
+           std::set<SUIT_DataObject*> objtemp;
+           DataObjectList oldchildren;
 -              SUIT_DataObject* obj = newNode2Entries[entr]; 
++          aCurObjO->children(oldchildren);
+           for ( DataObjectList::const_iterator it = oldchildren.begin(); it != oldchildren.end(); ++it )
+           {
+             SUIT_DataObject* old_ch = *it;
+             std::string entr = dynamic_cast<LightApp_DataObject*>(old_ch)->entry().toStdString();
+             if (newNode2Entries.count(entr) > 0)
+             {
++              SUIT_DataObject* obj = newNode2Entries[entr];
+               newNode->appendChild(obj);
+               objtemp.insert(obj);
+             }
+           }
+           //
+           for ( DataObjectList::const_iterator it = newchildren.begin(); it != newchildren.end(); ++it )
+           {
+             SUIT_DataObject* ch = *it;
+             if (objtemp.count(ch) == 0)
+               newNode->appendChild(ch);
+           }
+           { //IF DEBUG
+             //add. check
+             DataObjectList newchildren2;
+             newNode->children(newchildren2);
+             std::set<std::string> entries2, entries1;
+             for ( DataObjectList::const_iterator it = newchildren2.begin(); it != newchildren2.end(); ++it )
+               entries2.insert((dynamic_cast<LightApp_DataObject*>(*it))->entry().toStdString());
+             for ( DataObjectList::const_iterator it = newchildren.begin(); it != newchildren.end(); ++it )
+               entries1.insert((dynamic_cast<LightApp_DataObject*>(*it))->entry().toStdString());
+             assert(entries1 == entries2);
+           }
+         }
+       }
+     }
+   }
+   HYDROGUI_DataModelSync aSync( aNewRootObj );
    bool isNewDoc = aRoot==0;
    if( isNewDoc )
      aRoot = createRootModuleObject( aStudyRoot );
@@@ -602,7 -710,7 +710,7 @@@ void HYDROGUI_DataModel::clearRedos(
  
  bool HYDROGUI_DataModel::undo()
  {
--  try 
++  try
    {
      getDocument()->Undo();
    }
  
  bool HYDROGUI_DataModel::redo()
  {
--  try 
++  try
    {
      getDocument()->Redo();
    }
@@@ -636,9 -744,9 +744,9 @@@ bool HYDROGUI_DataModel::canCopy(
      if( !anObject.IsNull() ) {
        ObjectKind aKind = anObject->GetKind();
        bool isUnrecognized = aKind <= KIND_UNKNOWN || aKind > KIND_LAST;
--      bool isChildObject = aKind == KIND_DUMMY_3D || 
++      bool isChildObject = aKind == KIND_DUMMY_3D ||
                             aKind == KIND_ZONE ||
--                           aKind == KIND_SHAPES_GROUP || 
++                           aKind == KIND_SHAPES_GROUP ||
                             aKind == KIND_SPLIT_GROUP;
        if ( isUnrecognized || isChildObject ) {
          isCanCopy = false;
        }
      }
    }
--  
++
    return isCanCopy;
  }
  
@@@ -794,7 -905,7 +905,7 @@@ LightApp_DataObject* HYDROGUI_DataModel
                                                         const bool               theIsBuildTree,
                                                         const bool               theIsInOperation )
  {
--  return buildObject( theParent, new HYDROGUI_Region( theParent, theModelObject, theParentEntry, theIsInOperation ), 
++  return buildObject( theParent, new HYDROGUI_Region( theParent, theModelObject, theParentEntry, theIsInOperation ),
      theParentEntry, theIsBuildTree, theIsInOperation );
  }
  
@@@ -803,7 -914,7 +914,7 @@@ void HYDROGUI_DataModel::createDefaultS
  {
    // Create default Strickler table object
    Handle(HYDROData_StricklerTable) aStricklerTableObj =
--    Handle(HYDROData_StricklerTable)::DownCast( theDocument->CreateObject(KIND_STRICKLER_TABLE) );    
++    Handle(HYDROData_StricklerTable)::DownCast( theDocument->CreateObject(KIND_STRICKLER_TABLE) );
    if ( !aStricklerTableObj.IsNull() )
    {
      SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
@@@ -845,7 -956,7 +956,7 @@@ void HYDROGUI_DataModel::buildObjectPar
    if ( !aGuiObj )
      return;
  
--  LightApp_DataObject* aPartSect = 
++  LightApp_DataObject* aPartSect =
      createObject( aGuiObj, thePartName, aGuiObj->entry() );
  
    HYDROData_SequenceOfObjects::Iterator anIter( theObjects );
@@@ -903,14 -1014,14 +1014,14 @@@ void HYDROGUI_DataModel::buildObjectTre
      Handle(HYDROData_ImmersibleZone) aZoneObj =
        Handle(HYDROData_ImmersibleZone)::DownCast( aDataObj );
  
--    LightApp_DataObject* aPolylineSect = 
++    LightApp_DataObject* aPolylineSect =
        createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
  
      Handle(HYDROData_PolylineXY) aPolyline = aZoneObj->GetPolyline();
      if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
        createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
  
--    LightApp_DataObject* aBathSect = 
++    LightApp_DataObject* aBathSect =
        createObject( aGuiObj, tr( "ZONE_BATHYMETRY" ), aGuiObj->entry() );
  
      Handle(HYDROData_IAltitudeObject) anAltitudeObj = aZoneObj->GetAltitudeObject();
      Handle(HYDROData_Polyline3D) aPolyline3D =
        Handle(HYDROData_Polyline3D)::DownCast( aDataObj );
  
--    LightApp_DataObject* aPolylineSect = 
++    LightApp_DataObject* aPolylineSect =
        createObject( aGuiObj, tr( "POLYLINE3D_POLYLINE" ), aGuiObj->entry() );
  
      Handle(HYDROData_PolylineXY) aPolylineXY = aPolyline3D->GetPolylineXY();
      if ( !aPolylineXY.IsNull() && !aPolylineXY->IsRemoved() )
        createObject( aPolylineSect, aPolylineXY, aGuiObj->entry(), false );
  
--    LightApp_DataObject* aProfileSect = 
++    LightApp_DataObject* aProfileSect =
        createObject( aGuiObj, tr( "POLYLINE3D_PROFILE" ), aGuiObj->entry() );
  
      Handle(HYDROData_ProfileUZ) aProfileUZ = aPolyline3D->GetProfileUZ();
  
      if ( !aProfileUZ.IsNull() && !aProfileUZ->IsRemoved() )
      {
--      Handle(HYDROData_Profile) aProfile = 
++      Handle(HYDROData_Profile) aProfile =
          Handle(HYDROData_Profile)::DownCast( aProfileUZ->GetFatherObject() );
        if ( !aProfile.IsNull() && !aProfile->IsRemoved() )
          createObject( aProfileSect, aProfile, aGuiObj->entry(), false );
      }
  
--    LightApp_DataObject* aBathSect = 
++    LightApp_DataObject* aBathSect =
        createObject( aGuiObj, tr( "POLYLINE3D_BATHYMETRY" ), aGuiObj->entry() );
  
      Handle(HYDROData_IAltitudeObject) anAltitudeObj = aPolyline3D->GetAltitudeObject();
      Handle(HYDROData_CalculationCase) aCaseObj =
        Handle(HYDROData_CalculationCase)::DownCast( aDataObj );
  
--    LightApp_DataObject* aPolylineSect = 
++    LightApp_DataObject* aPolylineSect =
        createObject( aGuiObj, tr( "CASE_BOUNDARY" ), aGuiObj->entry() );
  
      Handle(HYDROData_PolylineXY) aPolyline = aCaseObj->GetBoundaryPolyline();
      if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
        createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
  
--    LightApp_DataObject* aCaseAOSect = 
++    LightApp_DataObject* aCaseAOSect =
        createObject( aGuiObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toLatin1() ),
                      aGuiObj->entry() );
--    LightApp_DataObject* aCaseNOSect = 
++    LightApp_DataObject* aCaseNOSect =
        createObject( aGuiObj, tr( partitionName( KIND_NATURAL_OBJECT ).toLatin1() ),
                      aGuiObj->entry() );
  
          aNObject = Handle(HYDROData_NaturalObject)::DownCast( anEntity );
          if ( !aNObject.IsNull() )
            createObject( aCaseNOSect, aNObject, aGuiObj->entry(), false );
 -      }    
 +      }
      }
  
-     LightApp_DataObject* aLandCoverMapSect = 
 -    LightApp_DataObject* aBoundaryPolygonSect = 
++    LightApp_DataObject* aBoundaryPolygonSect =
+       createObject( aGuiObj, tr( "CASE_BOUNDARY_POLYGONS" ), aGuiObj->entry() );
+     HYDROData_SequenceOfObjects aBCPolygons = aCaseObj->GetBoundaryPolygons();
+     for (int i = 1; i <= aBCPolygons.Size(); i++ )
+       createObject( aBoundaryPolygonSect, aBCPolygons(i), aGuiObj->entry(), false );
 -    LightApp_DataObject* aLandCoverMapSect = 
++    LightApp_DataObject* aLandCoverMapSect =
        createObject( aGuiObj, tr( "CASE_LAND_COVER_MAP" ), aGuiObj->entry() );
  
      Handle(HYDROData_LandCoverMap) aLandCoverMap = aCaseObj->GetLandCoverMap();
      if ( !aLandCoverMap.IsNull() && !aLandCoverMap->IsRemoved() )
        createObject( aLandCoverMapSect, aLandCoverMap, aGuiObj->entry(), false );
  
--    LightApp_DataObject* aCaseRegionsSect = 
++    LightApp_DataObject* aCaseRegionsSect =
        createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() );
  
      HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions();
        if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() )
          createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation );
      }
--   
++
  #ifdef DEB_GROUPS
      HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetGeometryGroups();
      buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false );
      Handle(HYDROData_Channel) aChannelObj =
        Handle(HYDROData_Channel)::DownCast( aDataObj );
  
--    LightApp_DataObject* aGuideLineSect = 
++    LightApp_DataObject* aGuideLineSect =
        createObject( aGuiObj, tr( "CHANNEL_GUIDE_LINE" ), aGuiObj->entry() );
      Handle(HYDROData_Polyline3D) aGuideLine = aChannelObj->GetGuideLine();
      if ( !aGuideLine.IsNull() && !aGuideLine->IsRemoved() ) {
        createObject( aGuideLineSect, aGuideLine, aGuiObj->entry(), false );
      }
  
--    LightApp_DataObject* aProfileSect = 
++    LightApp_DataObject* aProfileSect =
        createObject( aGuiObj, tr( "CHANNEL_PROFILE" ), aGuiObj->entry() );
      Handle(HYDROData_Profile) aProfile = aChannelObj->GetProfile();
      if ( !aProfile.IsNull() && !aProfile->IsRemoved() ) {
      Handle(HYDROData_Stream) aStreamObj =
        Handle(HYDROData_Stream)::DownCast( aDataObj );
  
--    LightApp_DataObject* aHydraulicAxisSect = 
++    LightApp_DataObject* aHydraulicAxisSect =
        createObject( aGuiObj, tr( "STREAM_HYDRAULIC_AXIS" ), aGuiObj->entry() );
      Handle(HYDROData_PolylineXY) aHydraulicAxis = aStreamObj->GetHydraulicAxis();
      if ( !aHydraulicAxis.IsNull() && !aHydraulicAxis->IsRemoved() ) {
      Handle(HYDROData_LandCoverMap) aLandCoverMapObj =
        Handle(HYDROData_LandCoverMap)::DownCast( aDataObj );
  
--    /*TODO: reference objects of the land cover map 
++    /*TODO: reference objects of the land cover map
      HYDROData_SequenceOfObjects aPolylines = aLandCoverMapObj->GetPolylines();
      buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );*/
    }
-   
+   else if ( anObjectKind == KIND_BC_POLYGON )
+   {
+     Handle(HYDROData_BCPolygon) aBCObj =
+       Handle(HYDROData_BCPolygon)::DownCast( aDataObj );
 -    LightApp_DataObject* aPolylineSect = 
++    LightApp_DataObject* aPolylineSect =
+       createObject( aGuiObj, tr( "BC_POLYGON_POLYLINE" ), aGuiObj->entry() );
+     Handle(HYDROData_PolylineXY) aPolyline = aBCObj->GetPolyline();
+     if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
+       createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
+   }
    HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
    if( aModule )
      aModule->enableLCMActions();
--  
++
  }
  
  void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase )
@@@ -1148,7 -1276,7 +1276,7 @@@ void HYDROGUI_DataModel::updateObjectTr
          aParentEntry = aParent->entry();
        }
        buildObjectTree( aParent, aGuiObj, aParentEntry, aGuiObj->isInOperation() );
--    } 
++    }
      else
      {
        // workaround for the bug in SalomeApp_Study::findObjectByEntry - it can't find LightApp_DataObjects
@@@ -1183,7 -1311,7 +1311,7 @@@ SUIT_DataObject* HYDROGUI_DataModel::fi
    return NULL; // not found
  }
  
--bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase, 
++bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase,
                                           const QList<HYDROGUI_Zone*>& theZonesList )
  {
    bool isOk = !theCase.IsNull();
@@@ -1219,7 -1347,7 +1347,7 @@@ bool HYDROGUI_DataModel::rename( Handle
    if ( theName.isEmpty() )
      return false;
  
--  try 
++  try
    {
      getDocument()->StartOperation();
      theEntity->SetName( theName );
index 890e29a9b62441aaf0e15f14a286ab519bf246d5,f68c26e692f4999d207bfd8e927c067ed1a6b0d1..f0cbd8b427c7bd02b4323afd3b4bd4e313acabb1
@@@ -32,8 -36,9 +36,9 @@@
  #include <SUIT_Study.h>
  
  #include <QPixmap>
+ #include <QPainter>
  
--HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent, 
++HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
                                            Handle(HYDROData_Entity) theData,
                                            const QString& theParentEntry,
                                            const bool theIsInOperation )
@@@ -142,6 -149,15 +149,15 @@@ QPixmap HYDROGUI_DataObject::icon( cons
    {
      QString anIcon;
      Handle(HYDROData_Entity) aDataObject = modelObject();
 -    
+     Handle(HYDROData_Object) anObject;
+     Handle(HYDROData_ArtificialObject) anAObject = Handle( HYDROData_ArtificialObject )::DownCast(aDataObject);
+     Handle(HYDROData_NaturalObject) aNObject = Handle( HYDROData_NaturalObject )::DownCast(aDataObject);
++
+     if (!anAObject.IsNull())
+       anObject = anAObject;
+     if (!aNObject.IsNull())
+       anObject = aNObject;
      if( aDataObject.IsNull() )
      {
        anIcon = QObject::tr( "HYDRO_TYPE0_ICO" ); // KIND_UNKNOWN
        QString aNeedUpdate( aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) ? "M_" : "" );
  
        int anObjectKind = (int)aDataObject->GetKind();
+       bool IsUnsImmZone = false;
        if ( anObjectKind == KIND_DUMMY_3D )
        {
--        Handle(HYDROData_DummyObject3D) anObject3D = 
++        Handle(HYDROData_DummyObject3D) anObject3D =
            Handle(HYDROData_DummyObject3D)::DownCast( aDataObject );
--        
++
          Handle(HYDROData_Object) aFatherObj = anObject3D->GetObject();
          if ( !aFatherObj.IsNull() )
            anObjectKind = aFatherObj->GetKind();
+         anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
        }
-       anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+       else if ( !anObject.IsNull() )
+       {
+         bool IsSubm = anObject->IsSubmersible();
+         QString anIcon1 = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+         QString anIcon2;
 -        if (IsSubm) 
++        if (IsSubm)
+           anIcon2 = QObject::tr( QString("HYDRO_SUBMERSIBLE16_ICO").toLatin1());
+         else
+           anIcon2 = QObject::tr( QString("HYDRO_UNSUBMERSIBLE16_ICO").toLatin1());
+         QPixmap qpm1 = aResMgr->loadPixmap( "HYDRO", anIcon1 );
+         QPixmap qpm2 = aResMgr->loadPixmap( "HYDRO", anIcon2 );
+         QPixmap qpmD(32,16);
+         qpmD.fill(QColor(0,0,0));
+         QPainter painter;
+         painter.begin(&qpmD);
+         painter.drawPixmap(0, 0, qpm1);
+         painter.drawPixmap(16, 0, qpm2);
+         painter.end();
+         return qpmD;
+       }
+       else if (anObjectKind == KIND_BC_POLYGON)
+       {
+         Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( aDataObject );
+         int aBT = aBCObj->GetBoundaryType();
+         if (aBT == 1)
+           anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE1_ICO").toLatin1());
+         else if (aBT == 2)
+           anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE2_ICO").toLatin1());
+         else if (aBT == 3)
+           anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE3_ICO").toLatin1());
+         else
+           anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE_UNDEF_ICO").toLatin1());
+       }
+       else
+         anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
      }
  
      return aResMgr->loadPixmap( "HYDRO", anIcon );
@@@ -300,7 -354,7 +354,7 @@@ HYDROGUI_DropTargetObject::HYDROGUI_Dro
                                              const QString&   theName,
                                              const QString&   theParentEntry,
                                              const bool       theIsInOperation  )
--: HYDROGUI_NamedObject( theParent, theName, theParentEntry, theIsInOperation ), 
++: HYDROGUI_NamedObject( theParent, theName, theParentEntry, theIsInOperation ),
    CAM_DataObject( theParent )
  {
  }
index 2d2e8bd626a4744ac560339e4c0beb6891e97898,3ad5e1dcc1869bc7eabc66c51a6c28275a41ef40..9efd47aef09a2324998384e2651eb5b5655369b5
@@@ -73,7 -72,7 +73,7 @@@ QWizardPage* HYDROGUI_ImportLandCoverMa
    aFileNameLayout->addWidget( aFileNameLabel );
    aFileNameLayout->addWidget( myFileName );
    aFileNameLayout->addWidget( aBrowseBtn );
--    
++
    myObjectNameGroup = new QGroupBox( tr( "LANDCOVERMAP_NAME" ) );
  
    QLabel* aLandcoverNameLabel = new QLabel( tr( "NAME" ), myObjectNameGroup );
  
    // Conections
    connect( myPolygonsListWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( onItemSelectionChanged() ) );
--  connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); 
++  connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
    connect( myAttrCheckBox, SIGNAL(clicked(bool)), this, SLOT(onAttrCBChecked(bool)));
  
    return aPage;
@@@ -123,7 -122,7 +123,7 @@@ QWizardPage* HYDROGUI_ImportLandCoverMa
  
    myAvAttrLabel = new QLabel();
    myAvAttrLabel->setText(tr("AV_ATTRS"));
--  
++
    myDBFAttrListWidget = new QListWidget( );
    myDBFAttrListWidget->setSelectionMode( QListWidget::SingleSelection );
    myDBFAttrListWidget->setEditTriggers( QListWidget::NoEditTriggers );
@@@ -147,7 -146,7 +147,7 @@@ QWizardPage* HYDROGUI_ImportLandCoverMa
    QFrame* aFrame = new QFrame( aPage );
    myCorrLabel = new QLabel();
    myCorrLabel->setText(tr ("CORR"));
--  
++
    myCorrTableWidget = new QTableWidget();
  
    // Layout
@@@ -198,7 -197,7 +198,7 @@@ void HYDROGUI_ImportLandCoverMapDlg::se
  }
  
  void HYDROGUI_ImportLandCoverMapDlg::onItemSelectionChanged()
--{ 
++{
    int aCurIndex = getCurrentWizardIndex();
    if (aCurIndex == 0 && getViewerState())
      emit selectionChanged( getSelectedPolygonNames() );
@@@ -252,13 -251,13 +252,13 @@@ QString HYDROGUI_ImportLandCoverMapDlg:
  }
  
  
--void HYDROGUI_ImportLandCoverMapDlg::FillCorrespondenceTable(const QStringList& theFirstColumn, 
++void HYDROGUI_ImportLandCoverMapDlg::FillCorrespondenceTable(const QStringList& theFirstColumn,
                                                     const QStringList& theSecondColumn,
                                                     const QVector<int> theDefCBIndices,
                                                     const QVector<QColor> theColors)
  {
    int aFCSize = theFirstColumn.size();  // == theDefCBIndices.size() !
--  int aSCSize = theSecondColumn.size(); 
++  int aSCSize = theSecondColumn.size();
  
    myStrColors = theColors;
  
index 9355bbd48fb97b286b4630642f8eaf5d7e22a07e,a452d2b3ba7145356f386adaf93f09285c28c6ca..280814ffe3639994c6c28b74c776f560fc4d1b6a
@@@ -87,7 -110,7 +110,7 @@@ QVariant HYDROGUI_ListModel::data( cons
  
    case Qt::DecorationRole:
      {
--      if( myIsDecorationEnabled && 
++      if( myIsDecorationEnabled &&
            aColumn==0 && aRow >=0 && aRow < myObjects.count() ) {
          bool isVisible = isObjectVisible( aRow );
          if( isVisible )
@@@ -293,7 -325,7 +326,7 @@@ Qt::DropActions HYDROGUI_ListModel::sup
    @param theIsToSort defines if the list of ids should be sorted in ascending order
    @return the list of ids
  */
--QList<int> HYDROGUI_ListModel::getIds( const QModelIndexList& theIndexes, 
++QList<int> HYDROGUI_ListModel::getIds( const QModelIndexList& theIndexes,
                                         bool theIsToSort ) const
  {
    QList<int> anIds;
@@@ -379,7 -411,7 +412,7 @@@ bool HYDROGUI_ListModel::move( const in
        aRes = true;
      }
    }
--        
++
    return aRes;
  }
  
    @param theDropItem the drop item id ( used for drag and drop obly )
    @return true in case of success
  */
--bool HYDROGUI_ListModel::move( const QList<int>& theItems, const OpType theType, 
++bool HYDROGUI_ListModel::move( const QList<int>& theItems, const OpType theType,
                                 bool theIsVisibleOnly, const int theDropItem )
  {
    bool aRes = true;
      default:
        aRes = false;
    }
--  
++
    return aRes;
  }
  
    @param theDropItem the drop item id
    @return true if drag and drop allowed
  */
--bool HYDROGUI_ListModel::isDragAndDropAllowed( const QList<int>& theItems, 
++bool HYDROGUI_ListModel::isDragAndDropAllowed( const QList<int>& theItems,
                                                 const int theDropItem ) const
  {
    bool isAllowed = false;
  
--  if ( theDropItem >= 0 && 
++  if ( theDropItem >= 0 &&
         // TODO: to disable drop between items use: theDropItem < myObjects.count()
         theDropItem <= myObjects.count() &&
         !theItems.empty() && theItems.count() < myObjects.count() &&
index 920222e9b215f8dd96ce4a7aa056c17a57e5033c,f8246036bb41fbddfd441ba776d2f5783daf5bb3..89b43870cbb229278095cc16252fac39171cafa7
@@@ -56,8 -58,8 +58,9 @@@ public
    virtual QStringList mimeTypes() const;
    virtual bool dropMimeData( const QMimeData* theData, Qt::DropAction theAction,
                               int theRow, int theColumn, const QModelIndex& theParent );
 +  virtual Qt::DropActions supportedDragActions() const;
    virtual Qt::DropActions supportedDropActions() const;
+   virtual Qt::DropActions supportedDragActions() const;
  
    QList<int> getIds( const QModelIndexList& theIndexes, bool theIsToSort = true ) const;
  
index 59ef21ae9dbf5303df845c6bf8351e8a175ff003,2f84a8229570b92dfa9bd6f83734042a80a5db6f..825cbc91cb55d0ba006251584ff5aac59ab4f6b8
@@@ -41,7 -42,7 +41,7 @@@ HYDROGUI_PriorityWidget::Delegate::Dele
  
  /**
   */
--QWidget* HYDROGUI_PriorityWidget::Delegate::createEditor( 
++QWidget* HYDROGUI_PriorityWidget::Delegate::createEditor(
    QWidget* theParent, const QStyleOptionViewItem& theOption,
    const QModelIndex& theIndex ) const
  {
@@@ -56,7 -57,7 +56,7 @@@
      QStringList anObjNames = theIndex.data( Qt::UserRole ).toStringList();
      aComboBox->addItems( anObjNames );
    }
--  
++
    connect( aComboBox, SIGNAL( activated( int ) ), this, SLOT( finishEditing() ) );
  
    return aComboBox;
@@@ -64,7 -65,7 +64,7 @@@
  
  /**
   */
--void HYDROGUI_PriorityWidget::Delegate::setEditorData( 
++void HYDROGUI_PriorityWidget::Delegate::setEditorData(
    QWidget* theEditor, const QModelIndex& theIndex ) const
  {
    QComboBox* aComboBox = dynamic_cast<QComboBox*>( theEditor );
@@@ -88,7 -89,7 +88,7 @@@
  
  /**
   */
--void HYDROGUI_PriorityWidget::Delegate::setModelData( 
++void HYDROGUI_PriorityWidget::Delegate::setModelData(
    QWidget* theEditor, QAbstractItemModel* theModel, const QModelIndex& theIndex) const
  {
    QComboBox* aComboBox = dynamic_cast<QComboBox*>( theEditor );
@@@ -139,27 -140,27 +139,27 @@@ HYDROGUI_PriorityWidget::HYDROGUI_Prior
    myRemove->setText( tr( "REMOVE" ) );
    myClear = new QToolButton;
    myClear->setText( tr( "CLEAR_ALL" ) );
--  
++
    // Table view
    myTable = new QTableView( this );
    myTable->setItemDelegate( new Delegate( this ) );
    myTable->setEditTriggers( QAbstractItemView::DoubleClicked |
                              QAbstractItemView::SelectedClicked |
                              QAbstractItemView::EditKeyPressed );
--  
++
    // Set the custom model
    HYDROGUI_PriorityTableModel* aModel = new HYDROGUI_PriorityTableModel();
    myTable->setModel( aModel );
  
    // Set resize mode
    myTable->horizontalHeader()->setStretchLastSection( false);
-   HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 0, QHeaderView::Stretch );
-   HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 1, QHeaderView::ResizeToContents );
-   HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 2, QHeaderView::Stretch );
-   HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 3, QHeaderView::ResizeToContents );
+   myTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
+   myTable->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
+   myTable->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
+   myTable->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::ResizeToContents );
+   myTable->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
 - 
 +
-   HYDROGUI_Tool::setResizeMode( myTable->verticalHeader(), QHeaderView::ResizeToContents );
-  
    // Layout
    // buttons
    QHBoxLayout* aButtonsLayout = new QHBoxLayout();
    // main
    aMainLayout->addLayout( aButtonsLayout );
    aMainLayout->addWidget( myTable );
--  
++
    // Update controls
    updateControls();
  
    connect( myRemove, SIGNAL( clicked() ), this, SLOT( onRemoveRule() ) );
    connect( myClear, SIGNAL( clicked() ), this, SLOT( onClearRules() ) );
  
--  connect ( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), 
++  connect ( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
              this, SLOT( onSelectionChanged() ) );
  
    connect( aModel, SIGNAL( showError( const QString& ) ), this, SLOT( onShowError( const QString& ) ) );
@@@ -199,7 -200,7 +199,7 @@@ HYDROGUI_PriorityWidget::~HYDROGUI_Prio
   */
  void HYDROGUI_PriorityWidget::onAddRule()
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if ( aModel ) {
      if (aModel->createNewRule()) {
   */
  void HYDROGUI_PriorityWidget::onRemoveRule()
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
  
    if (aModel) {
        if ( !aRows.contains( aRowIndex ) )
          aRows << aRowIndex;
      }
--    
++
      if ( aModel->removeRows( aRows ) ) {
        updateControls();
        emit ruleChanged();
   */
  void HYDROGUI_PriorityWidget::onClearRules()
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if ( aModel && aModel->removeAll() ) {
      updateControls();
   */
  void HYDROGUI_PriorityWidget::setObjects( const QList<Handle(HYDROData_Entity)>& theObjects )
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if( aModel ) {
      aModel->setObjects( theObjects );
@@@ -269,7 -270,7 +269,7 @@@ HYDROData_ListOfRules HYDROGUI_Priority
  {
    HYDROData_ListOfRules aRules;
  
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if( aModel ) {
      aRules = aModel->getRules();
  */
  void HYDROGUI_PriorityWidget::setRules( const HYDROData_ListOfRules& theRules )
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if( aModel ) {
      aModel->setRules( theRules );
@@@ -315,7 -316,7 +315,7 @@@ void HYDROGUI_PriorityWidget::onSelecti
   */
  void HYDROGUI_PriorityWidget::updateControls()
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if( aModel ) {
      myAdd->setEnabled( aModel->canCreateNewRule() );
@@@ -337,7 -338,7 +337,7 @@@ void HYDROGUI_PriorityWidget::onShowErr
   */
  void HYDROGUI_PriorityWidget::undoLastChange()
  {
--  HYDROGUI_PriorityTableModel* aModel = 
++  HYDROGUI_PriorityTableModel* aModel =
      dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
    if ( aModel )
      aModel->undoLastChange();
index 16b607042577f4a329a1524c8d7d87f80a3549c6,b09540c4008b37c3e03578b09ca31dd06bb4a589..6eadf8c5130269f70717317369acfa736bd648b1
@@@ -201,8 -206,8 +206,8 @@@ HYDROGUI_StricklerTableDlg::HYDROGUI_St
      connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onAddCoefficient() ) );
      connect( myRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemoveCoefficient() ) );
      connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( onClearCoefficients() ) );
--    connect( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), 
--        this, SLOT( onSelectionChanged() ) );  
++    connect( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
++        this, SLOT( onSelectionChanged() ) );
  
      setMinimumWidth( 450 );
  
@@@ -307,7 -312,7 +312,7 @@@ void HYDROGUI_StricklerTableDlg::setGui
      myTable->insertRow( aRow );
  
      // "Type" column
--    QTableWidgetItem* aTypeItem = new QTableWidgetItem( aType );    
++    QTableWidgetItem* aTypeItem = new QTableWidgetItem( aType );
      myTable->setItem( aRow, 0, aTypeItem );
  
      // "Coefficient" column
  void HYDROGUI_StricklerTableDlg::updateControls()
  {
      bool isTableNotEmpty = myTable->rowCount() > 0;
--    myClearBtn->setEnabled( isTableNotEmpty );  
++    myClearBtn->setEnabled( isTableNotEmpty );
      onSelectionChanged();
  }
  
@@@ -380,7 -385,7 +385,7 @@@ void HYDROGUI_StricklerTableDlg::onAddC
      // Set default type (=> generate unique type name) and coefficient
      //...
  
--    updateControls();  
++    updateControls();
  }
  
  /**
Simple merge
index 1c6587944d3db876b92575d15710d19f33ec2587,90756880a9589c23d1cf8e1fbf7635d33585ec86..2fe2d9a3daac22b8c1ca39be30d6ef4b7aaaa5ac
@@@ -47,12 -46,12 +47,12 @@@ namespace HYDROGUI_Too
  
    QDockWidget* WindowDock( QWidget* wid );
  
-   QStringList FindExistingObjectsNames( const Handle_HYDROData_Document& theDoc, 
 -  QStringList FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc, 
--                                        const ObjectKind theObjectKind, 
++  QStringList FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc,
++                                        const ObjectKind theObjectKind,
                                          bool isCheckValidProfile = false );
    QString GetCoordinateString( const double theNumber, bool isInLocale );
--  
-   Handle_Image_PixMap Pixmap( const QImage& theImage );
++
+   Handle(Image_PixMap) Pixmap( const QImage& theImage );
  
    void GetObjectReferences( const Handle(HYDROData_Entity)& theObj,
                              HYDROData_SequenceOfObjects& theRefObjects,
index 1986b5c182075987449fd7eb99b033a2b5471b08,d32d61b750af275aa9363c469d55a91ce853cd28..0833eb5eddc067ebf305864b393183df5a1fa086
@@@ -127,7 -128,7 +128,7 @@@ class HYDROData_Entit
        case KIND_SHAPES_GROUP:
          sipClass = sipClass_HYDROData_ShapesGroup;
          break;
--        
++
        case KIND_SPLIT_GROUP:
          sipClass = sipClass_HYDROData_SplitShapesGroup;
          break;
@@@ -206,7 -211,7 +211,7 @@@ public
     */
    virtual bool CanBeUpdated() const;
  
--  
++
    /**
     * Checks is object exists in the data structure.
     * \returns true is object is not exists in the data model
     * Returns father object. For object created under root document label
     * this method always return NULL object.
     */
-   HYDROData_Entity GetFatherObject() const [Handle_HYDROData_Entity ()];
+   HYDROData_Entity GetFatherObject() const [opencascade::handle<HYDROData_Entity> ()];
    %MethodCode
      Handle(HYDROData_Entity) aFather;
--    
++
      Py_BEGIN_ALLOW_THREADS
--    aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() : 
++    aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() :
                                sipCpp->GetFatherObject();
      Py_END_ALLOW_THREADS
--    
++
      sipRes = createPointer( aFather );
    %End
  
     */
    virtual void RemoveZLevel();
  
 -   
+    void SetColor( const QColor& theColor, const int theTag = 0 );
 +
  protected:
  
    /**
--   * Creates new object in the internal data structure. Use higher level objects 
++   * Creates new object in the internal data structure. Use higher level objects
     * to create objects with real content.
     */
    HYDROData_Entity( Geometry );
     * Destructs properties of the object and object itself, removes it from the document.
     */
    virtual ~HYDROData_Entity();
--  
++
  };
index 61cc4e7fee05c853efd7efb15167a249c53f2985,10b6c87f28d2f87ad2156124eb65286bec11c254..a9dfb54a6a089c0dd8c1496ef9091fde4e29ddd2
@@@ -18,7 -21,16 +21,16 @@@ set(PROJECT_HEADER
    test_HYDROGUI_ListModel.h
    test_HYDROGUI_Shape.h
    test_HYDROGUI_LandCoverMapDlg.h
 -  
+   test_HYDROData_CalcCase.h
+   test_HYDROData_Stream.h
+   test_HYDROData_Tool.h
+   test_HYDROGUI_BathymetryPrs.h
++
    test_Dependencies.h
+   test_HYDROData_DTM.h
+   test_HYDROData_BoundaryPolygons.h
+   test_GraphicsView.h
+   test_Overview.h
  
    TestShape.h
    TestViewer.h
@@@ -43,8 -57,15 +57,15 @@@ set(PROJECT_SOURCE
    test_HYDROGUI_ListModel.cxx
    test_HYDROGUI_Shape.cxx
    test_HYDROGUI_LandCoverMapDlg.cxx
+   test_HYDROData_CalcCase.cxx
+   test_HYDROData_Stream.cxx
    test_Dependencies.cxx
 - 
+   test_HYDROData_Tool.cxx
+   test_GraphicsView.cxx
+   test_Overview.cxx
+   test_HYDROGUI_ProfilesDlg.cxx
+   test_HYDROGUI_BathymetryPrs.cxx
 +
    TestShape.cxx
    TestViewer.cxx
    TestLib_Listener.cxx
index 97d01b8e6d9e5fc1711bbf3e25d032d9491ea9a5,86c5ab5d45b92e7383619c15b74bb15ad70ad9e6..6a5b7e0ba3b00080e819bed489a97d664091978c
@@@ -69,15 -79,27 +79,27 @@@ set( EXTERNAL_FILE
    ../HYDROGUI/HYDROGUI_StricklerTableDlg.cxx
    ../HYDROGUI/HYDROGUI_LineEditDoubleValidator.cxx
    ../HYDROGUI/HYDROGUI_Tool.cxx
+   ../HYDROGUI/HYDROGUI_StreamDlg.cxx
+   ../HYDROGUI/HYDROGUI_ListSelector.cxx
+   ../HYDROGUI/HYDROGUI_OrderedListWidget.cxx
+   ../HYDROGUI/HYDROGUI_Overview.cxx
+   ../HYDROGUI/HYDROGUI_ZoneTool.cxx
+   ../HYDROGUI/HYDROGUI_ProfileDlg.cxx
+   ../HYDROGUI/HYDROGUI_ViewerDlg.cxx
+   ../HYDROGUI/HYDROGUI_AISTrihedron.cxx
+   ../HYDROGUI/HYDROGUI_CurveCreatorProfile.cxx
  )
  
--set( MOC_HEADERS 
++set( MOC_HEADERS
    ../HYDROGUI/HYDROGUI_InputPanel.h
    ../HYDROGUI/HYDROGUI_StricklerTableDlg.h
+   ../HYDROGUI/HYDROGUI_StreamDlg.h
+   ../HYDROGUI/HYDROGUI_ListSelector.h
+   ../HYDROGUI/HYDROGUI_OrderedListWidget.h
+   ../HYDROGUI/HYDROGUI_Overview.h
+   ../HYDROGUI/HYDROGUI_ZoneTool.h
+   ../HYDROGUI/HYDROGUI_ProfileDlg.h
+   ../HYDROGUI/HYDROGUI_ViewerDlg.h
  )
  
- IF (SalomeGUI_VERSION VERSION_LESS "8.0.0")
-   QT4_WRAP_CPP( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
- ELSE()
-   QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
- ENDIF()
+ #QT5_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
index 90a5559e02701917a02d36dee560a84d8a7e8562,15ea61a6bbbd1cb3b5d4a388a2045ec8110eb468..4b04a8fb4425f263cdc179ffe730466dca3a3ced
@@@ -56,21 -68,25 +68,25 @@@ int main( int argc, char* argv[] 
    // Create the event manager and test controller
    CppUnit::TestResult controller;
  
-   // Add a listener that colllects test result
+   // Add a listener that collects test result
    CppUnit::TestResultCollector result;
--  controller.addListener( &result );        
++  controller.addListener( &result );
  
    // Add a listener that print dots as test run.
    TestLib_Listener progress;
--  controller.addListener( &progress );      
++  controller.addListener( &progress );
  
--  CppUnit::TestFactoryRegistry& registry = 
++  CppUnit::TestFactoryRegistry& registry =
      CppUnit::TestFactoryRegistry::getRegistry();
    // Add the top suite to the test runner
    TestLib_Runner runner;
+ #ifdef WIN32
    QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg";
+ #else
+   QString aPath = qgetenv( "HYDRO_ROOT_DIR" ) + "/tests.cfg";
+ #endif
    runner.Load( aPath.toStdString() );
--  runner.addTest( registry.makeTest() );   
++  runner.addTest( registry.makeTest() );
    try
    {
      std::cout << "Running tests "  << testPath << "..." << std::endl;
    }
    catch ( std::invalid_argument &e )  // Test path not resolved
    {
--    std::cerr  <<  std::endl  
++    std::cerr  <<  std::endl
        <<  "ERROR: "  <<  e.what()
        << std::endl;
      return 0;