Salome HOME
NCollection sequences improved.
[modules/hydro.git] / src / HYDROData / HYDROData_ImmersibleZone.cxx
index 4561fbf1b265dd17e9ef2ce76b7e8a0d574238ed..69cfebddb62a427bf78febfa141b28d78ef53c7f 100644 (file)
@@ -25,7 +25,6 @@
 #include <QColor>
 #include <QStringList>
 
-#define PYTHON_IMMERSIBLE_ZONE_ID "KIND_IMMERSIBLE_ZONE"
 //#define HYDRODATA_IMZONE_DEB 1
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_ImmersibleZone,HYDROData_NaturalObject)
@@ -43,21 +42,9 @@ HYDROData_ImmersibleZone::~HYDROData_ImmersibleZone()
 
 QStringList HYDROData_ImmersibleZone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = dumpObjectCreation( theTreatedObjects );
   QString aZoneName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aZoneName ).arg( aDocName ).arg( PYTHON_IMMERSIBLE_ZONE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aZoneName ).arg( aZoneName );
-  aResList << QString( "" );
-
   QColor aFillingColor = GetFillingColor();
   aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
               .arg( aFillingColor.red()  ).arg( aFillingColor.green() )
@@ -170,6 +157,10 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_
       }
     }
   }
+
+  if( aResultFace.IsNull() )
+    return aResultFace;
+
   BRepCheck_Analyzer anAnalyzer( aResultFace );
   if( anAnalyzer.IsValid() && aResultFace.ShapeType()==TopAbs_FACE )
     return aResultFace;