aDoc->Close();
}
+
+void test_HYDROData_LandCoverMap::test_copy()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+ aMap->SetName( "map_1" );
+
+ TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
+
+ TopoDS_Face aLC2 = Face( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
+
+ Handle(HYDROData_LandCoverMap) aMap2 =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+ aMap->CopyTo( aMap2, true );
+
+ CPPUNIT_ASSERT_EQUAL( QString( "map_2" ), aMap2->GetName() );
+ HYDROData_LandCoverMap::Explorer anIt( aMap2 );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), anIt.StricklerType() );
+ CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC1.TShape() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation haute" ), anIt.StricklerType() );
+ CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC2.TShape() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+ TopoDS_Shape aShape1 = aMap->GetShape();
+ TopoDS_Shape aShape2 = aMap2->GetShape();
+ gp_Trsf aTr;
+ aTr.SetTranslation( gp_Vec( 0, 50, 0 ) );
+ aShape2.Move( TopLoc_Location( aTr ) );
+ TestViewer::show( aShape1, AIS_Shaded, /*0,*/ true, "LCM_copied" );
+ TestViewer::show( aShape2, AIS_Shaded, /*0,*/ true, "" );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
CPPUNIT_TEST( test_transparent_prs );
CPPUNIT_TEST( test_assign_to_calc_case );
CPPUNIT_TEST( test_export_telemac );
+ CPPUNIT_TEST( test_copy );
#ifdef SHP_TESTS
CPPUNIT_TEST( test_shp_import_cyp );
CPPUNIT_TEST( test_shp_import_clc_dec );
void test_shp_import_nld_areas();
void test_shp_loop_back();
void test_export_telemac();
+ void test_copy();
};
CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );