1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <test_HYDROData_CalcCase.h>
20 #include <HYDROData_CalculationCase.h>
21 #include <HYDROData_Document.h>
22 #include <HYDROData_Tool.h>
23 #include <TopoDS_Edge.hxx>
24 #include <TopoDS_Wire.hxx>
25 #include <TopoDS_Face.hxx>
27 #include <TestViewer.h>
28 #include <TestShape.h>
29 #include <TopTools_ListOfShape.hxx>
30 #include <AIS_DisplayMode.hxx>
33 #include <BRep_Builder.hxx>
34 #include <BRepTools.hxx>
37 QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
40 void test_HYDROData_CalcCase::test_add_int_wires()
44 TopTools_ListOfShape Wires;
49 BRepTools::Read(InP, (REF_DATA_PATH + "/p1.brep").toStdString().c_str(), B);
50 BRepTools::Read(InF, (REF_DATA_PATH + "/r2.brep").toStdString().c_str(), B);
53 TopTools_ListOfShape OutSh;
54 TopTools_IndexedDataMapOfShapeShape ls;
55 HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
57 CPPUNIT_ASSERT_EQUAL(2, OutSh.Extent());
60 B.Add(cmp, OutSh.First());
61 B.Add(cmp, OutSh.Last());
62 TestViewer::show( cmp, AIS_Shaded, true, "cc_int_w_1" );
63 //CPPUNIT_ASSERT_IMAGES
68 TopTools_ListOfShape Wires;
73 BRepTools::Read(InP, (REF_DATA_PATH + "/p2.brep").toStdString().c_str(), B);
74 BRepTools::Read(InF, (REF_DATA_PATH + "/r2.brep").toStdString().c_str(), B);
77 TopTools_ListOfShape OutSh;
78 TopTools_IndexedDataMapOfShapeShape ls;
79 HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
80 CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent());
81 TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_2" );
82 //CPPUNIT_ASSERT_IMAGES
87 TopTools_ListOfShape Wires;
92 BRepTools::Read(InP, (REF_DATA_PATH + "/p3.brep").toStdString().c_str(), B);
93 BRepTools::Read(InF, (REF_DATA_PATH + "/r2.brep").toStdString().c_str(), B);
96 TopTools_ListOfShape OutSh;
97 TopTools_IndexedDataMapOfShapeShape ls;
98 HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
99 CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent());
100 TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3", 1, 1 );
101 CPPUNIT_ASSERT_IMAGES