diff --git a/src/EntityGUI/CMakeLists.txt b/src/EntityGUI/CMakeLists.txt index a1cfd4736..c42e5095d 100755 --- a/src/EntityGUI/CMakeLists.txt +++ b/src/EntityGUI/CMakeLists.txt @@ -25,6 +25,7 @@ INCLUDE(UseQtExt) INCLUDE_DIRECTORIES( ${PTHREAD_INCLUDE_DIR} ${VTK_INCLUDE_DIRS} + ${OPENCV_INCLUDE_DIR} ${OMNIORB_INCLUDE_DIR} ${CAS_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS} diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx index d69e7bba2..70d754765 100755 --- a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx +++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx @@ -319,7 +319,7 @@ void GEOMGUI_TextTreeWdg::updateAnnotationBranch( const QString& theEntry ) //================================================================================= void GEOMGUI_TextTreeWdg::updateObjectName( const QString& theEntry ) { - QTreeWidgetItem* anObjectItem; + QTreeWidgetItem* anObjectItem = 0; QHash anObjects = getObjects( DimensionShape ); if ( anObjects.contains( theEntry ) ) diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index f9a7d0a72..6c2e34a89 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -191,7 +191,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(LOGBOOK& log) const if (nbShapes > 0) { aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(1)); aShape = aRefShape->GetValue(); - + if (!aShape.IsNull()) { // check arguments for Mantis issue 0021019 if (!GEOMUtils::CheckShape(aShape, true)) @@ -218,12 +218,12 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(LOGBOOK& log) const aShape = aShapeCopy; for (i = 2; i <= nbShapes; i++) { - aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(i)); - aShape2 = aRefShape->GetValue(); - + aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(i)); + aShape2 = aRefShape->GetValue(); + if (!GEOMUtils::CheckShape(aShape2, true)) - StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); - + StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); + if (isCheckSelfInte) { BOPCol_ListOfShape aList2; aList2.Append(aShape2); @@ -237,17 +237,17 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(LOGBOOK& log) const // Copy shape aShapeCopy.Nullify(); TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy); - aShape = performOperation (aShape, aShapeCopy, aSimpleType); + aShape = performOperation (aShape, aShapeCopy, aSimpleType); if (isRmExtraEdges) { aShape = RemoveExtraEdges(aShape); } - - if (aShape.IsNull()) { - return 0; - } - } - } + + if (aShape.IsNull()) { + return 0; + } + } + } } } break; @@ -262,7 +262,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(LOGBOOK& log) const if (!GEOMUtils::CheckShape(aShape, true)) StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); - BOPAlgo_CheckerSI aCSI; // checker of self-interferences + BOPAlgo_CheckerSI aCSI; // checker of self-interferences if (isCheckSelfInte) { aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL); @@ -281,7 +281,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(LOGBOOK& log) const TNaming_CopyShape::CopyTool(aShape, aMapTShapes, aShapeCopy); aShape = aShapeCopy; - + Handle(TColStd_HSequenceOfTransient) aTools = aCI.GetShapes(); const Standard_Integer nbShapes = aTools->Length(); Standard_Integer i; @@ -342,16 +342,30 @@ TopoDS_Shape GEOMImpl_BooleanDriver::makeCompoundShellFromFaces if (theShape.ShapeType() != TopAbs_COMPOUND) return theShape; + BRep_Builder B; + TopoDS_Compound aFaces; + B.MakeCompound(aFaces); + + // simplify compound structure for + // Mantis issue 0023419 (note 0021712) + TopExp_Explorer aExp; + TopTools_MapOfShape aMapFaces; + aExp.Init(theShape, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aFace = aExp.Current(); + if (aMapFaces.Add(aFace)) { + B.Add(aFaces, aFace); + } + } + BOPCol_ListOfShape aListShapes; - BOPTools_AlgoTools::MakeConnexityBlocks(theShape, TopAbs_EDGE, TopAbs_FACE, aListShapes); + BOPTools_AlgoTools::MakeConnexityBlocks(aFaces, TopAbs_EDGE, TopAbs_FACE, aListShapes); if (aListShapes.IsEmpty()) return theShape; TopoDS_Compound aResult; - BRep_Builder B; B.MakeCompound(aResult); - TopExp_Explorer aExp; BOPCol_ListIteratorOfListOfShape anIter(aListShapes); for (; anIter.More(); anIter.Next()) { @@ -373,6 +387,7 @@ TopoDS_Shape GEOMImpl_BooleanDriver::makeCompoundShellFromFaces return aResult; } + //======================================================================= //function : performOperation //purpose : @@ -415,11 +430,12 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation // This allows to avoid adding empty compounds, // resulting from COMMON on two non-intersecting shapes. if (aStepResult.ShapeType() == TopAbs_COMPOUND) { - #if OCC_VERSION_MAJOR >= 7 - if (aValue1.ShapeType() == TopAbs_FACE && aValue2.ShapeType() == TopAbs_FACE) { +#if OCC_VERSION_MAJOR >= 7 + if ((aValue1.ShapeType() == TopAbs_FACE || aValue1.ShapeType() == TopAbs_SHELL) && + (aValue2.ShapeType() == TopAbs_FACE || aValue2.ShapeType() == TopAbs_SHELL)) { aStepResult = makeCompoundShellFromFaces(aStepResult); } - #endif +#endif TopoDS_Iterator aCompIter (aStepResult); for (; aCompIter.More(); aCompIter.Next()) { // add shape in a result @@ -477,11 +493,12 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation // This allows to avoid adding empty compounds, // resulting from CUT of parts if (aCut.ShapeType() == TopAbs_COMPOUND) { - #if OCC_VERSION_MAJOR >= 7 - if (itSub1.Value().ShapeType() == TopAbs_FACE) { +#if OCC_VERSION_MAJOR >= 7 + if (itSub1.Value().ShapeType() == TopAbs_FACE || + itSub1.Value().ShapeType() == TopAbs_SHELL) { aCut = makeCompoundShellFromFaces(aCut); } - #endif +#endif TopoDS_Iterator aCompIter (aCut); for (; aCompIter.More(); aCompIter.Next()) { // add shape in a result @@ -509,7 +526,7 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation // perform FUSE operation else if (theType == BOOLEAN_FUSE) { - #if OCC_VERSION_MAJOR >= 7 +#if OCC_VERSION_MAJOR >= 7 Standard_Boolean isFaces = Standard_False; TopTools_ListOfShape listShape1, listShape2; GEOMUtils::AddSimpleShapes(theShape1, listShape1); @@ -521,7 +538,8 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation TopTools_ListIteratorOfListOfShape itSub2 (listShape2); for (; itSub2.More(); itSub2.Next()) { TopoDS_Shape aValue2 = itSub2.Value(); - if (aValue1.ShapeType() == TopAbs_FACE && aValue2.ShapeType() == TopAbs_FACE) { + if ((aValue1.ShapeType() == TopAbs_FACE || aValue1.ShapeType() == TopAbs_SHELL) && + (aValue2.ShapeType() == TopAbs_FACE || aValue2.ShapeType() == TopAbs_SHELL)) { isFaces = Standard_True; } } @@ -534,10 +552,10 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation StdFail_NotDone::Raise("Fuse operation can not be performed on the given shapes"); } aShape = BO.Shape(); - #if OCC_VERSION_MAJOR >= 7 +#if OCC_VERSION_MAJOR >= 7 if (isFaces) aShape = makeCompoundShellFromFaces(aShape); - #endif +#endif } // perform SECTION operation @@ -569,7 +587,7 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation BO.ComputePCurveOn1(Standard_True); BO.ComputePCurveOn2(Standard_True); //modified by NIZNHY-PKV Tue Oct 18 14:34:18 2011t - + BO.Build(); if (!BO.IsDone()) { StdFail_NotDone::Raise("Section operation can not be performed on the given shapes"); diff --git a/src/OBJECT/GEOM_Annotation.cxx b/src/OBJECT/GEOM_Annotation.cxx index 1c66c77c1..2ab8f8e12 100755 --- a/src/OBJECT/GEOM_Annotation.cxx +++ b/src/OBJECT/GEOM_Annotation.cxx @@ -66,7 +66,7 @@ GEOM_Annotation::GEOM_Annotation() : AIS_InteractiveObject() SetDisplayMode( 0 ); SetZLayer( Graphic3d_ZLayerId_Default ); SetAutoHide( Standard_True ); -#if OCC_VERSION_LARGE <= 0x07010000 +#if OCC_VERSION_LARGE <= 0x07010001 SetHilightMode( HighlightAll ); #endif SetMutable( Standard_True ); @@ -749,7 +749,7 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)& return; } } -#if OCC_VERSION_LARGE > 0x07010000 +#if OCC_VERSION_LARGE > 0x07010001 const Handle(Graphic3d_PresentationAttributes) aHighlightStyle = theWorkspace->HighlightStyle(); if (!aHighlightStyle.IsNull() && myAISObject->myHilightMode == HighlightLabel) { @@ -879,7 +879,7 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)& aContext->ApplyModelViewMatrix(); -#if OCC_VERSION_LARGE > 0x07010000 +#if OCC_VERSION_LARGE > 0x07010001 theWorkspace->SetHighlightStyle(aHighlightStyle); #else if ( toHighlight != theWorkspace->ToHighlight() ) @@ -895,7 +895,7 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)& // purpose : Perform highlighting of the presentation. // ======================================================================= void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM, -#if OCC_VERSION_LARGE > 0x07010000 +#if OCC_VERSION_LARGE > 0x07010001 const Handle(Prs3d_Drawer)& theStyle, #else const Handle(Graphic3d_HighlightStyle)& theStyle, @@ -905,7 +905,7 @@ void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMg if ( myPrsSh.IsNull() ) { Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer; -#if OCC_VERSION_LARGE > 0x07010000 +#if OCC_VERSION_LARGE > 0x07010001 aDrawer->Link( theStyle ); #else aDrawer->Link( Selectable()->HilightAttributes() ); @@ -943,7 +943,7 @@ void GEOM_Annotation::GEOM_AnnotationOwner::Unhilight ( const Handle(PrsMgr_Pres { SelectMgr_EntityOwner::Unhilight( thePM, theMode ); -#if OCC_VERSION_LARGE > 0x07010000 +#if OCC_VERSION_LARGE > 0x07010001 thePM->Unhighlight( myPrsSh ); #else thePM->Unhighlight( myPrsSh, theMode ); diff --git a/src/OBJECT/GEOM_Annotation.hxx b/src/OBJECT/GEOM_Annotation.hxx index e672dd446..00fc80986 100755 --- a/src/OBJECT/GEOM_Annotation.hxx +++ b/src/OBJECT/GEOM_Annotation.hxx @@ -363,7 +363,7 @@ public: //! \param theMode [in] the display mode. virtual void HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM, -#if OCC_VERSION_LARGE > 0x07010000 +#if OCC_VERSION_LARGE > 0x07010001 const Handle(Prs3d_Drawer)& theStyle, #else const Handle(Graphic3d_HighlightStyle)& theStyle,