HYDROData_Zone::HYDROData_Zone()
: HYDROData_Entity()
{
- SetMergeType( Merge_ZMIN );
}
HYDROData_Zone::~HYDROData_Zone()
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;
- if ( !myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) )
- anInt = TDataStd_Integer::Set( myLab, 0 );
- anInt->Set( (int)theType );
+ 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 );
+ }
}
HYDROData_Zone::MergeBathymetriesType HYDROData_Zone::GetMergeType() const
{
- MergeBathymetriesType aMergeType = Merge_ZMIN;
+ MergeBathymetriesType aMergeType = Merge_UNKNOWN;
Handle(TDataStd_Integer) anInt;
if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) )