]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
test_merge_faces() // circles
authorisn <isn@opencascade.com>
Fri, 16 Oct 2015 12:41:28 +0000 (15:41 +0300)
committerisn <isn@opencascade.com>
Fri, 16 Oct 2015 12:41:28 +0000 (15:41 +0300)
13 files changed:
src/HYDRO_tests/reference_data/_cs13.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/_cs23.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs11_c.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs12_c.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs14_c.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs21_c.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs22_c.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cs24_c.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/ff1.brep [new file with mode: 0644]
src/HYDRO_tests/reference_data/ff2.brep [new file with mode: 0644]
src/HYDRO_tests/reference_data/ff3.brep [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

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..1745487
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 (file)
index 0000000..1745487
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 (file)
index 0000000..c5223cb
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 (file)
index 0000000..8358bee
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 (file)
index 0000000..c993242
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 (file)
index 0000000..58231b6
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 (file)
index 0000000..8358bee
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 (file)
index 0000000..c993242
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 (file)
index 0000000..ab2aa27
--- /dev/null
@@ -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 (file)
index 0000000..3bb4065
--- /dev/null
@@ -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 (file)
index 0000000..e7104dc
--- /dev/null
@@ -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
+
index e1589b7b13e913c608eb996b7b91eacb58460908..00630ffd854ff16f89d2b6fb7fb219adebf806f2 100644 (file)
@@ -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
index ea36880d7300a56e2f899128db2a9c7f37f509f0..a891c39c04680cf1211b840b1154926ad3817ca6 100644 (file)
@@ -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 );