Salome HOME
Convert the altitude for bathymetry to negative number during it reading from the...
[modules/hydro.git] / src / HYDROData / HYDROData_ImmersibleZone.cxx
index 05a468239cb007a32774d55c2f1cb83ba5eb5df1..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,14 +77,14 @@ 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;
 
-    TopExp_Explorer anExp( aPolylineShape, TopAbs_WIRE );
-    if ( !anExp.More() ) {
+    if ( !aPolylineShape.IsNull() && 
+         aPolylineShape.ShapeType() == TopAbs_WIRE ) {
       TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
       if ( !aPolylineWire.IsNull() ) {
         BRepBuilderAPI_MakeFace aMakeFace( aPolylineWire, Standard_True );
@@ -94,6 +94,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::GetTopShape() const
         }
       }
     } else {
+      TopExp_Explorer anExp( aPolylineShape, TopAbs_WIRE );
       for ( ; anExp.More(); anExp.Next() ) {
         TopoDS_Wire aWire = TopoDS::Wire( anExp.Current() );
         aWiresList.Append( aWire );
@@ -140,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 ) );
 }