+ myLab.FindChild( DataTag_ChildRegion ).ForgetAllAttributes();
+}
+
+HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplitGroups() const
+{
+ return GetReferenceObjects( DataTag_SplitGroups );
+}
+
+void HYDROData_CalculationCase::RemoveSplitGroups()
+{
+ myLab.FindChild( DataTag_SplitGroups ).ForgetAllAttributes();
+}
+
+double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const
+{
+ Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
+ return GetAltitudeForPoint( thePoint, aZone );
+}
+
+double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
+ const Handle(HYDROData_Region)& theRegion,
+ int theMethod) const
+{
+ double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
+
+ Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
+ if ( !aZone.IsNull() )
+ {
+ //DEBTRACE("GetAltitudeForPoint Region " << theRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString());
+ Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
+ if ( IsEqual( aRefRegion, theRegion ) )
+ aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod );
+ else
+ {
+ DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------");
+ aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod );
+ }
+ }
+ else
+ {
+ DEBTRACE(" --- GetAltitudeForPoint No Zone ---");
+ }
+
+ return aResAltitude;
+}
+
+double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
+ const Handle(HYDROData_Zone)& theZone,
+ int theMethod) const
+{
+ //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString());
+ double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
+ if ( theZone.IsNull() )
+ {
+ DEBTRACE("Zone nulle");
+ return aResAltitude;
+ }
+
+ HYDROData_Zone::MergeType aZoneMergeType = theZone->GetMergeType();
+ //DEBTRACE("aZoneMergeType " << aZoneMergeType);
+ if ( !theZone->IsMergingNeed() )
+ {
+ aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN;
+ //DEBTRACE("---");
+ }
+ else if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
+ {
+ DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString() << " Merge_UNKNOWN");
+ return aResAltitude;
+ }
+
+ HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
+ if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
+ {
+ Handle(HYDROData_IAltitudeObject) aMergeAltitude =
+ Handle(HYDROData_IAltitudeObject)::DownCast( theZone->GetMergeObject() );
+ if ( !aMergeAltitude.IsNull() )
+ {
+ if ( aZoneInterpolator != NULL )
+ {
+ DEBTRACE("aZoneInterpolator != NULL");
+ aZoneInterpolator->SetAltitudeObject( aMergeAltitude );
+ aResAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
+ }
+ else
+ {
+ DEBTRACE("aZoneInterpolator == NULL");
+ aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+ }
+ }
+ }
+ else
+ {
+ //DEBTRACE("aZoneMergeType != HYDROData_Zone::Merge_Object");
+ HYDROData_SequenceOfObjects aZoneObjects = theZone->GetObjects();
+ HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Object) aZoneObj =
+ Handle(HYDROData_Object)::DownCast( anIter.Value() );
+ if ( aZoneObj.IsNull() )
+ continue;
+
+ Handle(HYDROData_IAltitudeObject) anObjAltitude = aZoneObj->GetAltitudeObject();
+ if ( anObjAltitude.IsNull() )
+ continue;
+
+ double aPointAltitude = 0.0;
+ if ( aZoneInterpolator != NULL )
+ {
+ DEBTRACE("aZoneInterpolator != NULL");
+ aZoneInterpolator->SetAltitudeObject( anObjAltitude );
+ aPointAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
+ }
+ else
+ {
+ //DEBTRACE("aZoneInterpolator == NULL");
+ aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint, theMethod );
+ }
+
+ if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
+ continue;
+
+ if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
+ {
+ aResAltitude = aPointAltitude;
+ break;
+ }
+ else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMIN )
+ {
+ if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ||
+ aResAltitude > aPointAltitude )
+ {
+ aResAltitude = aPointAltitude;
+ }
+ }
+ else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMAX )
+ {
+ if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ||
+ aResAltitude < aPointAltitude )
+ {
+ aResAltitude = aPointAltitude;
+ }
+ }
+ }
+ }
+
+ return aResAltitude;
+}
+
+NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
+ const NCollection_Sequence<gp_XY>& thePoints,
+ const Handle(HYDROData_Region)& theRegion,
+ int theMethod) const
+{
+ DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString());
+ NCollection_Sequence<double> aResSeq;
+
+ for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
+ {
+ const gp_XY& thePnt = thePoints.Value( i );
+
+ double anAltitude = GetAltitudeForPoint( thePnt, theRegion, theMethod );
+ aResSeq.Append( anAltitude );
+ }
+
+ return aResSeq;
+}
+
+NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
+ const NCollection_Sequence<gp_XY>& thePoints,
+ const Handle(HYDROData_Zone)& theZone,
+ int theMethod) const
+{
+ NCollection_Sequence<double> aResSeq;
+
+ for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
+ {
+ const gp_XY& thePnt = thePoints.Value( i );
+
+ double anAltitude = GetAltitudeForPoint( thePnt, theZone, theMethod );
+ aResSeq.Append( anAltitude );
+ }
+
+ return aResSeq;
+}
+
+double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const
+{
+ Handle( HYDROData_LandCoverMap ) aMap = GetLandCoverMap();
+ Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+ if( aMap.IsNull() )
+ return 0.0;
+
+ QString aType;
+ aMap->FindByPoint( thePoint, aType );
+ double aCoeff = aTable->Get( aType, 0.0 );
+ return aCoeff;
+}
+
+std::vector<double> HYDROData_CalculationCase::GetStricklerCoefficientForPoints(const std::vector<gp_XY>& thePoints,
+ double DefValue, bool UseMax ) const
+{
+ Handle( HYDROData_LandCoverMap ) aLCM = GetLandCoverMap();
+ Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+ std::vector<double> theCoeffs;
+ if( aLCM.IsNull() || aTable.IsNull() )
+ return theCoeffs;
+
+ aLCM->ClassifyPoints(thePoints, aTable, theCoeffs, DefValue, UseMax );
+
+ return theCoeffs;
+}
+
+Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
+{
+ Handle(HYDROData_Region) aResRegion;
+
+ Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
+ if ( !aZone.IsNull() )
+ aResRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
+
+ return aResRegion;