This commit is contained in:
Anthony Geay 2023-03-31 17:43:04 +02:00
parent 104da2cf24
commit 915f8d2ffb

View File

@ -148,6 +148,11 @@
#include <TColStd_HArray1OfByte.hxx> #include <TColStd_HArray1OfByte.hxx>
#include "vtkSMSourceProxy.h"
#include "pqServerManagerModel.h"
#include "vtkPVTrivialProducer.h"
#include "vtkSMViewProxy.h"
#if OCC_VERSION_LARGE >= 0x070400ff #if OCC_VERSION_LARGE >= 0x070400ff
#include <Image_SupportedFormats.hxx> #include <Image_SupportedFormats.hxx>
#endif #endif
@ -1772,6 +1777,60 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
SHOW(myShape); SHOW(myShape);
MSGEL("...-> update SALOME_PV3DPrs"); 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 // For now, display the bbox instead of the shape itself
Standard_Real XMin = -1, YMin = -1, ZMin = -1, XMax = 1, YMax = 1, ZMax = 1; Standard_Real XMin = -1, YMin = -1, ZMin = -1, XMax = 1, YMax = 1, ZMax = 1;
if (!myShape.IsNull()) if (!myShape.IsNull())
@ -1822,8 +1881,9 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
} }
else { else {
// presentation is being updated // presentation is being updated
// NYI
} }
// NYI
#endif
} }
} }