From: Anthony Geay Date: Fri, 31 Mar 2023 15:43:04 +0000 (+0200) Subject: WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=915f8d2ffb4deb8580968cd8dfd2cbf55a821742;p=modules%2Fgeom.git WIP --- diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index bb395b9c8..01cb2c482 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -148,6 +148,11 @@ #include +#include "vtkSMSourceProxy.h" +#include "pqServerManagerModel.h" +#include "vtkPVTrivialProducer.h" +#include "vtkSMViewProxy.h" + #if OCC_VERSION_LARGE >= 0x070400ff #include #endif @@ -1772,6 +1777,60 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs ) SHOW(myShape); MSGEL("...-> update SALOME_PV3DPrs"); + { + GEOM_Actor *actor = GEOM_Actor::New(); + updateActorProperties( actor, true ); + actor->GetMapper()->Update(); + vtkDataObject *ds = actor->GetMapper()->GetInput();//GetOutputDataObject(0); + vtkPolyData *ds2 = vtkPolyData::SafeDownCast(ds); + MSGEL("!!!!!!!!!!!!!!!!!!!!!!!!"); + MSGEL(ds2->GetNumberOfCells()); + // + 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(ds2); + mySourceProducer->updatePipeline(); + // + pv3dPrs->SetSourceProducer( mySourceProducer ); +#if 0 + // check that study is active + SalomeApp_Study* study = getStudy(); + if ( !study ) return; + + // set interactive object + + Handle( SALOME_InteractiveObject ) anIO; + + if ( !myIO.IsNull() ) { + actor->setIO( myIO ); + anIO = myIO; + } + else if ( !myName.empty() ) { + // workaround to allow selection of temporary objects + static int tempId = 0; + anIO = new SALOME_InteractiveObject( QString( "TEMP_VTK_%1" ).arg( tempId++ ).toUtf8().data(), "GEOM", myName.c_str() ); + actor->setIO( anIO ); + } + + // presentation study entry (empty for temporary objects like preview) + QString entry = !anIO.IsNull() ? QString( anIO->getEntry() ) : QString(); + // flag: temporary object + bool isTemporary = entry.isEmpty() || entry.startsWith( "TEMP_" ); + // currently active view window's ID (-1 if no active view) + int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1; + + // get presentation properties + PropMap propMap = getObjectProperties( entry, myViewFrame ); + QColor c; + actor->SetShape( myShape, qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ), myType == GEOM_VECTOR ); +#endif + } +#if 0 // For now, display the bbox instead of the shape itself Standard_Real XMin = -1, YMin = -1, ZMin = -1, XMax = 1, YMax = 1, ZMax = 1; if (!myShape.IsNull()) @@ -1822,8 +1881,9 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs ) } else { // presentation is being updated - // NYI } + // NYI +#endif } }