]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting to OCCT 7.4.1dev
authorjfa <jfa@opencascade.com>
Fri, 31 Jul 2020 15:33:20 +0000 (18:33 +0300)
committerjfa <jfa@opencascade.com>
Fri, 31 Jul 2020 15:33:20 +0000 (18:33 +0300)
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/SOCC/SOCC_ViewModel.cxx

index eb7ff1564746fbd1d0a4dcbc30827d83f24ee52a..49adfd65b23fe1867716bb35d973f53a160b0131 100644 (file)
@@ -126,9 +126,6 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
   myIsRelative(true),
   myTopLayerId( 0 ),
   myTrihedronSize(100),
-#if OCC_VERSION_LARGE <= 0x07030000
-  myIsUseLocalSelection(false),
-#endif
   myClippingDlg (NULL),
   myFitter(0)
 {
@@ -456,18 +453,12 @@ void OCCViewer_Viewer::onKeyPress(SUIT_ViewWindow* theWindow, QKeyEvent* theEven
     break;
   case  Qt::Key_N:
     if ( isPreselectionEnabled() ) {
-#if OCC_VERSION_LARGE <= 0x07030000
-      if ( useLocalSelection() )
-#endif
-       getAISContext()->HilightNextDetected( aView->getViewPort()->getView() );
+      getAISContext()->HilightNextDetected( aView->getViewPort()->getView() );
     }
     break;
   case  Qt::Key_P:
     if ( isPreselectionEnabled() ) {
-#if OCC_VERSION_LARGE <= 0x07030000
-      if ( useLocalSelection() )
-#endif
-       getAISContext()->HilightPreviousDetected( aView->getViewPort()->getView() );
+      getAISContext()->HilightPreviousDetected( aView->getViewPort()->getView() );
     }
     break;
   default:
@@ -980,13 +971,8 @@ void OCCViewer_Viewer::setClippingTextureParams( const bool isDefault, const QSt
   Handle(Graphic3d_Texture2Dmanual) aTexture =
     initClippingTexture( myDefaultTextureUsed, myClippingTexture,
                          myTextureModulated, myClippingTextureScale );
-#if OCC_VERSION_LARGE <= 0x07030000
-  for( int i = 1; i <= myInternalClipPlanes.Size(); i++ )
-    myInternalClipPlanes.Value(i)->SetCappingTexture( aTexture );
-#else
   for ( Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt ( myInternalClipPlanes ); aPlaneIt.More(); aPlaneIt.Next() )
     aPlaneIt.Value()->SetCappingTexture( aTexture );
-#endif
 
   update();
 }
@@ -1169,17 +1155,10 @@ bool OCCViewer_Viewer::highlight( const Handle(AIS_InteractiveObject)& obj,
                                   bool hilight, bool update )
 {
   if( !obj.IsNull() ) {
-#if OCC_VERSION_LARGE <= 0x07030000
-    if( !myAISContext->HasOpenedContext() )
-      {
-#endif
-       if ( hilight && !myAISContext->IsSelected( obj ) )
-         myAISContext->AddOrRemoveSelected( obj, false );
-       else if ( !hilight && myAISContext->IsSelected( obj ) )
-         myAISContext->AddOrRemoveSelected( obj, false );
-#if OCC_VERSION_LARGE <= 0x07030000
-      }
-#endif
+    if ( hilight && !myAISContext->IsSelected( obj ) )
+      myAISContext->AddOrRemoveSelected( obj, false );
+    else if ( !hilight && myAISContext->IsSelected( obj ) )
+      myAISContext->AddOrRemoveSelected( obj, false );
   }
 
   if ( update )
@@ -1194,23 +1173,11 @@ bool OCCViewer_Viewer::highlight( const Handle(AIS_InteractiveObject)& obj,
 */
 bool OCCViewer_Viewer::unHighlightAll( bool updateviewer, bool unselect )
 {
-#if OCC_VERSION_LARGE <= 0x07030000
-  if ( myAISContext->HasOpenedContext() ) {
-#endif
-    if ( unselect ) {
-      myAISContext->ClearSelected( updateviewer );
-    } else {
-      myAISContext->UnhilightSelected( updateviewer );
-    }
-#if OCC_VERSION_LARGE <= 0x07030000
+  if ( unselect ) {
+    myAISContext->ClearSelected( updateviewer );
   } else {
-   if ( unselect ) {
-      myAISContext->ClearCurrents( updateviewer );
-    } else {
-      myAISContext->UnhilightCurrents( updateviewer );
-    }
+    myAISContext->UnhilightSelected( updateviewer );
   }
-#endif
   return false;
 }
 
@@ -1418,28 +1385,6 @@ OCCViewer_ViewWindow* OCCViewer_Viewer::createSubWindow()
   return new OCCViewer_ViewWindow(0,  this);
 }
 
-#if OCC_VERSION_LARGE <= 0x07030000
-/*!
-  Sets using local selection state
-  \param theIsUseLocalSelection - state
-*/
-void OCCViewer_Viewer::setUseLocalSelection(bool theIsUseLocalSelection)
-{
-  myIsUseLocalSelection = theIsUseLocalSelection;
-}
-
-/* 
- * Returns true if local context is opened or view model local state is set
- */
-bool OCCViewer_Viewer::useLocalSelection() const
-{
-  if (myIsUseLocalSelection)
-    return true;
-  Handle(AIS_InteractiveContext) ic = getAISContext();
-  return !ic.IsNull() && ic->HasOpenedContext();
-}
-#endif
-
 // obsolete  
 QColor OCCViewer_Viewer::backgroundColor( int theViewId ) const
 {
index 4bb4533b5dcda39137ac348b5395e7cbcab1d48b..3849f5db3d26ada063c0ccac35e393eeaba0cc44 100644 (file)
@@ -41,8 +41,6 @@
 #include <AIS_ListOfInteractive.hxx>
 #include <Graphic3d_SequenceOfHClipPlane.hxx>
 
-#include <Basics_OCCTVersion.hxx>
-
 class QKeyEvent;
 class QMouseEvent;
 
@@ -152,11 +150,6 @@ public:
 
   virtual OCCViewer_ViewWindow*   createSubWindow();
 
-#if OCC_VERSION_LARGE <= 0x07030000
-  void                            setUseLocalSelection(bool theIsUseLocalSelection);
-  bool                            useLocalSelection() const;
-#endif
-
   // Methods to access fitter
 
   /// Returns currently installed fitter
@@ -321,9 +314,6 @@ protected:
   QString                         myClippingTexture;
   bool                            myTextureModulated;
   double                          myClippingTextureScale;
-#if OCC_VERSION_LARGE <= 0x07030000
-  bool                            myIsUseLocalSelection;
-#endif
 
   OCCViewer_Fitter* myFitter;
 };
index dfe13c2bc396f72bb4bc847d2928723ba1a16a50..104a964becf3069193d46696ba057e983c86be60 100644 (file)
 #include <Graphic3d_ClipPlane.hxx>
 #include <OpenGl_GraphicDriver.hxx>
 #include <OpenGLUtils_FrameBuffer.h>
-#include <Basics_OCCTVersion.hxx>
 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
 #include <Graphic3d_MapOfStructure.hxx>
 #include <Graphic3d_Structure.hxx>
-#if OCC_VERSION_LARGE <= 0x07030000
-#include <Graphic3d_ExportFormat.hxx>
-#endif
 #include <Graphic3d_StereoMode.hxx>
 #include <Graphic3d_RenderingParams.hxx>
 #include <Graphic3d_BndBox3d.hxx>
@@ -396,11 +392,7 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e )
 
         if ( aEvent->modifiers().testFlag(Qt::ControlModifier) ) {
           Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-          if ( isPreselectionEnabled() 
-#if OCC_VERSION_LARGE <= 0x07030000
-              && myModel->useLocalSelection()
-#endif
-            ) {
+          if ( isPreselectionEnabled() ) {
             if ( aEvent->delta() > 0 ) {
               ic->HilightNextDetected( myViewPort->getView() );
             } else {
@@ -589,12 +581,8 @@ void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent )
           }
           if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType;
           if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
-#if OCC_VERSION_LARGE <= 0x07030000
-          ic->CloseAllContexts( Standard_True );
-#else
          ic->Deactivate();
          ic->Activate(0);
-#endif
           myOperation = NOVIEWOP;
           myViewPort->setCursor( myCursor );
           myCursorIsHand = false;
@@ -792,12 +780,8 @@ void OCCViewer_ViewWindow::activateSetRotationGravity()
   if ( myRotationPointSelection )
   {
     Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-#if OCC_VERSION_LARGE <= 0x07030000
-    ic->CloseAllContexts( Standard_True );
-#else
     ic->Deactivate();
     ic->Activate(0);
-#endif
     myOperation = NOVIEWOP;
     myViewPort->setCursor( myCursor );
     myCursorIsHand = false;
@@ -837,12 +821,8 @@ void OCCViewer_ViewWindow::activateSetRotationSelected( double theX, double theY
   if ( myRotationPointSelection )
   {
     Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-#if OCC_VERSION_LARGE < 0x07030000
-    ic->CloseAllContexts( Standard_True );
-#else
     ic->Deactivate();
     ic->Activate(0);
-#endif
     myOperation = NOVIEWOP;
     myViewPort->setCursor( myCursor );
     myCursorIsHand = false;
@@ -864,11 +844,7 @@ void OCCViewer_ViewWindow::activateStartPointSelection( TopAbs_ShapeEnum theShap
 
   // activate selection ------>
   Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-#if OCC_VERSION_LARGE <= 0x07030000
-  ic->OpenLocalContext();
-#else
   ic->Deactivate();
-#endif
 
   AIS_ListOfInteractive aList;
   ic->DisplayedObjects( aList );
@@ -2429,32 +2405,7 @@ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
   bool res = false;
   QApplication::setOverrideCursor( Qt::WaitCursor );
 
-  // OCCT version > 7.3.0 is not support export to PS and EPS
-#if OCC_VERSION_LARGE <= 0x07030000
-  Handle(Graphic3d_CView) a3dView = myViewPort->getView()->View();
-
-  if (format == "PS") {
-    Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myViewPort->getViewer()->Driver());
-    OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
-    int prev = aCaps->ffpEnable;
-    aCaps->ffpEnable = 1;
-    res = a3dView->Export(strdup(qUtf8Printable(fileName)), Graphic3d_EF_PostScript);
-    aCaps->ffpEnable = prev;
-  }
-  else if (format == "EPS") {
-    Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myViewPort->getViewer()->Driver());
-    OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
-    int prev = aCaps->ffpEnable;
-    aCaps->ffpEnable = 1;
-    res = a3dView->Export(strdup(qUtf8Printable(fileName)), Graphic3d_EF_EnhPostScript);
-    aCaps->ffpEnable = prev;
-  }
-  else { 
-#endif
-    res = myViewPort->getView()->Dump( fileName.toStdString().c_str() );
-#if OCC_VERSION_LARGE <= 0x07030000
-  }
-#endif
+  res = myViewPort->getView()->Dump( fileName.toStdString().c_str() );
 
   QApplication::restoreOverrideCursor();
   return res;
@@ -2463,12 +2414,9 @@ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
 
 QString OCCViewer_ViewWindow::filter() const
 {
-#if OCC_VERSION_LARGE <= 0x07030000
-  return tr( "OCC_IMAGE_FILES" );
-#else
+  // OCCT version > 7.3.0 is not support export to PS and EPS
   QString formats = tr( "OCC_IMAGE_FILES" );
   return formats.remove(" *.eps *.ps");
-#endif
 }
 
 
index 645736fdcabfa1993beb5fbe157ec747260e3b43..943a1583cbbb1f100d07c0f2d5576e1b65d2afbd 100644 (file)
@@ -74,12 +74,6 @@ SOCC_Viewer::~SOCC_Viewer()
 bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,
                              bool hilight, bool upd )
 {
-#if OCC_VERSION_LARGE <= 0x07030000
-  bool isInLocal = getAISContext()->HasOpenedContext();
-#endif
-  //SUIT_Study* ActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
-  //SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
-
   AIS_ListOfInteractive List;
   getAISContext()->DisplayedObjects(List);
   
@@ -91,23 +85,8 @@ bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,
 
     if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
     {
-#if OCC_VERSION_LARGE <= 0x07030000
-      if ( !isInLocal )
-#endif
-          OCCViewer_Viewer::highlight( ite.Value(), hilight, false );
+      OCCViewer_Viewer::highlight( ite.Value(), hilight, false );
       // highlight sub-shapes only when local selection is active
-#if OCC_VERSION_LARGE <= 0x07030000
-      else
-      {
-        /*if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )
-        {
-          Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );
-          TColStd_IndexedMapOfInteger MapIndex;
-          Sel->GetIndex( IObject, MapIndex );
-          aSh->highlightSubShapes( MapIndex, highlight );
-        }*/
-      }
-#endif
       break;
     }
   }
@@ -509,14 +488,7 @@ void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const std::list<i
   
   // Open local context if there is no one
   bool allObjects = thePrs == 0 || thePrs->IsNull();
-#if OCC_VERSION_LARGE <= 0x07030000
-  if ( !ic->HasOpenedContext() ) {
-    ic->ClearCurrents( false );
-    ic->OpenLocalContext( Standard_False, Standard_True, Standard_True );
-  }
-#else
   ic->Deactivate();
-#endif
 
   AIS_ListOfInteractive anObjs;
   // Get objects to be activated
@@ -571,12 +543,8 @@ void SOCC_Viewer::GlobalSelection( const bool update ) const
   Handle(AIS_InteractiveContext) ic = getAISContext();
   if ( !ic.IsNull() )
   {
-#if OCC_VERSION_LARGE <= 0x07030000
-    ic->CloseAllContexts( false );
-#else
     ic->Deactivate();
     ic->Activate( 0 );
-#endif
     if ( update )
       ic->CurrentViewer()->Redraw();
   }