mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-13 01:14:33 +05:00
Factorisation
This commit is contained in:
parent
915f8d2ffb
commit
4bc55e3217
@ -1774,116 +1774,11 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
|
||||
//
|
||||
// processing for usual geometry presentation
|
||||
//
|
||||
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
|
||||
pv3dPrs->FillUsingActor( actor );
|
||||
}
|
||||
#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())
|
||||
{
|
||||
Bnd_Box aBndBox;
|
||||
BRepBndLib::Add(myShape, aBndBox);
|
||||
aBndBox.Get(XMin, YMin, ZMin, XMax, YMax, ZMax);
|
||||
MSGEL("BBox= X:[" << XMin << "," << XMax << "] Y:[" << YMin << "," << YMax << "] Z: [" << ZMin << "," << ZMax << "]");
|
||||
}
|
||||
|
||||
// if presentation is empty we try to create new one
|
||||
if ( pv3dPrs->IsNull() )
|
||||
{
|
||||
// Create a pipeline source with vtkPolyData output from a TopoDS_Shape
|
||||
pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
|
||||
pqServer* activeServer = pqActiveObjects::instance().activeServer();
|
||||
|
||||
#define USE_CUBE_SOURCE
|
||||
#ifdef USE_CUBE_SOURCE
|
||||
pqPipelineSource* source = builder->createSource("sources", "CubeSource", activeServer);
|
||||
#else
|
||||
pqPipelineSource* source = builder->createSource("sources", "GeometryGenerator", activeServer);
|
||||
#endif
|
||||
if (!source) {
|
||||
MSGEL("ERR: VTK source not found");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// Set dimensions of bbox
|
||||
vtkSMProxy* proxy = source->getProxy();
|
||||
#ifdef USE_CUBE_SOURCE
|
||||
vtkSMPropertyHelper(proxy, "XLength").Set(XMax-XMin);
|
||||
vtkSMPropertyHelper(proxy, "YLength").Set(YMax-YMin);
|
||||
vtkSMPropertyHelper(proxy, "ZLength").Set(ZMax-ZMin);
|
||||
#else
|
||||
// Standard_SStream ss;
|
||||
// BRepTools::Write(myShape, ss);
|
||||
// std::string str = ss.str();
|
||||
// vtkSMPropertyHelper(proxy, "BRepStream").Set(str.c_str());
|
||||
|
||||
vtkSMPropertyHelper(proxy, "EdgeSubdivision").Set(2);
|
||||
vtkSMPropertyHelper(proxy, "NumberOfSolids").Set(1);
|
||||
#endif
|
||||
|
||||
proxy->UpdateVTKObjects();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// presentation is being updated
|
||||
}
|
||||
// NYI
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user