]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
WIP
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 31 Mar 2023 15:43:04 +0000 (17:43 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 31 Mar 2023 15:43:04 +0000 (17:43 +0200)
src/GEOMGUI/GEOM_Displayer.cxx

index bb395b9c8369ed25c6a0949d8fb15e91d0829d20..01cb2c4828532c19d76d1532de49c178e1d2b39e 100644 (file)
 
 #include <TColStd_HArray1OfByte.hxx>
 
+#include "vtkSMSourceProxy.h"
+#include "pqServerManagerModel.h"
+#include "vtkPVTrivialProducer.h"
+#include "vtkSMViewProxy.h"
+
 #if OCC_VERSION_LARGE >= 0x070400ff
 #include <Image_SupportedFormats.hxx>
 #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
   }
 }