]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
land cover map assignment to the calculation case
authorasl <asl@opencascade.com>
Mon, 26 Oct 2015 11:10:48 +0000 (14:10 +0300)
committerasl <asl@opencascade.com>
Mon, 26 Oct 2015 11:10:48 +0000 (14:10 +0300)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

index 3d3d918b7521712f904aba29a71516aba1fa2466..48ee53c6975022860123c04c1e590b9c0b6490f3 100644 (file)
@@ -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 )
index 1a4eb3115bb565fa6739cdd2ccb5d625e4c50455..4f09be72ec1e39b582747c55fba5434f598a26e8 100644 (file)
@@ -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.
index c8c12a84da8aca679faafa78bee81cc4dd016dd8..2cb5dead698d3bd5a70225e65891b0cb008c7193 100644 (file)
@@ -17,6 +17,7 @@
 //
 
 #include <test_HYDROData_LandCoverMap.h>
+#include <HYDROData_CalculationCase.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_LandCoverMap.h>
 #include <HYDROData_ImmersibleZone.h>
@@ -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();
+}
index 8af209a0f7225a083a7887c1760248a1302c90d6..4d0ccc9e5c7c6ff7c1806814534b8a8d31778990 100644 (file)
@@ -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 );