From: asl Date: Mon, 26 Oct 2015 11:10:48 +0000 (+0300) Subject: land cover map assignment to the calculation case X-Git-Tag: v1.5~63 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=947094c3fdd08e49a696111b3d58c561461544c6;p=modules%2Fhydro.git land cover map assignment to the calculation case --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 3d3d918b..48ee53c6 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -578,9 +578,14 @@ void HYDROData_CalculationCase::RemoveStricklerTable() Handle(HYDROData_LandCoverMap) HYDROData_CalculationCase::GetLandCoverMap() const { - // TODO - Handle(HYDROData_LandCoverMap) aLandCoverMap = NULL; - return aLandCoverMap; + Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( + GetReferenceObject( DataTag_LandCoverMap ) ); + return aMap; +} + +void HYDROData_CalculationCase::SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& theMap ) +{ + SetReferenceObject( theMap, DataTag_LandCoverMap ); } Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone ) diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 1a4eb311..4f09be72 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -101,8 +101,9 @@ public: DataTag_CustomLandCoverRules_Obsolete, ///< custom rules for land covers priority DataTag_AssignmentLandCoverMode_Obsolete, ///< assignment mode of land covers priority DataTag_ChildLandCoverRegion_Obsolete, ///< child land cover regions - DataTag_LandCoverRegion_Obsolete ///< reference land cover regions + DataTag_LandCoverRegion_Obsolete, ///< reference land cover regions + DataTag_LandCoverMap, ///< reference to land cover map }; public: @@ -219,7 +220,9 @@ public: * Returns reference Land Cover Map of calculation case. * \return the referenced Land Cover Map */ - HYDRODATA_EXPORT virtual Handle(HYDROData_LandCoverMap) GetLandCoverMap() const; + HYDRODATA_EXPORT Handle(HYDROData_LandCoverMap) GetLandCoverMap() const; + + HYDRODATA_EXPORT void SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& ); /** * Add new one child region for calculation case. diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index c8c12a84..2cb5dead 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -17,6 +17,7 @@ // #include +#include #include #include #include @@ -662,3 +663,18 @@ void test_HYDROData_LandCoverMap::test_add_triangles() aDoc->Close(); } + +void test_HYDROData_LandCoverMap::test_assign_to_calc_case() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + Handle(HYDROData_CalculationCase) aCalcCase = + Handle(HYDROData_CalculationCase)::DownCast( aDoc->CreateObject( KIND_CALCULATION ) ); + + aCalcCase->SetLandCoverMap( aMap ); + CPPUNIT_ASSERT_EQUAL( aMap->myLab, aCalcCase->GetLandCoverMap()->myLab ); + + aDoc->Close(); +} diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 8af209a0..4d0ccc9e 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -38,6 +38,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_land_cover_prs_by_coeff ); CPPUNIT_TEST( test_dump_python ); CPPUNIT_TEST( test_transparent_prs ); + CPPUNIT_TEST( test_assign_to_calc_case ); CPPUNIT_TEST_SUITE_END(); public: @@ -54,6 +55,7 @@ public: void test_land_cover_prs_by_coeff(); void test_dump_python(); void test_transparent_prs(); + void test_assign_to_calc_case(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );