ATLAS Offline Software
Classes | Signals | Public Member Functions | Private Slots | Private Attributes | List of all members
AnimationSequencer Class Reference

#include <AnimationSequencer.h>

Inheritance diagram for AnimationSequencer:
Collaboration diagram for AnimationSequencer:

Classes

class  Clockwork
 

Signals

void animationFinishedSuccessfully ()
 
void clipVolumePercentOfATLAS (double)
 

Public Member Functions

 AnimationSequencer (VP1ExaminerViewer *viewer)
 
 ~AnimationSequencer ()
 
AnimationSequencesequence ()
 
const AnimationSequencesequence () const
 
void startAnimating (bool skipFirstFrame=false)
 
void setMovie (bool)
 
void setMovieParameters (QString outdir, QString frameFileNamePrefix, int fps, int width, int height)
 

Private Slots

void nextAnimationFrame ()
 
void abortAnimation ()
 

Private Attributes

Clockworkm_c
 

Detailed Description

Definition at line 19 of file AnimationSequencer.h.

Constructor & Destructor Documentation

◆ AnimationSequencer()

AnimationSequencer::AnimationSequencer ( VP1ExaminerViewer viewer)

Definition at line 55 of file AnimationSequencer.cxx.

55  :
56  m_c(new Clockwork)
57 {
59  m_c->viewer=viewer;
60  m_c->sphere=NULL;
61  m_c->movieEnabled=false;
62  m_c->movieFPS=24;
63  m_c->movieWidth=100;
64  m_c->movieHeight=100;
65  m_c->movieOutdir="/tmp/vp1frames";
66  m_c->frameFileNamePrefix="vp1_frame";
67 }

◆ ~AnimationSequencer()

AnimationSequencer::~AnimationSequencer ( )

Definition at line 69 of file AnimationSequencer.cxx.

70 {
71  if (m_c->sphere) m_c->sphere->unref();
72  delete m_c;
73 }

Member Function Documentation

◆ abortAnimation

void AnimationSequencer::abortAnimation ( )
privateslot

Definition at line 90 of file AnimationSequencer.cxx.

90  {
91  //Make sure we halt:
92  VP1Msg::messageVerbose("AnimationSequencer::abortAnimation.");
94 }

◆ animationFinishedSuccessfully

void AnimationSequencer::animationFinishedSuccessfully ( )
signal

◆ clipVolumePercentOfATLAS

void AnimationSequencer::clipVolumePercentOfATLAS ( double  )
signal

◆ nextAnimationFrame

void AnimationSequencer::nextAnimationFrame ( )
privateslot

Definition at line 96 of file AnimationSequencer.cxx.

97 {
98  VP1Msg::messageVerbose("AnimationSequencer::nextAnimationFrame.");
99 
100  if (m_c->animationFrameNumber>=sequence().getNumFrames()) {
102  VP1Msg::messageVerbose("animation succeeded!");
103  return;
104  }
105 
106  SoNode * rootnode = m_c->viewer->getSceneGraph();
107  if (!rootnode) {
108  VP1Msg::messageDebug("AnimationSequencer::nextAnimationFrame WARNING: No scenegraph set. Ignoring.");
109  return;
110  }
111  if ( ! ( rootnode->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) ) {
112  VP1Msg::messageDebug("AnimationSequencer::nextAnimationFrame WARNING: Root node does not derive from SoGroup. Ignoring.");
113  return;
114  }
115 
116 // if (m_c->viewer->getCameraType() == SoPerspectiveCamera::getClassTypeId() ) {
117 // //Fix for bad camera:
118 // m_c->viewer->toggleCameraType();
119 // m_c->viewer->toggleCameraType();
120 // }
121 
122  SoCamera * camera = m_c->viewer->getCamera();
123  if (!camera) {
124  VP1Msg::messageDebug("AnimationSequencer::nextAnimationFrame WARNING: Could not get camera. Ignoring.");
125  return;
126  }
127 
128  rootnode->ref();
129  SoGroup * root = static_cast<SoGroup*>(rootnode);
130 
131  unsigned int i = m_c->animationFrameNumber;
132 
133 
134  //Get region:
136  // std::cout<<"Frame: "<<i<<" clipVolumePercentOfATLAS="<<f.clipVolPercent<<std::endl;
137 
138  if (f.time==0.0&&!f.camState.isEmpty())
139  {
141  QTimer::singleShot(0, this, SLOT(nextAnimationFrame()));
142  else
143  QTimer::singleShot(0, this, SLOT(abortAnimation()));
144  } else {
146  if (f.camState.isEmpty()) {
147  // std::cout<<"camState empty"<<std::endl;
148  camera->ref();
149  bool notifyenabled = root->enableNotify(false);
150  SoSphere * regionsphere = m_c->getRegionSphere(AnimationSequence::REGION(f.reg),
151  camera->getTypeId().isDerivedFrom(SoPerspectiveCamera::getClassTypeId()));
152  camera->unrefNoDelete();
153  //Get direction:
154  SbVec3f lookat=f.dir, upvec = f.upvec;
155  root->insertChild(regionsphere,0);
156  VP1Msg::messageVerbose("nextAnimationFrame Initiating zoom to region sphere.");
157  helper = VP1CameraHelper::animatedZoomToSubTree(camera,root,regionsphere,f.time,f.clipVolPercent, m_c->last_clipVolPercent,0.1,lookat,upvec,f.variableSpeed,f.forceCircular);
158 
159  root->removeChild(regionsphere);
160 
161  if (notifyenabled) {
162  root->enableNotify(true);
163  root->touch();
164  }
165 
166  } else {
167  // std::cout<<"camState not empty"<<std::endl;
168  helper = VP1CameraHelper::animatedZoomToCameraState( camera,root,f.camState,f.time,f.clipVolPercent, m_c->last_clipVolPercent, f.variableSpeed,f.forceCircular );
169  }
170 
171  if (m_c->movieEnabled)
173 
174  connect(helper,SIGNAL(animationFinished()), this, SLOT(nextAnimationFrame()));
175  connect(helper,SIGNAL(animationFinishedAbnormally()), this, SLOT(abortAnimation()));
176  connect(helper,SIGNAL(clipVolumePercentageOfATLAS(double)), this, SIGNAL(clipVolumePercentOfATLAS(double)));
177 
178  }
179  // std::cout<<" Setting last_clipVolPercent to "<<f.clipVolPercent<<std::endl;
180  m_c->last_clipVolPercent = f.clipVolPercent;
181 
182 
183  rootnode->unrefNoDelete();
185 
186 }

◆ sequence() [1/2]

AnimationSequence & AnimationSequencer::sequence ( )

Definition at line 75 of file AnimationSequencer.cxx.

75  {
76  return m_c->animationSequence;
77 }

◆ sequence() [2/2]

const AnimationSequence & AnimationSequencer::sequence ( ) const

Definition at line 79 of file AnimationSequencer.cxx.

79  {
80  return m_c->animationSequence;
81 }

◆ setMovie()

void AnimationSequencer::setMovie ( bool  b)

Definition at line 41 of file AnimationSequencer.cxx.

42 {
43  m_c->movieEnabled = b;
44 }

◆ setMovieParameters()

void AnimationSequencer::setMovieParameters ( QString  outdir,
QString  frameFileNamePrefix,
int  fps,
int  width,
int  height 
)

Definition at line 46 of file AnimationSequencer.cxx.

47 {
48  m_c->movieFPS = fps;
49  m_c->movieWidth = width;
50  m_c->movieHeight = height;
52  m_c->frameFileNamePrefix = frameFileNamePrefix;
53 }

◆ startAnimating()

void AnimationSequencer::startAnimating ( bool  skipFirstFrame = false)

Definition at line 83 of file AnimationSequencer.cxx.

83  {
84 
85  m_c->animationFrameNumber=(skipFirstFrame?1:0);
86  m_c->last_clipVolPercent = 100;
88 }

Member Data Documentation

◆ m_c

Clockwork* AnimationSequencer::m_c
private

Definition at line 57 of file AnimationSequencer.h.


The documentation for this class was generated from the following files:
AnimationSequencer::Clockwork::viewer
VP1ExaminerViewer * viewer
Definition: AnimationSequencer.cxx:27
VP1QtInventorUtils::deserializeSoCameraParameters
static bool deserializeSoCameraParameters(QByteArray &, SoCamera &)
Definition: VP1QtInventorUtils.cxx:961
VP1CameraHelper
Definition: VP1CameraHelper.h:31
AnimationSequencer::Clockwork::animationSequence
AnimationSequence animationSequence
Definition: AnimationSequencer.cxx:25
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
AnimationSequencer::Clockwork::movieFPS
int movieFPS
Definition: AnimationSequencer.cxx:33
sendEI_SPB.root
root
Definition: sendEI_SPB.py:34
AnimationSequencer::abortAnimation
void abortAnimation()
Definition: AnimationSequencer.cxx:90
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
plotting.efficiency.outdir
outdir
Definition: efficiency.py:18
VP1ExaminerViewer::getSceneGraph
virtual SoNode * getSceneGraph()
Definition: VP1ExaminerViewer.cxx:3138
lumiFormat.i
int i
Definition: lumiFormat.py:85
AnimationSequencer::Clockwork::movieEnabled
bool movieEnabled
Definition: AnimationSequencer.cxx:32
AnimationSequencer::Clockwork::movieOutdir
QString movieOutdir
Definition: AnimationSequencer.cxx:36
AnimationSequencer::animationFinishedSuccessfully
void animationFinishedSuccessfully()
hist_file_dump.f
f
Definition: hist_file_dump.py:135
AnimationSequencer::sequence
AnimationSequence & sequence()
Definition: AnimationSequencer.cxx:75
AnimationSequencer::Clockwork::last_clipVolPercent
double last_clipVolPercent
Definition: AnimationSequencer.cxx:38
AnimationSequencer::Clockwork::movieWidth
int movieWidth
Definition: AnimationSequencer.cxx:34
AnimationSequence::getNumFrames
unsigned int getNumFrames() const
Definition: AnimationSequence.h:67
AnimationSequence::Frame
Definition: AnimationSequence.h:29
VP1CameraHelper::animatedZoomToCameraState
static VP1CameraHelper * animatedZoomToCameraState(SoCamera *camera, SoGroup *sceneroot, const QByteArray &camstate, double duration_in_secs=1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, bool varySpeed=true, bool forceCircular=false)
Definition: VP1CameraHelper.cxx:301
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
AnimationSequencer::Clockwork::animationFrameNumber
unsigned int animationFrameNumber
Definition: AnimationSequencer.cxx:26
AnimationSequencer::nextAnimationFrame
void nextAnimationFrame()
Definition: AnimationSequencer.cxx:96
AnimationSequence::REGION
REGION
Definition: AnimationSequence.h:26
AnimationSequencer::Clockwork::getRegionSphere
SoSphere * getRegionSphere(AnimationSequence::REGION, bool perspective)
Definition: AnimationSequencer.cxx:188
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
AnimationSequencer::Clockwork::sphere
SoSphere * sphere
Definition: AnimationSequencer.cxx:28
AnimationSequencer::m_c
Clockwork * m_c
Definition: AnimationSequencer.h:56
AnimationSequencer::Clockwork::movieHeight
int movieHeight
Definition: AnimationSequencer.cxx:35
AnimationSequencer::Clockwork::frameFileNamePrefix
QString frameFileNamePrefix
Definition: AnimationSequencer.cxx:37
VP1CameraHelper::animatedZoomToSubTree
static VP1CameraHelper * animatedZoomToSubTree(SoCamera *camera, SoGroup *sceneroot, SoNode *subtreeroot, double duration_in_secs=1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
Definition: VP1CameraHelper.cxx:413
AnimationSequencer::clipVolumePercentOfATLAS
void clipVolumePercentOfATLAS(double)
AnimationSequence::getFrame
const Frame & getFrame(unsigned int i) const
Definition: AnimationSequence.h:70