From: isn Date: Fri, 16 Oct 2015 11:55:15 +0000 (+0300) Subject: test_merge_faces() // boxes X-Git-Tag: v1.5~102 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d75bc8e5b129bc5d0e6aea3c34f12e7439e76d51;p=modules%2Fhydro.git test_merge_faces() // boxes --- diff --git a/src/HYDRO_tests/reference_data/cs11.png b/src/HYDRO_tests/reference_data/cs11.png new file mode 100644 index 00000000..748b4ba6 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs11.png differ diff --git a/src/HYDRO_tests/reference_data/cs12.png b/src/HYDRO_tests/reference_data/cs12.png new file mode 100644 index 00000000..57c99a94 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs12.png differ diff --git a/src/HYDRO_tests/reference_data/cs13.png b/src/HYDRO_tests/reference_data/cs13.png new file mode 100644 index 00000000..36ed1426 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs13.png differ diff --git a/src/HYDRO_tests/reference_data/cs14.png b/src/HYDRO_tests/reference_data/cs14.png new file mode 100644 index 00000000..04cdf623 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs14.png differ diff --git a/src/HYDRO_tests/reference_data/cs21.png b/src/HYDRO_tests/reference_data/cs21.png new file mode 100644 index 00000000..748b4ba6 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs21.png differ diff --git a/src/HYDRO_tests/reference_data/cs22.png b/src/HYDRO_tests/reference_data/cs22.png new file mode 100644 index 00000000..57c99a94 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs22.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..36ed1426 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs23.png differ diff --git a/src/HYDRO_tests/reference_data/cs24.png b/src/HYDRO_tests/reference_data/cs24.png new file mode 100644 index 00000000..04cdf623 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cs24.png differ diff --git a/src/HYDRO_tests/reference_data/pp1.brep b/src/HYDRO_tests/reference_data/pp1.brep new file mode 100644 index 00000000..6b0033b2 --- /dev/null +++ b/src/HYDRO_tests/reference_data/pp1.brep @@ -0,0 +1,86 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 4 +1 0 0 0 0 1 0 +1 0 1 0 1 0 0 +1 1 1 0 0 -1 0 +1 1 0 0 -1 0 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 0.5 0.5 0 -0 -0 -1 -1 0 0 0 1 -0 +Triangulations 0 + +TShapes 10 +Ve +1e-007 +0 0 0 +0 0 + +0101101 +* +Ve +1e-007 +0 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 1 +0 + +0101000 ++10 0 -9 0 * +Ve +1e-007 +1 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 2 0 0 1 +0 + +0101000 ++9 0 -7 0 * +Ve +1e-007 +1 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 3 0 0 1 +0 + +0101000 ++7 0 -5 0 * +Ed + 1e-007 1 1 0 +1 4 0 0 1 +0 + +0101000 ++5 0 -10 0 * +Wi + +0101100 ++8 0 +6 0 +4 0 +3 0 * +Fa +0 1e-007 1 0 + +1111000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/pp2.brep b/src/HYDRO_tests/reference_data/pp2.brep new file mode 100644 index 00000000..a5e11fb6 --- /dev/null +++ b/src/HYDRO_tests/reference_data/pp2.brep @@ -0,0 +1,86 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 4 +1 1 0 0 0 1 0 +1 1 1 0 1 0 0 +1 2 1 0 0 -1 0 +1 2 0 0 -1 0 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 1.5 0.5 0 -0 -0 -1 -1 0 0 0 1 -0 +Triangulations 0 + +TShapes 10 +Ve +1e-007 +1 0 0 +0 0 + +0101101 +* +Ve +1e-007 +1 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 1 +0 + +0101000 ++10 0 -9 0 * +Ve +1e-007 +2 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 2 0 0 1 +0 + +0101000 ++9 0 -7 0 * +Ve +1e-007 +2 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 3 0 0 1 +0 + +0101000 ++7 0 -5 0 * +Ed + 1e-007 1 1 0 +1 4 0 0 1 +0 + +0101000 ++5 0 -10 0 * +Wi + +0101100 ++8 0 +6 0 +4 0 +3 0 * +Fa +0 1e-007 1 0 + +1111000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/pp3.brep b/src/HYDRO_tests/reference_data/pp3.brep new file mode 100644 index 00000000..ce4d91e9 --- /dev/null +++ b/src/HYDRO_tests/reference_data/pp3.brep @@ -0,0 +1,86 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 4 +1 2 0 0 0 1 0 +1 2 1 0 1 0 0 +1 3 1 0 0 -1 0 +1 3 0 0 -1 0 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 2.5 0.5 0 -0 -0 -1 -1 0 0 0 1 -0 +Triangulations 0 + +TShapes 10 +Ve +1e-007 +2 0 0 +0 0 + +0101101 +* +Ve +1e-007 +2 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 1 +0 + +0101000 ++10 0 -9 0 * +Ve +1e-007 +3 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 2 0 0 1 +0 + +0101000 ++9 0 -7 0 * +Ve +1e-007 +3 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 3 0 0 1 +0 + +0101000 ++7 0 -5 0 * +Ed + 1e-007 1 1 0 +1 4 0 0 1 +0 + +0101000 ++5 0 -10 0 * +Wi + +0101100 ++8 0 +6 0 +4 0 +3 0 * +Fa +0 1e-007 1 0 + +1111000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/pp4.brep b/src/HYDRO_tests/reference_data/pp4.brep new file mode 100644 index 00000000..0e767fdd --- /dev/null +++ b/src/HYDRO_tests/reference_data/pp4.brep @@ -0,0 +1,86 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 4 +1 3 0 0 0 1 0 +1 3 1 0 1 0 0 +1 4 1 0 0 -1 0 +1 4 0 0 -1 0 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 1 +1 3.5 0.5 0 -0 -0 -1 -1 0 0 0 1 -0 +Triangulations 0 + +TShapes 10 +Ve +1e-007 +3 0 0 +0 0 + +0101101 +* +Ve +1e-007 +3 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 1 +0 + +0101000 ++10 0 -9 0 * +Ve +1e-007 +4 1 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 2 0 0 1 +0 + +0101000 ++9 0 -7 0 * +Ve +1e-007 +4 0 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 3 0 0 1 +0 + +0101000 ++7 0 -5 0 * +Ed + 1e-007 1 1 0 +1 4 0 0 1 +0 + +0101000 ++5 0 -10 0 * +Wi + +0101100 ++8 0 +6 0 +4 0 +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 17c9b751..02a1b12e 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -36,6 +36,9 @@ #include #include +#include + +const QString REF_DATA_PATH = qgetenv( "HYDRO_REFERENCE_DATA" ); TopoDS_Edge Spline( const QList& theXYList, bool isClosed = false ) { @@ -252,5 +255,98 @@ void test_HYDROData_LandCoverMap::test_remove() void test_HYDROData_LandCoverMap::test_merge_faces() { + TopoDS_Shape pp1, pp2, pp3, pp4; + BRep_Builder BB; + BRepTools::Read(pp1, (REF_DATA_PATH + "/pp1.brep").toStdString().c_str(), BB); + BRepTools::Read(pp2, (REF_DATA_PATH + "/pp2.brep").toStdString().c_str(), BB); + BRepTools::Read(pp3, (REF_DATA_PATH + "/pp3.brep").toStdString().c_str(), BB); + BRepTools::Read(pp4, (REF_DATA_PATH + "/pp4.brep").toStdString().c_str(), BB); + + CPPUNIT_ASSERT(!pp1.IsNull()); + CPPUNIT_ASSERT(!pp2.IsNull()); + CPPUNIT_ASSERT(!pp3.IsNull()); + CPPUNIT_ASSERT(!pp4.IsNull()); + + //Test mergeFaces() func; USD == true + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs11" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE); + } + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp3); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs12" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp2); + Faces.Append(pp4); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs13" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp3); + Faces.Append(pp4); + Faces.Append(pp2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, true ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs14" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_FACE); + } + // + //Test mergeFaces() func; USD == false + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs21" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp3); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs22" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp2); + Faces.Append(pp4); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs23" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } + { + TopTools_ListOfShape Faces; + Faces.Append(pp1); + Faces.Append(pp3); + Faces.Append(pp4); + Faces.Append(pp2); + TopoDS_Shape aMergedFace = HYDROData_LandCoverMap::MergeFaces( Faces, false ); + TestViewer::show( aMergedFace, AIS_Shaded, true ); + TestViewer::AssertEqual( "cs24" ); + CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); + } }