+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetPipeLine(VISU_PipeLine* thePipeLine)
+{
+ myPipeLine = thePipeLine;
+ if(thePipeLine)
+ thePipeLine->Delete();
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::Prs3d_i
+::IsPipeLineExists()
+{
+ return myPipeLine.GetPointer() != NULL;
+}
+
+//----------------------------------------------------------------------------
+VISU_PipeLine*
+VISU::Prs3d_i
+::GetActorPipeLine()
+{
+ return GetPipeLine();
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU::Prs3d_i
+::GetInput()
+{
+ return GetPipeLine()->GetInput();
+}
+
+//----------------------------------------------------------------------------
+Handle(SALOME_InteractiveObject)
+VISU::Prs3d_i
+::GetIO()
+{
+ if( myIO.IsNull() )
+ myIO = new SALOME_InteractiveObject(GetActorEntry().c_str(), "VISU", GetName().c_str());
+
+ return myIO;
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::Prs3d_i
+::GetActorEntry()
+{
+ return GetEntry();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::CreateActor(VISU_Actor* theActor)
+{
+ try{
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ Handle(SALOME_InteractiveObject) anIO = GetIO();
+ if(!anIO.IsNull() && anIO->hasEntry()){
+ theActor->setIO(anIO);
+ }
+
+ Update();
+ CheckDataSet();
+
+ theActor->SetPrs3d(this);
+ theActor->SetShrinkFactor(aResourceMgr->integerValue("VISU", "shrink_factor", 80)/100.);
+ theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
+
+ if( myMarkerType != VISU::MT_USER )
+ theActor->SetMarkerStd( (VTK::MarkerType)myMarkerType, (VTK::MarkerScale)myMarkerScale );
+ else if( myMarkerId > 0 ) {
+ VTK::MarkerTexture aMarkerTexture;
+ if( LoadMarkerTexture( myMarkerId, aMarkerTexture ) )
+ theActor->SetMarkerTexture( myMarkerId, aMarkerTexture );
+ }
+
+ theActor->SetPipeLine(GetActorPipeLine());
+ if(theActor->GetPipeLine() != GetPipeLine()){
+ // To decrease actor'ss pipeline reference counter
+ theActor->GetPipeLine()->Delete();
+ }
+
+ theActor->SetFactory(this);
+ theActor->ConnectToFactory(myUpdateActorsSignal, myRemoveActorsFromRendererSignal);
+
+ myActorCollection->AddItem(theActor);
+ theActor->Delete();
+ }catch(std::bad_alloc& ex){
+ throw std::runtime_error("CreateActor >> No enough memory");
+ throw ex;
+ } catch(std::exception&){
+ throw;
+ }catch(...) {
+ throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::RemoveActor(VISU_ActorBase* theActor)
+{
+ if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor<<"; "<<theActor->GetReferenceCount());
+ myActorCollection->RemoveItem(theActor);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::RemoveActors()
+{
+ if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActors - this = "<<this);
+ ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal));
+ myActorCollection->RemoveAllItems();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::UpdateActor(VISU_ActorBase* theActor)
+{
+ if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor)){
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<anActor);
+ anActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
+
+ if( myMarkerType != VISU::MT_USER )
+ anActor->SetMarkerStd( (VTK::MarkerType)myMarkerType, (VTK::MarkerScale)myMarkerScale );
+ else if( myMarkerId > 0 ) {
+ VTK::MarkerTexture aMarkerTexture;
+ if( LoadMarkerTexture( myMarkerId, aMarkerTexture ) )
+ anActor->SetMarkerTexture( myMarkerId, aMarkerTexture );
+ }
+
+ anActor->ShallowCopyPL(GetPipeLine());
+ anActor->highlight(anActor->isHighlighted());
+ }
+}
+
+void
+VISU::Prs3d_i
+::UpdateActors()
+{
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "<<this);
+ Update();
+ try {
+ CheckDataSet();
+ } catch( std::exception& ex ) {
+ if( !IsForcedHidden() ) {
+ if( HasVisibleActors() )
+ SetForcedHidden( true );
+ RemoveActors();
+ SUIT_MessageBox::warning( 0,
+ QObject::tr("WRN_VISU"),
+ QString( ex.what() ),
+ QObject::tr("BUT_OK") );
+ }
+ return;
+ }
+ ProcessVoidEvent(new TInvokeSignalEvent(myUpdateActorsSignal));
+}
+
+
+//----------------------------------------------------------------------------
+// Clipping planes
+void
+VISU::Prs3d_i
+::RemoveAllClippingPlanes()
+{
+ GetPipeLine()->RemoveAllClippingPlanes();
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::Prs3d_i
+::AddClippingPlane(vtkPlane* thePlane)
+{
+ return GetPipeLine()->AddClippingPlane(thePlane);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU::Prs3d_i
+::GetNumberOfClippingPlanes() const
+{
+ return GetPipeLine()->GetNumberOfClippingPlanes();
+}
+
+//----------------------------------------------------------------------------
+vtkPlane*
+VISU::Prs3d_i::
+GetClippingPlane(vtkIdType theID) const
+{
+ return GetPipeLine()->GetClippingPlane(theID);
+}
+
+//----------------------------------------------------------------------------
+void VISU::Prs3d_i::RemoveClippingPlane(vtkIdType theID)
+{
+ GetPipeLine()->RemoveClippingPlane(theID);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetPlaneParam(vtkFloatingPointType theDir[3],
+ vtkFloatingPointType theDist,
+ vtkPlane* thePlane)
+{
+ GetPipeLine()->SetPlaneParam(theDir, theDist, thePlane);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::GetBounds(vtkFloatingPointType aBounds[6])
+{
+ GetPipeLine()->GetMapper()->GetBounds(aBounds);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetOffset(const CORBA::Float* theOffsets)
+{
+ myOffset[0] = theOffsets[0];
+ myOffset[1] = theOffsets[1];
+ myOffset[2] = theOffsets[2];
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetOffset(CORBA::Float theDx,
+ CORBA::Float theDy,
+ CORBA::Float theDz)
+{
+ myOffset[0] = theDx;
+ myOffset[1] = theDy;
+ myOffset[2] = theDz;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::GetOffset(CORBA::Float* theOffsets)
+{
+ theOffsets[0] = myOffset[0];
+ theOffsets[1] = myOffset[1];
+ theOffsets[2] = myOffset[2];
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::GetOffset(CORBA::Float& theDx,
+ CORBA::Float& theDy,
+ CORBA::Float& theDz)
+{
+ theDx = myOffset[0];
+ theDy = myOffset[1];
+ theDz = myOffset[2];
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::Prs3d_i
+::GetMemorySize()
+{
+ // To calculate memory used by VISU PipeLine
+ CORBA::Float aSize = GetPipeLine()->GetMemorySize();
+ //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; GetPipeLine = "<<aSize / (1024.0 * 1024.0)<<endl;
+
+ // To calculate memory used by VISU Actos
+ int anEnd = myActorCollection->GetNumberOfItems();
+ for(int anId = 0; anId < anEnd; anId++)
+ if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId))
+ if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anObject)){
+ aSize += anActor->GetMemorySize();
+ //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
+ }
+
+ // Convert to mega bytes
+ return aSize / (1024.0 * 1024.0);
+}
+
+int
+VISU::Prs3d_i
+::GetNumberOfActors()
+{
+ return myActorCollection->GetNumberOfItems();
+}
+
+bool
+VISU::Prs3d_i
+::HasVisibleActors()
+{
+ myActorCollection->InitTraversal();
+ while( vtkActor* anActor = myActorCollection->GetNextActor() )
+ if( VISU_Actor* aVISUActor = dynamic_cast<VISU_Actor*>( anActor ) )
+ if( aVISUActor->GetVisibility() )
+ return true;
+ return false;
+}
+
+bool
+VISU::Prs3d_i
+::IsForcedHidden() const
+{
+ return myIsForcedHidden;
+}
+
+void
+VISU::Prs3d_i
+::SetForcedHidden( bool theFlag )
+{
+ myIsForcedHidden = theFlag;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetMarkerStd(VISU::MarkerType theMarkerType, VISU::MarkerScale theMarkerScale)
+{
+ myMarkerType = theMarkerType;
+ myMarkerScale = theMarkerScale;
+ if( myMarkerType == VISU::MT_POINT_SPRITE )
+ myMarkerScale = VISU::MS_NONE;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetMarkerTexture(CORBA::Long theMarkerId)
+{
+ myMarkerType = VISU::MT_USER;
+ myMarkerId = theMarkerId;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+VISU::MarkerType
+VISU::Prs3d_i
+::GetMarkerType()
+{
+ return myMarkerType;
+}
+
+//----------------------------------------------------------------------------
+VISU::MarkerScale
+VISU::Prs3d_i
+::GetMarkerScale()
+{
+ return myMarkerScale;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::Prs3d_i
+::GetMarkerTexture()
+{
+ return myMarkerId;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::Prs3d_i
+::LoadMarkerTexture(int theMarkerId, VTK::MarkerTexture& theMarkerTexture)
+{
+ VISU::VISU_Gen_i* aVisuGen = VISU::VISU_Gen_i::GetVisuGenImpl();
+ if( !aVisuGen )
+ return false;
+
+ const VISU::StudyId2MarkerMap& aStudyId2MarkerMap = aVisuGen->GetMarkerMap();
+
+ const SALOMEDS::Study_var& aStudy = GetStudyDocument();
+ if( CORBA::is_nil( aStudy.in() ) )
+ return false;
+
+ int aStudyId = aStudy->StudyId();
+ VISU::StudyId2MarkerMap::const_iterator aStudyId2MarkerIter = aStudyId2MarkerMap.find( aStudyId );
+ if( aStudyId2MarkerIter == aStudyId2MarkerMap.end() )
+ return false;
+
+ VTK::MarkerMap aMarkerMap = aStudyId2MarkerIter->second;
+ VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.find( theMarkerId );
+ if( aMarkerIter == aMarkerMap.end() )
+ return false;
+
+ theMarkerTexture = aMarkerIter->second.second;
+ return true;