]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
test_merge_faces() // boxes
authorisn <isn@opencascade.com>
Fri, 16 Oct 2015 11:55:15 +0000 (14:55 +0300)
committerisn <isn@opencascade.com>
Fri, 16 Oct 2015 11:55:15 +0000 (14:55 +0300)
13 files changed:
src/HYDRO_tests/reference_data/cs11.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs12.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs13.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs14.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs21.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs22.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs23.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs24.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/pp1.brep [new file with mode: 0644]
src/HYDRO_tests/reference_data/pp2.brep [new file with mode: 0644]
src/HYDRO_tests/reference_data/pp3.brep [new file with mode: 0644]
src/HYDRO_tests/reference_data/pp4.brep [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx

diff --git a/src/HYDRO_tests/reference_data/cs11.png b/src/HYDRO_tests/reference_data/cs11.png
new file mode 100644 (file)
index 0000000..748b4ba
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 (file)
index 0000000..57c99a9
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 (file)
index 0000000..36ed142
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 (file)
index 0000000..04cdf62
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 (file)
index 0000000..748b4ba
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 (file)
index 0000000..57c99a9
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 (file)
index 0000000..36ed142
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 (file)
index 0000000..04cdf62
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 (file)
index 0000000..6b0033b
--- /dev/null
@@ -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 (file)
index 0000000..a5e11fb
--- /dev/null
@@ -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 (file)
index 0000000..ce4d91e
--- /dev/null
@@ -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 (file)
index 0000000..0e767fd
--- /dev/null
@@ -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
+
index 17c9b751366aad81ba94087134968885fdc4a0ca..02a1b12eb7196aaaaf8f507ee8304057c559edb9 100644 (file)
@@ -36,6 +36,9 @@
 #include <QColor>
 
 #include <BRepTools.hxx>
+#include <BRep_Builder.hxx>
+
+const QString REF_DATA_PATH = qgetenv( "HYDRO_REFERENCE_DATA" );
 
 TopoDS_Edge Spline( const QList<double>& 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);
+  }
 }