From 7e333dca6e0697358a9f08beedbc3afa4e7068de Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 10 Feb 2017 16:38:51 +0300 Subject: [PATCH] Porting to DEV version of OpenCASCADE. --- src/BasicGUI/BasicGUI.cxx | 4 +- src/CurveCreator/CurveCreator_Utils.cxx | 2 +- src/CurveCreator/CurveCreator_Widget.cxx | 8 ++-- src/EntityGUI/EntityGUI.cxx | 14 +++---- src/EntityGUI/EntityGUI_PolylineDlg.cxx | 2 +- src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx | 4 +- src/GEOMGUI/GEOM_Displayer.cxx | 6 +-- .../MeasureGUI_AnnotationInteractor.cxx | 4 +- .../MeasureGUI_CreateDimensionDlg.cxx | 4 +- .../MeasureGUI_DimensionInteractor.cxx | 12 +++--- src/OBJECT/GEOM_Annotation.cxx | 42 +++++++++++++++---- src/OBJECT/GEOM_Annotation.hxx | 8 +++- 12 files changed, 71 insertions(+), 39 deletions(-) diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index d7686b070..816162dee 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -144,9 +144,9 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin ic->InitSelected(); if ( pe->modifiers() == Qt::ShiftModifier ) - ic->ShiftSelect(); // Append selection + ic->ShiftSelect( Standard_True ); // Append selection else - ic->Select(); // New selection + ic->Select( Standard_True ); // New selection ic->InitSelected(); if ( ic->MoreSelected() ) { diff --git a/src/CurveCreator/CurveCreator_Utils.cxx b/src/CurveCreator/CurveCreator_Utils.cxx index 0170fb5ff..5f53caea4 100644 --- a/src/CurveCreator/CurveCreator_Utils.cxx +++ b/src/CurveCreator/CurveCreator_Utils.cxx @@ -687,7 +687,7 @@ void CurveCreator_Utils::setLocalPointContext( const CurveCreator_ICurve* theCur } else { if ( theContext->HasOpenedContext() ) - theContext->CloseAllContexts(); + theContext->CloseAllContexts( Standard_True ); } } diff --git a/src/CurveCreator/CurveCreator_Widget.cxx b/src/CurveCreator/CurveCreator_Widget.cxx index b34b1f2da..1906c758d 100644 --- a/src/CurveCreator/CurveCreator_Widget.cxx +++ b/src/CurveCreator/CurveCreator_Widget.cxx @@ -1090,7 +1090,7 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEven { Handle(AIS_InteractiveContext) aCtx = getAISContext(); if ( !aCtx.IsNull() ) - aCtx->ClearSelected(); + aCtx->ClearSelected( Standard_True ); } return; } @@ -1121,11 +1121,11 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEven // otherwise a rectangular selection. if ( myStartPoint == myEndPoint ) { - aCtx->MoveTo( myEndPoint.x(), myEndPoint.y(), aView3d ); + aCtx->MoveTo( myEndPoint.x(), myEndPoint.y(), aView3d, Standard_True ); if ( aHasShift ) - aCtx->ShiftSelect(); + aCtx->ShiftSelect( Standard_True ); else - aCtx->Select(); + aCtx->Select( Standard_True ); } else { diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx index d35d6b218..019e0ad47 100644 --- a/src/EntityGUI/EntityGUI.cxx +++ b/src/EntityGUI/EntityGUI.cxx @@ -234,9 +234,9 @@ bool EntityGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWi ic->InitSelected(); if ( pe->modifiers() == Qt::ShiftModifier ) - ic->ShiftSelect(); // Append selection + ic->ShiftSelect( Standard_True ); // Append selection else - ic->Select(); // New selection + ic->Select( Standard_True ); // New selection ic->InitSelected(); if ( ic->MoreSelected() ) { @@ -263,7 +263,7 @@ bool EntityGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWi Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); ic->InitSelected(); - ic->Select(); // New selection + ic->Select( Standard_True ); // New selection ic->InitSelected(); TopoDS_Shape aShape; @@ -365,7 +365,7 @@ void EntityGUI::DisplaySimulationShape( const TopoDS_Shape& S1, const TopoDS_Sha if ( !S1.IsNull() ) { /* erase any previous */ ic->Erase( mySimulationShape1, Standard_True ); - ic->ClearPrs( mySimulationShape1 ); + ic->ClearPrs( mySimulationShape1, 0, Standard_True ); mySimulationShape1 = new AIS_Shape( TopoDS_Shape() ); mySimulationShape1->Set( S1 ); @@ -377,7 +377,7 @@ void EntityGUI::DisplaySimulationShape( const TopoDS_Shape& S1, const TopoDS_Sha } if ( !S2.IsNull() ) { ic->Erase( mySimulationShape2, Standard_True ); - ic->ClearPrs( mySimulationShape2 ); + ic->ClearPrs( mySimulationShape2, 0, Standard_True ); mySimulationShape2 = new AIS_Shape( TopoDS_Shape() ); mySimulationShape2->Set( S2 ); @@ -422,8 +422,8 @@ void EntityGUI::EraseSimulationShape() Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); ic->Erase( mySimulationShape1, Standard_True ); ic->Erase( mySimulationShape2, Standard_True ); - ic->ClearPrs( mySimulationShape1 ); - ic->ClearPrs( mySimulationShape2 ); + ic->ClearPrs( mySimulationShape1, 0, Standard_True ); + ic->ClearPrs( mySimulationShape2, 0, Standard_True ); ic->UpdateCurrentViewer(); } } diff --git a/src/EntityGUI/EntityGUI_PolylineDlg.cxx b/src/EntityGUI/EntityGUI_PolylineDlg.cxx index a2c4be2c6..1c6c9bda5 100644 --- a/src/EntityGUI/EntityGUI_PolylineDlg.cxx +++ b/src/EntityGUI/EntityGUI_PolylineDlg.cxx @@ -780,7 +780,7 @@ void EntityGUI_PolylineDlg::displayPreview() // Set color for temporary AIS_InteractiveObject anAISObj->Attributes()->WireAspect()->SetColor( Quantity_NOC_VIOLET ); - aCtx->Redisplay( anAISObj ); + aCtx->Redisplay( anAISObj, Standard_True ); } } } diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx index f46d527d3..14edb1509 100755 --- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx +++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx @@ -251,7 +251,7 @@ void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theInd Handle(GEOM_Annotation) aPresentation = Handle(GEOM_Annotation)::DownCast( aPrs ); GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS ); - aView->getAISContext()->Redisplay( aPresentation ); + aView->getAISContext()->Redisplay( aPresentation, Standard_True ); } } } @@ -440,7 +440,7 @@ void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, S setDisplayProperties( aPresentation, aView, theEntry ); - aView->getAISContext()->Redisplay( aPresentation ); + aView->getAISContext()->Redisplay( aPresentation, Standard_True ); } } getDisplayer()->UpdateViewer(); diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index c03b93777..43521f3f5 100755 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -2068,7 +2068,7 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* ) if ( !ic.IsNull() ) { if ( ic->HasOpenedContext() ) - ic->CloseAllContexts(); + ic->CloseAllContexts(Standard_True); } } } @@ -3128,11 +3128,11 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons aView->ColorScaleErase(); #else if( !aViewModel->getAISContext()->IsDisplayed( myColorScale ) ) - aViewModel->getAISContext()->Display( myColorScale ); + aViewModel->getAISContext()->Display( myColorScale, Standard_True); } else if( aViewModel->getAISContext()->IsDisplayed( myColorScale ) ) - aViewModel->getAISContext()->Erase( myColorScale ); + aViewModel->getAISContext()->Erase( myColorScale, Standard_True ); #endif if( theIsRedisplayFieldSteps ) diff --git a/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx b/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx index 2d0cd204a..952c54bd2 100755 --- a/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx +++ b/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx @@ -211,7 +211,7 @@ bool MeasureGUI_AnnotationInteractor::eventFilter( QObject* theObject, QEvent* t const Handle(AIS_InteractiveContext) anAISContext = myViewer->getAISContext(); - anAISContext->MoveTo( aMouseEv->x(), aMouseEv->y(), aView3d ); + anAISContext->MoveTo( aMouseEv->x(), aMouseEv->y(), aView3d, Standard_True ); if ( !anAISContext->HasDetected() ) { @@ -316,7 +316,7 @@ bool MeasureGUI_AnnotationInteractor::eventFilter( QObject* theObject, QEvent* t anAISContext->Update( myActiveIO, Standard_False ); anAISContext->UpdateCurrentViewer(); - anAISContext->MoveTo( aMouseEv->pos().x(), aMouseEv->pos().y(), aView3d ); + anAISContext->MoveTo( aMouseEv->pos().x(), aMouseEv->pos().y(), aView3d, Standard_True ); emit SignalInteractionFinished( myActiveIO ); diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx index 6713729f7..6032636e0 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx @@ -440,7 +440,7 @@ void MeasureGUI_CreateDimensionDlg::StartLocalEditing() anAISContext->SetZLayer( myDimension, myEditingLayer ); anAISContext->Activate( myDimension, AIS_DSM_Line ); anAISContext->Activate( myDimension, AIS_DSM_Text ); - anAISContext->Redisplay( myDimension ); + anAISContext->Redisplay( myDimension , Standard_True ); } //================================================================================= @@ -460,7 +460,7 @@ void MeasureGUI_CreateDimensionDlg::StopLocalEditing() Handle(V3d_Viewer) aViewer3d = myEditingViewer->getViewer3d(); aViewer3d->RemoveZLayer( myEditingLayer ); - anAISContext->CloseLocalContext(); + anAISContext->CloseLocalContext( Standard_True ); myEditingViewer = NULL; } diff --git a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx index 4d738e0db..8a7eaf259 100644 --- a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx +++ b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx @@ -373,7 +373,7 @@ void MeasureGUI_DimensionInteractor::MoveFlyoutFree( const Handle(V3d_View)& the if ( aNewFlyout <= Precision::Confusion() ) { myInteractedIO->SetFlyout( 0.0 ); - myViewer->getAISContext()->Redisplay( myInteractedIO ); + myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True ); return; } @@ -382,7 +382,7 @@ void MeasureGUI_DimensionInteractor::MoveFlyoutFree( const Handle(V3d_View)& the myInteractedIO->SetFlyout( aNewFlyout ); myInteractedIO->SetCustomPlane( aNewPlane ); - myViewer->getAISContext()->Redisplay( myInteractedIO ); + myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True ); } //================================================================================= @@ -496,7 +496,7 @@ void MeasureGUI_DimensionInteractor::MoveFlyoutInPlane( const Handle(V3d_View)& myInteractedIO->SetFlyout( aFlyout ); - myViewer->getAISContext()->Redisplay( myInteractedIO ); + myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True ); } //================================================================================= @@ -668,7 +668,7 @@ void MeasureGUI_DimensionInteractor::MoveText( const Handle(V3d_View)& theView, myInteractedIO->DimensionAspect()->SetArrowOrientation( aArrPos ); myInteractedIO->SetToUpdate(); - myViewer->getAISContext()->Redisplay( myInteractedIO ); + myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True ); } //================================================================================= @@ -691,7 +691,7 @@ bool MeasureGUI_DimensionInteractor::eventFilter( QObject* theObject, QEvent* th QMouseEvent* aMouseEv = dynamic_cast( theEvent ); // init detection - anAISContext->MoveTo( aMouseEv->x(), aMouseEv->y(), aView3d ); + anAISContext->MoveTo( aMouseEv->x(), aMouseEv->y(), aView3d, Standard_True ); if ( !anAISContext->HasDetected() ) { return false; @@ -738,7 +738,7 @@ bool MeasureGUI_DimensionInteractor::eventFilter( QObject* theObject, QEvent* th } anAISContext->ClearSelected( Standard_False ); - anAISContext->AddOrRemoveSelected( aDetectedOwner ); + anAISContext->AddOrRemoveSelected( aDetectedOwner, Standard_True ); emit InteractionStarted( myInteractedIO ); diff --git a/src/OBJECT/GEOM_Annotation.cxx b/src/OBJECT/GEOM_Annotation.cxx index 1d966bb3d..1c66c77c1 100755 --- a/src/OBJECT/GEOM_Annotation.cxx +++ b/src/OBJECT/GEOM_Annotation.cxx @@ -66,7 +66,9 @@ GEOM_Annotation::GEOM_Annotation() : AIS_InteractiveObject() SetDisplayMode( 0 ); SetZLayer( Graphic3d_ZLayerId_Default ); SetAutoHide( Standard_True ); +#if OCC_VERSION_LARGE <= 0x07010000 SetHilightMode( HighlightAll ); +#endif SetMutable( Standard_True ); SetDepthCulling( Standard_True ); @@ -616,9 +618,9 @@ GEOM_Annotation::OpenGl_Annotation::OpenGl_Annotation( GEOM_Annotation* theAnnot const Standard_Integer theTextHeight, const OpenGl_GraphicDriver* theDriver ) : OpenGl_Element(), - myDepthMode( 0 ), myAISObject( theAnnotation ), myText( theAnnotation->myText.ToExtString() ), + myDepthMode( 0 ), myTextLineY( 0.f ), myTextDPI( 0 ) { @@ -747,7 +749,15 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)& return; } } - +#if OCC_VERSION_LARGE > 0x07010000 + const Handle(Graphic3d_PresentationAttributes) aHighlightStyle = theWorkspace->HighlightStyle(); + if (!aHighlightStyle.IsNull() && myAISObject->myHilightMode == HighlightLabel) + { + Handle(Graphic3d_PresentationAttributes) empty; + theWorkspace->SetHighlightStyle(empty); + theWorkspace->ApplyAspectLine(); + } +#else const bool toHighlight = theWorkspace->ToHighlight(); if (toHighlight && myAISObject->myHilightMode == HighlightLabel) @@ -755,7 +765,8 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)& theWorkspace->SetHighlight( false ); theWorkspace->ApplyAspectLine(); } - +#endif + GLint myOldDepthMode = 0; if ( myDepthMode ) @@ -867,11 +878,15 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)& } aContext->ApplyModelViewMatrix(); - + +#if OCC_VERSION_LARGE > 0x07010000 + theWorkspace->SetHighlightStyle(aHighlightStyle); +#else if ( toHighlight != theWorkspace->ToHighlight() ) { theWorkspace->SetHighlight( toHighlight ); } +#endif } // ======================================================================= @@ -880,14 +895,21 @@ 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, - const Handle(Graphic3d_HighlightStyle)& theStyle, +#if OCC_VERSION_LARGE > 0x07010000 + const Handle(Prs3d_Drawer)& theStyle, +#else + const Handle(Graphic3d_HighlightStyle)& theStyle, +#endif const Standard_Integer theMode ) { if ( myPrsSh.IsNull() ) { Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer; +#if OCC_VERSION_LARGE > 0x07010000 + aDrawer->Link( theStyle ); +#else aDrawer->Link( Selectable()->HilightAttributes() ); - +#endif Handle(Prs3d_IsoAspect) aUIsoAspect = new Prs3d_IsoAspect( aDrawer->UIsoAspect()->Aspect()->Color(), aDrawer->UIsoAspect()->Aspect()->Type(), @@ -905,7 +927,7 @@ void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMg } myPrsSh->SetZLayer ( Selectable()->ZLayer() ); - + thePM->Color( Selectable(), theStyle, theMode, NULL, Graphic3d_ZLayerId_Topmost ); thePM->Color( myPrsSh, theStyle, theMode, Selectable(), Graphic3d_ZLayerId_Topmost ); @@ -920,8 +942,12 @@ void GEOM_Annotation::GEOM_AnnotationOwner::Unhilight ( const Handle(PrsMgr_Pres const Standard_Integer theMode ) { SelectMgr_EntityOwner::Unhilight( thePM, theMode ); - + +#if OCC_VERSION_LARGE > 0x07010000 + thePM->Unhighlight( myPrsSh ); +#else thePM->Unhighlight( myPrsSh, theMode ); +#endif } // ======================================================================= diff --git a/src/OBJECT/GEOM_Annotation.hxx b/src/OBJECT/GEOM_Annotation.hxx index ac8bf3a2f..e672dd446 100755 --- a/src/OBJECT/GEOM_Annotation.hxx +++ b/src/OBJECT/GEOM_Annotation.hxx @@ -27,6 +27,8 @@ #ifndef GEOM_Annotation_HeaderFile #define GEOM_Annotation_HeaderFile +#include + #include #include #include @@ -361,7 +363,11 @@ public: //! \param theMode [in] the display mode. virtual void HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM, - const Handle(Graphic3d_HighlightStyle)& theStyle, +#if OCC_VERSION_LARGE > 0x07010000 + const Handle(Prs3d_Drawer)& theStyle, +#else + const Handle(Graphic3d_HighlightStyle)& theStyle, +#endif const Standard_Integer theMode = 0 ) Standard_OVERRIDE; //! Removes highlighting from the type of shape. -- 2.39.2