~TActorFactory()
{}
+ //! Gets know whether the factory instance can be used for actor management or not
+ virtual
+ bool
+ GetActiveState() = 0;
+
//! Return modified time of the factory
virtual
unsigned long int
#include "VISU_View_i.hh"
#include "VISU_Actor.h"
-#include "VTKViewer_Algorithm.h"
-#include "SVTK_Functor.h"
-
-//#include "VISU_Convertor.hxx"
-//#include "VISU_PipeLine.hxx"
-
#include "VVTK_ViewWindow.h"
#include "SUIT_ResourceMgr.h"
-#include <vtkRenderer.h>
-
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
return true;
if(aPrs3d != aLastVisitedPrs3d){
- // To erase all actors that corresponds to the holder
- vtkRenderer* aRenderer = aViewWindow->getRenderer();
- vtkActorCollection* anActors = aRenderer->GetActors();
- Handle(SALOME_InteractiveObject) anIO = aPrs3d->GetIO();
- SVTK::ForEachIf<VISU_Actor>(anActors,
- SVTK::TIsSameIObject<SALOME_Actor>(anIO),
- SVTK::TSetVisibility<VISU_Actor>(false));
+ // To erase non active presentation
+ aLastVisitedPrs3d->SetActiveState(false);
+ anActor->SetVisibility(false);
// To find the new one that corresponds to fresh presentation
VISU_Actor* aNewActor = VISU::FindActor(aViewWindow, aPrs3d);
if(!aNewActor){
aNewActor->SetVisibility(true);
//anActor->RemoveFromRender();
aNewActor->DeepCopy(anActor);
+ aPrs3d->SetActiveState(true);
}
aViewWindow->Repaint();
return true;
}
}
}
-
-
}
PrsObject_i(SALOMEDS::Study::_nil()),
myActorCollection(vtkActorCollection::New()),
mySObject(SALOMEDS::SObject::_nil()),
+ myIsActiveSatate(true),
myPipeLine(NULL),
myResult(NULL)
{
PrsObject_i(theSObject->GetStudy()),
mySObject(theSObject),
myActorCollection(vtkActorCollection::New()),
+ myIsActiveSatate(true),
myResult(theResult),
myPipeLine(NULL)
{
return aTime;
}
+//----------------------------------------------------------------------------
+bool
+VISU::Prs3d_i
+::GetActiveState()
+{
+ return myIsActiveSatate;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetActiveState(bool theState)
+{
+ myIsActiveSatate = theState;
+}
+
//----------------------------------------------------------------------------
VISU::Storable*
VISU::Prs3d_i
CORBA::Float
GetMemorySize();
+ //----------------------------------------------------------------------------
+ //! Gets know whether the factory instance can be used for actor management or not
+ virtual
+ bool
+ GetActiveState();
+
//----------------------------------------------------------------------------
//! Return modified time of the presentation
virtual
VISU_PipeLine *myPipeLine;
Handle(SALOME_InteractiveObject) myIO;
+
+ private:
+ //! Sets activity flag for the factory instance
+ void
+ SetActiveState(bool theState);
+
+ bool myIsActiveSatate;
+
+ friend class ColoredPrs3dCache_i;
};
//----------------------------------------------------------------------------
#include "VVTK_ViewWindow.h"
-VVTK_Viewer::
-VVTK_Viewer()
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+#include "VISU_Actor.h"
+#include "SVTK_View.h"
+#include "SVTK_Prs.h"
+
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
+//---------------------------------------------------------------
+VVTK_Viewer
+::VVTK_Viewer()
{
}
-VVTK_Viewer::
-~VVTK_Viewer()
+//---------------------------------------------------------------
+VVTK_Viewer
+::~VVTK_Viewer()
{
}
-//==========================================================
+//---------------------------------------------------------------
SUIT_ViewWindow*
-VVTK_Viewer::
-createView( SUIT_Desktop* theDesktop )
+VVTK_Viewer
+::createView( SUIT_Desktop* theDesktop )
{
TViewWindow* aViewWindow = new TViewWindow (theDesktop);
aViewWindow->Initialize(this);
return aViewWindow;
}
+
+//---------------------------------------------------------------
+void
+VVTK_Viewer
+::Display(const SALOME_VTKPrs* thePrs)
+{
+ // try do downcast object
+ if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>(thePrs)){
+ if(aPrs->IsNull())
+ return;
+ if(vtkActorCollection* aCollection = aPrs->GetObjects()){
+ aCollection->InitTraversal();
+ while(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(aCollection->GetNextActor())){
+ if(!anActor->GetFactory()->GetActiveState())
+ continue;
+ QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+ for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+ if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
+ if(SVTK_View* aView = aViewWindow->getView()){
+ aView->Display(anActor, false);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------
+namespace VVTK
+{
+ struct TIsOneActorVisibleAction
+ {
+ bool& myResult;
+ TIsOneActorVisibleAction(bool& theResult):
+ myResult(theResult)
+ {
+ myResult = false;
+ }
+ void
+ operator()(SALOME_Actor* theActor)
+ {
+ if(!myResult)
+ myResult = theActor->GetVisibility();
+ }
+ };
+}
+
+//---------------------------------------------------------------
+bool
+VVTK_Viewer
+::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
+{
+ QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+ for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+ if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
+ bool aResult;
+ VVTK::TIsOneActorVisibleAction anAction(aResult);
+ SVTK::ForEachIf<SALOME_Actor>(aViewWindow->getRenderer()->GetActors(),
+ SVTK::TIsSameIObject<SALOME_Actor>(theIO),
+ anAction);
+ return anAction.myResult;
+ }
+
+ return false;
+}
public:
typedef VVTK_ViewWindow TViewWindow;
- static QString Type() { return "VVTK"; }
+
+ static
+ QString
+ Type()
+ {
+ return "VVTK";
+ }
VVTK_Viewer();
- virtual ~VVTK_Viewer();
+
+ virtual
+ ~VVTK_Viewer();
//! See #SUIT_ViewModel::createView
- virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
+ virtual
+ SUIT_ViewWindow*
+ createView(SUIT_Desktop*);
//! See SUIT_ViewModel::getType
- virtual QString getType() const { return Type(); }
+ virtual
+ QString
+ getType() const
+ {
+ return Type();
+ }
+
+ //! See #SALOME_View::Display( const SALOME_Prs* )
+ virtual
+ void
+ Display(const SALOME_VTKPrs* thePrs);
+
+ //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
+ virtual
+ bool
+ isVisible(const Handle(SALOME_InteractiveObject)& theIO);
};
#endif