Salome HOME
First integration of a new PV3D viewer.
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 6 Mar 2023 17:45:44 +0000 (17:45 +0000)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 17 Apr 2023 07:04:40 +0000 (09:04 +0200)
61 files changed:
CMakeLists.txt
SalomeGUIConfig.cmake.in
src/CAM/CAM_Application.cxx
src/CMakeLists.txt
src/LightApp/CMakeLists.txt
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_Module.cxx
src/LightApp/LightApp_PV3DSelector.cxx [new file with mode: 0644]
src/LightApp/LightApp_PV3DSelector.h [new file with mode: 0644]
src/LightApp/resources/LightApp.xml
src/LightApp/resources/LightApp_msg_en.ts
src/PV3DViewer/CMakeLists.txt [new file with mode: 0644]
src/PV3DViewer/PV3DViewer.h [new file with mode: 0644]
src/PV3DViewer/PV3DViewer_ViewManager.cxx [new file with mode: 0644]
src/PV3DViewer/PV3DViewer_ViewManager.h [new file with mode: 0644]
src/PV3DViewer/PV3DViewer_ViewModel.cxx [new file with mode: 0644]
src/PV3DViewer/PV3DViewer_ViewModel.h [new file with mode: 0644]
src/PV3DViewer/PV3DViewer_ViewWindow.cxx [new file with mode: 0644]
src/PV3DViewer/PV3DViewer_ViewWindow.h [new file with mode: 0644]
src/PV3DViewer/PVViewer_Behaviors.cxx [new file with mode: 0644]
src/PV3DViewer/PVViewer_Behaviors.h [new file with mode: 0644]
src/PV3DViewer/resources/CMakeLists.txt [new file with mode: 0644]
src/PV3DViewer/resources/PV3DViewer_msg_en.ts [new file with mode: 0644]
src/PV3DViewer/resources/PV3DViewer_msg_fr.ts [new file with mode: 0644]
src/PV3DViewer/resources/PV3DViewer_msg_ja.ts [new file with mode: 0644]
src/PV3DViewer/resources/ParaViewFilters.xml [new file with mode: 0644]
src/PV3DViewer/resources/ParaViewReaders.xml [new file with mode: 0644]
src/PV3DViewer/resources/ParaViewSources.xml [new file with mode: 0644]
src/PV3DViewer/resources/ParaViewWriters.xml [new file with mode: 0644]
src/PV3DViewer/resources/README [new file with mode: 0644]
src/PVViewer/PVViewer_Core.cxx
src/PVViewer/PVViewer_Core.h
src/PVViewer/PVViewer_GUIElements.cxx
src/PVViewer/PVViewer_InitSingleton.cxx
src/PVViewer/PVViewer_ViewModel.cxx
src/PVViewer/PVViewer_ViewWindow.cxx
src/Prs/SALOME_Prs.cxx
src/Prs/SALOME_Prs.h
src/SALOME_PYQT/SalomePyQt/CMakeLists.txt
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_SWIG/CMakeLists.txt
src/SPV3D/CMakeLists.txt [new file with mode: 0644]
src/SPV3D/SPV3D.h [new file with mode: 0644]
src/SPV3D/SPV3D_CADSelection.cxx [new file with mode: 0644]
src/SPV3D/SPV3D_CADSelection.h [new file with mode: 0644]
src/SPV3D/SPV3D_Prs.cxx [new file with mode: 0644]
src/SPV3D/SPV3D_Prs.h [new file with mode: 0644]
src/SPV3D/SPV3D_ViewManager.cxx [new file with mode: 0644]
src/SPV3D/SPV3D_ViewManager.h [new file with mode: 0644]
src/SPV3D/SPV3D_ViewModel.cxx [new file with mode: 0644]
src/SPV3D/SPV3D_ViewModel.h [new file with mode: 0644]
src/SPV3D/SPV3D_ViewWindow.cxx [new file with mode: 0644]
src/SPV3D/SPV3D_ViewWindow.h [new file with mode: 0644]
src/SUIT/SUIT_SelectionMgr.cxx
src/SUIT/SUIT_Selector.cxx
src/SUIT/SUIT_Session.cxx
src/SUIT/SUIT_ViewModel.cxx
src/SUIT/SUIT_ViewWindow.cxx
src/SalomeApp/CMakeLists.txt
src/Session/SALOME_Session_Server.cxx

index 113cc34e2c6b964e5914d6d42a39f45d110b011e..5812423287aed6b136b0dfe9389431a99b645fd4 100644 (file)
@@ -72,6 +72,7 @@ CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OF
                        "NOT SALOME_KERNEL_LIGHT_ONLY" ON)
 OPTION(SALOME_USE_VTKVIEWER "Enable VTK visualization (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_OCCVIEWER "Enable OCC visualization (Mandatory in classic configurations)" ON)
+OPTION(SALOME_USE_PV3DVIEWER "Enable ParaView3D visualization (Optionally in classic configurations)" ON)
 OPTION(SALOME_USE_GLVIEWER "Enable OpenGL visualization (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_GRAPHICSVIEW "Enable GraphicsView visualization (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_PYVIEWER "Enable Python viewer (Mandatory in classic configurations)" ON)
@@ -85,7 +86,7 @@ CMAKE_DEPENDENT_OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory
 
 MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_PVVIEWER)
 MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER)
-MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER SALOME_USE_PYVIEWER)
+MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER SALOME_USE_PYVIEWER SALOME_USE_PV3DVIEWER)
 
 # Prerequisites
 # =============
@@ -191,6 +192,14 @@ ELSE()
   ADD_DEFINITIONS("-DDISABLE_PVVIEWER")
 ENDIF()
 
+# - PV3D viewer: ParaView3D
+IF (SALOME_USE_PV3DVIEWER)
+  FIND_PACKAGE(SalomeParaView)
+  SALOME_LOG_OPTIONAL_PACKAGE(ParaView SALOME_USE_PV3DVIEWER)
+ELSE()
+  ADD_DEFINITIONS("-DDISABLE_PV3DVIEWER")
+ENDIF()
+
 # - VTK viewer: VTK
 IF(SALOME_USE_VTKVIEWER)
   # Required components are listed in the FindSalomeVTK.cmake file: 
@@ -362,6 +371,16 @@ IF(SALOME_USE_OCCVIEWER)
   ENDIF(SALOME_USE_SALOMEOBJECT)
 ENDIF(SALOME_USE_OCCVIEWER)
 
+# PV3D specific targets:
+IF(SALOME_USE_PV3DVIEWER)
+  LIST(APPEND _${PROJECT_NAME}_exposed_targets 
+       PV3DViewer)
+  IF(SALOME_USE_SALOMEOBJECT)
+    LIST(APPEND _${PROJECT_NAME}_exposed_targets 
+         SPV3D)
+  ENDIF(SALOME_USE_SALOMEOBJECT)
+ENDIF(SALOME_USE_PV3DVIEWER)
+
 # Plot2d specific targets:
 IF(SALOME_USE_PLOT2DVIEWER)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets 
index 62159e8325466655ed7526e8e138426b4d6f9538..457cd61c862cb52661861445a728988327e986ed 100644 (file)
@@ -55,6 +55,7 @@ SET(SALOME_GUI_LIGHT_ONLY     @SALOME_LIGHT_ONLY@)
 SET(SALOME_USE_OCCVIEWER      @SALOME_USE_OCCVIEWER@)
 SET(SALOME_USE_GLVIEWER       @SALOME_USE_GLVIEWER@)
 SET(SALOME_USE_VTKVIEWER      @SALOME_USE_VTKVIEWER@)
+SET(SALOME_USE_PV3DVIEWER     @SALOME_USE_PV3DVIEWER@)
 SET(SALOME_USE_PLOT2DVIEWER   @SALOME_USE_PLOT2DVIEWER@)
 SET(SALOME_USE_GRAPHICSVIEW   @SALOME_USE_GRAPHICSVIEW@)
 SET(SALOME_USE_QXGRAPHVIEWER  @SALOME_USE_QXGRAPHVIEWER@)
@@ -78,6 +79,9 @@ ENDIF()
 IF(NOT SALOME_USE_OCCVIEWER)
   LIST(APPEND GUI_DEFINITIONS "-DDISABLE_OCCVIEWER")
 ENDIF()
+IF(NOT SALOME_USE_PV3DVIEWER)
+  LIST(APPEND GUI_DEFINITIONS "-DDISABLE_PV3DVIEWER")
+ENDIF()
 IF(NOT SALOME_USE_GLVIEWER)
   LIST(APPEND GUI_DEFINITIONS "-DDISABLE_GLVIEWER")
 ENDIF()
@@ -217,6 +221,7 @@ SET(GUI_SalomePy SalomePy)
 SET(GUI_SalomeSession SalomeSession)
 SET(GUI_SalomeStyle SalomeStyle)
 SET(GUI_SOCC SOCC)
+SET(GUI_SPV3D SPV3D)
 SET(GUI_SPlot2d SPlot2d)
 SET(GUI_std std)
 SET(GUI_SUITApp SUITApp)
@@ -226,6 +231,7 @@ SET(GUI_ToolsGUI ToolsGUI)
 SET(GUI_ViewerTools ViewerTools)
 SET(GUI_ViewerData ViewerData)
 SET(GUI_VTKViewer VTKViewer)
+SET(GUI_PV3DViewer PV3DViewer)
 SET(GUI_PVViewer PVViewer)
 SET(GUI_PVServerService PVServerService)
 SET(GUI_vtkTools vtkTools)
index 2e6f51e43ca692251eeb798698a1a3c332c6aedb..51e76fcfa5945d24fafbc85990716f170b1b55d5 100644 (file)
@@ -950,4 +950,4 @@ bool CAM_Application::abortAllOperations()
     aborted = (*it)->abortAllOperations();
   }
   return aborted;
-}
+}
\ No newline at end of file
index f5f7684947292e69005690d34927556bd25b009c..02ebfb2288e9ced02cd5d53f195ff631c3809e24 100644 (file)
@@ -83,6 +83,17 @@ IF(SALOME_USE_OCCVIEWER)
   ENDIF(SALOME_USE_SALOMEOBJECT)
 ENDIF(SALOME_USE_OCCVIEWER)
 
+##
+# ParaView3D Viewer
+##
+IF(SALOME_USE_PV3DVIEWER)
+  ADD_SUBDIRECTORY(PV3DViewer)
+  # ADD_SUBDIRECTORY(PV3DServerService)
+  IF(SALOME_USE_SALOMEOBJECT)
+    ADD_SUBDIRECTORY(SPV3D)
+  ENDIF(SALOME_USE_SALOMEOBJECT)
+ENDIF()
+
 ##
 # Plot2d viewer
 ##
index 993298328cd53b335fefdde0fa44364ee3bda945..084f12931ea5535318c7952cb38d38722129bfbd 100644 (file)
@@ -58,6 +58,12 @@ IF(SALOME_USE_OCCVIEWER)
     INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/SOCC)
   ENDIF()
 ENDIF()
+IF(SALOME_USE_PV3DVIEWER)
+  INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/PV3DViewer)
+  IF(SALOME_USE_SALOMEOBJECT)
+    INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/SPV3D)
+  ENDIF()
+ENDIF()
 IF(SALOME_USE_PLOT2DVIEWER)
   INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIR})
   INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Plot2d)
@@ -121,6 +127,12 @@ IF(SALOME_USE_OCCVIEWER)
     LIST(APPEND _link_LIBRARIES SOCC)
   ENDIF()
 ENDIF()
+IF(SALOME_USE_PV3DVIEWER)
+  LIST(APPEND _link_LIBRARIES PV3DViewer)
+  IF(SALOME_USE_SALOMEOBJECT)
+    LIST(APPEND _link_LIBRARIES SPV3D)
+  ENDIF()
+ENDIF()
 IF(SALOME_USE_PLOT2DVIEWER)
   LIST(APPEND _link_LIBRARIES Plot2d)
   IF(SALOME_USE_SALOMEOBJECT)
@@ -174,6 +186,11 @@ ENDIF()
 IF(SALOME_USE_OCCVIEWER)
   LIST(APPEND _moc_HEADERS LightApp_OCCSelector.h)
 ENDIF()
+IF(SALOME_USE_PV3DVIEWER)
+  IF(SALOME_USE_SALOMEOBJECT)
+    LIST(APPEND _moc_HEADERS LightApp_PV3DSelector.h)
+  ENDIF()
+ENDIF()
 IF(SALOME_USE_PLOT2DVIEWER)
   LIST(APPEND _moc_HEADERS LightApp_Plot2dSelector.h)
 ENDIF()
@@ -279,6 +296,11 @@ ENDIF()
 IF(SALOME_USE_OCCVIEWER)
   LIST(APPEND _other_SOURCES LightApp_OCCSelector.cxx)
 ENDIF()
+IF(SALOME_USE_PV3DVIEWER)
+  IF(SALOME_USE_SALOMEOBJECT)
+    LIST(APPEND _other_SOURCES LightApp_PV3DSelector.cxx)
+  ENDIF()
+ENDIF()
 IF(SALOME_USE_PLOT2DVIEWER)
   LIST(APPEND _other_SOURCES LightApp_Plot2dSelector.cxx)
 ENDIF()
index 49972104e670860d5d1f733e978ac0b3e0d199b7..4758aa40e0d85764065ab849bcf113cc330fb8e9 100644 (file)
   #include <PyViewer_ViewWindow.h>
 #endif
 
+#ifndef DISABLE_PV3DVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+  #include <SPV3D_ViewModel.h>
+  #include <SPV3D_ViewManager.h>
+  #include "LightApp_PV3DSelector.h"
+#else
+  #include <PV3DViewer_ViewModel.h>
+  #include <PV3DViewer_ViewManager.h>
+#endif
+  #include <PV3DViewer_ViewManager.h>
+  #include <PV3DViewer_ViewModel.h>
+  #include "PV3DViewer_ViewWindow.h"
+#endif
+
 
 #define VISIBILITY_COLUMN_WIDTH 25
 
@@ -784,6 +798,9 @@ void LightApp_Application::createActions()
 #ifndef DISABLE_PYVIEWER
   createActionForViewer( NewPyViewerId, newWinMenu, QString::number( 7 ), Qt::ALT+Qt::Key_Y );
 #endif
+#ifndef DISABLE_PV3DVIEWER
+  createActionForViewer( NewPV3DViewId, newWinMenu, QString::number( 8 ), Qt::ALT+Qt::Key_3 );
+#endif
 
   createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
                 Qt::ALT+Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
@@ -1104,6 +1121,11 @@ void LightApp_Application::onNewWindow()
   case NewPyViewerId:
     type = PyViewer_Viewer::Type();
     break;
+#endif
+#ifndef DISABLE_PV3DVIEWER
+  case NewPV3DViewId:
+    type = PV3DViewer_ViewModel::Type();
+    break;
 #endif
   }
 
@@ -1278,6 +1300,12 @@ void LightApp_Application::updateCommandsStatus()
   if( a )
     a->setEnabled( activeStudy() );
 #endif
+
+#ifndef DISABLE_PV3DVIEWER
+  a = action( NewPV3DViewId );
+  if( a )
+    a->setEnabled( activeStudy() );
+#endif
 }
 
 /*!
@@ -1843,6 +1871,32 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
   }
 #endif
 
+#ifndef DISABLE_PV3DVIEWER
+# ifndef DISABLE_SALOMEOBJECT
+  if ( vmType == SPV3D_ViewModel::Type() )
+# else
+  if ( vmType == PV3DViewer_ViewModel::Type() )
+# endif
+  {
+    viewMgr = new SPV3D_ViewManager( activeStudy(), desktop() );
+    SPV3D_ViewModel* vm = dynamic_cast<SPV3D_ViewModel*>( viewMgr->getViewModel() );
+    if ( vm )
+    {
+      // vm->setBackground(...); //NYI
+      // vm->...
+
+      new LightApp_PV3DSelector( vm, mySelMgr );
+    }
+#else
+    viewMgr = new PV3DViewer_ViewManager( activeStudy(), desktop() );
+    PV3DViewer_ViewModel* vm = dynamic_cast<PV3DViewer_ViewModel*>( viewMgr->getViewModel() );
+    if ( vm )
+    {
+      // vm->setBackground(...); //NYI
+    }
+#endif
+  }
+
   if ( !viewMgr )
     return 0;
 
@@ -4966,6 +5020,9 @@ QStringList LightApp_Application::viewManagersTypes() const
  #else
   aTypesList<<VTKViewer_Viewer::Type();
  #endif
+#endif
+#ifndef DISABLE_PV3DVIEWER
+  aTypesList<<PV3DViewer_ViewModel::Type();
 #endif
   return aTypesList;
 }
index aae6c005e511cd90db54f99e36d6072b461397db..9861ff964d03163b851a9bc2da1b551b0a5477c1 100644 (file)
@@ -91,7 +91,7 @@ public:
          CloseId, CloseAllId, GroupAllId,
          PreferencesId, MRUId, ModulesListId,
          NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId,
-         NewQxSceneViewId, NewGraphicsViewId, NewPVViewId, NewPyViewerId, StyleId, FullScreenId,
+         NewQxSceneViewId, NewGraphicsViewId, NewPVViewId, NewPyViewerId, NewPV3DViewId, StyleId, FullScreenId,
          WebSiteId, ForumId, VideosId, TutorialsId,
          UserID };
 
index e5fef3efa9c1d5ac6bffc24d9b73433b0afa263a..1b2c15b6147a2003c353cdb04054251ed168c5cc 100644 (file)
   #include <PVViewer_ViewManager.h>
   #include <PVViewer_ViewWindow.h>
 #endif
+#ifndef DISABLE_PV3DVIEWER
+  #include <PV3DViewer_ViewWindow.h>
+  #include <PV3DViewer_ViewModel.h>
+#endif
 #ifndef DISABLE_PLOT2DVIEWER
   #include <Plot2d_ViewWindow.h>
   #include <Plot2d_ViewFrame.h>
@@ -377,6 +381,12 @@ void LightApp_Module::update( const int theFlags )
           ( (VTKViewer_ViewWindow*)viewWnd )->Repaint();
 #endif
 #endif
+#ifndef DISABLE_PV3DVIEWER
+        // if ( viewWnd->inherits( "SPV3D_ViewWindow" ) )
+        //   ( (SPV3D_ViewWindow*)viewWnd )->Repaint();
+        // if ( viewWnd->inherits( "PV3DViewer_ViewWindow" ) )
+        //   ( (PV3DViewer_ViewWindow*)viewWnd )->getMultiViewManager()->Repaint();
+#endif
 #ifndef DISABLE_OCCVIEWER
         if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
           ( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
@@ -486,6 +496,13 @@ QtxPopupMgr* LightApp_Module::popupMgr()
     viewers.append( VTKViewer_Viewer::Type() );
 #endif
 #endif
+#ifndef DISABLE_PV3DVIEWER
+// #ifndef DISABLE_SALOMEOBJECT
+//     viewers.append( SPV3D_ViewModel::Type() );
+// #else
+    viewers.append( PV3DViewer_ViewModel::Type() );
+// #endif
+#endif
 #ifndef DISABLE_PLOT2DVIEWER
 #ifndef DISABLE_SALOMEOBJECT
     viewers.append( SPlot2d_Viewer::Type() );
diff --git a/src/LightApp/LightApp_PV3DSelector.cxx b/src/LightApp/LightApp_PV3DSelector.cxx
new file mode 100644 (file)
index 0000000..c1c23ae
--- /dev/null
@@ -0,0 +1,168 @@
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "LightApp_PV3DSelector.h"
+#include "LightApp_DataOwner.h"
+
+#include "SUIT_Desktop.h"
+
+#ifndef DISABLE_PV3DVIEWER
+  #include "SPV3D_ViewModel.h"
+  #include "SPV3D_ViewManager.h"
+  #include "SPV3D_ViewWindow.h"
+  #include <vtkRenderer.h>
+#endif
+
+#ifndef DISABLE_SALOMEOBJECT
+  // #include "SALOME_Actor.h"
+  // #include "SALOME_ListIO.hxx"
+#endif
+
+#include <utilities.h>
+
+#ifndef DISABLE_PV3DVIEWER
+/*!
+  Constructor.
+*/
+LightApp_PV3DSelector::LightApp_PV3DSelector( SPV3D_ViewModel* viewer, SUIT_SelectionMgr* mgr )
+: SUIT_Selector( mgr, viewer ),
+  myViewer( viewer )
+{
+  if ( myViewer )
+    connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+}
+
+/*!
+  Gets viewer.
+*/
+SPV3D_ViewModel* LightApp_PV3DSelector::viewer() const
+{
+  return myViewer;
+}
+
+/*!
+  Gets type of salome PV3D viewer.
+*/
+QString LightApp_PV3DSelector::type() const
+{ 
+  return myViewer->getType(); 
+}
+
+#endif
+
+/*!
+  On selection changed.
+*/
+void LightApp_PV3DSelector::onSelectionChanged()
+{
+  selectionChanged();
+}
+
+#ifndef DISABLE_PV3DVIEWER
+
+/*!
+  Gets list of selected data owners.(output \a aList).
+*/
+void LightApp_PV3DSelector::getSelection( SUIT_DataOwnerPtrList& /*aList*/ ) const
+{
+  if ( !myViewer )
+    return;
+
+  if ( !myViewer->isSelectionEnabled() )
+    return;
+
+  // if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){
+  //   if(PV3DViewer_ViewManager* aViewMgr = dynamic_cast<PV3DViewer_ViewManager*>(aViewManager)){
+  //     if(PV3DViewer_ViewWindow* aView = dynamic_cast<PV3DViewer_ViewWindow*>(aViewMgr->getActiveView())){
+  //       if(SPV3D_Selector* aSelector = aView->GetSelector()){
+  //         const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+  //         SALOME_ListIteratorOfListIO anIter(aListIO);
+  //         for(; anIter.More(); anIter.Next()){
+  //           Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+  //           if(anIO->hasEntry())
+  //             aList.append(new LightApp_SPV3DDataOwner(anIO,aViewMgr->getDesktop()));
+  //         }
+  //       }
+  //     }
+  //   }
+  // }
+}
+
+/*!
+  Sets selection to selector from data owner list \a theList.
+*/
+void LightApp_PV3DSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
+{
+  if ( myViewer && ( theList.isEmpty() || myViewer->isSelectionEnabled() )) {
+    //if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager())
+    {
+    //  if(SPV3D_ViewWindow* aView = dynamic_cast<SPV3D_ViewWindow*>(aViewMgr->getActiveView()))
+      {
+        // if(PV3DViewer_Selector* aSelector = aView->GetSelector()){
+        //   SALOME_ListIO anAppendList;
+        //   const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
+        //   SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();
+        //   for(; anIter != theList.end(); ++anIter) {
+        //     const SUIT_DataOwner* aDataOwner = (*anIter).get();
+        //     if(const LightApp_SPV3DDataOwner* anOwner = dynamic_cast<const LightApp_SPV3DDataOwner*>(aDataOwner))
+        //     {
+        //       MESSAGE("aSelector->SetSelectionMode("<<anOwner->GetMode()<<");");
+        //       aSelector->SetSelectionMode(anOwner->GetMode());
+        //       Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
+
+        //       aSelector->AddIObject(anIO);
+
+        //       anAppendList.Append(anIO);
+        //       aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
+        //     }
+        //     else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner))
+        //     {
+        //       Handle(SALOME_InteractiveObject) anIO =
+        //         new SALOME_InteractiveObject(anOwner->entry().toUtf8(),"");
+        //       aSelector->AddIObject(anIO);
+        //       anAppendList.Append(anIO);
+        //     }
+        //   }
+        //   // To remove IOs, which is not selected.
+        //   QMap< QString, Handle( SALOME_InteractiveObject )> toRemove;
+        //   SALOME_ListIteratorOfListIO anIt( aStoredList );
+        //   for( ; anIt.More(); anIt.Next() )
+        //     if( !anIt.Value().IsNull() )
+        //       toRemove[ anIt.Value()->getEntry() ] = anIt.Value();
+
+        //   anIt = SALOME_ListIteratorOfListIO(anAppendList);
+        //   for( ; anIt.More(); anIt.Next() )
+        //     toRemove.remove( anIt.Value()->getEntry() );
+
+        //   QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),
+        //     REnd = toRemove.end();
+        //   for( ; RIt!=REnd; RIt++ )
+        //     aSelector->RemoveIObject( RIt.value() );
+
+        //   aView->onSelectionChanged();
+        // }
+      }
+    }
+  }
+}
+
+#endif
diff --git a/src/LightApp/LightApp_PV3DSelector.h b/src/LightApp/LightApp_PV3DSelector.h
new file mode 100644 (file)
index 0000000..4586b85
--- /dev/null
@@ -0,0 +1,73 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef LIGHTAPP_PV3DSELECTOR_H
+#define LIGHTAPP_PV3DSELECTOR_H
+
+#include "LightApp.h"
+
+#include <SUIT_Selector.h>
+#include <SUIT_DataOwner.h>
+
+#include <QObject>
+
+
+#ifndef DISABLE_PV3DVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+  #include "SALOME_InteractiveObject.hxx"
+#endif
+  class SPV3D_ViewModel;
+#endif
+
+
+/*!
+  \class LightApp_PV3DSelector
+  Custom selector to get/set selection from PV3D viewer
+*/
+class LIGHTAPP_EXPORT LightApp_PV3DSelector : public QObject, public SUIT_Selector
+{
+  Q_OBJECT
+
+public:
+  virtual ~LightApp_PV3DSelector() {};
+#ifndef DISABLE_PV3DVIEWER
+  LightApp_PV3DSelector( SPV3D_ViewModel*, SUIT_SelectionMgr* );
+
+  SPV3D_ViewModel* viewer() const;
+
+  virtual QString type() const;
+#else
+  LightApp_PV3DSelector( SUIT_SelectionMgr* );
+#endif
+
+private slots:
+  void              onSelectionChanged();
+
+#ifndef DISABLE_PV3DVIEWER
+protected:
+  virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
+  virtual void      setSelection( const SUIT_DataOwnerPtrList& );
+
+private:
+  SPV3D_ViewModel* myViewer;
+
+#endif
+};
+
+#endif
index 98cf244856823622c197bb17ccbbc525326f6a5f..0e1c4249e764cebd02385eaca650232a47048102 100644 (file)
@@ -46,6 +46,7 @@
     <parameter name="OCCViewer"     value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="VTKViewer"     value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="PVViewer"      value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+    <parameter name="PV3DViewer"    value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="QxSceneViewer" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="PyEditor"      value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="PyViewer"      value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
index 15d27efdf5e0cc57484e6d2a31000bd1350c6af2..3bb663ce7a35f6273c7931a3e66ba4ad57c203c3 100644 (file)
@@ -560,6 +560,10 @@ The changes will be applied on the next application session.</translation>
         <source>NEW_WINDOW_7</source>
         <translation>P&amp;ython view</translation>
     </message>
+    <message>
+        <source>NEW_WINDOW_8</source>
+        <translation>ParaView&amp;3D view</translation>
+    </message>
     <message>
         <source>CREATING_NEW_WINDOW</source>
         <translation>Create new %1</translation>
diff --git a/src/PV3DViewer/CMakeLists.txt b/src/PV3DViewer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3da2397
--- /dev/null
@@ -0,0 +1,115 @@
+# Copyright (C) 2014-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# Install ParaView filters, etc ...
+ADD_SUBDIRECTORY(resources)
+
+INCLUDE(UseQtExt)
+
+# --- options ---
+
+INCLUDE_DIRECTORIES(
+  ${PROJECT_SOURCE_DIR}/src/Qtx
+  ${PROJECT_SOURCE_DIR}/src/SUIT
+  ${PROJECT_SOURCE_DIR}/src/PV3DViewer
+  ${PROJECT_SOURCE_DIR}/src/PVViewer
+  ${PROJECT_SOURCE_DIR}/src/PVServerService
+  )
+
+ADD_DEFINITIONS(
+  ${KERNEL_DEFINITIONS}
+  ${PYTHON_DEFINITIONS}
+  )
+
+SET(_link_LIBRARIES 
+  ${KERNEL_SALOMELocalTrace} 
+  ${KERNEL_OpUtil}
+  suit 
+  PV3DViewer 
+  PVViewer
+  PVServerService
+  ParaView::pqApplicationComponents
+  ParaView::pqPython
+  )
+
+# --- headers ---
+
+# header files / to be processed by moc
+SET(_moc_HEADERS
+  PV3DViewer_ViewManager.h
+  PV3DViewer_ViewModel.h
+  PV3DViewer_ViewWindow.h
+  # PV3DViewer_Behaviors.h
+  # PV3DViewer_GUIElements.h
+  # PV3DViewer_InitSingleton.h
+)
+
+# header files / no moc processing
+SET(_other_HEADERS
+  PV3DViewer.h
+  # PV3DViewer_OutputWindow.h
+  # PV3DViewer_Core.h
+)
+# header files / to install
+SET(PV3DViewer_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
+
+# resource files / to be processed by lrelease
+SET(_ts_RESOURCES
+  resources/PV3DViewer_msg_en.ts
+  resources/PV3DViewer_msg_ja.ts
+  resources/PV3DViewer_msg_fr.ts
+)
+
+# --- sources ---
+
+# sources / moc wrappings
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
+
+# sources / rcc wrappings
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+
+# sources / static
+SET(_other_SOURCES
+  PV3DViewer_ViewManager.cxx
+  PV3DViewer_ViewModel.cxx
+  PV3DViewer_ViewWindow.cxx
+  # PV3DViewer_OutputWindow.cxx
+  # PV3DViewer_Behaviors.cxx
+  # PV3DViewer_GUIElements.cxx
+  # PV3DViewer_Core.cxx
+  # PV3DViewer_InitSingleton.cxx
+  )
+  
+# sources / to compile
+SET(PV3DViewer_SOURCES 
+  ${_other_SOURCES} 
+  ${_moc_SOURCES} 
+  ${_rcc_SOURCES}
+  )
+
+# --- rules ---
+ADD_LIBRARY(PV3DViewer ${PV3DViewer_SOURCES})
+
+TARGET_LINK_LIBRARIES(PV3DViewer ${_link_LIBRARIES})
+INSTALL(TARGETS PV3DViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+
+# --- header and resources installation ---
+INSTALL(FILES ${PV3DViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
diff --git a/src/PV3DViewer/PV3DViewer.h b/src/PV3DViewer/PV3DViewer.h
new file mode 100644 (file)
index 0000000..2b00f79
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef PV3DVIEWER_H
+#define PV3DVIEWER_H
+
+#ifdef WIN32
+#  if defined PV3DVIEWER_EXPORTS || defined PV3DViewer_EXPORTS
+#    define PV3DVIEWER_EXPORT __declspec(dllexport)
+#  else
+#    define PV3DVIEWER_EXPORT __declspec(dllimport)
+#  endif
+#else
+#   define PV3DVIEWER_EXPORT
+#endif
+
+#endif // PV3DVIEWER_H
diff --git a/src/PV3DViewer/PV3DViewer_ViewManager.cxx b/src/PV3DViewer/PV3DViewer_ViewManager.cxx
new file mode 100644 (file)
index 0000000..d4c0faa
--- /dev/null
@@ -0,0 +1,65 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "PV3DViewer_ViewManager.h"
+#include "PV3DViewer_ViewWindow.h"
+#include "PV3DViewer_ViewModel.h"
+// #include "PV3DViewer_Core.h"
+#include "PVViewer_InitSingleton.h"
+#include "PVViewer_GUIElements.h"
+#include "PVServer_ServiceWrapper.h"
+
+#include <utilities.h>
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Study.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include <pqServer.h>
+#include <pqServerConnectReaction.h>
+#include <pqActiveObjects.h>
+
+/*!
+  Constructor
+*/
+PV3DViewer_ViewManager::PV3DViewer_ViewManager(SUIT_Study* study, SUIT_Desktop* desktop)
+: SUIT_ViewManager( study, desktop, new PV3DViewer_ViewModel() )
+{
+  setTitle( tr( "PARAVIEW3D_VIEW_TITLE" ) );
+
+  // Initialize minimal paraview stuff (if not already done)
+  PVViewer_InitSingleton::Init(desktop);
+
+  connect( desktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+           this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+}
+
+/*!Enable toolbars if view \a view is ParaView viewer and disable otherwise.
+*/
+void PV3DViewer_ViewManager::onWindowActivated(SUIT_ViewWindow* view)
+{
+  if (view)
+  {
+    PV3DViewer_ViewWindow* pvWindow = dynamic_cast<PV3DViewer_ViewWindow*>(view);
+    PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance( myDesktop );
+    guiElements->setToolBarEnabled(pvWindow!=0);
+  }
+}
diff --git a/src/PV3DViewer/PV3DViewer_ViewManager.h b/src/PV3DViewer/PV3DViewer_ViewManager.h
new file mode 100644 (file)
index 0000000..84dee04
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef PV3DVIEWER_VIEWMANAGER_H
+#define PV3DVIEWER_VIEWMANAGER_H
+
+#include "PV3DViewer.h"
+
+#include "SUIT_ViewManager.h"
+
+class SUIT_Desktop;
+class SUIT_Study;
+class SUIT_ViewWindow;
+class PVServer_ServiceWrapper;
+class QMainWindow;
+
+class PV3DVIEWER_EXPORT PV3DViewer_ViewManager : public SUIT_ViewManager
+{
+  Q_OBJECT
+
+public:
+  PV3DViewer_ViewManager(SUIT_Study*, SUIT_Desktop*);
+  ~PV3DViewer_ViewManager() {}
+
+protected slots:
+  void onWindowActivated(SUIT_ViewWindow*);
+};
+
+#endif // PV3DVIEWER_VIEWMANAGER_H
diff --git a/src/PV3DViewer/PV3DViewer_ViewModel.cxx b/src/PV3DViewer/PV3DViewer_ViewModel.cxx
new file mode 100644 (file)
index 0000000..dc230eb
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "PV3DViewer_ViewModel.h"
+#include "PV3DViewer_ViewWindow.h"
+
+#include <utilities.h>
+#include "SUIT_Desktop.h"
+
+PV3DViewer_ViewModel::PV3DViewer_ViewModel():SUIT_ViewModel() 
+{
+  MESSAGE("PV3DViewer_ViewModel: creating view model ...");
+}
+
+/*!
+  Create new instance of view window on desktop \a theDesktop.
+  \retval SUIT_ViewWindow* - created view window pointer.
+*/
+SUIT_ViewWindow* PV3DViewer_ViewModel::createView(SUIT_Desktop* desktop)
+{
+  return new PV3DViewer_ViewWindow(desktop, this);
+}
diff --git a/src/PV3DViewer/PV3DViewer_ViewModel.h b/src/PV3DViewer/PV3DViewer_ViewModel.h
new file mode 100644 (file)
index 0000000..bfb82e0
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef PV3DVIEWER_VIEWMODEL_H
+#define PV3DVIEWER_VIEWMODEL_H
+
+#include "PV3DViewer.h"
+
+#include "SUIT_ViewModel.h"
+
+class SUIT_ViewWindow;
+class SUIT_Desktop;
+class SUIT_Desktop;
+
+class PV3DVIEWER_EXPORT PV3DViewer_ViewModel : public SUIT_ViewModel
+{
+  Q_OBJECT
+
+public:
+  PV3DViewer_ViewModel();
+  virtual ~PV3DViewer_ViewModel() {}
+
+  virtual SUIT_ViewWindow*  createView(SUIT_Desktop*);
+  virtual QString           getType() const   { return Type(); }
+  static QString            Type()            { return "ParaView3D"; }
+};
+
+#endif // PV3DVIEWER_VIEWMODEL_H
diff --git a/src/PV3DViewer/PV3DViewer_ViewWindow.cxx b/src/PV3DViewer/PV3DViewer_ViewWindow.cxx
new file mode 100644 (file)
index 0000000..9ae9cf4
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "PV3DViewer_ViewWindow.h"
+//#include "PV3DViewer_Core.h"
+//#include "PV3DViewer_GUIElements.h"
+#include "PV3DViewer_ViewModel.h"
+#include "PV3DViewer_ViewManager.h"
+
+#include "SUIT_ViewManager.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Application.h"
+
+#include <pqTabbedMultiViewWidget.h>
+#include <pqApplicationCore.h>
+
+/*!
+  \brief Constructor.
+  \param theDesktop parent desktop window
+  \param theModel view model
+*/
+PV3DViewer_ViewWindow::PV3DViewer_ViewWindow( SUIT_Desktop* theDesktop, PV3DViewer_ViewModel* theModel )
+  : SUIT_ViewWindow( theDesktop ), myPVMgr( 0 )
+{
+  myDesktop = theDesktop;
+  myModel = theModel;
+  setViewManager(myModel->getViewManager());
+}
+
+/*!
+  \brief Destructor.
+  As pqViewManager persists through the whole session,
+  the destructor first removes it from the children of this PV3DViewer_ViewWindow
+  to prevent its unexpected deletion.
+*/
+PV3DViewer_ViewWindow::~PV3DViewer_ViewWindow()
+{
+  if ( myPVMgr ) {
+    myPVMgr->setParent( nullptr );
+    myPVMgr->hide();
+    myPVMgr = nullptr;
+    setCentralWidget( nullptr );
+  }
+}
+
+void PV3DViewer_ViewWindow::removePVMgr()
+{
+  pqTabbedMultiViewWidget* aPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
+  delete aPVMgr;
+}
+
+
+/*!
+  \brief Returns the ParaView multi-view manager previously set with setPVManager()
+*/
+pqTabbedMultiViewWidget *PV3DViewer_ViewWindow::getMultiViewManager() const
+{
+  return myPVMgr;
+}
diff --git a/src/PV3DViewer/PV3DViewer_ViewWindow.h b/src/PV3DViewer/PV3DViewer_ViewWindow.h
new file mode 100644 (file)
index 0000000..6060616
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef PV3DVIEWER_VIEWWINDOW_H
+#define PV3DVIEWER_VIEWWINDOW_H
+
+#include "PV3DViewer.h"
+
+#include "SUIT_ViewWindow.h"
+#include <QMap>
+
+class SUIT_Desktop;
+class PV3DViewer_ViewModel;
+class pqTabbedMultiViewWidget;
+
+class PV3DVIEWER_EXPORT PV3DViewer_ViewWindow : public SUIT_ViewWindow
+{
+  Q_OBJECT
+
+public:
+  PV3DViewer_ViewWindow( SUIT_Desktop*, PV3DViewer_ViewModel* );
+  virtual ~PV3DViewer_ViewWindow();
+
+  pqTabbedMultiViewWidget* getMultiViewManager() const;
+
+  static void removePVMgr();
+
+private:
+  SUIT_Desktop*             myDesktop;
+  PV3DViewer_ViewModel*     myModel;
+  pqTabbedMultiViewWidget*  myPVMgr;
+};
+
+#endif // PV3DVIEWER_VIEWWINDOW_H
diff --git a/src/PV3DViewer/PVViewer_Behaviors.cxx b/src/PV3DViewer/PVViewer_Behaviors.cxx
new file mode 100644 (file)
index 0000000..66f22e2
--- /dev/null
@@ -0,0 +1,129 @@
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author: Adrien Bruneton (CEA)
+
+#include "PVViewer_Behaviors.h"
+
+#include <QMainWindow>
+
+#include <pqInterfaceTracker.h>
+#include <pqApplicationCore.h>
+#include <pqPluginManager.h>
+#include <pqStandardPropertyWidgetInterface.h>
+#include <pqStandardViewFrameActionsImplementation.h>
+#include <pqPropertiesPanel.h>
+
+#include <pqAlwaysConnectedBehavior.h>
+#include <pqAutoLoadPluginXMLBehavior.h>
+#include <pqCommandLineOptionsBehavior.h>
+#include <pqCrashRecoveryBehavior.h>
+#include <pqDataTimeStepBehavior.h>
+#include <pqDefaultViewBehavior.h>
+#include <pqObjectPickingBehavior.h>
+#include <pqPipelineContextMenuBehavior.h>
+#include <pqPluginActionGroupBehavior.h>
+#include <pqPluginDockWidgetsBehavior.h>
+#include <pqSpreadSheetVisibilityBehavior.h>
+#include <pqUndoRedoBehavior.h>
+#include <pqViewStreamingBehavior.h>
+#include <pqCollaborationBehavior.h>
+#include <pqVerifyRequiredPluginBehavior.h>
+#include <pqPluginSettingsBehavior.h>
+#include <pqApplyBehavior.h>
+
+#include <pqPropertiesPanel.h>
+
+int PVViewer_Behaviors::BehaviorLoadingLevel = 0;
+
+PVViewer_Behaviors::PVViewer_Behaviors(QMainWindow * parent)
+  : QObject(parent)
+{
+}
+
+/**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer.
+ * This method should be updated at each new version of ParaView with what is found in
+ *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ */
+void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * /*desk*/)
+{
+  if (BehaviorLoadingLevel < 1)
+    {
+      // Register ParaView interfaces.
+      pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
+
+      // Register standard types of property widgets.
+      pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
+      // Register standard types of view-frame actions.
+      pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));
+
+      new pqPipelineContextMenuBehavior(this);
+      new pqDefaultViewBehavior(this);  // shows a 3D view as soon as a server connection is made
+      new pqAlwaysConnectedBehavior(this);  // client always connected to a server
+      new pqVerifyRequiredPluginBehavior(this);
+      new pqPluginSettingsBehavior(this);
+      new pqCrashRecoveryBehavior(this);
+      new pqCommandLineOptionsBehavior(this);
+
+      BehaviorLoadingLevel = 1;
+    }
+}
+
+/**! Instanciate usual ParaView behaviors.
+ * This method should be updated at each new version of ParaView with what is found in
+ *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ */
+void PVViewer_Behaviors::instanciateAllBehaviors(QMainWindow * desk)
+{
+  //    "new pqParaViewBehaviors(anApp->desktop(), this);"
+  // -> (which loads all standard ParaView behaviors at once) has to be replaced in order to
+  // exclude using of pqQtMessageHandlerBehaviour
+
+  // Define application behaviors.
+  if (BehaviorLoadingLevel < 1)
+    instanciateMinimalBehaviors(desk);
+
+  if (BehaviorLoadingLevel < 2)
+    {
+      //new pqQtMessageHandlerBehavior(this);   // THIS ONE TO EXCLUDE !! see comment above
+      new pqDataTimeStepBehavior(this);
+      new pqSpreadSheetVisibilityBehavior(this);
+      //new pqPipelineContextMenuBehavior(this);
+      new pqUndoRedoBehavior(this);
+      new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins GUI stuff
+      new pqPluginDockWidgetsBehavior(desk);
+      new pqPluginActionGroupBehavior(desk);
+      // rnv: Disable ParaView main window persistance mechanism,
+      //      because SALOME has own functionality for store/restore windows state.
+      //  new pqPersistentMainWindowStateBehavior(desk);
+      new pqObjectPickingBehavior(desk);
+      new pqCollaborationBehavior(this);
+      new pqViewStreamingBehavior(this);
+
+      // Move instantiation of the pqApplyBehavior to the PVViewer_GUIElements::buildPVWidgets(),
+      // because without pqPropertiesPanel it doesn't make sense.      
+      /*
+      pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
+      foreach (pqPropertiesPanel* ppanel, desk->findChildren<pqPropertiesPanel*>())
+      {
+        applyBehavior->registerPanel(ppanel);
+      }
+      */
+      BehaviorLoadingLevel = 2;
+    }
+}
diff --git a/src/PV3DViewer/PVViewer_Behaviors.h b/src/PV3DViewer/PVViewer_Behaviors.h
new file mode 100644 (file)
index 0000000..780b039
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author: Adrien Bruneton (CEA)
+
+
+#ifndef PVVIEWER_BEHAVIORS_H
+#define PVVIEWER_BEHAVIORS_H
+
+#include "PVViewer.h"
+
+#include <QObject>
+
+class QMainWindow;
+class pqPropertiesPanel;
+
+/**!
+ * PARAVIS behaviors - mimic what is done in
+ *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ * Except a few ones, behaviors are destroyed when the module is destroyed.
+ */
+class PVVIEWER_EXPORT PVViewer_Behaviors: public QObject
+{
+  Q_OBJECT
+
+public:
+  PVViewer_Behaviors(QMainWindow*);
+
+  void instanciateMinimalBehaviors(QMainWindow*);
+  void instanciateAllBehaviors(QMainWindow*);
+
+  virtual ~PVViewer_Behaviors() {}
+
+private:
+  static int BehaviorLoadingLevel;
+};
+
+#endif // PVVIEWER_BEHAVIORS_H
diff --git a/src/PV3DViewer/resources/CMakeLists.txt b/src/PV3DViewer/resources/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c5b2f86
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (C) 2010-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(dist_salomeres_DATA
+  ParaViewFilters.xml
+  ParaViewSources.xml
+  )
+
+FOREACH(f ${dist_salomeres_DATA})
+  INSTALL(FILES ${f} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
+ENDFOREACH(f ${dist_salomeres_DATA})
diff --git a/src/PV3DViewer/resources/PV3DViewer_msg_en.ts b/src/PV3DViewer/resources/PV3DViewer_msg_en.ts
new file mode 100644 (file)
index 0000000..1d88682
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+    <name>@default</name>
+    <message>
+    </message>
+</context>
+<context>
+    <name>SPV3D_ViewManager</name>
+    <message>
+        <source>PARAVIEW3D_VIEW_TITLE</source>
+        <translation>ParaView3D scene:%M - viewer:%V</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/PV3DViewer/resources/PV3DViewer_msg_fr.ts b/src/PV3DViewer/resources/PV3DViewer_msg_fr.ts
new file mode 100644 (file)
index 0000000..df0aa01
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+    <name>@default</name>
+    <message>
+    </message>
+</context>
+<context>
+    <name>SPV3D_ViewManager</name>
+    <message>
+        <source>PARAVIEW3D_VIEW_TITLE</source>
+        <translation>Scène ParaView3D:%1 - visualiseur:%2</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/PV3DViewer/resources/PV3DViewer_msg_ja.ts b/src/PV3DViewer/resources/PV3DViewer_msg_ja.ts
new file mode 100644 (file)
index 0000000..7853a42
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="ja" sourcelanguage="en">
+  <context>
+    <name>@default</name>
+    <message>
+      <translation type="unfinished"/>
+    </message>
+  </context>
+  <context>
+    <name>SPV3D_ViewManager</name>
+    <message>
+      <source>PARAVIEW3D_VIEW_TITLE</source>
+      <translation>ParaView3D ã‚·ãƒ¼ãƒ³:%1 - ãƒ“ューア:%2</translation>
+    </message>
+  </context>
+</TS>
diff --git a/src/PV3DViewer/resources/ParaViewFilters.xml b/src/PV3DViewer/resources/ParaViewFilters.xml
new file mode 100644 (file)
index 0000000..060d098
--- /dev/null
@@ -0,0 +1,309 @@
+<ParaViewFilters>
+  <Category name="Common" menu_label="&amp;Common" preserve_order="1"
+    show_in_toolbar="1">
+    <Proxy group="filters" name="Calculator" icon=":/pqWidgets/Icons/pqCalculator.svg"/>
+    <Proxy group="filters" name="Contour" icon=":/pqWidgets/Icons/pqIsosurface.svg"/>
+    <Proxy group="filters" name="Clip" icon=":/pqWidgets/Icons/pqClip.svg"/>
+    <Proxy group="filters" name="Cut" icon=":/pqWidgets/Icons/pqSlice.svg"/>
+    <Proxy group="filters" name="Threshold" icon=":/pqWidgets/Icons/pqThreshold.svg"/>
+    <Proxy group="filters" name="ExtractGrid" icon=":/pqWidgets/Icons/pqExtractGrid.svg"/>
+    <Proxy group="filters" name="Glyph" icon=":/pqWidgets/Icons/pqGlyph.svg"/>
+    <Proxy group="filters" name="NewGlyph" icon=":/pqWidgets/Icons/pqGlyph.svg"/>
+    <Proxy group="filters" name="StreamTracer" icon=":/pqWidgets/Icons/pqStreamTracer.svg"/>
+    <Proxy group="filters" name="WarpVector" icon=":/pqWidgets/Icons/pqWarp.svg"/>
+    <Proxy group="filters" name="GroupDataSets" icon=":/pqWidgets/Icons/pqGroup.svg"/>
+    <Proxy group="filters" name="ExtractHierarchicalLevel" icon=":/pqWidgets/Icons/pqGroupExtract.svg"/>
+  </Category>
+
+  <Category name="CosmoTools" menu_label="&amp;CosmoTools" show_in_toolbar="0">
+    <Proxy group="filters" name="ANLHaloFinder" />
+    <Proxy group="filters" name="ANLSubhaloFinder" />
+    <Proxy group="filters" name="LANLHaloFinder" />
+    <Proxy group="filters" name="MinkowskiFilter" />
+    <Proxy group="filters" name="PMergeConnected" />
+  </Category>
+
+  <Category name="DataAnalysis" menu_label="&amp;Data Analysis" show_in_toolbar="1" hide_for_tests="1">
+    <Proxy group="filters" name="Calculator"
+            icon=":/pqWidgets/Icons/pqCalculator.svg" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="ExtractSelection"
+            icon=":/pqWidgets/Icons/pqExtractSelection.svg" />
+    <Proxy group="filters" name="ExtractSelectionOverTime"
+            icon=":/pqWidgets/Icons/pqPlotSelectionOverTime.svg" />
+    <Proxy group="filters" name="ExtractHistogram"
+            icon=":/pqWidgets/Icons/pqHistogram24.png" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="IntegrateAttributes" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="ExtractFieldDataOverTime"
+            icon=":/pqWidgets/Icons/pqPlotGlobalOverTime.svg" />
+    <Proxy group="filters" name="ProbeLine"
+            icon=":/pqWidgets/Icons/pqPlotOverLine.svg" />
+    <Proxy group="filters" name="ProbePoint"
+            icon=":/pqWidgets/Icons/pqProbeLocation.svg" />
+    <Proxy group="filters" name="PlotAttributes" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="PlotOnSortedLines" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="PlotOnIntersectionCurves" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="ProgrammableFilter"
+            icon=":/pqWidgets/Icons/pqProgrammableFilter24.png" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="TransposeTable" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="ComputeQuartiles"
+            icon=":/pqWidgets/Icons/pqBoxChart16.png" omit_from_toolbar="1"/>
+    <Proxy group="filters" name="ExtractLocation" omit_from_toolbar="1" />
+    <Proxy group="filters" name="PlotDataOverTime" omit_from_toolbar="1" />
+  </Category>
+
+  <Category name="Hyper Tree Grid" menu_label="&amp;Hyper Tree Grid">
+    <Proxy group="filters" name="Clip" icon=":/pqWidgets/Icons/pqClip.svg"/>
+    <Proxy group="filters" name="Cut" icon=":/pqWidgets/Icons/pqSlice.svg"/>
+    <Proxy group="filters" name="HyperTreeGridAxisReflection" />
+    <Proxy group="filters" name="HyperTreeGridCellCenters" />
+    <Proxy group="filters" name="Contour" icon=":/pqWidgets/Icons/pqIsosurface.svg"/>
+    <Proxy group="filters" name="HyperTreeGridDepthLimiter" />
+    <Proxy group="filters" name="GroupDataSets" icon=":/pqWidgets/Icons/pqGroup.svg"/>
+    <Proxy group="filters" name="HyperTreeGridGhostCellsGenerator" />
+    <Proxy group="filters" name="Threshold" icon=":/pqWidgets/Icons/pqThreshold.svg"/>
+    <Proxy group="filters" name="HyperTreeGridToDualGrid" />
+    <Proxy group="filters" name="HyperTreeGridToUnstructuredGrid" />
+  </Category>
+
+  <Category name="Statistics" menu_label="&amp;Statistics">
+    <Proxy group="filters" name="ContingencyStatistics"/>
+    <Proxy group="filters" name="DescriptiveStatistics"/>
+    <Proxy group="filters" name="KMeans"/>
+    <Proxy group="filters" name="MulticorrelativeStatistics"/>
+    <Proxy group="filters" name="PCAStatistics"/>
+  </Category>
+
+  <Category name="Temporal" menu_label="&amp;Temporal">
+    <Proxy group="filters" name="ExtractTimeSteps" />
+    <Proxy group="filters" name="GroupTimeSteps" />
+    <Proxy group="filters" name="ParticlePath" />
+    <Proxy group="filters" name="ParticleTracer" />
+    <Proxy group="filters" name="StreakLine" />
+    <Proxy group="filters" name="SynchronizeTime" />
+    <Proxy group="filters" name="TemporalCache" />
+    <Proxy group="filters" name="TemporalInterpolator" />
+    <Proxy group="filters" name="TemporalShiftScale" />
+    <Proxy group="filters" name="TemporalSnapToTimeStep" />
+    <Proxy group="filters" name="TemporalStatistics" />
+    <Proxy group="filters" name="TimeStepProgressFilter" />
+    <Proxy group="filters" name="TimeToTextConvertor" />
+  </Category>
+
+  <Category name="Material Analysis" menu_label="&amp;Material Analysis">
+    <Proxy group="filters" name="MaterialInterfaceFilter" />
+    <Proxy group="filters" name="IntersectFragments" />
+  </Category>
+
+  <Category name="CTH" menu_label="&amp;CTH">
+    <Proxy group="filters" name="CTHFragmentConnect"/>
+    <Proxy group="filters" name="CTHFragmentIntersect"/>
+    <Proxy group="filters" name="CTHPart" />
+    <Proxy group="filters" name="NonOverlappingLevelIdScalars" />
+    <Proxy group="filters" name="MaterialInterfaceFilter" />
+    <Proxy group="filters" name="AMRDualClip" />
+    <Proxy group="filters" name="AMRDualContour" />
+    <Proxy group="filters" name="AMRConnectivity" />
+    <Proxy group="filters" name="AMRFragmentIntegration" />
+    <Proxy group="filters" name="AMRFragmentsFilter"/>
+    <Proxy group="filters" name="ExtractHierarchicalLevel" />
+    <Proxy group="filters" name="ExtractHierarchicalDataSets" />
+  </Category>
+
+  <Category name="AMR" menu_label="&amp;AMR">
+    <Proxy group="filters" name="AMRDualMeshExtractor" />
+    <Proxy group="filters" name="AMRResampleFilter" />
+    <Proxy group="filters" name="AMRSlice" />
+    <Proxy group="filters" name="AMRToMultiBlock" />
+    <Proxy group="filters" name="AMRCutPlane" />
+    <Proxy group="filters" name="OverlappingLevelIdScalars" />
+    <Proxy group="filters" name="ExtractHierarchicalLevel" />
+    <Proxy group="filters" name="ExtractHierarchicalDataSets" />
+  </Category>
+
+  <Category name="Quadrature Points" menu_label="&amp;Quadrature Points">
+    <Proxy group="filters" name="QuadraturePointInterpolator" />
+    <Proxy group="filters" name="QuadraturePointsGenerator" />
+    <Proxy group="filters" name="QuadraturePointStatistics" />
+    <Proxy group="filters" name="QuadratureSchemeDictionaryGenerator" />
+  </Category>
+
+  <Category name="Annotation" menu_label="Annotation">
+    <Proxy group="filters" name="AnnotateGlobalData" />
+    <Proxy group="filters" name="AnnotateAttributeData" />
+    <Proxy group="filters" name="PythonAnnotation" />
+    <Proxy group="filters" name="TimeToTextConvertor" />
+    <Proxy group="filters" name="TimeStepProgressFilter" />
+    <Proxy group="filters" name="DataSetRegionSurfaceFilter" />
+    <Proxy group="filters" name="EnvironmentAnnotation" />
+  </Category>
+
+  <Category name="Point Interpolation" menu_label="Point Interpolation">
+    <Proxy group="filters" name="PointLineInterpolator" />
+    <Proxy group="filters" name="PointPlaneInterpolator" />
+    <Proxy group="filters" name="PointVolumeInterpolator" />
+    <Proxy group="filters" name="PointDatasetInterpolator" />
+    <Proxy group="filters" name="SPHLineInterpolator" />
+    <Proxy group="filters" name="SPHPlaneInterpolator" />
+    <Proxy group="filters" name="SPHVolumeInterpolator" />
+    <Proxy group="filters" name="SPHDatasetInterpolator" />
+  </Category>
+
+  <Category name="Chemistry" menu_label="Chemistry">
+    <Proxy group="filters" name="AppendMolecule"/>
+    <Proxy group="filters" name="ComputeMoleculeBonds"/>
+    <Proxy group="filters" name="MoleculeToLines"/>
+    <Proxy group="filters" name="PointSetToMolecule"/>
+  </Category>
+
+  <Proxy group="filters" name="AggregateDataSet" />
+  <Proxy group="filters" name="AppendArcLength" />
+  <Proxy group="filters" name="AddFieldArrays" />
+  <Proxy group="filters" name="ImageDataToAMR" />
+  <Proxy group="filters" name="UniformGridPartitioner" />
+  <Proxy group="filters" name="Append" />
+  <Proxy group="filters" name="AppendAttributes" />
+  <Proxy group="filters" name="AppendLocationAttributes" />
+  <Proxy group="filters" name="AppendPolyData" />
+  <Proxy group="filters" name="AppendReductionFilter" />
+  <Proxy group="filters" name="AngularPeriodicFilter" />
+  <Proxy group="filters" name="ArbitrarySourceStreamTracer" />
+  <Proxy group="filters" name="BlockIdScalars" />
+  <Proxy group="filters" name="RandomAttributeGenerator" />
+  <Proxy group="filters" name="BrownianPoints" />
+  <Proxy group="filters" name="Calculator" />
+  <Proxy group="filters" name="CellCenters" />
+  <Proxy group="filters" name="CellDataToPointData" />
+  <Proxy group="filters" name="CellDerivatives"/>
+  <Proxy group="filters" name="CellSize" />
+  <Proxy group="filters" name="CleanPolyData" />
+  <Proxy group="filters" name="CleanUnstructuredGrid" />
+  <Proxy group="filters" name="CleanUnstructuredGridCells" />
+  <Proxy group="filters" name="Clip" />
+  <Proxy group="filters" name="ClipClosedSurface" />
+  <Proxy group="filters" name="Contour" />
+  <Proxy group="filters" name="CountCellFaces" />
+  <Proxy group="filters" name="CountCellVertices" />
+  <Proxy group="filters" name="Curvatures" />
+  <Proxy group="filters" name="Cut" />
+  <Proxy group="filters" name="CutEverything" />
+  <Proxy group="filters" name="D3" />
+  <Proxy group="filters" name="DataSetSurfaceFilter" />
+  <Proxy group="filters" name="DataSetRegionSurfaceFilter" />
+  <Proxy group="filters" name="DataSetTriangleFilter" />
+  <Proxy group="filters" name="DateToNumeric" />
+  <Proxy group="filters" name="DecimatePro" />
+  <Proxy group="filters" name="DecimatePolyline" />
+  <Proxy group="filters" name="Delaunay2D" />
+  <Proxy group="filters" name="Delaunay3D" />
+  <Proxy group="filters" name="DistributePoints"/>
+  <Proxy group="filters" name="ElevationFilter" />
+  <Proxy group="filters" name="EvenlySpacedStreamlines2D" />
+  <Proxy group="filters" name="ExtractBlock" />
+  <Proxy group="filters" name="ExtractComponent" />
+  <Proxy group="filters" name="ExtractEdges" />
+  <Proxy group="filters" name="ExtractEnclosedPoints" />
+  <Proxy group="filters" name="ExtractGeometry" />
+  <Proxy group="filters" name="ExtractGrid" />
+  <Proxy group="filters" name="ExtractHistogram" />
+  <Proxy group="filters" name="ExtractSelection" />
+  <Proxy group="filters" name="ExtractSelectionOverTime" />
+  <Proxy group="filters" name="ExtractSubsetWithSeed" />
+  <Proxy group="filters" name="PlotDataOverTime" />
+  <Proxy group="filters" name="FeatureEdges" />
+  <Proxy group="filters" name="FFTSelectionOverTime" />
+  <Proxy group="filters" name="GaussianSplatter"/>
+  <Proxy group="filters" name="GenerateIdScalars"/>
+  <Proxy group="filters" name="GenerateGlobalIds"/>
+  <Proxy group="filters" name="GhostCellsGenerator" />
+  <Proxy group="filters" name="Glyph" />
+  <Proxy group="filters" name="NewGlyph" />
+  <Proxy group="filters" name="GlyphWithCustomSource" icon=":/pqWidgets/Icons/pqGlyph.svg" />
+  <Proxy group="filters" name="Gradient" />
+  <Proxy group="filters" name="GridConnectivity" />
+  <Proxy group="filters" name="GroupDataSets" />
+  <Proxy group="filters" name="ImageDataToAMR" />
+  <Proxy group="filters" name="ImageDataToPointSet" />
+  <Proxy group="filters" name="ImageDataToUniformGrid" />
+  <Proxy group="filters" name="IntegrateAttributes" />
+  <Proxy group="filters" name="IntegrateFlowThroughSurface" />
+  <!--  <Proxy group="filters" name="LevelIdScalars" /> -->
+  <Proxy group="filters" name="LinearExtrusionFilter" />
+  <Proxy group="filters" name="LinearCellExtrusionFilter" />
+  <Proxy group="filters" name="LoopSubdivisionFilter" />
+  <Proxy group="filters" name="MaskPoints" />
+  <Proxy group="filters" name="Median" />
+  <Proxy group="filters" name="MergeBlocks" />
+  <Proxy group="filters" name="MeshQuality" />
+  <Proxy group="filters" name="OTKernelSmoothing" />
+  <Proxy group="filters" name="OTDensityMap" />
+  <Proxy group="filters" name="OutlineCornerFilter" />
+  <Proxy group="filters" name="OutlineFilter" />
+  <Proxy group="filters" name="ParticlePathLines" />
+  <Proxy group="filters" name="ParticleTracer" />
+  <Proxy group="filters" name="PassArrays" />
+  <Proxy group="filters" name="PlotAttributes" />
+  <Proxy group="filters" name="PlotOnIntersectionCurves" />
+  <Proxy group="filters" name="PlotOnSortedLines" />
+  <Proxy group="filters" name="PointDataToCellData" />
+  <Proxy group="filters" name="PolyDataNormals" />
+  <Proxy group="filters" name="PolyDataTangents" />
+  <Proxy group="filters" name="ProbeLine" />
+  <Proxy group="filters" name="ProbePoint" />
+  <Proxy group="filters" name="ProcessIdScalars" />
+  <Proxy group="filters" name="ProgrammableFilter" />
+  <Proxy group="filters" name="PVConnectivityFilter" />
+  <Proxy group="filters" name="PythonCalculator" />
+  <Proxy group="filters" name="PythonExtractSelection" />
+
+  <Proxy group="filters" name="QuadricClustering" />
+  <Proxy group="filters" name="RectilinearGridConnectivity" />
+  <Proxy group="filters" name="RectilinearGridToPointSet" />
+  <Proxy group="filters" name="RedistributeDataSet" />
+  <Proxy group="filters" name="ReflectionFilter" />
+  <Proxy group="filters" name="RemoveGhostInformation" />
+  <Proxy group="filters" name="ResampleToImage" />
+  <Proxy group="filters" name="ResampleWithDataset" />
+  <Proxy group="filters" name="RibbonFilter" />
+  <Proxy group="filters" name="RotationalExtrusionFilter" />
+  <Proxy group="filters" name="ScatterPlot"/>
+  <Proxy group="filters" name="ShrinkFilter" />
+  <Proxy group="filters" name="SmoothPolyDataFilter" />
+  <Proxy group="filters" name="StreamTracer" />
+  <Proxy group="filters" name="Stripper" />
+  <Proxy group="filters" name="StructuredGridOutlineFilter" />
+  <Proxy group="filters" name="Subdivide" />
+  <Proxy group="filters" name="SurfaceVectors" />
+  <Proxy group="filters" name="TemporalCache" />
+  <Proxy group="filters" name="TemporalInterpolator" />
+  <Proxy group="filters" name="TemporalSnapToTimeStep" />
+  <Proxy group="filters" name="TemporalShiftScale" />
+  <Proxy group="filters" name="TemporalStatistics" />
+  <Proxy group="filters" name="TensorGlyph" />
+  <Proxy group="filters" name="TessellatorFilter" />
+  <Proxy group="filters" name="TextureMapToCylinder" />
+  <Proxy group="filters" name="TextureMapToPlane" />
+  <Proxy group="filters" name="TextureMapToSphere" />
+  <Proxy group="filters" name="Threshold" />
+  <Proxy group="filters" name="TransformFilter" />
+  <Proxy group="filters" name="TriangleFilter" />
+  <Proxy group="filters" name="TubeFilter" />
+  <Proxy group="filters" name="UnstructuredGradient" />
+  <Proxy group="filters" name="ValidateCells" />
+  <Proxy group="filters" name="WarpScalar" />
+  <Proxy group="filters" name="WarpVector" />
+  <Proxy group="filters" name="YoungsMaterialInterface"/>
+  <Proxy group="filters" name="NormalGlyphs" />
+  <Proxy group="filters" name="TableToPolyData" />
+  <Proxy group="filters" name="TableToStructuredGrid" />
+  <Proxy group="filters" name="IsoVolume" />
+
+  <Proxy group="filters" name="GenericClip" />
+  <Proxy group="filters" name="GenericContour" />
+  <Proxy group="filters" name="GenericCut" />
+  <Proxy group="filters" name="GenericStreamTracer" />
+  <Proxy group="filters" name="GenericGeometryFilter" />
+  <Proxy group="filters" name="SliceAlongPolyLine" />
+  <Proxy group="filters" name="SliceWithPlane" />
+  <Proxy group="filters" name="RulerFilter" icon=":/pqWidgets/Icons/pqRuler.png"/>
+  <Proxy group="filters" name="OMETIFFChannelCalculator" />
+</ParaViewFilters>
diff --git a/src/PV3DViewer/resources/ParaViewReaders.xml b/src/PV3DViewer/resources/ParaViewReaders.xml
new file mode 100644 (file)
index 0000000..dd88e53
--- /dev/null
@@ -0,0 +1,78 @@
+<ParaViewReaders>
+  <!--
+    NOTE: Readers are tried in reverse order that they are present in this
+    list i.e. if two readers can read the same extension, then the reader
+    apperaring later will be tried first when reading the file.
+  -->
+  <ProxyManager type="reader" />
+  <Proxy group="sources" name="LSDynaReader" />
+  <Proxy group="sources" name="PVDReader" />
+  <Proxy group="sources" name="XMLHierarchicalBoxDataReader" />
+  <Proxy group="sources" name="XMLPolyDataReader"/>
+  <Proxy group="sources" name="XMLUnstructuredGridReader" />
+  <Proxy group="sources" name="XMLImageDataReader" />
+  <Proxy group="sources" name="XMLStructuredGridReader" />
+  <Proxy group="sources" name="XMLRectilinearGridReader" />
+  <Proxy group="sources" name="XMLPPolyDataReader" />
+  <Proxy group="sources" name="XMLPUnstructuredGridReader" />
+  <Proxy group="sources" name="XMLPImageDataReader" />
+  <Proxy group="sources" name="XMLPStructuredGridReader" />
+  <Proxy group="sources" name="XMLPRectilinearGridReader" />
+  <Proxy group="sources" name="XMLMultiBlockDataReader" />
+  <Proxy group="sources" name="XMLUniformGridAMRReader" />
+  <Proxy group="sources" name="LegacyVTKFileReader" />
+  <Proxy group="sources" name="pvtkfile" />
+  <Proxy group="sources" name="ensight" />
+  <Proxy group="sources" name="ensightMS" />
+  <Proxy group="sources" name="TecplotReader" />
+  <Proxy group="sources" name="netCDFReader" />
+  <Proxy group="sources" name="byureader" />
+  <Proxy group="sources" name="objreader" />
+  <Proxy group="sources" name="ProStarReader" />
+  <Proxy group="sources" name="XdmfReader" />
+  <Proxy group="sources" name="pdbreader" />
+  <Proxy group="sources" name="xyzreader" />
+  <Proxy group="sources" name="P3DReader" />
+  <Proxy group="sources" name="spcthreader" />
+  <Proxy group="sources" name="SPCTHRestartReader" />
+  <Proxy group="sources" name="spcthhistoryreader" />
+  <Proxy group="sources" name="DEMReader" />
+  <Proxy group="sources" name="vrmlreader" />
+  <Proxy group="sources" name="plyreader" />
+  <Proxy group="sources" name="stlreader" />
+  <Proxy group="sources" name="gaussiancubereader" />
+  <Proxy group="sources" name="ImageReader" />
+  <Proxy group="sources" name="popreader"/>
+  <Proxy group="sources" name="AVSucdSeriesReader" />
+  <Proxy group="sources" name="MetaImageReader" />
+  <Proxy group="sources" name="NrrdReader" />
+  <Proxy group="sources" name="FacetReader" />
+  <Proxy group="sources" name="PNGSeriesReader" />
+  <Proxy group="sources" name="JPEGSeriesReader" />
+  <Proxy group="sources" name="TIFFSeriesReader" />
+  <Proxy group="sources" name="PhastaReader" />
+  <Proxy group="sources" name="EnzoReader" />
+  <Proxy group="sources" name="FlashReader" />
+  <Proxy group="sources" name="SESAMEReader" />
+  <Proxy group="sources" name="CSVReader" />
+  <Proxy group="sources" name="MFIXReader" />
+  <Proxy group="sources" name="FLUENTReader" />
+  <Proxy group="sources" name="OpenFOAMReader" />
+  <Proxy group="sources" name="CosmoReader" />
+  <Proxy group="sources" name="SiloReader"/>
+  <Proxy group="sources" name="ExodusIIReader" />
+  <Proxy group="sources" name="ExodusRestartReader" />
+  <Proxy group="sources" name="SLACReader" />
+  <Proxy group="sources" name="SLACParticleReader" />
+  <Proxy group="sources" name="ParticleReader" />
+  <Proxy group="sources" name="VPICReader" />
+  <Proxy group="sources" name="WindBladeReader" />
+  <Proxy group="sources" name="NetCDFCAMReader" />
+  <Proxy group="sources" name="NetCDFPOPReader" />
+  <Proxy group="sources" name="UnstructuredPOPReader" />
+  <Proxy group="sources" name="PNetCDFPOPReader" />
+  <Proxy group="sources" name="MPASReader" />
+  <Proxy group="sources" name="EnzoParticlesReader" />
+  <Proxy group="sources" name="FlashParticlesReader" />
+  <Proxy group="sources" name="CMLMoleculeReader"/>
+</ParaViewReaders>
diff --git a/src/PV3DViewer/resources/ParaViewSources.xml b/src/PV3DViewer/resources/ParaViewSources.xml
new file mode 100644 (file)
index 0000000..f89f10e
--- /dev/null
@@ -0,0 +1,48 @@
+<ParaViewSources>
+  <Category name="Annotation" menu_label="&amp;Annotation" preserve_order="1"
+    show_in_toolbar="0">
+    <Proxy group="sources" name="VectorText" />
+    <Proxy group="sources" name="TimeToTextConvertorSource" />
+    <Proxy group="sources" name="ArrowSource" />
+    <Proxy group="sources" name="LogoSource" />
+    <Proxy group="sources" name="TextSource" />
+  </Category>
+  <Category name="DataObjects" menu_label="&amp;Data Objects" preserve_order="1"
+    show_in_toolbar="0">
+    <Proxy group="sources" name="AMRGaussianPulseSource" />
+    <Proxy group="sources" name="DataObjectGenerator" />
+    <Proxy group="sources" name="FastUniformGrid" />
+    <Proxy group="sources" name="HierarchicalFractal" />
+    <Proxy group="sources" name="HyperTreeGridSource" />
+    <Proxy group="sources" name="ImageMandelbrotSource" />
+    <Proxy group="sources" name="LiveProgrammableSource" />
+    <Proxy group="sources" name="RandomHyperTreeGridSource" />
+    <Proxy group="sources" name="RTAnalyticSource" />
+  </Category>
+  <Category name="GeometricShapes" menu_label="&amp;Geometric Shapes" preserve_order="1"
+    show_in_toolbar="1">
+    <Proxy group="sources" name="CubeSource" />
+    <Proxy group="sources" name="ConeSource" />
+    <Proxy group="sources" name="CylinderSource" />
+    <Proxy group="sources" name="DiskSource" />
+    <Proxy group="sources" name="EllipseSource" />
+    <Proxy group="sources" name="LineSource" />
+    <Proxy group="sources" name="OutlineSource" />
+    <Proxy group="sources" name="PlaneSource" />
+    <Proxy group="sources" name="PointSource" />
+    <Proxy group="sources" name="PolyLineSource" />
+    <Proxy group="sources" name="PolyPointSource" />
+    <Proxy group="sources" name="SphereSource" />
+    <Proxy group="sources" name="SplineSource" />
+    <Proxy group="sources" name="SuperquadricSource" />
+  </Category>
+  <Category name="MeasurementTools" menu_label="&amp;Measurement Tools" preserve_order="1"
+    show_in_toolbar="1">
+    <Proxy group="sources" name="Axes" omit_from_toolbar="1" icon=":/pqWidgets/Icons/pqAxes.png"/>
+    <Proxy group="sources" name="Ruler" icon=":/pqWidgets/Icons/pqRuler.png"/>
+  </Category>
+  <Proxy group="sources" name="GlyphSource2D" />
+  <Proxy group="sources" name="ProgrammableSource" />
+  <Proxy group="sources" name="TimeSource" />
+  <Proxy group="sources" name="UnstructuredCellTypes" />
+</ParaViewSources>
diff --git a/src/PV3DViewer/resources/ParaViewWriters.xml b/src/PV3DViewer/resources/ParaViewWriters.xml
new file mode 100644 (file)
index 0000000..db7fd3e
--- /dev/null
@@ -0,0 +1,28 @@
+<ParaViewWriters>
+  <ProxyManager type="writer" />
+  <Proxy group="writers" name="XMLPVDWriter" />
+  <Proxy group="writers" name="XMLHyperOctreeWriter" />
+  <Proxy group="writers" name="XMLPolyDataWriter" />
+  <Proxy group="writers" name="XMLUnstructuredGridWriter" />
+  <Proxy group="writers" name="XMLStructuredGridWriter" />
+  <Proxy group="writers" name="XMLRectilinearGridWriter" />
+  <Proxy group="writers" name="XMLImageDataWriter" />
+  <Proxy group="writers" name="XMLPPolyDataWriter" />
+  <Proxy group="writers" name="XMLPUnstructuredGridWriter" />
+  <Proxy group="writers" name="XMLPStructuredGridWriter" />
+  <Proxy group="writers" name="XMLPRectilinearGridWriter"/>
+  <Proxy group="writers" name="XMLPImageDataWriter" />
+  <Proxy group="writers" name="XMLMultiBlockDataWriter" />
+  <Proxy group="writers" name="XMLUniformGridAMRWriter" />
+  <Proxy group="writers" name="DataSetWriter" />
+  <Proxy group="writers" name="PDataSetWriter" />
+  <Proxy group="writers" name="PPLYWriter" />
+  <Proxy group="writers" name="PSTLWriter" />
+  <Proxy group="writers" name="MetaImageWriter" />
+  <Proxy group="writers" name="PNGWriter" />
+  <Proxy group="writers" name="XdmfWriter"/>
+  <Proxy group="writers" name="ExodusIIWriter" />
+  <Proxy group="writers" name="EnSightWriter" />
+  <Proxy group="writers" name="CSVWriter" />
+  <Proxy group="writers" name="DataSetCSVWriter" />
+</ParaViewWriters>
diff --git a/src/PV3DViewer/resources/README b/src/PV3DViewer/resources/README
new file mode 100644 (file)
index 0000000..287b0ff
--- /dev/null
@@ -0,0 +1,12 @@
+README
+------
+
+The purpose of the XML files in this folder is the following:
+
+1. ParaViewFilters.xml - this file describes ParaView filters which are available in the SALOME
+2. ParaViewSources.xml - this file describes ParaView sources which are available in the SALOME
+3. ParaViewReaders.xml - deprecated
+4. ParaViewWriters.xml - deprecated
+
+Initially these files are available in the ParaView sources, they ensure proper loading of the ParaView resources such as icons and names of an actions.
+ParaViewFilters.xml and ParaViewSources.xml should be updated during migration to newer ParaView version.
index 6b4205eef762f03cbf0d57a844e7c0bce6c77228..d50b18c5a740d610391364bd815549f503ab0528 100644 (file)
 #include <pqPipelineBrowserWidget.h>
 #include <pqServerDisconnectReaction.h>
 
-
 //---------- Static init -----------------
-pqPVApplicationCore* PVViewer_Core::MyCoreApp = 0;
+pqPVApplicationCore* PVViewer_Core::MyCoreApp = nullptr;
+bool PVViewer_Core::MyPqTabWidSingletonLoaded = false;
 bool PVViewer_Core::ConfigLoaded = false;
-PVViewer_Behaviors * PVViewer_Core::ParaviewBehaviors = NULL;
+PVViewer_Behaviors * PVViewer_Core::ParaviewBehaviors = nullptr;
 
 pqPVApplicationCore * PVViewer_Core::GetPVApplication()
 {
   return MyCoreApp;
 }
 
-/*!
-  \brief Static method, performs initialization of ParaView session.
-  \param fullSetup whether to instanciate all behaviors or just the minimal ones.
-  \return \c true if ParaView has been initialized successfully, otherwise false
-*/
-bool PVViewer_Core::ParaviewInitApp(QMainWindow * /*aDesktop*/)
+bool PVViewer_Core::ParaViewInitAppCore()
 {
   if ( ! MyCoreApp) {
       // Obtain command-line arguments
@@ -99,28 +94,44 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * /*aDesktop*/)
         }
       //
       MyCoreApp = new pqPVApplicationCore (argc, argv);
+      for (int i = 0; i < argc; i++)
+        free(argv[i]);
+      delete[] argv;
       if (MyCoreApp->getOptions()->GetHelpSelected() ||
           MyCoreApp->getOptions()->GetUnknownArgument() ||
           MyCoreApp->getOptions()->GetErrorMessage() ||
           MyCoreApp->getOptions()->GetTellVersion()) {
           return false;
       }
+  }
+  return true;
+}
 
-      // Direct VTK log messages to our SALOME window - TODO: review this
-      PVViewer_OutputWindow * w = PVViewer_OutputWindow::New();
-      vtkOutputWindow::SetInstance(w);
-
-      new pqTabbedMultiViewWidget(); // registers a "MULTIVIEW_WIDGET" on creation
-
-      for (int i = 0; i < argc; i++)
-        free(argv[i]);
-      delete[] argv;
+/*!
+  \brief Static method, performs initialization of ParaView session.
+  \param fullSetup whether to instanciate all behaviors or just the minimal ones.
+  \return \c true if ParaView has been initialized successfully, otherwise false
+*/
+bool PVViewer_Core::ParaviewInitApp()
+{
+  if( ! MyPqTabWidSingletonLoaded )
+  {
+    if( ! ParaViewInitAppCore() )
+      return false;
+
+    // Direct VTK log messages to our SALOME window - TODO: review this
+    PVViewer_OutputWindow * w = PVViewer_OutputWindow::New();
+    vtkOutputWindow::SetInstance(w);
+    pqActiveObjects::instance().setActiveView(nullptr);
+    new pqTabbedMultiViewWidget(); // registers a "MULTIVIEW_WIDGET" on creation
+    // Initialization of ParaView GUI widgets will be done when these widgets are
+    // really needed.
+    // PVViewer_GUIElements* inst = PVViewer_GUIElements::GetInstance(aDesktop);
+    // inst->getPropertiesPanel();
+    PVViewer_Core::MyPqTabWidSingletonLoaded = true;
+    return true;
   }
-   // Initialization of ParaView GUI widgets will be done when these widgets are
-   // really needed.
-   // PVViewer_GUIElements* inst = PVViewer_GUIElements::GetInstance(aDesktop);
-   // inst->getPropertiesPanel();
-   return true;
+  return true;
 }
 
 void PVViewer_Core::ParaviewInitBehaviors(bool fullSetup, QMainWindow* aDesktop)
index 9d56dfda96d3014b34b78b4d07f5dae64e6ec7d6..369c1a957966e18c2180c663f8e9fdda1552ff7c 100644 (file)
@@ -38,9 +38,11 @@ class PVVIEWER_EXPORT PVViewer_Core
 {
 public:
   static pqPVApplicationCore* GetPVApplication();
+  static bool ParaViewInitAppCore();
+  static pqPVApplicationCore *GetPVAppCore() { return MyCoreApp; }
 
   //! Initialize ParaView if not yet done (once per session)
-  static bool ParaviewInitApp(QMainWindow*);
+  static bool ParaviewInitApp();
   static void ParaviewInitBehaviors(bool = false, QMainWindow* = 0);
   static void ParaviewLoadConfigurations(const QString&, bool = false);
   static void ParaviewCleanup();
@@ -50,6 +52,7 @@ private:
   virtual ~PVViewer_Core(){};
 
   static pqPVApplicationCore* MyCoreApp;
+  static bool MyPqTabWidSingletonLoaded;
   static bool ConfigLoaded;
   static PVViewer_Behaviors* ParaviewBehaviors;
 };
index 057354cba19eea4412b76b21a712f8094a86e84e..4958535f1b8ae757e57ff88b4246515cc97b680a 100644 (file)
@@ -257,7 +257,7 @@ void PVViewer_GUIElements::buildPVWidgets()
 }
 
 void PVViewer_GUIElements::setToolBarVisible(bool show)
-{  
+{
   QCoreApplication::processEvents();
   if (!myPVWidgetsFlag)
     return;
index ea138dbaa3adb06c3eb79cfc92176f062d8ecf2f..c401af3924d9c73da6ebbe577ef886b36cdf1309 100644 (file)
@@ -28,7 +28,7 @@ void PVViewer_InitSingleton::Init(QMainWindow* desktop)
 {
   if(IS_INIT)
     return ;
-  PVViewer_Core::ParaviewInitApp(desktop);
+  PVViewer_Core::ParaviewInitApp();
   // Finish ParaView set up: behaviors, connection and configurations.
   const QString configPath(PVViewer_ViewManager::GetPVConfigPath());
   PVViewer_Core::ParaviewInitBehaviors(true, desktop);
index 55cc5e447bc272f70d002a5ee0c74ee2346f9feb..d5b136c80ef1bc6e38bf6ed902ba4ddb097f9ae0 100644 (file)
@@ -39,4 +39,3 @@ SUIT_ViewWindow* PVViewer_Viewer::createView(SUIT_Desktop* desktop)
 {
   return new PVViewer_ViewWindow(desktop, this);
 }
-
index 0f860d8e902298c986c88bd1f9021fd14a7323bc..cd8ed9ebc388bc14eda22c124adb89bbb8b13100 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <pqTabbedMultiViewWidget.h>
 #include <pqApplicationCore.h>
-
+#include "pqActiveObjects.h"
 
 /*!
   \class PVViewer_ViewWindow
@@ -50,6 +50,7 @@ PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Vie
   myDesktop = theDesktop;
   myModel = theModel;
   setViewManager(myModel->getViewManager());
+  pqActiveObjects::instance().setActiveView(nullptr);
   myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
   if (myPVMgr) {
     SUIT_Application* app = SUIT_Session::session()->activeApplication();
@@ -109,7 +110,6 @@ void PVViewer_ViewWindow::setVisualParameters( const QString& parameters )
   SUIT_ViewWindow::setVisualParameters( parameters );
 }
 
-
 /*!
   \brief Returns the ParaView multi-view manager previously set with setMultiViewManager()
 */
index 15385f3466b3d5031c2e187dd77d950260c1e980..681cb70688a2f879fc072440e34e61d3f4481958 100644 (file)
@@ -187,6 +187,80 @@ void SALOME_VTKPrs::Update( SALOME_Displayer* d )
   if ( d ) d->Update( this );
 }
 
+/*!
+  Dispatches display operation to proper Display() method of SALOME_View
+*/
+void SALOME_PV3DPrs::DisplayIn( SALOME_View* v ) const
+{
+  if ( v ) v->Display( this );
+}
+
+/*!
+  Dispatches display operation to proper Erase() method of SALOME_View
+*/
+void SALOME_PV3DPrs::EraseIn( SALOME_View* v, const bool forced ) const
+{
+  if ( v ) v->Erase( this, forced );
+}
+
+/*!
+  Dispatches display operation to proper BeforeDisplay() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->BeforeDisplay( v, this );
+}
+
+/*!
+  Dispatches display operation to proper AfterDisplay() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->AfterDisplay( v, this );
+}
+
+/*!
+  Dispatches display operation to proper BeforeErase() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->BeforeErase( v, this );
+}
+
+/*!
+  Dispatches display operation to proper AfterErase() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->AfterErase( v, this );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_PV3DPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+  std::list<int> modes;
+  modes.push_back( mode );
+  LocalSelectionIn( v, modes );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_PV3DPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
+{
+  if ( v && !modes.empty() ) v->LocalSelection( this, modes );
+}
+
+/*!
+   Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::Update( SALOME_Displayer* d )
+{
+  if ( d ) d->Update( this );
+}
+
 /*!
   Dispatches display operation to proper Display() method of SALOME_View
 */
@@ -303,6 +377,14 @@ void SALOME_View::Display( const SALOME_VTKPrs* )
 //  MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Display( const SALOME_PV3DPrs* )
+{
+//  MESSAGE( "SALOME_View::Display( const SALOME_PV3DPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -327,6 +409,14 @@ void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
 //  MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Erase( const SALOME_PV3DPrs*, const bool )
+{
+//  MESSAGE( "SALOME_View::Erase( const SALOME_PV3DPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -371,6 +461,15 @@ void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
 //   Probably, selection is being activated in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::LocalSelection( const SALOME_PV3DPrs*, const int )
+{
+//  MESSAGE( "SALOME_View::LocalSelection( const SALOME_PV3DPrs* ) called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -433,6 +532,14 @@ void SALOME_Displayer::Update( SALOME_VTKPrs* )
 //  MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_Displayer::Update( SALOME_PV3DPrs* )
+{
+//  MESSAGE( "SALOME_Displayer::Update( SALOME_PV3DPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
index 8f7e5ad9fb1707ca911a3279163d3ecd54ebc2dc..72d349f3b41f7d95aba107facac11affc2ca391a 100644 (file)
@@ -194,6 +194,51 @@ public:
   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
 };
 
+/*!
+ \class SALOME_PV3DPrs
+ Base class for PV3D graphic object (pqPipelineSource) wrappers.
+ This intermediate class is necessary to avoid dependencies from ParaView libs.
+*/
+
+class PRS_EXPORT SALOME_PV3DPrs : public SALOME_Prs
+{
+public:
+  //! Constructor
+  explicit SALOME_PV3DPrs(const char* e) : SALOME_Prs(e) {}
+
+  //! It uses double dispatch in order to
+  //! invoke Display() method corresponding to the actual type of presentation.
+  virtual void DisplayIn( SALOME_View* ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke Erase() method corresponding to the actual type of presentation.
+  virtual void EraseIn( SALOME_View*, const bool = false ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke BeforeDisplayIn() method corresponding to the actual type of presentation.
+  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke AfterDisplayIn() method corresponding to the actual type of presentation.
+  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke BeforeEraseIn() method corresponding to the actual type of presentation.
+  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke AfterEraseIn() method corresponding to the actual type of presentation.
+  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke Update() method corresponding to the actual type of presentation.
+  virtual void Update( SALOME_Displayer* );
+
+  //! Key method for double dispatch of activation of sub-shapes selection
+  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+  virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
+};
+
 /*!
  \class SALOME_Prs2d
  Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
@@ -274,12 +319,14 @@ public:
   // Display() methods for ALL kinds of presentation should appear here
   virtual void Display( const SALOME_OCCPrs* );//!< Display SALOME_OCCPrs presentation.
   virtual void Display( const SALOME_VTKPrs* );//!< Display SALOME_VTKPrs presentation.
+  virtual void Display( const SALOME_PV3DPrs* );//!< Display SALOME_PV3DPrs presentation.
   virtual void Display( const SALOME_Prs2d*  );//!< Display SALOME_Prs2d  presentation.
   // Add new Display() methods here...
 
   // Erase() methods for ALL kinds of presentation should appear here
   virtual void Erase( const SALOME_OCCPrs*, const bool = false );//!< Erase SALOME_OCCPrs
   virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
+  virtual void Erase( const SALOME_PV3DPrs*, const bool = false );//!< Erase SALOME_PV3DPrs
   virtual void Erase( const SALOME_Prs2d*,  const bool = false );//!< Erase SALOME_Prs2d
   // Add new Erase() methods here...
 
@@ -287,12 +334,13 @@ public:
   virtual void LocalSelection( const SALOME_OCCPrs*, const int );           //!< Local selection SALOME_OCCPrs
   virtual void LocalSelection( const SALOME_OCCPrs*, const std::list<int> );//!< Multiple local selection SALOME_OCCPrs
   virtual void LocalSelection( const SALOME_VTKPrs*, const int );           //!< Local selection SALOME_VTKPrs
+  virtual void LocalSelection( const SALOME_PV3DPrs*, const int );          //!< Local selection SALOME_PV3DPrs
   virtual void LocalSelection( const SALOME_Prs2d* , const int );           //!< Local selection SALOME_Prs2d
 
   //! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
   virtual void GlobalSelection( const bool = false ) const;
 
-  //! Creates empty presenation of corresponding type
+  //! Creates empty presentation of corresponding type
   virtual SALOME_Prs* CreatePrs( const char* /*entry*/ = 0 ) { return 0; }
 
   // Axiluary methods called before and after displaying of objects
@@ -330,26 +378,31 @@ public:
   // Update() methods for ALL kinds of presentation should appear here
   virtual void Update( SALOME_OCCPrs* );//!< Update SALOME_OCCPrs presentation.
   virtual void Update( SALOME_VTKPrs* );//!< Update SALOME_VTKPrs presentation.
+  virtual void Update( SALOME_PV3DPrs* );//!< Update SALOME_PV3DPrs presentation.
   virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
   // Add new Update() methods here...
 
-  // Axiluary methods called before and after displaying of objects
+  // Auxiliary methods called before and after displaying of objects
   virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
   virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
   virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKPrs* ) {} //! Null body here
   virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKPrs* ) {} //! Null body here
+  virtual void BeforeDisplay( SALOME_View*, const SALOME_PV3DPrs* ) {} //! Null body here
+  virtual void AfterDisplay ( SALOME_View*, const SALOME_PV3DPrs* ) {} //! Null body here
   virtual void BeforeDisplay( SALOME_View*, const SALOME_Prs2d*  ) {} //! Null body here
   virtual void AfterDisplay ( SALOME_View*, const SALOME_Prs2d*  ) {} //! Null body here
 
-  // Axiluary methods called before and after erasing of objects
+  // Auxiliary methods called before and after erasing of objects
   virtual void BeforeErase( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
   virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
   virtual void BeforeErase( SALOME_View*, const SALOME_VTKPrs* ) {} //! Null body here
   virtual void AfterErase ( SALOME_View*, const SALOME_VTKPrs* ) {} //! Null body here
+  virtual void BeforeErase( SALOME_View*, const SALOME_PV3DPrs* ) {} //! Null body here
+  virtual void AfterErase ( SALOME_View*, const SALOME_PV3DPrs* ) {} //! Null body here
   virtual void BeforeErase( SALOME_View*, const SALOME_Prs2d*  ) {} //! Null body here
   virtual void AfterErase ( SALOME_View*, const SALOME_Prs2d*  ) {} //! Null body here
 
-  // Axiluary method called to update visibility state of presentation
+  // Auxiliary method called to update visibility state of presentation
   virtual void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
 };
 
index 2a32e0e5e55b6b721fddc107063ef61495fd7135..0e2543505d729061b56a5d6417bd300e984fa1b6 100644 (file)
@@ -52,6 +52,10 @@ IF(SALOME_USE_VTKVIEWER)
   INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/VTKViewer)
   INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/SVTK)  
 ENDIF()
+IF(SALOME_USE_PV3DVIEWER)
+  INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/PV3DViewer)
+  INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/SPV3D)  
+ENDIF()
 IF(SALOME_USE_PVVIEWER)
   INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/PVViewer)
 ENDIF(SALOME_USE_PVVIEWER)
index eea2424635e3c813d78e27a9c751af14ac9b8d1c..2ac40ecd4dcd7298670a1d8c83e8de78a73a2324 100644 (file)
 #include "PVViewer_ViewManager.h"
 #include "PVViewer_ViewModel.h"
 #endif // DISABLE_PVVIEWER
+#ifndef DISABLE_PV3DVIEWER
+#include "PV3DViewer_ViewManager.h"
+#include "PV3DViewer_ViewModel.h"
+#endif // DISABLE_PV3DVIEWER
 #include "QtxActionMenuMgr.h"
 #include "QtxWorkstack.h"
 #include "QtxTreeView.h"
@@ -3450,6 +3454,18 @@ public:
             myResult = true;
           }
 #endif // DISABLE_PVVIEWER
+        }
+        else if ( type == "ParaView3D") {
+#ifndef DISABLE_PV3DVIEWER
+          // specific processing for ParaView3D viewer:
+          // hierarchy of ParaView3D viewer is much more complex than for usual view;
+          // we look for sub-widget named "Viewport"
+          QList<QWidget*> lst = wnd->findChildren<QWidget*>( "Viewport" );
+          if ( !lst.isEmpty() ) {
+            lst[0]->resize( myWndWidth, myWndHeight );
+            myResult = true;
+          }
+#endif // DISABLE_PV3DVIEWER
         }
         else {
           if ( wnd->centralWidget() ) {
index 04818851a0539bf23ccc73032ebebda53bdade5d..7e5d05303575e994e290c765638a4286f431136e 100644 (file)
@@ -33,10 +33,12 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/LightApp
   ${PROJECT_SOURCE_DIR}/src/OBJECT
   ${PROJECT_SOURCE_DIR}/src/OCCViewer
+  ${PROJECT_SOURCE_DIR}/src/PV3DViewer
   ${PROJECT_SOURCE_DIR}/src/Plot2d
   ${PROJECT_SOURCE_DIR}/src/Prs
   ${PROJECT_SOURCE_DIR}/src/Qtx
   ${PROJECT_SOURCE_DIR}/src/SOCC
+  ${PROJECT_SOURCE_DIR}/src/SPV3D
   ${PROJECT_SOURCE_DIR}/src/STD
   ${PROJECT_SOURCE_DIR}/src/SUIT
   ${PROJECT_SOURCE_DIR}/src/SVTK
diff --git a/src/SPV3D/CMakeLists.txt b/src/SPV3D/CMakeLists.txt
new file mode 100644 (file)
index 0000000..423141e
--- /dev/null
@@ -0,0 +1,99 @@
+# Copyright (C) 2023  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(UseQtExt)
+
+# --- options ---
+
+# additional include directories
+INCLUDE_DIRECTORIES(
+  ${OpenCASCADE_INCLUDE_DIR}
+  ${QT_INCLUDES}
+  ${Boost_INCLUDE_DIRS}
+  ${PTHREAD_INCLUDE_DIR}
+  ${PROJECT_SOURCE_DIR}/src/Qtx
+  ${PROJECT_SOURCE_DIR}/src/SUIT
+  ${PROJECT_SOURCE_DIR}/src/OBJECT
+  ${PROJECT_SOURCE_DIR}/src/Prs
+  ${PROJECT_SOURCE_DIR}/src/PV3DViewer
+  ${PROJECT_SOURCE_DIR}/src/PVViewer
+  ${PROJECT_SOURCE_DIR}/src/PVServerService
+)
+
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(${QT_DEFINITIONS} ${OpenCASCADE_DEFINITIONS} ${BOOST_DEFINITIONS})
+
+# libraries to link to
+SET(_link_LIBRARIES 
+  ${QT_LIBRARIES}
+  ${OPENGL_LIBRARIES}
+  ${OpenCASCADE_FoundationClasses_LIBRARIES} ${OpenCASCADE_Visualization_LIBRARIES}
+  ${KERNEL_OpUtil}
+  qtx suit 
+  SalomeObject SalomePrs PV3DViewer PVViewer PVServerService
+  ParaView::pqApplicationComponents
+  ParaView::pqPython
+)
+
+# --- headers ---
+
+# header files / to be processed by moc
+SET(_moc_HEADERS
+   SPV3D_ViewManager.h
+   SPV3D_ViewModel.h
+   SPV3D_ViewWindow.h
+   SPV3D_CADSelection.h
+)
+
+# header files / no moc processing
+SET(_other_HEADERS
+   SPV3D.h
+   SPV3D_Prs.h
+)
+
+# header files / to install
+SET(SPV3D_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
+
+# --- sources ---
+
+# sources / moc wrappings
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS} ${_moc_internal_HEADERS})
+
+# sources / static
+SET(_other_SOURCES
+   SPV3D_Prs.cxx
+   SPV3D_ViewManager.cxx
+   SPV3D_ViewModel.cxx
+   SPV3D_ViewWindow.cxx
+   SPV3D_CADSelection.cxx
+)
+
+# sources / to compile
+SET(SPV3D_SOURCES ${_other_SOURCES} ${_moc_SOURCES})
+
+# --- rules ---
+
+ADD_LIBRARY(SPV3D ${SPV3D_SOURCES})
+TARGET_LINK_LIBRARIES(SPV3D ${_link_LIBRARIES})
+INSTALL(TARGETS SPV3D EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES ${SPV3D_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+# QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+
+INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
diff --git a/src/SPV3D/SPV3D.h b/src/SPV3D/SPV3D.h
new file mode 100644 (file)
index 0000000..64871a4
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SPV3D_H
+#define SPV3D_H
+
+#ifdef WIN32
+#  if defined SPV3D_EXPORTS
+#    define SPV3D_EXPORT __declspec(dllexport)
+#  else
+#   define SPV3D_EXPORT __declspec(dllimport)
+#  endif
+#else
+#  define SPV3D_EXPORT
+#endif
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#pragma warning ( disable: 4786 )
+#endif
+
+#endif
diff --git a/src/SPV3D/SPV3D_CADSelection.cxx b/src/SPV3D/SPV3D_CADSelection.cxx
new file mode 100644 (file)
index 0000000..3433178
--- /dev/null
@@ -0,0 +1,443 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SPV3D_CADSelection.h"
+
+#include <pqActiveObjects.h>
+#include <pqRenderView.h>
+#include <pqUndoStack.h>
+#include <pqCoreUtilities.h>
+
+#include <vtkDataObject.h>
+#include <vtkCollection.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkPVRenderView.h>
+#include <vtkPVDataInformation.h>
+#include <vtkPVArrayInformation.h>
+#include <vtkPVRenderViewSettings.h>
+#include <vtkSMRenderViewProxy.h>
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMSessionProxyManager.h>
+#include <vtkSMStringVectorProperty.h>
+#include <vtkSMRepresentationProxy.h>
+#include <vtkPVDataSetAttributesInformation.h>
+
+//-----------------------------------------------------------------------------
+SPV3D_CADSelection::SPV3D_CADSelection(QObject *parent,
+  pqRenderView* view, SelectionMode mode):QObject(parent)
+{
+  this->View = view;
+  this->Mode = mode;
+  this->PreviousRenderViewMode = -1;
+  this->MousePosition[0] = 0;
+  this->MousePosition[1] = 0;
+  //this->selectionComboBox = comboBox;
+
+  for (size_t i = 0; i < sizeof(this->ObserverIds) / sizeof(this->ObserverIds[0]); ++i)
+  {
+    this->ObserverIds[i] = 0;
+  }
+
+  //QObject::connect(button, SIGNAL(toggled(bool)), this, SLOT(actionTriggered(bool)));
+
+  // if view == nullptr, we track the active view.
+  if (view == nullptr)
+  {
+    QObject::connect(
+      &pqActiveObjects::instance(), SIGNAL(viewChanged(pqView*)), this, SLOT(setView(pqView*)));
+    // this ensure that the enabled-state is set correctly.
+    this->setView(nullptr);
+  }
+
+  this->setRepresentation(nullptr);
+  QObject::connect(&pqActiveObjects::instance(),
+    SIGNAL(representationChanged(pqDataRepresentation*)), this,
+    SLOT(setRepresentation(pqDataRepresentation*)));
+
+  vtkPVRenderViewSettings::GetInstance()->SetEnableFastPreselection(true);
+
+  this->updateEnableState();
+}
+
+//-----------------------------------------------------------------------------
+SPV3D_CADSelection::~SPV3D_CADSelection()
+{
+  this->cleanupObservers();
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::SetMode(const SPV3D_CADSelection::SelectionMode mode)
+{
+  this->Mode = mode;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::updateEnableState()
+{
+  this->endSelection();
+
+  //auto paction = this->parentAction();
+  //bool state = false;
+  if (this->Representation)
+  {
+    vtkSMProxy* proxy = this->Representation->getProxy();
+    vtkSMStringVectorProperty* prop =
+      vtkSMStringVectorProperty::SafeDownCast(proxy->GetProperty("ColorArrayName"));
+    if (prop)
+    {
+      int association = std::atoi(prop->GetElement(3));
+      const char* arrayName = prop->GetElement(4);
+
+      vtkPVDataInformation* dataInfo = this->Representation->getInputDataInformation();
+
+      vtkPVDataSetAttributesInformation* info = nullptr;
+      if (association == vtkDataObject::CELL &&
+        this->Mode == SELECT_FACES)
+      {
+        info = dataInfo->GetCellDataInformation();
+      }
+      if (association == vtkDataObject::POINT &&
+        this->Mode == SELECT_VERTICES)
+      {
+        info = dataInfo->GetPointDataInformation();
+      }
+
+      if (info)
+      {
+        /*vtkPVArrayInformation* arrayInfo = */info->GetArrayInformation(arrayName);
+        //state = arrayInfo && arrayInfo->GetDataType() == VTK_ID_TYPE;
+      }
+    }
+  }
+  //paction->setEnabled(state);
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::actionTriggered(bool val)
+{
+  if (val)
+  {
+    this->beginSelection();
+  }
+  else
+  {
+    this->endSelection();
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::setView(pqView* view)
+{
+  if (this->View != view)
+  {
+    // if we were currently in selection, finish that before changing the view.
+    this->endSelection();
+  }
+
+  this->View = qobject_cast<pqRenderView*>(view);
+
+  // update enable state.
+  //this->parentAction()->setEnabled(this->View != nullptr);
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::setRepresentation(pqDataRepresentation* representation)
+{
+  if (this->Representation != representation)
+  {
+    // if we are currently in selection, finish that before changing the representation.
+    this->endSelection();
+
+    if (this->Representation != nullptr)
+    {
+      QObject::disconnect(this->RepresentationConnection);
+    }
+
+    this->Representation = representation;
+
+    if (this->Representation != nullptr)
+    {
+      this->RepresentationConnection = this->connect(
+        this->Representation, SIGNAL(colorArrayNameModified()), SLOT(updateEnableState()));
+    }
+
+    // update enable state.
+    this->updateEnableState();
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::beginSelection()
+{
+  if (!this->View)
+  {
+    return;
+  }
+
+  //QAction* actn = this->parentAction();
+  //if (actn->isCheckable())
+  {
+    //this->selectionComboBox->setEnabled(false);
+
+    vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+    vtkSMPropertyHelper(rmp, "InteractionMode").Get(&this->PreviousRenderViewMode);
+
+    //QString currentPrimitive = this->selectionComboBox->currentText();
+    pqCoreUtilities::promptUser("SPV3D_CADSelection", QMessageBox::Information,
+      "Interactive Selection Information",
+      "You are entering interactive selection mode to highlight.\n"
+      "Move the mouse point over the dataset to interactively highlight elements.\n\n"
+      "Press Ctrl + click to add the currently highlighted element.\n"
+      "Press Shift + click to remove the element.\n\n"
+      "Click on Select button to exit this mode.",
+      QMessageBox::Ok | QMessageBox::Save);
+    this->View->setCursor(Qt::CrossCursor);
+    vtkSMPropertyHelper(rmp, "InteractionMode").Set(vtkPVRenderView::INTERACTION_MODE_SELECTION);
+
+    rmp->UpdateVTKObjects();
+
+    // Setup observer.
+    assert(this->ObserverIds[0] == 0 && this->ObservedObject == nullptr && this->ObserverIds[1] == 0);
+    this->ObservedObject = rmp->GetInteractor();
+    this->ObserverIds[0] = this->ObservedObject->AddObserver(
+      vtkCommand::MouseMoveEvent, this, &SPV3D_CADSelection::onMouseMove);
+    this->ObserverIds[1] = this->ObservedObject->AddObserver(vtkCommand::LeftButtonReleaseEvent,
+      this, &SPV3D_CADSelection::onLeftButtonRelease);
+    this->ObserverIds[2] = this->ObservedObject->AddObserver(vtkCommand::RightButtonPressEvent,
+      this, &SPV3D_CADSelection::onRightButtonPress);
+    this->ObserverIds[3] = this->ObservedObject->AddObserver(vtkCommand::RightButtonReleaseEvent,
+      this, &SPV3D_CADSelection::onRightButtonRelease);
+
+    //this->parentAction()->setChecked(true);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::endSelection()
+{
+  if (!this->View)
+  {
+    return;
+  }
+
+  if (this->PreviousRenderViewMode == -1)
+  {
+    return;
+  }
+
+  //QAction* actn = this->parentAction();
+  //if (actn->isCheckable())
+  {
+    vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+    vtkSMPropertyHelper(rmp, "InteractionMode").Set(this->PreviousRenderViewMode);
+    this->PreviousRenderViewMode = -1;
+    rmp->UpdateVTKObjects();
+    this->View->setCursor(QCursor());
+    this->cleanupObservers();
+    //this->parentAction()->setChecked(false);
+
+    if (this->CurrentRepresentation != nullptr)
+    {
+      vtkSMSessionProxyManager* pxm = rmp->GetSessionProxyManager();
+      vtkSMProxy* emptySel = pxm->NewProxy("sources", "IDSelectionSource");
+
+      this->CurrentRepresentation->UpdateVTKObjects();
+      this->CurrentRepresentation = nullptr;
+      emptySel->Delete();
+
+      rmp->StillRender();
+    }
+
+    //this->selectionComboBox->setEnabled(true);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onMouseMove()
+{
+  if (!this->DisablePreSelection && vtkPVRenderViewSettings::GetInstance()->GetEnableFastPreselection())
+  {
+    this->fastSelection(true);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onLeftButtonRelease()
+{
+  if (vtkPVRenderViewSettings::GetInstance()->GetEnableFastPreselection())
+  {
+    this->fastSelection();
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onRightButtonPress()
+{
+  this->DisablePreSelection = true;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onRightButtonRelease()
+{
+  this->DisablePreSelection = false;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::fastSelection(bool presel)
+{
+  vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+  assert(rmp != nullptr);
+
+  int x = rmp->GetInteractor()->GetEventPosition()[0];
+  int y = rmp->GetInteractor()->GetEventPosition()[1];
+  this->MousePosition[0] = x;
+  this->MousePosition[1] = y;
+
+  int region[4] = { x, y, x, y };
+
+  vtkNew<vtkCollection> selectedRepresentations;
+  vtkNew<vtkCollection> selectionSources;
+  bool status = false;
+  // Do the selection on the current region
+  switch (this->Mode)
+  {
+    case SELECT_SOLIDS:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Solid id");
+      break;
+    case SELECT_FACES:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Face id");
+      break;
+    case SELECT_EDGES:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Edge id");
+      break;
+    case SELECT_VERTICES:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Vertex id");
+      break;
+    default:
+      qCritical("Invalid call to SPV3D_CADSelection::fastSelection");
+      return;
+  }
+
+  vtkSMRepresentationProxy* repr =
+    vtkSMRepresentationProxy::SafeDownCast(selectedRepresentations->GetItemAsObject(0));
+
+  if (repr && !presel)
+  {
+    repr->InvokeCommand("BeginSelect");
+  }
+
+  // If something has been preselected or selected
+  if (status)
+  {
+    vtkSMRepresentationProxy* repr =
+      vtkSMRepresentationProxy::SafeDownCast(selectedRepresentations->GetItemAsObject(0));
+
+    // If the selection occurs on a new represention, clean the selection on the
+    // current representation before continuing
+    if (this->CurrentRepresentation != nullptr && repr != this->CurrentRepresentation)
+    {
+      vtkSMSessionProxyManager* pxm = repr->GetSessionProxyManager();
+      vtkSMProxy* emptySel = pxm->NewProxy("sources", "IDSelectionSource");
+
+      vtkSMPropertyHelper(this->CurrentRepresentation, "Selection").Set(emptySel);
+      this->CurrentRepresentation->UpdateVTKObjects();
+      emptySel->Delete();
+    }
+
+    this->CurrentRepresentation = repr;
+
+    // Set the selection (selection source) to the current representation
+    vtkSMSourceProxy* sel = vtkSMSourceProxy::SafeDownCast(selectionSources->GetItemAsObject(0));
+    vtkSMPropertyHelper(repr, "Selection").Set(sel);
+    repr->UpdateVTKObjects();
+  }
+  // If nothing has been selected then clean current representation
+  // with an "empty" selection source
+  else if (this->CurrentRepresentation != nullptr)
+  {
+    vtkSMSessionProxyManager* pxm = rmp->GetSessionProxyManager();
+    vtkSMProxy* emptySel = pxm->NewProxy("sources", "IDSelectionSource");
+
+    vtkSMPropertyHelper(this->CurrentRepresentation, "Selection").Set(emptySel);
+    this->CurrentRepresentation->UpdateVTKObjects();
+    this->CurrentRepresentation = nullptr;
+    emptySel->Delete();
+  }
+
+  this->View->forceRender();
+  this->View->forceRender();
+  // TODO improve this to avoid double render
+
+  if (repr && !presel)
+  {
+    repr->InvokeCommand("EndSelect");
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::selectionChanged(vtkObject*, unsigned long, void* calldata)
+{
+  BEGIN_UNDO_EXCLUDE();
+
+  int selectionModifier = this->getSelectionModifier();
+  int* region = reinterpret_cast<int*>(calldata);
+// Simple version check to change once 5.10 support is dropped
+  this->View->selectCellsOnSurface(region, selectionModifier);
+  //this->View->selectOnSurface(region, selectionModifier);
+  END_UNDO_EXCLUDE();
+
+  this->endSelection();
+}
+
+//-----------------------------------------------------------------------------
+int SPV3D_CADSelection::getSelectionModifier()
+{
+  int selectionModifier = pqView::PV_SELECTION_DEFAULT;//this->Superclass::getSelectionModifier();
+
+  vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+  assert(rmp != nullptr);
+
+  bool ctrl = rmp->GetInteractor()->GetControlKey() == 1;
+  bool shift = rmp->GetInteractor()->GetShiftKey() == 1;
+  selectionModifier = pqView::PV_SELECTION_TOGGLE;
+
+  if (ctrl)
+  {
+    selectionModifier = pqView::PV_SELECTION_ADDITION;
+  }
+  else if (shift)
+  {
+    selectionModifier = pqView::PV_SELECTION_SUBTRACTION;
+  }
+  return selectionModifier;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::cleanupObservers()
+{
+  for (size_t i = 0; i < sizeof(this->ObserverIds) / sizeof(this->ObserverIds[0]); ++i)
+  {
+    if (this->ObservedObject != nullptr && this->ObserverIds[i] > 0)
+    {
+      this->ObservedObject->RemoveObserver(this->ObserverIds[i]);
+    }
+    this->ObserverIds[i] = 0;
+  }
+  this->ObservedObject = nullptr;
+}
diff --git a/src/SPV3D/SPV3D_CADSelection.h b/src/SPV3D/SPV3D_CADSelection.h
new file mode 100644 (file)
index 0000000..b73fa7d
--- /dev/null
@@ -0,0 +1,160 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include <pqSelectionReaction.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkWeakPointer.h>
+
+#include <QCursor>
+#include <QPointer>
+#include <QTimer>
+#include <QPushButton>
+#include <QComboBox>
+
+class vtkObject;
+class pqView;
+class pqRenderView;
+class vtkIntArray;
+class pqDataRepresentation;
+class vtkSMRepresentationProxy;
+class vtkSMSourceProxy;
+
+/**
+ * SPV3D_CADSelection handles various selection modes available on
+ * RenderViews. Simply create multiple instances of
+ * SPV3D_CADSelection to handle selection modes for that RenderView.
+ * SPV3D_CADSelection uses internal static members to ensure that
+ * at most 1 view (and 1 type of selection) is in selection-mode at any given
+ * time.
+ */
+class SPV3D_CADSelection : public QObject
+{
+  Q_OBJECT
+
+public:
+  enum SelectionMode
+  {
+    SELECT_SOLIDS,
+    SELECT_FACES,
+    SELECT_EDGES,
+    SELECT_VERTICES
+  };
+
+  /**
+   * If \c view is nullptr, this reaction will track the active-view maintained by
+   * pqActiveObjects.
+   */
+  SPV3D_CADSelection(QObject *parent, pqRenderView* view, SelectionMode mode);
+  
+  ~SPV3D_CADSelection() override;
+
+  /**
+   * Set the selectionMode
+   */
+  void SetMode(const SPV3D_CADSelection::SelectionMode mode);
+  
+public Q_SLOTS:
+  /**
+   * For checkable actions, this calls this->beginSelection() or
+   * this->endSelection() is val is true or false, respectively. For
+   * non-checkable actions, this call this->beginSelection() and
+   * this->endSelection() in that order.
+   */
+  virtual void actionTriggered(bool val);
+  
+private Q_SLOTS:
+  /**
+   * Called when this object was created with nullptr as the view and the active
+   * view changes.
+   */
+  void setView(pqView* view);
+
+  /**
+   * Called when the active representation changes.
+   */
+  void setRepresentation(pqDataRepresentation* representation);
+
+  /**
+   * starts the selection i.e. setup render view in selection mode.
+   */
+  void beginSelection();
+
+  /**
+   * finishes the selection. Doesn't cause the selection, just returns the
+   * render view to previous interaction mode.
+   */
+  void endSelection();
+
+  void updateEnableState();
+
+  ///@{
+  /**
+   * Disable preselection during rotation using the right button.
+   */
+  void onRightButtonPress();
+  void onRightButtonRelease();
+  ///@}
+
+private:
+
+  /**
+   * callback called when the vtkPVRenderView is done with selection.
+   */
+  void selectionChanged(vtkObject*, unsigned long, void* calldata);
+
+  /**
+   * callback called for mouse move events when in 'interactive selection'
+   * modes.
+   */
+  void onMouseMove();
+
+  /**
+   * callback called for click events when in 'interactive selection' modes.
+   */
+  void onLeftButtonRelease();
+
+  // Get the current state of selection modifier
+  int getSelectionModifier();
+
+  /**
+   * makes fast selection.
+   */
+  void fastSelection(bool presel = false);
+
+  /**
+   * cleans up observers.
+   */
+  void cleanupObservers();
+
+  Q_DISABLE_COPY(SPV3D_CADSelection)
+  QPointer<pqRenderView> View;
+  QPointer<pqDataRepresentation> Representation;
+  QMetaObject::Connection RepresentationConnection;
+  vtkSMRepresentationProxy* CurrentRepresentation = nullptr;
+  SelectionMode Mode;
+  int PreviousRenderViewMode;
+  vtkWeakPointer<vtkObject> ObservedObject;
+  unsigned long ObserverIds[4];
+  int MousePosition[2];
+  QComboBox* selectionComboBox;
+  bool DisablePreSelection = false;
+};
diff --git a/src/SPV3D/SPV3D_Prs.cxx b/src/SPV3D/SPV3D_Prs.cxx
new file mode 100644 (file)
index 0000000..60520b9
--- /dev/null
@@ -0,0 +1,136 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME PV3DViewer : build PV3D viewer into Salome desktop
+//  File   : SPV3D_Prs.cxx
+
+#include "SPV3D_Prs.h"
+#include "SPV3D_ViewWindow.h"
+
+#include "vtkActor.h"
+#include "vtkPolyData.h"
+#include "vtkCellData.h"
+#include "vtkMapper.h"
+#include "pqServer.h"
+#include "pqApplicationCore.h"
+#include "pqServerManagerModel.h"
+#include "pqObjectBuilder.h"
+#include "pqPipelineSource.h"
+#include "vtkSMSourceProxy.h"
+#include "vtkPVTrivialProducer.h"
+#include <pqDataRepresentation.h>
+
+bool SPV3D_EXPORTSPV3DData::IsVisible() const
+{
+  if( IsNull() )
+    return false;
+  return GetRepresentation()->isVisible();
+}
+
+void SPV3D_EXPORTSPV3DData::Hide() const
+{
+  if( GetRepresentation() )
+    GetRepresentation()->setVisible(0);
+}
+
+SPV3D_Prs::SPV3D_Prs( const char* entry , SPV3D_ViewWindow *view) : SALOME_PV3DPrs(entry),_view(view)
+{
+}
+
+SPV3D_Prs *SPV3D_Prs::deepCopy() const
+{
+  SPV3D_Prs *ret = new SPV3D_Prs( *this );
+  return ret;
+}
+
+pqProxy *getPQProxy(vtkSMProxy *proxy)
+{
+  pqServerManagerModel* smmodel = pqApplicationCore::instance()->getServerManagerModel();
+  return smmodel->findItem<pqProxy*>(proxy);
+}
+
+void SPV3D_Prs::FillUsingActor(vtkActor *actor) const
+{
+  SPV3D_EXPORTSPV3DData *alreadyExistingSrc = nullptr;
+  alreadyExistingSrc = _view->isEntryAlreadyExist( GetEntry() );
+  if(alreadyExistingSrc && !alreadyExistingSrc->GetSourceProducer())
+  {
+    actor->GetMapper()->Update();
+    vtkDataObject *ds = actor->GetMapper()->GetInput();
+    vtkPolyData *ds3 = vtkPolyData::SafeDownCast(ds);
+    vtkNew<vtkPolyData> ds4;
+    if(ds3)
+    {
+      ds4->ShallowCopy( ds3 );
+      vtkNew<vtkIdTypeArray> solidIdArray;
+      auto nbCells( ds4->GetNumberOfCells() );
+      solidIdArray->SetNumberOfComponents(1);
+      solidIdArray->SetNumberOfTuples( nbCells );
+      solidIdArray->SetName("Solid id");
+      vtkIdType *pt( solidIdArray->GetPointer(0) );
+      std::for_each(pt,pt+nbCells,[](vtkIdType& elt) { elt = 0; });
+      ds4->GetCellData()->AddArray( solidIdArray );
+    }
+    //
+    pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
+    pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+    pqPipelineSource *mySourceProducer(builder->createSource("sources","PVTrivialProducer",serv));
+    vtkSMProxy *producerBase = mySourceProducer->getProxy();
+    vtkSMSourceProxy *producer(vtkSMSourceProxy::SafeDownCast(producerBase));
+    vtkObjectBase *clientSideObject(producer->GetClientSideObject());
+    vtkPVTrivialProducer *clientSideObjectCast = vtkPVTrivialProducer::SafeDownCast(clientSideObject);
+    clientSideObjectCast->SetOutput(ds4);
+    mySourceProducer->updatePipeline();
+    pqProxy *producerBase2( getPQProxy(producerBase) );
+    if(producerBase2 && !_name.empty())
+      producerBase2->rename( _name.c_str() );
+    this->SetSourceProducer( mySourceProducer );
+  }
+  else
+  {
+    this->CopyInfo( alreadyExistingSrc );
+  }
+}
+
+SPV3D_Prs:: ~SPV3D_Prs() 
+{
+}
+
+void SPV3D_Prs::DisplayIn( SALOME_View* v ) const
+{
+  SALOME_PV3DPrs::DisplayIn(v);
+}
+
+void SPV3D_Prs::CopyInfo(SPV3D_EXPORTSPV3DData *info) const
+{
+  if(!_pvRendInfo || !info)
+    return ;
+  if(_pvRendInfo == info)
+    return ;
+  *_pvRendInfo = *info;
+}
+
+bool SPV3D_Prs::IsNull() const
+{
+  if(_pvRendInfo)
+    return _pvRendInfo->IsNull();
+  return true;
+}
+
+
diff --git a/src/SPV3D/SPV3D_Prs.h b/src/SPV3D/SPV3D_Prs.h
new file mode 100644 (file)
index 0000000..e6a0db6
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SPV3D.h"
+#include "SALOME_Prs.h"
+
+class vtkActor;
+class pqPipelineSource;
+class pqDataRepresentation;
+
+class SPV3D_EXPORTSPV3DData
+{
+public:
+  SPV3D_EXPORTSPV3DData() = default;
+  SPV3D_EXPORTSPV3DData *deepCopy() { return new SPV3D_EXPORTSPV3DData(*this); }
+  void SetSourceProducer(pqPipelineSource *sourceProducer) const { _sourceProducer = sourceProducer; }
+  pqPipelineSource *GetSourceProducer() const { return _sourceProducer; }
+  
+  void SetRepresentation(pqDataRepresentation *repr) const { _repr = repr; }
+  pqDataRepresentation *GetRepresentation() const { return _repr; }
+  
+  bool IsNull() const { return !_sourceProducer && !_repr; }
+
+  bool IsVisible() const;
+  void Hide() const;
+private:
+  SPV3D_EXPORTSPV3DData(const SPV3D_EXPORTSPV3DData& other) = default;
+private:
+  mutable pqPipelineSource *_sourceProducer = nullptr;
+  mutable pqDataRepresentation *_repr = nullptr;
+};
+
+class SPV3D_ViewWindow;
+
+class SPV3D_EXPORT SPV3D_Prs : public SALOME_PV3DPrs
+{
+public:
+  explicit SPV3D_Prs( const char* entry, SPV3D_ViewWindow *view);
+  ~SPV3D_Prs();
+  
+  void SetName(const std::string& name) { _name = name; }
+  
+  SPV3D_Prs *deepCopy() const;
+  
+  void FillUsingActor(vtkActor *actor) const;
+
+  void DisplayIn( SALOME_View* v ) const override;
+
+  void CopyInfo(SPV3D_EXPORTSPV3DData *info) const;
+
+  void SetPVRenderInfo(SPV3D_EXPORTSPV3DData *pvRendInfo) { _pvRendInfo = pvRendInfo; }
+
+  void SetSourceProducer(pqPipelineSource *sourceProducer) const { if(_pvRendInfo) _pvRendInfo->SetSourceProducer(sourceProducer); }
+  pqPipelineSource *GetSourceProducer() const { if(_pvRendInfo) return _pvRendInfo->GetSourceProducer(); return nullptr; }
+  
+  void SetRepresentation(pqDataRepresentation *repr) const { if(_pvRendInfo) _pvRendInfo->SetRepresentation(repr); }
+  pqDataRepresentation *GetRepresentation() const { if(_pvRendInfo) return _pvRendInfo->GetRepresentation(); return nullptr; }
+
+  bool IsNull() const override;
+
+private:
+
+  SPV3D_Prs(const SPV3D_Prs& other) = default;
+
+public:
+  void hide() const { if(_pvRendInfo) return _pvRendInfo->Hide(); }
+  bool isVisible() const { if(_pvRendInfo) return _pvRendInfo->IsVisible(); return false; }
+
+private:
+  
+  SPV3D_EXPORTSPV3DData *_pvRendInfo = nullptr;
+  SPV3D_ViewWindow *_view = nullptr;
+  //! Name attached to the displayable object in the study
+  std::string _name;
+};
diff --git a/src/SPV3D/SPV3D_ViewManager.cxx b/src/SPV3D/SPV3D_ViewManager.cxx
new file mode 100644 (file)
index 0000000..5ae6763
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SPV3D_ViewManager.h"
+#include "SPV3D_ViewModel.h"
+#include "SPV3D_ViewWindow.h"
+
+#include <PV3DViewer_ViewManager.h>
+
+#include "PVViewer_InitSingleton.h"
+#include "PVViewer_GUIElements.h"
+#include "PVServer_ServiceWrapper.h"
+
+#include <SUIT_Desktop.h>
+
+#include <pqObjectBuilder.h>
+#include <pqApplicationCore.h>
+#include <pqServerManagerModel.h>
+#include <pqServerResource.h>
+#include <pqView.h>
+#include <pqPVApplicationCore.h>
+#include <pqParaViewBehaviors.h>
+
+#include <QVBoxLayout>
+#include <QApplication>
+
+/*!
+  Constructor
+*/
+SPV3D_ViewManager::SPV3D_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop ) 
+: SUIT_ViewManager( study, theDesktop, new SPV3D_ViewModel() )
+{
+  setTitle( SPV3D_ViewManager::tr( "PARAVIEW3D_VIEW_TITLE" ) );
+  /*QStringList args = QCoreApplication::arguments();
+  int argc = args.length();
+  char **argv = new char *[argc+1];
+  for(auto i = 0 ; i < argc ; ++i)
+    argv[i] = strdup(args[i].toStdString().c_str());
+  argv[argc] = nullptr;
+  pqPVApplicationCore appPV(argc,argv);
+  QApplication::instance()->installEventFilter(&appPV);
+  new pqParaViewBehaviors(theDesktop,theDesktop);
+  pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+  pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
+  pqView *view=builder->createView(QString("RenderView"),serv);
+  static_cast<SPV3D_ViewModel *>(this->getViewModel())->setView(view);*/
+  //QVBoxLayout *lay(new QVBoxLayout(theDesktop));
+  //lay->addWidget( view->widget() );
+  //view->widget()->setParent( theDesktop);
+  // Initialize minimal paraview stuff (if not already done)
+  //PVViewer_InitSingleton::Init(theDesktop);
+
+  connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+           this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+
+  SPV3D_ViewModel *vm = dynamic_cast<SPV3D_ViewModel*>(getViewModel());
+  if (vm)
+    vm->initialize();
+}
+
+/*!
+  Destructor
+*/
+SPV3D_ViewManager::~SPV3D_ViewManager()
+{
+}
+
+/*!
+  \return corresponding main window
+*/
+SUIT_Desktop* SPV3D_ViewManager::getDesktop()
+{
+  return myDesktop;
+}
+
+/*!Enable toolbars if view \a view is ParaView viewer and disable otherwise.
+*/
+void SPV3D_ViewManager::onWindowActivated(SUIT_ViewWindow* view)
+{
+  if (view)
+  {
+    SPV3D_ViewWindow* pvWindow = dynamic_cast<SPV3D_ViewWindow*>(view);
+    PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance( myDesktop );
+    guiElements->setToolBarEnabled(pvWindow!=0);
+  }
+}
diff --git a/src/SPV3D/SPV3D_ViewManager.h b/src/SPV3D/SPV3D_ViewManager.h
new file mode 100644 (file)
index 0000000..35bbb87
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SPV3D_VIEWMANAGER_H
+#define SPV3D_VIEWMANAGER_H
+
+#include "SUIT_ViewManager.h"
+#include "SPV3D.h"
+
+class SUIT_Desktop;
+class SUIT_Study;
+class SUIT_ViewWindow;
+
+//! Extend SUIT_ViewManager to deal with SPV3D_ViewModel
+class SPV3D_EXPORT SPV3D_ViewManager : public SUIT_ViewManager
+{
+  Q_OBJECT
+
+public:
+  //! Construct the view manager
+  SPV3D_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+
+  //! Destroy the view manager
+  virtual ~SPV3D_ViewManager();
+
+  SUIT_Desktop* getDesktop();
+
+protected slots:
+  void onWindowActivated(SUIT_ViewWindow*);
+};
+
+#endif
diff --git a/src/SPV3D/SPV3D_ViewModel.cxx b/src/SPV3D/SPV3D_ViewModel.cxx
new file mode 100644 (file)
index 0000000..6827398
--- /dev/null
@@ -0,0 +1,358 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <QMenu>
+#include <QColorDialog>
+#include <QToolBar>
+#include <QTimer>
+
+#include <vtkActorCollection.h>
+
+#include "SPV3D_ViewModel.h"
+#include "SPV3D_ViewWindow.h"
+#include "SPV3D_Prs.h"
+#include "PVViewer_Core.h"
+
+#include <pqActiveObjects.h>
+#include <pqApplicationCore.h>
+#include <pqObjectBuilder.h>
+#include <pqPipelineSource.h>
+#include <pqRenderView.h>
+
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMParaViewPipelineControllerWithRendering.h>
+#include <vtkSMRenderViewProxy.h>
+#include <vtkSMRepresentationProxy.h>
+#include <vtkSMSourceProxy.h>
+#include <vtkSMPVRepresentationProxy.h>
+
+#include "SUIT_ViewModel.h"
+#include "SUIT_ViewManager.h"
+
+#include "SALOME_InteractiveObject.hxx"
+
+#include "QtxActionToolMgr.h"
+#include "QtxBackgroundTool.h"
+
+#include <pqObjectBuilder.h>
+#include <pqApplicationCore.h>
+#include <pqServerManagerModel.h>
+#include <pqServerResource.h>
+#include <pqView.h>
+#include <pqPVApplicationCore.h>
+#include <pqParaViewBehaviors.h>
+
+#include <QApplication>
+
+// VSR: Uncomment below line to allow texture background support in PV3D viewer
+#define PV3D_ENABLE_TEXTURED_BACKGROUND
+
+/*!
+  Constructor
+*/
+SPV3D_ViewModel::SPV3D_ViewModel()
+{
+  mySelectionEnabled = true;
+}
+
+/*!
+  Destructor
+*/
+SPV3D_ViewModel::~SPV3D_ViewModel() 
+{
+}
+
+
+void SPV3D_ViewModel::initialize()
+{
+}
+
+void SPV3D_ViewModel::render() const
+{
+  if( _view )
+    _view->render();
+}
+
+/*!Create new instance of view window on desktop \a theDesktop.
+ *\retval SUIT_ViewWindow* - created view window pointer.
+ */
+SUIT_ViewWindow* SPV3D_ViewModel::createView( SUIT_Desktop* theDesktop )
+{
+  SPV3D_ViewWindow* aViewWindow = new SPV3D_ViewWindow(theDesktop, this);
+
+  aViewWindow->SetSelectionEnabled( isSelectionEnabled() );
+  PVViewer_Core::ParaviewInitApp();
+  QApplication::instance()->installEventFilter( PVViewer_Core::GetPVAppCore() );
+  new pqParaViewBehaviors(aViewWindow,aViewWindow);
+  pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+  QObject::connect(builder, &pqObjectBuilder::sourceCreated, this, &SPV3D_ViewModel::onSourceCreated);
+  pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
+  pqView *view=builder->createView(QString("RenderView"),serv);
+  setView(view);
+  
+  aViewWindow->init();
+  
+  return aViewWindow;
+}
+
+/*!
+  Sets new view manager
+  \param theViewManager - new view manager
+*/
+void SPV3D_ViewModel::setViewManager(SUIT_ViewManager* theViewManager)
+{
+  SUIT_ViewModel::setViewManager(theViewManager);
+
+  if ( !theViewManager )
+    return;
+
+  connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+
+  connect(theViewManager, SIGNAL(viewCreated(SUIT_ViewWindow*)), 
+         this, SLOT(onViewCreated(SUIT_ViewWindow*)));
+}
+
+/*!
+  Builds popup for vtk viewer
+*/
+void SPV3D_ViewModel::contextMenuPopup( QMenu */*thePopup*/ )
+{
+  // NYI
+}
+
+/*!
+  SLOT: called on mouse button press, empty implementation
+*/
+void SPV3D_ViewModel::onMousePress(SUIT_ViewWindow* /*vw*/, QMouseEvent* /*event*/)
+{}
+
+/*!
+  SLOT: called on mouse move, empty implementation
+*/
+void SPV3D_ViewModel::onMouseMove(SUIT_ViewWindow* /*vw*/, QMouseEvent* /*event*/)
+{}
+
+/*!
+  SLOT: called on mouse button release, empty implementation
+*/
+void SPV3D_ViewModel::onMouseRelease(SUIT_ViewWindow* /*vw*/, QMouseEvent* /*event*/)
+{}
+
+/*!
+  Enables/disables selection
+  \param isEnabled - new state
+*/
+void SPV3D_ViewModel::enableSelection(bool isEnabled)
+{
+  mySelectionEnabled = isEnabled;
+  //!! To be done for view windows
+  if (SUIT_ViewManager* aViewManager = getViewManager()) {
+    QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+    for ( int i = 0; i < aViews.count(); i++ )
+    {
+      if ( SPV3D_ViewWindow* aView = dynamic_cast<SPV3D_ViewWindow*>(aViews.at( i )) )
+        aView->SetSelectionEnabled( isEnabled );
+    }
+  }
+
+  if(!isEnabled) {
+    //clear current selection in the viewer
+    bool blocked = blockSignals( true );
+    /*if ( SUIT_ViewManager* aViewMgr = getViewManager() ) {
+      if( SPV3D_ViewWindow* aViewWindow = dynamic_cast<SPV3D_ViewWindow*>( aViewMgr->getActiveView() ) ){
+        //NYI
+      }
+    }*/
+    blockSignals( blocked );  
+  }
+
+}
+
+pqView *SPV3D_ViewModel::getView() const
+{
+  return _view;
+}
+
+/*!
+  Display presentation
+  \param prs - presentation
+*/
+void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
+{
+  if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs ))
+  {
+    if( !aPrs->GetRepresentation() )
+    {
+      pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+      pqActiveObjects::instance().setActiveView(getView());
+      pqPipelineSource *mySourceProducer = aPrs->GetSourceProducer();
+      aPrs->SetSourceProducer( mySourceProducer );
+      pqDataRepresentation* myRepr(builder->createDataRepresentation(mySourceProducer->getOutputPort(0),getView(),"CADRepresentation"));//"GeometryRepresentation"
+      vtkSMViewProxy::RepresentationVisibilityChanged(myRepr->getViewProxy(), myRepr->getProxy(), true);
+      aPrs->SetRepresentation(myRepr);
+    }
+    pqDataRepresentation* myRepr = aPrs->GetRepresentation();
+    myRepr->setVisible(1);
+    vtkSMPVRepresentationProxy* proxy(dynamic_cast<vtkSMPVRepresentationProxy*>(myRepr->getProxy()));
+    if(proxy)
+    {
+      vtkSMPropertyHelper inputHelper(proxy, "Input");
+      vtkSMSourceProxy* input = vtkSMSourceProxy::SafeDownCast(inputHelper.GetAsProxy());
+      input->UpdatePipeline();
+    }
+    getView()->resetDisplay();
+    getView()->render();
+  }
+}
+
+/*!
+  Erase presentation
+  \param prs - presentation
+  \param forced - removes object from view
+*/
+void SPV3D_ViewModel::Erase( const SALOME_PV3DPrs* prs, const bool /*forced*/ )
+{
+  // NYI - hide a source
+  if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs )){
+    if(aPrs->IsNull())
+      return;
+    aPrs->GetRepresentation()->setVisible(0);
+    getView()->render();
+    //pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
+    //pqServer* activeServer = pqActiveObjects::instance().activeServer();
+    //builder->destroySources(activeServer);
+  }
+}
+
+/*!
+  Erase all presentations
+  \param forced - removes all objects from view
+*/
+void SPV3D_ViewModel::EraseAll( SALOME_Displayer* d, const bool forced )
+{
+  SALOME_View::EraseAll( d, forced );
+  if(SPV3D_ViewWindow* aViewWindow = dynamic_cast<SPV3D_ViewWindow*>(getViewManager()->getActiveView()))
+    aViewWindow->EraseAll();
+  Repaint();
+}
+
+/*!
+  Create presentation corresponding to the entry
+  \param entry - entry
+*/
+SALOME_Prs* SPV3D_ViewModel::CreatePrs( const char* entry )
+{
+  if(SPV3D_ViewWindow* aViewWindow = dynamic_cast<SPV3D_ViewWindow*>(getViewManager()->getActiveView()))
+  {
+    return aViewWindow->findOrCreatePrs( entry );
+  }
+  return nullptr;
+}
+
+/*!
+  \return true if object is displayed in viewer
+  \param obj - object to be checked
+*/
+bool SPV3D_ViewModel::isVisible( const Handle(SALOME_InteractiveObject)& io )
+{
+  if(SPV3D_ViewWindow* aViewWindow = dynamic_cast<SPV3D_ViewWindow*>(getViewManager()->getActiveView()))
+    return aViewWindow->isVisible( io );
+  return false;
+}
+
+/*!
+  \Collect objects visible in viewer
+  \param theList - visible objects collection
+*/
+void SPV3D_ViewModel::GetVisible( SALOME_ListIO &/*theList*/ )
+{
+  // NYI
+}
+
+/*!
+  Updates current viewer
+*/
+void SPV3D_ViewModel::Repaint()
+{
+  // NYI
+}
+
+
+void SPV3D_ViewModel::onViewCreated( SUIT_ViewWindow */*view*/) {
+#ifdef VGL_WORKAROUND
+  if ( SPV3D_ViewWindow* svw = dynamic_cast<SPV3D_ViewWindow*>( view ) )
+    QTimer::singleShot(500, [svw] () { svw->Repaint(); } );
+#endif
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_ViewModel::onSourceCreated(pqPipelineSource* source)
+{
+  std::string sourceXMLName(source->getSourceProxy()->GetXMLName());
+  pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
+  if (sourceXMLName == "XMLPolyDataReader" || sourceXMLName == "GeometryGenerator" || sourceXMLName == "ShapeSource" || sourceXMLName == "CubeSource")
+  {
+    if (this->GeometrySource)
+    {
+      if (this->GeometrySource == source) {
+      }
+      else
+        builder->destroy(this->GeometrySource);
+    }
+    this->GeometrySource = source;
+  }
+  else
+  {
+    qWarning("Unsupported Source");
+    return;
+  }
+  this->showSelectedMode();
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_ViewModel::showSelectedMode()
+{
+  vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
+  pqView* activeView = pqActiveObjects::instance().activeView();
+  if (activeView)
+  {
+    if (this->GeometrySource)
+    {
+#if PARAVIEW_VERSION_MINOR <= 10
+      this->GeometrySource->updatePipeline();
+      this->GeometrySource->setModifiedState(pqProxy::UNMODIFIED);
+#endif
+
+      vtkSMSourceProxy *sourceProxy = this->GeometrySource->getSourceProxy();
+      vtkSMViewProxy *viewProxy = activeView->getViewProxy();
+      //const char *representationType = "CADRepresentation";
+      controller->Show(sourceProxy, 0, viewProxy);//, representationType);
+
+    }
+  }
+  activeView->render();
+  activeView->resetDisplay();
+}
diff --git a/src/SPV3D/SPV3D_ViewModel.h b/src/SPV3D/SPV3D_ViewModel.h
new file mode 100644 (file)
index 0000000..b969050
--- /dev/null
@@ -0,0 +1,106 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SPV3D.h"
+#include "PV3DViewer_ViewModel.h"
+
+#include <SALOME_Prs.h>
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
+
+class QMouseEvent;
+class pqPipelineSource;
+class pqView;
+
+//! Extends two interfaces #SPV3D_ViewModelBase and #SALOME_View 
+class SPV3D_EXPORT SPV3D_ViewModel : public PV3DViewer_ViewModel, public SALOME_View 
+{
+  Q_OBJECT
+public:
+  void setView(pqView *view) { _view = view; }
+  pqView *getView() const;
+  void render() const;
+public:
+  //! Define string representation of the viewer type
+  static QString           Type() { return "ParaView3D"; }
+
+  SPV3D_ViewModel();
+  virtual ~SPV3D_ViewModel();
+
+  virtual void initialize();
+  
+  //! See #SUIT_ViewModel::createView
+  virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
+
+  //! See #SUIT_ViewModel::createView
+  virtual void setViewManager(SUIT_ViewManager* theViewManager);
+
+  //! See #SUIT_ViewModel::contextMenuPopup
+  virtual void contextMenuPopup( QMenu* );
+
+  //! See #SUIT_ViewModel::getType
+  virtual QString getType() const { return Type(); }
+
+public:
+  void enableSelection(bool isEnabled);
+  bool isSelectionEnabled() const { return mySelectionEnabled; }
+
+  /* Reimplemented from SALOME_View */
+
+  //! See #SALOME_View::Display( const SALOME_Prs* )
+  void Display( const SALOME_PV3DPrs* ); 
+
+  //! See #SALOME_View::Erase( const SALOME_PV3DPrs*, const bool = false )
+  void Erase( const SALOME_PV3DPrs*, const bool = false );
+
+  //! See #SALOME_View::EraseAll( SALOME_Displayer*, const bool = false )
+  void EraseAll( SALOME_Displayer*, const bool = false );
+
+  //! See #SALOME_View::getVisible( SALOME_ListIO& )
+  virtual void GetVisible( SALOME_ListIO& );
+
+  //! See #SALOME_View::CreatePrs( const char* entry = 0 )
+  SALOME_Prs* CreatePrs( const char* entry = 0 );
+
+  //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
+  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
+
+  //! See #SALOME_View::Repaint()
+  virtual void Repaint();
+
+protected slots:
+  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
+
+  void onViewCreated( SUIT_ViewWindow* );
+
+  void onSourceCreated(pqPipelineSource* source);
+  void showSelectedMode();
+
+protected:
+  pqPipelineSource* GeometrySource = nullptr;
+  pqPipelineSource* MeshSource = nullptr;
+
+private:
+  bool mySelectionEnabled;
+  pqView *_view = nullptr;
+};
diff --git a/src/SPV3D/SPV3D_ViewWindow.cxx b/src/SPV3D/SPV3D_ViewWindow.cxx
new file mode 100644 (file)
index 0000000..48cf059
--- /dev/null
@@ -0,0 +1,413 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SPV3D_ViewWindow.h"
+
+#include "SPV3D_ViewModel.h"
+
+#include <QMenu>
+#include <QToolBar>
+#include <QTimer>
+#include <QEvent>
+#include <QFileInfo>
+#include <QSignalMapper>
+#include <QXmlStreamWriter>
+#include <QXmlStreamReader>
+#include <QXmlStreamAttributes>
+
+#include <pqView.h>
+
+#include "QtxAction.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_Accel.h"
+#include "SUIT_Tools.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Accel.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_ViewManager.h"
+#include "QtxActionToolMgr.h"
+#include "QtxMultiAction.h"
+#include "QtxActionGroup.h"
+
+#include <pqCameraReaction.h>
+#include <pqParaViewBehaviors.h>
+#include <pqRenderView.h>
+
+#include "SALOME_ListIO.hxx"
+#include "SPV3D_Prs.h"
+
+#include <QToolBar>
+
+// Use workaround for rendering transparent object over MESA
+#define USE_WORKAROUND_FOR_MESA
+
+/*!
+  Constructor
+*/
+SPV3D_ViewWindow::SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* theModel):
+  PV3DViewer_ViewWindow(theDesktop, theModel),
+  myModel(theModel)
+{
+}
+
+#include <pqRenderViewSelectionReaction.h>
+#include <pqPipelineSource.h>
+#include <vtkSMRenderViewProxy.h>
+#include <vtkCollection.h>
+#include <vtkSMRepresentationProxy.h>
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMProxyManager.h>
+#include <vtkRenderer.h>
+#include <vtkSMSessionProxyManager.h>
+
+#include "SPV3D_CADSelection.h"
+
+void SPV3D_ViewWindow::init()
+{
+  pqView *view(myModel->getView());
+  pqRenderView *renderView(qobject_cast<pqRenderView *>(view));
+  QWidget *wid = view->widget();
+  wid->setParent( this );
+  setCentralWidget( wid );
+  //
+  this->
+  myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"),                       // title (language-dependant)
+                                        QString( "PV3DViewerViewOperations" ),          // name (language-independant)
+                                        false );
+  QAction* resetCenterAction =
+    toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqResetCamera.svg"), tr( "MNU_FITALL" ) );
+  new pqCameraReaction(resetCenterAction, pqCameraReaction::RESET_CAMERA);
+  QAction *showCenterAction =
+    toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqShowCenterAxes.svg"), tr( "DSC_SHOW_TRIHEDRON" ) );
+  showCenterAction->setCheckable(true);
+  QObject::connect(showCenterAction, &QAction::toggled, this, &SPV3D_ViewWindow::showCenterAxes);
+  
+  // Pick a new center of rotation on the surface of the mesh
+  QAction* pickCenterAction = toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqPickCenter.svg"), tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ) );
+  pickCenterAction->setCheckable(true);
+  pqRenderViewSelectionReaction* selectionReaction = new pqRenderViewSelectionReaction(
+    pickCenterAction, renderView, pqRenderViewSelectionReaction::SELECT_CUSTOM_BOX);
+
+  QObject::connect(selectionReaction,
+    QOverload<int, int, int, int>::of(&pqRenderViewSelectionReaction::selectedCustomBox), this,
+    &SPV3D_ViewWindow::pickCenterOfRotation);
+  //
+  mySelection = new SPV3D_CADSelection(this,renderView,SPV3D_CADSelection::SELECT_SOLIDS);
+  QAction *selectionAction =  toolMgr()->toolBar(myToolBar)->addAction(SUIT_Session::session()->resourceMgr()->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_STANDARD" ) ), tr( "MNU_SVTK_PRESELECTION_STANDARD" ) );
+  selectionAction->setCheckable(true);
+  QObject::connect(selectionAction, &QAction::toggled, this, &SPV3D_ViewWindow::goSelect);
+}
+
+void SPV3D_ViewWindow::goSelect(bool val)
+{
+  if(val)
+    {
+      pqView* activeView(myModel->getView());
+      if (!activeView)
+      {
+        return;
+      }
+      for(const auto& elt : myPrs)
+      {
+        pqPipelineSource *geometrySource = elt.second->GetSourceProducer();
+        if(geometrySource)
+        {
+          vtkSMProxy* repr = activeView->getViewProxy()->FindRepresentation(
+            geometrySource->getSourceProxy(), 0);
+          repr->InvokeCommand("Reset");
+        }
+      }
+      activeView->forceRender();
+      activeView->render();
+      activeView->resetDisplay();
+    }
+  mySelection->actionTriggered(val);
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_ViewWindow::pickCenterOfRotation(int posx, int posy)
+{
+  pqView *view(myModel->getView());
+  pqRenderView *renderView(qobject_cast<pqRenderView *>(view));
+  if (!renderView)
+    return;
+
+  // Taken from vtkSMRenderViewProxy::ConvertDisplayToPointOnSurface
+  // TODO : we can use this function directly if we make a simple correction in ParaView :
+  // replace the vtkSMPVRepresentationProxy::SafeDownCast(...) by
+  // vtkSMRepresentationProxy::SafeDownCast(...), like done bellow
+  int region[4] = { posx, posy, posx, posy };
+  vtkNew<vtkCollection> representations;
+  vtkNew<vtkCollection> sources;
+
+  vtkSMRenderViewProxy* renderViewProxy = renderView->getRenderViewProxy();
+  renderViewProxy->SelectSurfaceCells(region, representations, sources, false);
+
+  // If a point has been selected
+  if (representations->GetNumberOfItems() > 0 && sources->GetNumberOfItems() > 0)
+  {
+    vtkSMRepresentationProxy* rep =
+      vtkSMRepresentationProxy::SafeDownCast(representations->GetItemAsObject(0));
+    vtkSMProxy* input = vtkSMPropertyHelper(rep, "Input").GetAsProxy(0);
+    vtkSMSourceProxy* selection = vtkSMSourceProxy::SafeDownCast(sources->GetItemAsObject(0));
+
+    // Setup a ray that starts at the center of the camera and ends
+    // at the end of the scene
+    double nearDisplayPoint[3] = { (double)posx, (double)posy, 0.0 };
+    double farDisplayPoint[3] = { (double)posx, (double)posy, 1.0 };
+    double farLinePoint[3] = { 0.0, 0.0, 0.0 };
+    double nearLinePoint[3] = { 0.0, 0.0, 0.0 };
+
+    vtkRenderer* renderer = renderViewProxy->GetRenderer();
+
+    // Compute the near ray point
+    renderer->SetDisplayPoint(nearDisplayPoint);
+    renderer->DisplayToWorld();
+    const double* world = renderer->GetWorldPoint();
+    for (int i = 0; i < 3; i++)
+    {
+      nearLinePoint[i] = world[i] / world[3];
+    }
+
+    // Compute the far ray point
+    renderer->SetDisplayPoint(farDisplayPoint);
+    renderer->DisplayToWorld();
+    world = renderer->GetWorldPoint();
+    for (int i = 0; i < 3; i++)
+    {
+      farLinePoint[i] = world[i] / world[3];
+    }
+
+    // Compute the intersection of the ray with the mesh
+    vtkSMProxyManager* proxyManager = vtkSMProxyManager::GetProxyManager();
+    vtkSMSessionProxyManager* sessionProxyManager = proxyManager->GetActiveSessionProxyManager();
+    vtkSMProxy* pickingHelper = sessionProxyManager->NewProxy("misc", "PickingHelper");
+
+    vtkSMPropertyHelper(pickingHelper, "Input").Set(input);
+    vtkSMPropertyHelper(pickingHelper, "Selection").Set(selection);
+    vtkSMPropertyHelper(pickingHelper, "PointA").Set(nearLinePoint, 3);
+    vtkSMPropertyHelper(pickingHelper, "PointB").Set(farLinePoint, 3);
+    vtkSMPropertyHelper(pickingHelper, "SnapOnMeshPoint").Set(false);
+    pickingHelper->UpdateVTKObjects();
+    pickingHelper->UpdateProperty("Update", 1);
+
+    double center[3] = { 0.0, 0.0, 0.0 };
+    vtkSMPropertyHelper(pickingHelper, "Intersection").UpdateValueFromServer();
+    vtkSMPropertyHelper(pickingHelper, "Intersection").Get(center, 3);
+    pickingHelper->Delete();
+
+    // Update the camera
+    vtkSMRenderViewProxy* renderViewProxy = renderView->getRenderViewProxy();
+    vtkSMPropertyHelper(renderViewProxy, "CenterOfRotation").Set(center, 3);
+    vtkSMPropertyHelper(renderViewProxy, "CameraFocalPoint").Set(center, 3);
+    renderViewProxy->UpdateVTKObjects();
+    renderView->render();
+  }
+}
+
+void SPV3D_ViewWindow::showCenterAxes(bool show_axes)
+{
+  if(!myModel)
+    return;
+  pqRenderView* renderView = qobject_cast<pqRenderView*>(myModel->getView());
+  if (!renderView)
+    return;
+  renderView->setCenterAxesVisibility(show_axes);
+  renderView->render();
+}
+
+SPV3D_Prs *SPV3D_ViewWindow::findOrCreatePrs( const char* entry )
+{
+  std::string entryCpp( entry );
+  SPV3D_Prs *prsOut( new SPV3D_Prs( entry, this ) );
+  for(auto& prs : myPrs)
+  {
+    if(entryCpp == prs.first)
+    {
+      prsOut->SetPVRenderInfo( prs.second.get() );
+      return prsOut;
+    }
+  }
+  std::unique_ptr<SPV3D_EXPORTSPV3DData> data(new SPV3D_EXPORTSPV3DData);
+  prsOut->SetPVRenderInfo( data.get() );
+  std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > p(entryCpp,std::move(data));
+  myPrs.emplace_back( std::move(p) );
+  return prsOut;
+}
+
+SPV3D_EXPORTSPV3DData *SPV3D_ViewWindow::isEntryAlreadyExist( const char* entry ) const
+{
+  std::string entryCpp( entry );
+  for(const auto& prs : myPrs)
+  {
+    if(entryCpp == prs.first)
+      return prs.second.get();
+  }
+  return nullptr;
+}
+
+/*!
+  Destructor
+*/
+SPV3D_ViewWindow::~SPV3D_ViewWindow()
+{
+}
+
+bool SPV3D_ViewWindow::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
+{
+  std::string entryCpp( theIObject->getEntry() );
+  for(auto& prs : myPrs)
+  {
+    if(entryCpp == prs.first )
+      return prs.second->IsVisible();
+  }
+  return false;
+}
+
+/*!
+  Display object
+  \param theIO - object
+  \param theImmediatly - update viewer
+*/
+void SPV3D_ViewWindow::Display(const Handle(SALOME_InteractiveObject)& /*theIO*/,
+                              bool /*theImmediatly*/) 
+{
+}
+
+/*!
+  Erase object
+  \param theIO - object
+  \param theImmediatly - update viewer
+*/
+void SPV3D_ViewWindow::Erase(const Handle(SALOME_InteractiveObject)& /*theIO*/,
+                            bool /*theImmediatly*/)
+{
+}
+
+/*!
+  Display only passed object
+  \param theIO - object
+*/
+void SPV3D_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& /*theIO*/)
+{
+}
+
+
+/*!
+  Display all objects in view
+*/
+void SPV3D_ViewWindow::DisplayAll() 
+{
+}
+
+/*!
+  Erase all objects in view
+*/
+void SPV3D_ViewWindow::EraseAll() 
+{
+  for(auto& prs : myPrs)
+  {
+    prs.second->Hide();
+  }
+  if(myModel)
+    myModel->render();
+}
+
+/*!
+  Updates current viewer
+*/
+void SPV3D_ViewWindow::Repaint(bool )//(bool theUpdateTrihedron)
+{
+  if(myModel)
+    myModel->render();
+}
+
+/*!
+  Enables/disables selection.
+  \param theEnable if true - selection will be enabled
+*/
+void SPV3D_ViewWindow::SetSelectionEnabled( bool /*theEnable*/ )
+{
+}
+
+/*!
+  Emits key pressed
+*/
+void SPV3D_ViewWindow::onKeyPressed(QKeyEvent* event)
+{
+  emit keyPressed( this, event );
+}
+
+/*!
+  Emits key released
+*/
+void SPV3D_ViewWindow::onKeyReleased(QKeyEvent* event)
+{
+  emit keyReleased( this, event );
+}
+
+/*!
+  Emits mouse pressed
+*/
+void SPV3D_ViewWindow::onMousePressed(QMouseEvent* event)
+{
+  emit mousePressed(this, event);
+}
+
+/*!
+  Emits mouse released
+*/
+void SPV3D_ViewWindow::onMouseReleased(QMouseEvent* event)
+{
+  emit mouseReleased( this, event );
+}
+
+/*!
+  Emits mouse moving
+*/
+void SPV3D_ViewWindow::onMouseMoving(QMouseEvent* event)
+{
+  emit mouseMoving( this, event );
+}
+
+/*!
+  Emits mouse double clicked
+*/
+void SPV3D_ViewWindow::onMouseDoubleClicked( QMouseEvent* event )
+{
+  emit mouseDoubleClicked( this, event );
+}
+
+/*!
+  Custom show event handler
+*/
+void SPV3D_ViewWindow::showEvent( QShowEvent * theEvent ) 
+{
+  emit Show( theEvent );
+}
+
+/*!
+  Custom hide event handler
+*/
+void SPV3D_ViewWindow::hideEvent( QHideEvent * theEvent ) 
+{
+  emit Hide( theEvent );
+}
diff --git a/src/SPV3D/SPV3D_ViewWindow.h b/src/SPV3D/SPV3D_ViewWindow.h
new file mode 100644 (file)
index 0000000..3ec1af3
--- /dev/null
@@ -0,0 +1,112 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SPV3D.h"
+#include "Qtx.h"
+#include "PV3DViewer_ViewWindow.h"
+#include "SPV3D_Prs.h"
+
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_ListIO.hxx"
+
+#include <list>
+#include <memory>
+
+class SPV3D_ViewModel;
+class SPV3D_CADSelection;
+
+//! Define a container for SALOME PV3D view window
+class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow 
+{
+  Q_OBJECT
+
+ public:
+  //! To construct #SPV3D_ViewWindow instance
+  SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* theModel);
+
+  SPV3D_Prs *findOrCreatePrs( const char* entry );
+
+  SPV3D_EXPORTSPV3DData *isEntryAlreadyExist( const char* entry ) const;
+
+  void init();
+
+  virtual ~SPV3D_ViewWindow();
+  
+  bool isVisible(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  /* display */         
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SPV3D_View::Display (to support old code)
+  virtual void Display(const Handle(SALOME_InteractiveObject)& theIObject,
+                       bool theImmediatly = true);
+
+  //! Redirect the request to #SPV3D_View::DisplayOnly (to support old code)
+  virtual void DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  //! Redirect the request to #SPV3D_View::Erase (to support old code)
+  virtual void Erase(const Handle(SALOME_InteractiveObject)& theIObject,
+                     bool theImmediatly = true);
+
+  //! Redirect the request to #SPV3D_View::DisplayAll (to support old code)
+  virtual void DisplayAll();
+
+  //! Redirect the request to #SPV3D_View::EraseAll (to support old code)
+  virtual void EraseAll();
+
+  //! To repaint the viewer
+  virtual void Repaint(bool theUpdateTrihedron = true);
+
+  //! Enable/disable selection
+  virtual void SetSelectionEnabled( bool );
+
+ signals:
+  void Show( QShowEvent * );
+  void Hide( QHideEvent * );
+
+public slots:
+  virtual void showEvent( QShowEvent * );
+  virtual void hideEvent( QHideEvent * );
+  void showCenterAxes(bool);
+  void pickCenterOfRotation(int posx, int posy);
+  void goSelect(bool val);
+
+protected slots:
+  void onKeyPressed(QKeyEvent* event);
+  void onKeyReleased(QKeyEvent* event);
+  void onMousePressed(QMouseEvent* event);
+  void onMouseDoubleClicked(QMouseEvent* event);
+  void onMouseReleased(QMouseEvent* event);
+  void onMouseMoving(QMouseEvent* event);
+
+protected:
+  SPV3D_CADSelection *mySelection = nullptr;
+  int myToolBar = -1;
+  SPV3D_ViewModel* myModel;
+  std::list< std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > > myPrs;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
index 567ca5488ec0e8e88e2e03e6fc56a8928c018a05..17dfa646c89bbcfc88af069a60caf6cc1a4954ea 100644 (file)
@@ -367,4 +367,4 @@ void SUIT_SelectionMgr::filterOwners( const SUIT_DataOwnerPtrList& in, SUIT_Data
     if ( isOk( *it ) )
       out.append( *it );
   }
-}
+}
\ No newline at end of file
index a3e49cc58353185232aa568a1d4e78340b61d7e9..0d103479cdcf28d0f882f68989bd81b7cd6e7a9a 100644 (file)
@@ -204,4 +204,4 @@ void SUIT_Selector::selectionModes( QList<int>& lst ) const
 QObject* SUIT_Selector::owner() const
 {
   return myDestroyer ? myDestroyer->parent() : 0;
-}
+}
\ No newline at end of file
index 3c031a976c9dcfdb6e46a73beec65f334f983e08..dbacd417f4df73d85fb6d4d86b31c3fd919e09c6 100644 (file)
@@ -362,4 +362,4 @@ SUIT_ResourceMgr* SUIT_Session::createResourceMgr( const QString& appName ) cons
 void SUIT_Session::onApplicationActivated( SUIT_Application* app ) 
 {
   myActiveApp = app;
-}
+}
\ No newline at end of file
index 715e45d67900da820787d871948f5b6734db8b0d..6a3201b941bca1e73578e848fae72754d39f1efb 100644 (file)
@@ -117,4 +117,4 @@ void SUIT_ViewModel::getHotButton( InteractionStyle theInteractionStyle, HotOper
 {
   theState  = myStateMap[theInteractionStyle][theOper];
   theButton = myButtonMap[theInteractionStyle][theOper];
-}
+}
\ No newline at end of file
index 6f8f2243e658240c08e15fab55b501fa6357a8db..7480df9ea0a5d140b38c7f64ab069124983a6abf 100644 (file)
@@ -560,4 +560,4 @@ void SUIT_ViewWindow::setVisible( bool on )
   QApplication::sendPostedEvents( 0, QEvent::ChildPolished );
   if ( !property( "blockShow" ).toBool() )
     QMainWindow::setVisible( on );
-}
+}
\ No newline at end of file
index 05b406eb2613610961018f24c012d6fc2ebbd7bc..3a69e3d0e57406748957f54b5d6ed32824c499e3 100644 (file)
@@ -107,6 +107,13 @@ IF(SALOME_USE_OCCVIEWER)
   ENDIF(SALOME_USE_SALOMEOBJECT)
 ENDIF()
 
+IF(SALOME_USE_PV3DVIEWER)
+  LIST(APPEND _link_LIBRARIES PV3DViewer)
+  IF(SALOME_USE_SALOMEOBJECT)
+    LIST(APPEND _link_LIBRARIES SPV3D)
+  ENDIF(SALOME_USE_SALOMEOBJECT)
+ENDIF()
+
 IF(SALOME_USE_PVVIEWER)
   LIST(APPEND _link_LIBRARIES PVViewer)
 ENDIF()
index 876289b1b2ec56384e09efdfc4bbb40cbfb2ee01..2d02db84be153fea611656185223ab487fd2a1e1 100644 (file)
@@ -495,6 +495,7 @@ int AbstractGUIAppMain(int argc, char **argv)
 
   // Create Qt application instance: this should be done as early as possible!
   // Note: QApplication forces setting locale LC_ALL to system one: setlocale(LC_ALL, "").
+  SetArgcArgv(argc,argv);
   Application app(argc, argv);
 
   // Initialize Python (only once)