From: isn Date: Fri, 16 Oct 2015 12:41:28 +0000 (+0300) Subject: test_merge_faces() // circles X-Git-Tag: v1.5~99 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ec15c74fa546d5af23d92040b2e8fce6b5271df4;p=modules%2Fhydro.git test_merge_faces() // circles --- diff --git a/src/HYDRO_tests/reference_data/_cs13.png b/src/HYDRO_tests/reference_data/_cs13.png new file mode 100644 index 00000000..1745487f Binary files /dev/null and b/src/HYDRO_tests/reference_data/_cs13.png differ diff --git a/src/HYDRO_tests/reference_data/_cs23.png b/src/HYDRO_tests/reference_data/_cs23.png new file mode 100644 index 00000000..1745487f Binary files /dev/null and b/src/HYDRO_tests/reference_data/_cs23.png differ diff --git a/src/HYDRO_tests/reference_data/cs11_c.png b/src/HYDRO_tests/reference_data/cs11_c.png new file mode 100644 index 00000000..c5223cb0 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs11_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs12_c.png b/src/HYDRO_tests/reference_data/cs12_c.png new file mode 100644 index 00000000..8358bee8 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs12_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs14_c.png b/src/HYDRO_tests/reference_data/cs14_c.png new file mode 100644 index 00000000..c9932426 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs14_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs21_c.png b/src/HYDRO_tests/reference_data/cs21_c.png new file mode 100644 index 00000000..58231b66 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs21_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs22_c.png b/src/HYDRO_tests/reference_data/cs22_c.png new file mode 100644 index 00000000..8358bee8 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs22_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs24_c.png b/src/HYDRO_tests/reference_data/cs24_c.png new file mode 100644 index 00000000..c9932426 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs24_c.png differ diff --git a/src/HYDRO_tests/reference_data/ff1.brep b/src/HYDRO_tests/reference_data/ff1.brep new file mode 100644 index 00000000..ab2aa273 --- /dev/null +++ b/src/HYDRO_tests/reference_data/ff1.brep @@ -0,0 +1,41 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 1 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 10 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 -5.4697605301576938e-016 6.8573650631575423e-016 0 0 0 1 1 0 -0 -0 1 0 +Triangulations 0 + +TShapes 4 +Ve +1e-007 +10 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 6.28318530717959 +0 + +0101000 ++4 0 -4 0 * +Wi + +0101100 ++3 0 * +Fa +0 1e-007 1 0 + +1111000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/ff2.brep b/src/HYDRO_tests/reference_data/ff2.brep new file mode 100644 index 00000000..3bb40652 --- /dev/null +++ b/src/HYDRO_tests/reference_data/ff2.brep @@ -0,0 +1,41 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 1 +2 10 0 0 0 0 1 1 0 -0 -0 1 0 10 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 10.000000000000002 6.8573650631575423e-016 0 0 0 1 1 0 -0 -0 1 0 +Triangulations 0 + +TShapes 4 +Ve +1e-007 +20 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 6.28318530717959 +0 + +0101000 ++4 0 -4 0 * +Wi + +0101100 ++3 0 * +Fa +0 1e-007 1 0 + +1111000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/ff3.brep b/src/HYDRO_tests/reference_data/ff3.brep new file mode 100644 index 00000000..e7104dcb --- /dev/null +++ b/src/HYDRO_tests/reference_data/ff3.brep @@ -0,0 +1,41 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 1 +2 40 0 0 0 0 1 1 0 -0 -0 1 0 10 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 39.999999999999993 1.3876045329998471e-016 0 0 0 1 1 0 -0 -0 1 0 +Triangulations 0 + +TShapes 4 +Ve +1e-007 +50 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 6.28318530717959 +0 + +0101000 ++4 0 -4 0 * +Wi + +0101100 ++3 0 * +Fa +0 1e-007 1 0 + +1111000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index e1589b7b..00630ffd 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 EDF-R&D +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either @@ -253,7 +253,7 @@ void test_HYDROData_LandCoverMap::test_remove() aDoc->Close(); } -void test_HYDROData_LandCoverMap::test_merge_faces() +void test_HYDROData_LandCoverMap::test_merge_faces_boxes() { TopoDS_Shape pp1, pp2, pp3, pp4; BRep_Builder BB; @@ -267,7 +267,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces() CPPUNIT_ASSERT(!pp3.IsNull()); CPPUNIT_ASSERT(!pp4.IsNull()); - //Test mergeFaces() func; USD == true + //Test mergeFaces() func // boxes // USD == true { TopTools_ListOfShape Faces; Faces.Append(pp1); @@ -309,7 +309,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces() } // - //Test mergeFaces() func; USD == false + //Test mergeFaces() func // boxes // USD == false { TopTools_ListOfShape Faces; Faces.Append(pp1); @@ -335,7 +335,7 @@ void test_HYDROData_LandCoverMap::test_merge_faces() Faces.Append(pp4); TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); TestViewer::show( aMergedFace, AIS_Shaded, true, "cs23" ); - CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT_IMAGES CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); } { @@ -350,3 +350,99 @@ void test_HYDROData_LandCoverMap::test_merge_faces() CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); } } + + +void test_HYDROData_LandCoverMap::test_merge_faces_circles() +{ + TopoDS_Shape ff1, ff2, ff3; + BRep_Builder BB; + BRepTools::Read(ff1, (REF_DATA_PATH + "/ff1.brep").toStdString().c_str(), BB); + BRepTools::Read(ff2, (REF_DATA_PATH + "/ff2.brep").toStdString().c_str(), BB); + BRepTools::Read(ff3, (REF_DATA_PATH + "/ff3.brep").toStdString().c_str(), BB); + + CPPUNIT_ASSERT(!ff1.IsNull()); + CPPUNIT_ASSERT(!ff2.IsNull()); + CPPUNIT_ASSERT(!ff3.IsNull()); + + //Test mergeFaces() func // circles // USD == true + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "cs11_c" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE); + } + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff3); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "cs12_c" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff2); + Faces.Append(ff3); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "_cs13" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff3); + Faces.Append(ff2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "cs14_c" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + // + + //Test mergeFaces() func // circles // USD == false + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "cs21_c" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff3); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "cs22_c" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff2); + Faces.Append(ff3); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "_cs23" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(ff1); + Faces.Append(ff3); + Faces.Append(ff2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true, "cs24_c" ); + CPPUNIT_ASSERT_IMAGES + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + +} \ No newline at end of file diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index ea36880d..a891c39c 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -30,7 +30,8 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_incomplete_split ); CPPUNIT_TEST( test_merge ); CPPUNIT_TEST( test_remove ); - CPPUNIT_TEST( test_merge_faces ); + CPPUNIT_TEST( test_merge_faces_boxes ); + CPPUNIT_TEST( test_merge_faces_circles ); CPPUNIT_TEST_SUITE_END(); public: @@ -39,7 +40,8 @@ public: void test_incomplete_split(); void test_merge(); void test_remove(); - void test_merge_faces(); + void test_merge_faces_boxes(); + void test_merge_faces_circles(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );