From: Anthony Geay Date: Wed, 5 Apr 2023 12:49:17 +0000 (+0200) Subject: First visu of GEOM objects X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=69ee4ba3deecc60df174dbfd2d9446daf7aa6a61;p=modules%2Fgui.git First visu of GEOM objects --- diff --git a/src/PVViewer/PVViewer_Core.cxx b/src/PVViewer/PVViewer_Core.cxx index 352a67caf..02a07a5e4 100644 --- a/src/PVViewer/PVViewer_Core.cxx +++ b/src/PVViewer/PVViewer_Core.cxx @@ -53,23 +53,17 @@ //---------- Static init ----------------- -pqPVApplicationCore* PVViewer_Core::MyCoreApp = 0; +pqPVApplicationCore* PVViewer_Core::MyCoreApp = nullptr; 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() { - DBG_FUNC(); if ( ! MyCoreApp) { // Obtain command-line arguments int argc = 0; @@ -107,23 +101,35 @@ 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); +/*! + \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) +{ + DBG_FUNC(); + if( ! ParaViewInitAppCore() ) + return false; - new pqTabbedMultiViewWidget(); // registers a "MULTIVIEW_WIDGET" on creation + // Direct VTK log messages to our SALOME window - TODO: review this + PVViewer_OutputWindow * w = PVViewer_OutputWindow::New(); + vtkOutputWindow::SetInstance(w); - for (int i = 0; i < argc; i++) - free(argv[i]); - delete[] argv; - } + 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); diff --git a/src/PVViewer/PVViewer_Core.h b/src/PVViewer/PVViewer_Core.h index 9d56dfda9..4c12e3930 100644 --- a/src/PVViewer/PVViewer_Core.h +++ b/src/PVViewer/PVViewer_Core.h @@ -38,6 +38,8 @@ 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*); diff --git a/src/SPV3D/SPV3D_ViewModel.cxx b/src/SPV3D/SPV3D_ViewModel.cxx index e2ab71e3e..ccd03eadd 100644 --- a/src/SPV3D/SPV3D_ViewModel.cxx +++ b/src/SPV3D/SPV3D_ViewModel.cxx @@ -30,6 +30,7 @@ #include "SPV3D_ViewModel.h" #include "SPV3D_ViewWindow.h" #include "SPV3D_Prs.h" +#include "PVViewer_Core.h" #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include "SUIT_ViewModel.h" #include "SUIT_ViewManager.h" @@ -103,15 +105,15 @@ SUIT_ViewWindow* SPV3D_ViewModel::createView( SUIT_Desktop* theDesktop ) SPV3D_ViewWindow* aViewWindow = new SPV3D_ViewWindow(theDesktop, this); aViewWindow->SetSelectionEnabled( isSelectionEnabled() ); - - QStringList args = QCoreApplication::arguments(); + PVViewer_Core::ParaViewInitAppCore(); + /*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 = new pqPVApplicationCore(argc,argv); - QApplication::instance()->installEventFilter(appPV); + pqPVApplicationCore *appPV = new pqPVApplicationCore(argc,argv);*/ + QApplication::instance()->installEventFilter( PVViewer_Core::GetPVAppCore() ); new pqParaViewBehaviors(aViewWindow,aViewWindow); pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder()); QObject::connect(builder, &pqObjectBuilder::sourceCreated, this, &SPV3D_ViewModel::onSourceCreated); @@ -225,14 +227,18 @@ void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs ) DBG_FUN(); // try do downcast object if(const SPV3D_Prs* aPrs = dynamic_cast( prs )){ - if(aPrs->IsNull()) - return; pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder()); + pqActiveObjects::instance().setActiveView(getView()); pqPipelineSource *mySourceProducer = aPrs->GetSourceProducer(); pqDataRepresentation* myRepr(builder->createDataRepresentation(mySourceProducer->getOutputPort(0),getView(),"GeometryRepresentation")); vtkSMViewProxy::RepresentationVisibilityChanged(myRepr->getViewProxy(), myRepr->getProxy(), true); myRepr->setVisible(1); aPrs->SetRepresentation(myRepr); + vtkSMPVRepresentationProxy* proxy(dynamic_cast(myRepr->getProxy())); + vtkSMPropertyHelper inputHelper(proxy, "Input"); + vtkSMSourceProxy* input = vtkSMSourceProxy::SafeDownCast(inputHelper.GetAsProxy()); + input->UpdatePipeline(); + getView()->resetDisplay(); getView()->render(); #if 0 if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){