From: adv Date: Thu, 31 Oct 2013 09:28:09 +0000 (+0000) Subject: Method to check what zone needs merging of bathymetries has been added. X-Git-Tag: BR_hydro_v_0_3~59 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e265b347fa990a3f6541b8887f19d61965a623c;p=modules%2Fhydro.git Method to check what zone needs merging of bathymetries has been added. --- diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index 2e8e58dd..29fd5bbe 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -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; diff --git a/src/HYDROData/HYDROData_Zone.h b/src/HYDROData/HYDROData_Zone.h index a0c4279c..aba5d5ba 100644 --- a/src/HYDROData/HYDROData_Zone.h +++ b/src/HYDROData/HYDROData_Zone.h @@ -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.