Salome HOME
Method to check what zone needs merging of bathymetries has been added.
authoradv <adv@opencascade.com>
Thu, 31 Oct 2013 09:28:09 +0000 (09:28 +0000)
committeradv <adv@opencascade.com>
Thu, 31 Oct 2013 09:28:09 +0000 (09:28 +0000)
src/HYDROData/HYDROData_Zone.cxx
src/HYDROData/HYDROData_Zone.h

index 2e8e58dd2a07de0ef22f76053372bd5bddfa1684..29fd5bbe805e24c9bacf9ac9ff6d0cebc36e2231 100644 (file)
@@ -77,6 +77,36 @@ TopoDS_Shape HYDROData_Zone::GetShape() const
   return TopoDS_Shape();
 }
 
+bool HYDROData_Zone::IsMergingNeed() const
+{
+  Handle(HYDROData_Bathymetry) aRefBathymetry;
+
+  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() )
+      continue;
+
+    Handle(HYDROData_Bathymetry) anObjBathymetry = aRefGeomObj->GetBathymetry();
+    if ( anObjBathymetry.IsNull() )
+      continue;
+
+    if ( aRefBathymetry.IsNull() )
+    {
+      aRefBathymetry = anObjBathymetry;
+      continue;
+    }
+
+    if ( !IsEqual( aRefBathymetry, anObjBathymetry ) )
+      return true;
+  }
+
+  return false;
+}
+
 void HYDROData_Zone::SetMergeType( const MergeBathymetriesType& theType )
 {
   Handle(TDataStd_Integer) anInt;
index a0c4279cb55164f8730fc2a0a413f54d06ebc98c..aba5d5ba8c3a8b60dd349ba0558c2cd84d509f35 100644 (file)
@@ -66,6 +66,12 @@ public:
   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
 
 
+  /**
+   * Returns true if zone needs merge of bathymetries.
+   */
+  HYDRODATA_EXPORT virtual bool IsMergingNeed() const;
+
+
   /**
    * Sets the merging type for conflict bathymetries.
    * By default it is set to Merge_UNKNOWN.