From: mnt Date: Tue, 19 Feb 2019 11:47:33 +0000 (+0300) Subject: Porting to OCCT 7.4 dev X-Git-Tag: V9_3_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bfd48ef62aad2b2dede9ceecde01123c072d6f98;p=modules%2Fgeom.git Porting to OCCT 7.4 dev --- diff --git a/src/BlockFix/BlockFix_UnionEdges.cxx b/src/BlockFix/BlockFix_UnionEdges.cxx index 45fa5adbb..65d825b39 100644 --- a/src/BlockFix/BlockFix_UnionEdges.cxx +++ b/src/BlockFix/BlockFix_UnionEdges.cxx @@ -375,11 +375,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain, } Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex + Standard_Boolean ClosedFlag = Standard_False; GeomConvert::ConcatC1(tab_c3d, tabtolvertex, ArrayOfIndices, concatcurve, - Standard_False, + ClosedFlag, Precision::Confusion()); //C1 concatenation if (concatcurve->Length() > 1) @@ -425,11 +426,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain, } Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex + Standard_Boolean ClosedFlag = Standard_False; Geom2dConvert::ConcatC1(tab_c2d, tabtolvertex, ArrayOfInd2d, concatc2d, - Standard_False, + ClosedFlag, Precision::Confusion()); //C1 concatenation if (concatc2d->Length() > 1) diff --git a/src/CurveCreator/CurveCreator_Utils.cxx b/src/CurveCreator/CurveCreator_Utils.cxx index 4bca859d0..4aac8b87f 100644 --- a/src/CurveCreator/CurveCreator_Utils.cxx +++ b/src/CurveCreator/CurveCreator_Utils.cxx @@ -17,6 +17,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include + #include "CurveCreator_Utils.hxx" #include "CurveCreator.hxx" #include "CurveCreator_Curve.hxx" @@ -38,7 +40,10 @@ #include #include #include + +#if OCC_VERSION_LARGE <= 0x07030000 #include +#endif #include #include @@ -646,7 +651,9 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo //ASL: we switch on again automatic highlight (otherwise selection will not be shown) // and call HilightPicked to draw selected owners theContext->SetAutomaticHilight( Standard_True ); +#if OCC_VERSION_LARGE <= 0x07030000 theContext->LocalContext()->HilightPicked( Standard_True ); +#endif } //======================================================================= @@ -661,11 +668,15 @@ void CurveCreator_Utils::setLocalPointContext( const CurveCreator_ICurve* theCur return; if ( theOpen ) { +#if OCC_VERSION_LARGE <= 0x07030000 // Open local context if there is no one if ( !theContext->HasOpenedContext() ) { +#endif theContext->ClearCurrents( false ); +#if OCC_VERSION_LARGE <= 0x07030000 theContext->OpenLocalContext( false/*use displayed objects*/, true/*allow shape decomposition*/ ); } +#endif // load the curve AIS object to the local context with the point selection Handle(AIS_InteractiveObject) anAIS = theCurve->getAISObject(); if ( !anAIS.IsNull() ) @@ -678,8 +689,13 @@ void CurveCreator_Utils::setLocalPointContext( const CurveCreator_ICurve* theCur } } else { +#if OCC_VERSION_LARGE <= 0x07030000 if ( theContext->HasOpenedContext() ) theContext->CloseAllContexts( Standard_True ); +#else + theContext->Deactivate(); + theContext->Activate(0); +#endif } } diff --git a/src/CurveCreator/CurveCreator_Widget.cxx b/src/CurveCreator/CurveCreator_Widget.cxx index 34fa0a021..f18329ef5 100644 --- a/src/CurveCreator/CurveCreator_Widget.cxx +++ b/src/CurveCreator/CurveCreator_Widget.cxx @@ -17,6 +17,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include + #include "CurveCreator_Widget.h" #include "CurveCreator_TreeView.h" #include "CurveCreator_NewSectionDlg.h" @@ -1520,7 +1522,11 @@ void CurveCreator_Widget::setSelectedPoints( const CurveCreator_ICurve::SectionT if ( myDragStarted ) return; Handle(AIS_InteractiveContext) aContext = getAISContext(); - if ( aContext.IsNull() || !aContext->HasOpenedContext() ) + if ( aContext.IsNull() +#if OCC_VERSION_LARGE <= 0x07030000 + || !aContext->HasOpenedContext() +#endif + ) return; CurveCreator_Utils::setSelectedPoints( aContext, myCurve, thePoints ); diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx index e2030efcf..1be9d9311 100644 --- a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -50,6 +50,7 @@ #include #include +#include //================================================================ // Function : GEOMGUI_OCCSelector @@ -79,24 +80,24 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const return; Handle(AIS_InteractiveContext) ic = vw->getAISContext(); - +#if OCC_VERSION_LARGE <= 0x07030000 if (ic->HasOpenedContext()) { +#endif TopoDS_Shape curBigShape; TopTools_IndexedMapOfShape subShapes; for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected()) { - Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner()); - if (anOwner.IsNull()) - continue; - Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); + Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast( ic->SelectedInteractive() ); QString entryStr = entry(io); int index = -1; - if (anOwner->ComesFromDecomposition()) // == Local Selection + Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast( ic->SelectedOwner() ); + + if (!anOwner.IsNull() && anOwner->ComesFromDecomposition()) // == Local Selection { TopoDS_Shape subShape = anOwner->Shape(); Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast(io); @@ -126,6 +127,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const aList.append(SUIT_DataOwnerPtr(owner)); } } +#if OCC_VERSION_LARGE <= 0x07030000 } else { @@ -145,6 +147,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const } } } +#endif // add externally selected objects SUIT_DataOwnerPtrList::const_iterator anExtIter; @@ -347,8 +350,8 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) if ( owner->State() ) continue; - if ( ic->HasOpenedContext() ) - ic->AddOrRemoveSelected( owner, false ); + if ( owner->ComesFromDecomposition() ) + ic->AddOrRemoveSelected( owner, false ); else ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false ); } diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index f823834d4..5a4dc4914 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -118,6 +118,7 @@ #include #include +#include // CORBA Headers #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) @@ -2050,8 +2051,13 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* ) Handle(AIS_InteractiveContext) ic = vf->getAISContext(); if ( !ic.IsNull() ) { +#if OCC_VERSION_LARGE <= 0x07030000 if ( ic->HasOpenedContext() ) ic->CloseAllContexts(Standard_True); +#else + ic->Deactivate(); + ic->Activate( 0 ); +#endif } } } diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 09d9b1dc4..f1790cd21 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -47,6 +47,8 @@ #include #include +#include + #include #include #include @@ -2428,10 +2430,16 @@ void GeometryGUI::createPreferences() aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf"; // add enginier font into combobox /*int fontID =*/ QFontDatabase::addApplicationFont( aFontFile ); +#if OCC_VERSION_LARGE <= 0x07030000 Handle(Font_SystemFont) sf = new Font_SystemFont( new TCollection_HAsciiString("Y14.5M-2009"), Font_FA_Regular, new TCollection_HAsciiString(aFontFile.toLatin1().data()) ); +# else + Handle(Font_SystemFont) sf = new Font_SystemFont( TCollection_AsciiString("Y14.5M-2009") ); + sf->SetFontPath( Font_FA_Regular, + TCollection_AsciiString( aFontFile.toLatin1().data() ) ); +#endif // register font in OCC font manager fmgr->RegisterFont( sf, Standard_False ); diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx index b78a7a5d0..99462ccee 100644 --- a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx @@ -45,6 +45,8 @@ #include +#include + //======================================================================= //function : GetID //purpose : @@ -128,7 +130,11 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(Handle(TFunction_Logbook)& log) if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E) && M.FindFromIndex(i).Extent() == 2) +#if OCC_VERSION_LARGE <= 0x07030000 fill.Add(aD, E, F); +#else + fill.Add(aD, aD, E, F); +#endif } } else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) { diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx index 326c420be..3012715d9 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx @@ -48,6 +48,7 @@ #include #include #include +#include // Depth of self-intersection check (see BOPAlgo_CheckerSI::SetLevelOfCheck() for more details) // Default value for BOPAlgo_CheckerSI gives very long computation when checking face-to-face intersections; @@ -440,10 +441,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo TopTools_IndexedMapOfShape aResIndices; TopExp::MapShapes(aShape, aResIndices); - // Map: source_shape/images of source_shape in Result - const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult(); - //const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult(); - // history for all argument shapes // be sure to use aCopyMap TDF_LabelSequence aLabelSeq; @@ -467,37 +464,39 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) { TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie); + if (!BRepTools_History::IsSupportedType(anEntity)) + continue; + // be sure to use aCopyMap here if (aCopyMap.IsBound(anEntity)) anEntity = aCopyMap.Find(anEntity); // - if (!aMR.Contains(anEntity)) continue; - - const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity); - //const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity); - Standard_Integer nbModified = aModified.Extent(); - - if (nbModified > 0) { // Mantis issue 0021182 - int ih = 1; - TopTools_ListIteratorOfListOfShape itM (aModified); - for (; itM.More() && nbModified > 0; itM.Next(), ++ih) { - if (!aResIndices.Contains(itM.Value())) { - nbModified = 0; - } - } + if (PS.IsDeleted(anEntity)) + // The shape has been deleted + continue; + + // Check if the shape has been modified during the operation. + // If it was - use its splits, otherwise use the shape itself + const TopTools_ListOfShape *pModified; + TopTools_ListOfShape aLItself; + const TopTools_ListOfShape& aPSModified = PS.Modified(anEntity); + if (!aPSModified.IsEmpty()) + pModified = &aPSModified; + else + { + aLItself.Append(anEntity); + pModified = &aLItself; } - if (nbModified > 0) { - TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True); - Handle(TDataStd_IntegerArray) anAttr = - TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified); - - int ih = 1; - TopTools_ListIteratorOfListOfShape itM (aModified); - //TopTools_ListIteratorOfListOfShape itM (aModified); - for (; itM.More(); itM.Next(), ++ih) { - int id = aResIndices.FindIndex(itM.Value()); - anAttr->SetValue(ih, id); - } + + TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True); + Handle(TDataStd_IntegerArray) anAttr = + TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, pModified->Extent()); + + int ih = 1; + TopTools_ListIteratorOfListOfShape itM (*pModified); + for (; itM.More(); itM.Next(), ++ih) { + int id = aResIndices.FindIndex(itM.Value()); + anAttr->SetValue(ih, id); } } } diff --git a/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx b/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx index c194cd9fa..dd54dc688 100644 --- a/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx @@ -98,6 +98,8 @@ #include #include +#include + #ifdef max #undef max #endif @@ -905,9 +907,11 @@ bool MeasureGUI_AnnotationDlg::getPickedPoint( gp_Pnt& thePnt, const TopoDS_Shap Handle(AIS_InteractiveContext) anAISContext = aViewer->getAISContext(); Handle(SelectMgr_ViewerSelector) aSelector; +#if OCC_VERSION_LARGE <= 0x07030000 if ( anAISContext->HasOpenedContext() ) aSelector = anAISContext->LocalSelector(); else +#endif aSelector = anAISContext->MainSelector(); if ( aSelector->NbPicked() < 1 ) diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx index 46201b2a2..34f34789c 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx @@ -52,6 +52,8 @@ #include +#include + //================================================================================= // function : Constructor // purpose : @@ -434,8 +436,9 @@ void MeasureGUI_CreateDimensionDlg::StartLocalEditing() Handle(V3d_Viewer) aViewer3d = myEditingViewer->getViewer3d(); aViewer3d->AddZLayer( myEditingLayer ); - +#if OCC_VERSION_LARGE <= 0x07030000 anAISContext->OpenLocalContext( Standard_False, Standard_False ); +#endif anAISContext->Load( myDimension, AIS_DSM_All ); anAISContext->SetZLayer( myDimension, myEditingLayer ); anAISContext->Activate( myDimension, AIS_DSM_Line ); @@ -460,7 +463,12 @@ void MeasureGUI_CreateDimensionDlg::StopLocalEditing() Handle(V3d_Viewer) aViewer3d = myEditingViewer->getViewer3d(); aViewer3d->RemoveZLayer( myEditingLayer ); +#if OCC_VERSION_LARGE <= 0x07030000 anAISContext->CloseLocalContext( Standard_True ); +#else + anAISContext->Deactivate(); + anAISContext->Activate(0); +#endif myEditingViewer = NULL; } diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx index 84265fdfa..de58cbcff 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx @@ -61,6 +61,8 @@ #include #include +#include + //================================================================================= // function : Constructor // purpose : @@ -196,8 +198,9 @@ void MeasureGUI_ManageDimensionsDlg::StartSelection( const Selection theSelectio anAISContext->ClearCurrents( Standard_False ); anAISContext->ClearSelected( Standard_False ); +#if OCC_VERSION_LARGE <= 0x07030000 anAISContext->OpenLocalContext( Standard_True, Standard_False ); - +#endif Handle(MeasureGUI_DimensionFilter) aFilter = new MeasureGUI_DimensionFilter( myEditObject->GetStudyEntry() ); anAISContext->AddFilter( aFilter ); @@ -261,8 +264,12 @@ void MeasureGUI_ManageDimensionsDlg::StopSelection() * ------------------------------------------------ */ Handle(AIS_InteractiveContext) anAISContext = myOperatedViewer->getAISContext(); - +#if OCC_VERSION_LARGE <= 0x07030000 anAISContext->CloseLocalContext(); +#else + anAISContext->Deactivate(); + anAISContext->Activate(0); +#endif LightApp_SelectionMgr* aSelectionMgr = myGeomGUI->getApp()->selectionMgr(); @@ -355,7 +362,7 @@ void MeasureGUI_ManageDimensionsDlg::SelectionIntoArgument( const Selection theS anAISContext->InitSelected(); Handle(AIS_InteractiveObject) anAIS; - +#if OCC_VERSION_LARGE <= 0x07030000 if ( anAISContext->HasOpenedContext() ) { Handle(SelectMgr_EntityOwner) anAISOwner = anAISContext->SelectedOwner(); @@ -363,8 +370,11 @@ void MeasureGUI_ManageDimensionsDlg::SelectionIntoArgument( const Selection theS } else { +#endif anAIS = anAISContext->Current(); +#if OCC_VERSION_LARGE <= 0x07030000 } +#endif int aDimensionId = IdFromPrs( anAIS ); @@ -1239,7 +1249,7 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con { return; } - +#if OCC_VERSION_LARGE <= 0x07030000 Standard_Boolean isLocal = anAISContext->HasOpenedContext(); if ( isLocal ) { @@ -1247,9 +1257,11 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con } else { +#endif anAISContext->ClearCurrents( Standard_False ); +#if OCC_VERSION_LARGE <= 0x07030000 } - +#endif SOCC_Prs* aPrs = dynamic_cast( theViewer->CreatePrs( myEditObject->GetStudyEntry() ) ); AIS_ListOfInteractive aListOfIO; @@ -1261,24 +1273,32 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con const Handle(AIS_InteractiveObject)& anIO = anIt.Value(); if ( IdFromPrs( anIO ) != theId ) { +#if OCC_VERSION_LARGE <= 0x07030000 if ( isLocal ) { +#endif anAISContext->Deactivate( anIO, AIS_DSM_Line ); anAISContext->Deactivate( anIO, AIS_DSM_Text ); } continue; +#if OCC_VERSION_LARGE <= 0x07030000 } if ( isLocal ) { +#endif anAISContext->AddOrRemoveSelected( anIO, Standard_False ); anAISContext->Activate( anIO, AIS_DSM_Line ); anAISContext->Activate( anIO, AIS_DSM_Text ); +#if OCC_VERSION_LARGE <= 0x07030000 } else { +#endif anAISContext->AddOrRemoveCurrentObject( anIO, Standard_False ); +#if OCC_VERSION_LARGE <= 0x07030000 } +#endif anAISContext->UpdateCurrentViewer(); } diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index 6a57c85ae..11ef68e1c 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -70,6 +70,8 @@ #include #include +#include + #include #include #include @@ -358,7 +360,11 @@ void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndex { Handle(AIS_InteractiveObject) anObj = this; Handle(AIS_InteractiveContext) anIC = GetContext(); - if ( anIC.IsNull() || !anIC->HasOpenedContext() ) + if ( anIC.IsNull() +#if OCC_VERSION_LARGE <= 0x07030000 + || !anIC->HasOpenedContext() +#endif + ) return; Standard_Boolean isAutoHilight = anIC->AutomaticHilight(); diff --git a/src/OBJECT/GEOM_Annotation.hxx b/src/OBJECT/GEOM_Annotation.hxx index 39def573d..5ecb38174 100644 --- a/src/OBJECT/GEOM_Annotation.hxx +++ b/src/OBJECT/GEOM_Annotation.hxx @@ -44,6 +44,8 @@ #include #include +#include + class OpenGl_GraphicDriver; class OpenGl_PrimitiveArray; class OpenGl_Text; @@ -401,7 +403,11 @@ public: const Standard_Boolean isMatches = Select3D_SensitiveBox::Matches( theMgr, thePickResult ); if ( !myIsDepthCulling ) { +#if OCC_VERSION_LARGE <= 0x07030000 thePickResult = SelectBasics_PickResult( -DBL_MAX, thePickResult.DistToGeomCenter() ); +#else + thePickResult = SelectBasics_PickResult( -DBL_MAX, thePickResult.DistToGeomCenter(), thePickResult.PickedPoint() ); +#endif } return isMatches; }