//---------- 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;
}
//
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);
#include "SPV3D_ViewModel.h"
#include "SPV3D_ViewWindow.h"
#include "SPV3D_Prs.h"
+#include "PVViewer_Core.h"
#include <pqActiveObjects.h>
#include <pqApplicationCore.h>
#include <vtkSMRenderViewProxy.h>
#include <vtkSMRepresentationProxy.h>
#include <vtkSMSourceProxy.h>
+#include <vtkSMPVRepresentationProxy.h>
#include "SUIT_ViewModel.h"
#include "SUIT_ViewManager.h"
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);
DBG_FUN();
// try do downcast object
if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( 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<vtkSMPVRepresentationProxy*>(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()){