From: asl Date: Tue, 17 Nov 2015 14:52:12 +0000 (+0300) Subject: refs #691: the automatic test covering the bug #691 X-Git-Tag: v1.5~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f721b65d07e1b93c5ebc4b7baddd119167466553;p=modules%2Fhydro.git refs #691: the automatic test covering the bug #691 --- diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index 5127c91b..ea4eaf09 100644 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -541,7 +541,7 @@ void HYDROData_PolylineXY::Update() aBB.MakeCompound(aCmp); if(aSeqEdges->Length() >1) { - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges,1E-5,Standard_False,aSeqWires); + ShapeAnalysis_FreeBounds::ConnectEdgesToWires( aSeqEdges, 1E-5, Standard_True, aSeqWires ); if( aSeqWires->Length()==1 ) aResult = aSeqWires->Value( 1 ); diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png new file mode 100644 index 00000000..e4ff0803 Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png differ diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 286767a6..83345f84 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -188,6 +189,66 @@ void test_HYDROData_LandCoverMap::test_merge() aDoc->Close(); } +void test_HYDROData_LandCoverMap::test_merge_refs_691() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_PolylineXY) Polyline_4 = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Polyline_4->SetName( "test_Polyline_4" ); + Polyline_4->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true ); + Polyline_4->AddPoint( 0, gp_XY( -242.741935, -16.129032 ) ); + Polyline_4->AddPoint( 0, gp_XY( -339.516129, -95.161290 ) ); + Polyline_4->AddPoint( 0, gp_XY( -204.032258, -167.740000 ) ); + Polyline_4->AddPoint( 0, gp_XY( -86.290000, -158.060000 ) ); + Polyline_4->AddPoint( 0, gp_XY( -83.064516, -37.096774 ) ); + Polyline_4->AddPoint( 0, gp_XY( -116.935484, 17.741935 ) ); + Polyline_4->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_POLYLINE, true ); + Polyline_4->AddPoint( 1, gp_XY( -239.516129, -295.161290 ) ); + Polyline_4->AddPoint( 1, gp_XY( -204.030000, -167.740000 ) ); + Polyline_4->AddPoint( 1, gp_XY( -86.290000, -158.060000 ) ); + Polyline_4->AddPoint( 1, gp_XY( -2.419355, -288.709677 ) ); + Polyline_4->AddPoint( 1, gp_XY( -165.322581, -351.612903 ) ); + Polyline_4->Update(); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + + CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_4, "test" ) ); + + TopTools_ListOfShape aList; + HYDROData_LandCoverMap::Explorer anIt( aMap ); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() ); + aList.Append( anIt.Face() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() ); + aList.Append( anIt.Face() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( false, anIt.More() ); + + BRepCheck_Analyzer aCheck1( aMap->GetShape() ); + CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck1.IsValid() ); + + CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "test" ) ); + + BRepCheck_Analyzer aCheck2( aMap->GetShape() ); + CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck2.IsValid() ); + + // we try construct the triangulation to check that it is correct + BRepMesh_IncrementalMesh anIncMesh( aMap->GetShape(), 0.01 ); + CPPUNIT_ASSERT_EQUAL( true, (bool)anIncMesh.IsDone() ); + BRepCheck_Analyzer aCheck3( aMap->GetShape() ); + CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck3.IsValid() ); + + Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap ); + TestViewer::show( aPrs, AIS_Shaded, 0, true, "LandCoverMap_Merge_2" ); + CPPUNIT_ASSERT_IMAGES + + aDoc->Close(); +} + void test_HYDROData_LandCoverMap::test_remove() { Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); @@ -481,7 +542,6 @@ void test_HYDROData_LandCoverMap::test_import_dbf() QList Inds = QList() << 1 << 2 << 3; aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds); HYDROData_LandCoverMap::Explorer anIt( aMap ); - CPPUNIT_ASSERT_EQUAL( QString( "forest" ), anIt.StricklerType() ); anIt.Next(); CPPUNIT_ASSERT_EQUAL( QString( "road" ), anIt.StricklerType() ); diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 79eb35d3..85d34bc7 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -33,6 +33,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_split_2 ); CPPUNIT_TEST( test_incomplete_split ); CPPUNIT_TEST( test_merge ); + CPPUNIT_TEST( test_merge_refs_691 ); CPPUNIT_TEST( test_remove ); CPPUNIT_TEST( test_merge_faces_boxes ); CPPUNIT_TEST( test_merge_faces_circles ); @@ -60,6 +61,7 @@ public: void test_split_2(); void test_incomplete_split(); void test_merge(); + void test_merge_refs_691(); void test_remove(); void test_merge_faces_boxes(); void test_merge_faces_circles();