if (!CORBA::is_nil(theView3D)) {
VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
SUIT_ViewWindow* aVW = pView->GetViewWindow();
- myView = dynamic_cast<SVTK_ViewWindow*>(aVW);
- connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) );
+ setViewer( dynamic_cast<SVTK_ViewWindow*>(aVW) );
}
myAnimationMode = VISU::Animation::PARALLEL;
//------------------------------------------------------------------------
VISU_TimeAnimation::~VISU_TimeAnimation()
{
- if (!myView) {
- MESSAGE("Viewer is not defined for animation");
- return;
- }
-
if (QThread::isRunning() && !QThread::isFinished()) {
- //myExecutionState->SetActive(false);
stopAnimation();
QThread::wait(500);
if (QThread::isRunning() && !QThread::isFinished()) {
}
}
- for (int i = 0; i < getNbFields(); i++) {
+ for (int i = 0; i < getNbFields() && myView; i++) {
clearData(myFieldsLst[i]);
}
clearFieldData();
}
+//------------------------------------------------------------------------
+void VISU_TimeAnimation::_connectView()
+{
+ connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) );
+}
+
//------------------------------------------------------------------------
bool VISU_TimeAnimation::addField (_PTR(SObject) theField)
{
//------------------------------------------------------------------------
void VISU_TimeAnimation::_visibilityOff(int num_field, int num_frame) {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
if ( num_field < 0 || num_frame < 0 ) return;
FieldData& aData = myFieldsLst[num_field];
if ( aData.myActors.empty() ) return;
(this,&VISU_TimeAnimation::_startAnimation));
}
-//------------------------------------------------------------------------
-CORBA::Boolean VISU_TimeAnimation::isRunning()
-{
- return myExecutionState->IsActive();
-}
-
//------------------------------------------------------------------------
void VISU_TimeAnimation::_nextFrame() {
if (!myView) {
if (aData.myActors[aData.myNbFrames-1] != 0)
visibilityOff(i, aData.myNbFrames-1);
}
- if (aData.myActors[myFrame] != 0) {
+ if (aData.myActors[myFrame] != 0 && myView) {
ProcessVoidEvent(new TVoidMemFunEvent<VISU_Actor>(aData.myActors[myFrame],
&VISU_Actor::VisibilityOn));
}
}
+ if (!myView)
+ return;
bool repainArg = false;
ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
&SVTK_ViewWindow::Repaint,
if (aData.myActors[aData.myNbFrames-1] != 0)
visibilityOff(aFieldId, aData.myNbFrames-1);
}
- if (aData.myActors[aFrame] != 0) {
+ if (aData.myActors[aFrame] != 0 && myView) {
ProcessVoidEvent(new TVoidMemFunEvent<VISU_Actor>(aData.myActors[aFrame],
&VISU_Actor::VisibilityOn));
}
+ if (!myView)
+ return;
bool repainArg = false;
ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
&SVTK_ViewWindow::Repaint,
void VISU_TimeAnimation::onViewDeleted()
{
myView = 0;
+ stopAnimation();
}
void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs)
protected:
CORBA::Boolean _generateFrames();
+ void _connectView();
void _visibilityOff(int num_field, int num_frame);
void _clearView();
void _clearData(FieldData& theData);
CORBA::Boolean generateFrames();
void generatePresentations(CORBA::Long theFieldNum);
- void setViewer(SVTK_ViewWindow* theView) { myView = theView; }
+ void setViewer(SVTK_ViewWindow* theView) { myView = theView; _connectView(); }
SVTK_ViewWindow* getViewer() { return myView; }
void clearView();
void clearData(FieldData& theData);
CORBA::Long getNbFields() { return myFieldsLst.size(); }
CORBA::Long getNbFrames();
- CORBA::Boolean isRunning();
CORBA::Long getCurrentFrame() { return myFrame; }
long getAbsoluteFrameNumber(std::pair<int,long> theFieldTimeStamp);