Salome HOME
porting on Linux
[modules/hydro.git] / src / HYDROData / HYDROData_Zone.cxx
index f90f02873d021154215d5a7f5f194dbea5b8a0df..53d40e5224d6bfc590d9ee791fc9d7f782ee7e38 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_Zone.h"
 
@@ -22,35 +39,21 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity)
 HYDROData_Zone::HYDROData_Zone()
 : HYDROData_Entity()
 {
+  myInterpolator = NULL;
 }
 
 HYDROData_Zone::~HYDROData_Zone()
 {
 }
 
-QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+bool HYDROData_Zone::CanBeUpdated() const
 {
-  QStringList aResList = dumpObjectCreation( theTreatedObjects );
-
-  HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
-  HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
-  for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() )
-  {
-    Handle(HYDROData_Object) aRefGeomObj =
-      Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() );
-    if ( !aRefGeomObj.IsNull() )
-      setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
-  }
-
-  // How can we get the shape? Mb Update() method to intersect the shapes of reference objects?
-  // TODO:  TopoDS_Shape aRefShape = GetShape();
-
-  return aResList;
+  return false;
 }
 
-bool HYDROData_Zone::CanBeUpdated() const
+bool HYDROData_Zone::IsHas2dPrs() const
 {
-  return false;
+  return true;
 }
 
 bool HYDROData_Zone::CanRemove()
@@ -117,17 +120,19 @@ bool HYDROData_Zone::IsMergingNeed() const
   return false;
 }
 
+void HYDROData_Zone::SetInterpolator( HYDROData_IInterpolator* theInter )
+{
+  myInterpolator = theInter;
+}
+
+HYDROData_IInterpolator* HYDROData_Zone::GetInterpolator() const
+{
+  return myInterpolator;
+}
+
 void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType )
 {
-  Handle(TDataStd_Integer) anInt;
-  if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) )
-  {
-    anInt->Set( (int)theType );
-  }
-  else
-  {
-    anInt = TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
-  }
+  TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
 }
 
 HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const
@@ -188,5 +193,17 @@ void HYDROData_Zone::RemoveGeometryObjects()
   ClearReferenceObjects( DataTag_GeometryObject );
 }
 
-
+bool HYDROData_Zone::IsSubmersible() const
+{
+  HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
+  HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
+  for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() )
+  {
+    Handle(HYDROData_Object) aRefGeomObj =
+      Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() );
+    if( !aRefGeomObj->IsSubmersible() )
+      return false; //if one of geometry objects is not submersible the zone is considered as not submersible
+  }
+  return true;
+}