From: inv Date: Mon, 7 Oct 2013 11:28:44 +0000 (+0000) Subject: RNV: Porting SALOME GUI module to the new OCCT version. X-Git-Tag: BR_hydro_v_0_3_1~50 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05253c660fd147e1c6b69abc3d839c7b9f925b60;p=modules%2Fgui.git RNV: Porting SALOME GUI module to the new OCCT version. --- diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.cxx b/src/OCCViewer/OCCViewer_ClippingDlg.cxx index 4c4865f67..f49c43c8e 100644 --- a/src/OCCViewer/OCCViewer_ClippingDlg.cxx +++ b/src/OCCViewer/OCCViewer_ClippingDlg.cxx @@ -530,7 +530,11 @@ void OCCViewer_ClippingDlg::erasePreview () if ( !myPreviewPlane.IsNull() && ic->IsDisplayed( myPreviewPlane ) ) { +#if OCC_VERSION_LARGE <= 0x06060000 ic->Erase( myPreviewPlane, false, false ); +#else + ic->Erase( myPreviewPlane, false ); +#endif ic->Remove( myPreviewPlane, false ); myPreviewPlane.Nullify(); } diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 2ed855b85..96809de49 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -61,7 +61,6 @@ #include -#include // VSR: Uncomment below line to allow texture background support in OCC viewer #define OCC_ENABLE_TEXTURED_BACKGROUND @@ -101,12 +100,18 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron) // init CasCade viewers myV3dViewer = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Viewer3d").ToExtString() ); myV3dViewer->Init(); + +#if OCC_VERSION_LARGE <= 0x06060000 // Porting to OCCT higher 6.6.0 version myV3dCollector = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Collector3d").ToExtString() ); myV3dCollector->Init(); +#endif // init selector +#if OCC_VERSION_LARGE <= 0x06060000 myAISContext = new AIS_InteractiveContext( myV3dViewer, myV3dCollector ); - +#else + myAISContext = new AIS_InteractiveContext( myV3dViewer ); +#endif myAISContext->SelectionColor( Quantity_NOC_WHITE ); // display isoline on planar faces (box for ex.) @@ -169,7 +174,9 @@ OCCViewer_Viewer::~OCCViewer_Viewer() { myAISContext.Nullify(); myV3dViewer.Nullify(); +#if OCC_VERSION_LARGE <= 0x06060000 myV3dCollector.Nullify(); +#endif } /*! @@ -720,12 +727,14 @@ bool OCCViewer_Viewer::isInViewer( const Handle(AIS_InteractiveObject)& obj, AIS_ListOfInteractive List; myAISContext->DisplayedObjects(List); +#if OCC_VERSION_LARGE <= 0x06060000 if( !onlyInViewer ) { AIS_ListOfInteractive List1; myAISContext->ObjectsInCollector(List1); List.Append(List1); } +#endif AIS_ListIteratorOfListOfInteractive ite(List); for ( ; ite.More(); ite.Next() ) diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index e6893e307..9b98467ff 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -35,6 +35,7 @@ #include #include #include +#include class QKeyEvent; class QMouseEvent; @@ -117,7 +118,9 @@ public: public: Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;} +#if OCC_VERSION_LARGE <= 0x06060000 Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; } +#endif Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; } Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; } @@ -176,7 +179,11 @@ protected slots: protected: Handle(V3d_Viewer) myV3dViewer; + +#if OCC_VERSION_LARGE <= 0x06060000 Handle(V3d_Viewer) myV3dCollector; +#endif + Handle(AIS_Trihedron) myTrihedron; Handle(AIS_InteractiveContext) myAISContext; diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index c9c822422..455a51d10 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -159,11 +159,14 @@ bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj, AIS_ListOfInteractive List; getAISContext()->DisplayedObjects(List); +#if OCC_VERSION_LARGE <= 0x06060000 if( !onlyInViewer ) { AIS_ListOfInteractive List1; getAISContext()->ObjectsInCollector(List1); List.Append(List1); - } +} +#endif + AIS_ListIteratorOfListOfInteractive ite(List); for ( ; ite.More(); ite.Next() ) @@ -359,6 +362,7 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs ) continue; } +#if OCC_VERSION_LARGE <= 0x06060000 // then try to find presentation in the collector if(ic->IsInCollector(anAIS)) { @@ -380,7 +384,7 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs ) //} continue; } - +#endif // if object is not displayed and not found in the collector - display it if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) ) { @@ -473,8 +477,11 @@ void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced ) Handle(AIS_InteractiveObject) anAIS = aIter.Value(); if ( !anAIS.IsNull() ) { // erase the object from context : move it to collector +#if OCC_VERSION_LARGE <= 0x06060000 ic->Erase( anAIS, false, forced ? false : true ); - +#else + ic->Erase( anAIS, false ); +#endif // Set visibility flag if necessary // Temporarily commented to avoid awful dependecy on SALOMEDS // TODO: better mechanism of storing display/erse status in a study @@ -524,7 +531,11 @@ void SOCC_Viewer::EraseAll( const bool forced ) // erase an object Handle(AIS_InteractiveObject) anIO = anIter.Value(); +#if OCC_VERSION_LARGE <= 0x06060000 ic->Erase( anIO, false, forced ? false : true ); +#else + ic->Erase( anIO, false ); +#endif // Set visibility flag if necessary // Temporarily commented to avoid awful dependecy on SALOMEDS @@ -564,7 +575,11 @@ SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry ) for ( unsigned int ind = 0; ind < List.size(); ind++ ) { Handle(AIS_InteractiveObject) anAIS=List[ind]; - if(ic->IsDisplayed(anAIS)||ic->IsInCollector(anAIS)) + if(ic->IsDisplayed(anAIS) +#if OCC_VERSION_LARGE <= 0x06060000 + || ic->IsInCollector(anAIS) +#endif + ) { prs->AddObject( anAIS ); }