if ( myObjects ) myObjects->Delete();
}
+void SPV3D_Prs::DisplayIn( SALOME_View* v ) const
+{
+ SALOME_PV3DPrs::DisplayIn(v);
+}
+
/*!
\return actors list
*/
class vtkActorCollection;
class vtkActor;
+class pqPipelineSource;
+class pqDataRepresentation;
class SPV3D_EXPORT SPV3D_Prs : public SALOME_PV3DPrs
{
public:
explicit SPV3D_Prs( const char* entry );
- // Default constructor
SPV3D_Prs( const char* entry, const vtkActor* obj );
- // Standard constructor
~SPV3D_Prs();
- // Destructor
+
+ void DisplayIn( SALOME_View* v ) const override;
+
+ void SetSourceProducer(pqPipelineSource *sourceProducer) { _sourceProducer = sourceProducer; }
+ pqPipelineSource *GetSourceProducer() const { return _sourceProducer; }
+
+ void SetRepresentation(pqDataRepresentation *repr) const { _repr = repr; }
vtkActorCollection* GetObjects() const;
// Get actors list
private:
vtkActorCollection* myObjects; // list of actors
+ pqPipelineSource *_sourceProducer = nullptr;
+ mutable pqDataRepresentation *_repr = nullptr;
};
#endif
#include <SUIT_Desktop.h>
+#include <pqObjectBuilder.h>
+#include <pqApplicationCore.h>
+#include <pqServerManagerModel.h>
+#include <pqServerResource.h>
+#include <pqView.h>
+#include <pqPVApplicationCore.h>
+
+#include <QVBoxLayout>
+#include <QApplication>
+
//---------------------------------------------------------
#define USE_DEBUG
#define MBCLASSNAME "SPV3D_ViewManager"
{
DBG_FUN();
setTitle( PV3DViewer_ViewManager::tr( "PARAVIEW3D_VIEW_TITLE" ) );
-
+ int argc = 1;
+ char *argv[2];
+ argv[0] = strdup("salome");
+ argv[1] = nullptr;
+ pqPVApplicationCore appPV(argc,argv);
+ QApplication::instance()->installEventFilter(&appPV);
+ 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);
+ //PVViewer_InitSingleton::Init(theDesktop);
connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
}
+pqView *SPV3D_ViewModel::getView() const
+{
+ return _view;
+ //return pqActiveObjects::instance().activeView();
+}
+
/*!
Display presentation
\param prs - presentation
if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs )){
if(aPrs->IsNull())
return;
+ pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+ 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);
+ getView()->render();
+#if 0
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor()){
// NYI
}
}
+#endif
}
}
class pqPipelineSource;
class pqCADSelection;
class pqCADGroupModel;
+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;
public:
//! Define string representation of the viewer type
private:
bool mySelectionEnabled;
+ pqView *_view = nullptr;
};
#endif