0021019: EDF 1574 GEOM: Make Common doesn't stop when applied to a corrupted shape.

This commit is contained in:
jfa 2010-12-03 11:22:19 +00:00
parent f729ceb932
commit fc6914d846

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <GEOMImpl_BooleanDriver.hxx> #include <GEOMImpl_BooleanDriver.hxx>
#include <GEOMImpl_IBoolean.hxx> #include <GEOMImpl_IBoolean.hxx>
@ -26,12 +25,17 @@
#include <GEOMImpl_GlueDriver.hxx> #include <GEOMImpl_GlueDriver.hxx>
#include <GEOM_Function.hxx> #include <GEOM_Function.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <ShapeFix_Shape.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BRepAlgo.hxx> #include <BRepAlgo.hxx>
#include <BRepAlgoAPI_Common.hxx> #include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx> #include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Fuse.hxx> #include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Section.hxx> #include <BRepAlgoAPI_Section.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
@ -39,10 +43,8 @@
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <ShapeFix_Shape.hxx>
#include <Standard_ConstructionError.hxx> #include <Standard_ConstructionError.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
@ -93,7 +95,7 @@ void AddSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape& theList)
//function : Execute //function : Execute
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
{ {
if (Label().IsNull()) return 0; if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
@ -109,6 +111,14 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
TopoDS_Shape aShape2 = aRefShape2->GetValue(); TopoDS_Shape aShape2 = aRefShape2->GetValue();
if (!aShape1.IsNull() && !aShape2.IsNull()) { if (!aShape1.IsNull() && !aShape2.IsNull()) {
// check arguments for Mantis issue 0021019
BRepCheck_Analyzer ana (aShape1, Standard_True);
if (!ana.IsValid())
StdFail_NotDone::Raise("Common operation will not be performed, because argument shape is not valid");
ana.Init(aShape2);
if (!ana.IsValid())
StdFail_NotDone::Raise("Common operation will not be performed, because argument shape is not valid");
// perform COMMON operation // perform COMMON operation
if (aType == BOOLEAN_COMMON) { if (aType == BOOLEAN_COMMON) {
BRep_Builder B; BRep_Builder B;