X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_CalculationCase.cxx;h=8814d9aaa28b5c31c4411c0303dfa03aa8c9a5b9;hb=058fcba8376e80a53b920bc79b832a8df2080b0c;hp=6f607c48a874dda18e21eda74852600363c66347;hpb=765c6d70b46e05c73ae0cb23ab4eab4215138a34;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 6f607c48..8814d9aa 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -16,8 +16,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "HYDROData_CalculationCase.h" +#ifdef WIN32 + #pragma warning ( disable: 4251 ) +#endif +#include "HYDROData_CalculationCase.h" #include "HYDROData_ArtificialObject.h" #include "HYDROData_IAltitudeObject.h" #include "HYDROData_Document.h" @@ -67,8 +70,18 @@ #include #endif +#ifdef WIN32 + #pragma warning ( default: 4251 ) +#endif + #define EXPORT_NAME "HYDRO_" + GetName() +#include +#include + +#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity) @@ -785,10 +798,20 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, false ); 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 ); + else + { + DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------"); + aResAltitude = GetAltitudeForPoint( thePoint, aZone ); + } } + else + { + DEBTRACE(" --- GetAltitudeForPoint No Zone ---"); + } return aResAltitude; } @@ -796,6 +819,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint, const Handle(HYDROData_Zone)& theZone ) const { + //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString()); double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude(); if ( theZone.IsNull() ) return aResAltitude; @@ -884,6 +908,7 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( const NCollection_Sequence& thePoints, const Handle(HYDROData_Region)& theRegion ) const { + //DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString()); NCollection_Sequence aResSeq; for ( int i = 1, n = thePoints.Length(); i <= n; ++i ) @@ -914,6 +939,38 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( return aResSeq; } +double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const +{ + double aCoeff = 0; + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); + if ( !aDocument.IsNull() ) + aCoeff = aDocument->GetDefaultStricklerCoefficient(); + + Handle(HYDROData_LandCover) aLandCover; + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, Standard_True ); + if ( !aZone.IsNull() ) + { + HYDROData_SequenceOfObjects anObjList = aZone->GetObjects(); + if ( anObjList.Length() == 1 ) + aLandCover = Handle(HYDROData_LandCover)::DownCast( anObjList.First() ); + else + aLandCover = Handle(HYDROData_LandCover)::DownCast( aZone->GetMergeObject() ); + } + + if ( !aLandCover.IsNull() ) + { + QString aType = aLandCover->GetStricklerType(); + Handle(HYDROData_StricklerTable) aTable = GetStricklerTable(); + if ( !aTable.IsNull() ) + { + if ( aTable->GetTypes().contains( aType ) ) + aCoeff = aTable->Get( aType, aCoeff ); + } + } + + return aCoeff; +} + Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint, const bool theLandCover ) const {