Salome HOME
Merge remote-tracking branch 'origin/BR_SHAPE_RECOGNITION' into BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_Region.cxx
index aca81aeb2bdb2f868ba126a69d391e01015bb63a..0cbb266d27f1f5388730078fb6768ac00ee58b67 100644 (file)
@@ -1,3 +1,20 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// 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, or (at your option) any later version.
+//
+// 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
+//
 
 #include "HYDROData_Region.h"
 
@@ -392,8 +409,7 @@ QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjec
     // find zone
     aZone->findPythonReferenceObject( theTreatedObjects, aResList );
     theTreatedObjects.insert( aZone->GetName(), aZone );
-    // add zone
-    setPythonReferenceObject( theTreatedObjects, aResList, aZone, "AddZone" );
+    
     // set zone merge type
     QString aMergeTypeStr;
     HYDROData_Zone::MergeAltitudesType aMergeType = aZone->GetMergeType();
@@ -416,7 +432,24 @@ QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjec
                                                           .arg( aMergeAltitude->GetObjPyName() );
       }
     }
+
+    // add zone
+    setPythonReferenceObject( theTreatedObjects, aResList, aZone, "AddZone" );
   }
 
   return aResList;
-}
\ No newline at end of file
+}
+
+bool HYDROData_Region::IsSubmersible() const
+{
+  HYDROData_SequenceOfObjects aZones = GetZones();
+  HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
+  for ( ; aZonesIter.More(); aZonesIter.Next() )
+  {
+    Handle(HYDROData_Zone) aZone =
+      Handle(HYDROData_Zone)::DownCast( aZonesIter.Value() );
+    if ( !aZone->IsSubmersible() )
+      return false; //if one of zones is not submersible the region is considered as not submersible
+  }
+  return true;
+}