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

#include <VP1CameraHelper.h>

Inheritance diagram for VP1CameraHelper:
Collaboration diagram for VP1CameraHelper:

Classes

class  Imp
 

Signals

void animationFinished ()
 
void animationFinishedAbnormally ()
 
void clipVolumePercentageOfATLAS (double)
 

Public Member Functions

void setOutputImagesMode (VP1ExaminerViewer *ra, const QString &outputdir, int width=1024, int height=768, double fps=24, const QString &prefix="vp1_frame")
 
void forceAbort ()
 

Static Public Member Functions

static void abortAnyCurrentZoom (SoCamera *camera)
 
static VP1CameraHelperanimatedZoomToCameraState (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)
 
static VP1CameraHelperanimatedZoomToPoint (SoCamera *camera, SoGroup *sceneroot, SbVec3f, double duration_in_secs=1.0, double clipVolPercent=100.0, bool varySpeed=true, bool forceCircular=false)
 
static VP1CameraHelperanimatedZoomToPath (SoCamera *camera, SoGroup *sceneroot, SoPath *path, double duration_in_secs=1.0, double clipVolPercent=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)
 
static VP1CameraHelperanimatedZoomToBBox (SoCamera *camera, SoGroup *sceneroot, const SbBox3f &box, double duration_in_secs=1.0, double clipVolPercent=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)
 
static VP1CameraHelperanimatedZoomToSubTree (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)
 
static void getLastAndNextFrameFileNames (const QString &outputdir, const QString &prefix, QString &lastOfExistingFiles, QString &nextAvailableFile)
 

Private Member Functions

 VP1CameraHelper (SoCamera *, SoGroup *)
 
virtual ~VP1CameraHelper ()
 

Private Attributes

Impm_d
 

Detailed Description

Definition at line 31 of file VP1CameraHelper.h.

Constructor & Destructor Documentation

◆ VP1CameraHelper()

VP1CameraHelper::VP1CameraHelper ( SoCamera *  camera,
SoGroup *  sceneroot 
)
private

Definition at line 202 of file VP1CameraHelper.cxx.

203  : QObject(0), m_d(new Imp)
204 {
205  m_d->theclass=this;
206  m_d->camera=camera;
207  m_d->forceCircular = false;
208  if (camera) {
210  if (it!=Imp::helpers.end())
211  it->second->forceAbort();
212  Imp::helpers[camera] = this;
213  }
214  m_d->sceneroot=sceneroot;
215 
216  m_d->fps=-1;
217  m_d->ntotframes = -1;
218  m_d->width = 100;
219  m_d->height = 100;
220  m_d->iframe = -1;
221  m_d->renderArea = 0;
222 
223  m_d->seekdistance = 50.0f;
225  m_d->seektopoint = TRUE;
226  m_d->seekperiod = 2.0f;
227  m_d->inseekmode = FALSE;
228  m_d->seeksensor = new SoTimerSensor(Imp::seeksensorCB, m_d);
229 
230  m_d->searchaction = new SoSearchAction;
231  m_d->matrixaction = new SoGetMatrixAction(SbViewportRegion(100,100));
232 
233  m_d->camera->ref();
234  m_d->sceneroot->ref();
235  m_d->camera_ref=m_d->camera->getRefCount();
236  m_d->instance_invalid = false;
237 
238  if (!camera||!sceneroot)
239  m_d->instance_invalid=true;
240 
241 }

◆ ~VP1CameraHelper()

VP1CameraHelper::~VP1CameraHelper ( )
privatevirtual

Definition at line 245 of file VP1CameraHelper.cxx.

246 {
247  if (m_d->seeksensor->isScheduled())
248  m_d->seeksensor->unschedule();
249  delete m_d->seeksensor;
250  m_d->searchaction->reset(); delete m_d->searchaction;
251  delete m_d->matrixaction;
252  SoCamera * cam = m_d->camera;
253  if (m_d->sceneroot)
254  m_d->sceneroot->unref();
255  delete m_d; m_d=0;
256  if (cam) {
258  if (it!=Imp::helpers.end())
259  Imp::helpers.erase(it);
260  cam->unref();
261  }
262 }

Member Function Documentation

◆ abortAnyCurrentZoom()

void VP1CameraHelper::abortAnyCurrentZoom ( SoCamera *  camera)
static

Definition at line 265 of file VP1CameraHelper.cxx.

266 {
269  if (it!=Imp::helpers.end()) {
270  helper = it->second;
271  }
272  if (helper)
273  helper->forceAbort();
274 }

◆ animatedZoomToBBox()

VP1CameraHelper * VP1CameraHelper::animatedZoomToBBox ( SoCamera *  camera,
SoGroup *  sceneroot,
const SbBox3f &  box,
double  duration_in_secs = 1.0,
double  clipVolPercent = 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 
)
static

Definition at line 460 of file VP1CameraHelper.cxx.

464 {
465 
466  VP1CameraHelper * helper = new VP1CameraHelper(camera,sceneroot);
467  helper->m_d->actual_animatedZoomToBBox( box,duration_in_secs,slack,lookat,upvec );
468  helper->m_d->varySpeed=varySpeed;
469  helper->m_d->forceCircular = forceCircular;
470  return helper;
471 }

◆ animatedZoomToCameraState()

VP1CameraHelper * 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 
)
static

Definition at line 301 of file VP1CameraHelper.cxx.

305 {
306  // std::cout<<"VP1CameraHelper::animatedZoomToCameraState - clipVol%="<<clipVolPercent<<" lastClipVolPercent"<<lastClipVolPercent<<std::endl;
307  // std::cout<<"clipVol_lastPercentage%="<<d->clipVol_lastPercentage<<", clipVol_percentage%="<<d->clipVol_percentage
308  // <<", clipVol_startPercentage%="<<d->clipVol_startPercentage<<", clipVol_endPercentage%="<<d->clipVol_endPercentage<<std::endl;
309  VP1CameraHelper * helper = new VP1CameraHelper(camera,sceneroot);
310  helper->m_d->actual_animatedZoomToCameraState( camstate,duration_in_secs );
311  helper->m_d->varySpeed=varySpeed;
312  helper->m_d->clipVol_startPercentage=lastClipVolPercent;
313  helper->m_d->clipVol_percentage=lastClipVolPercent;
314  helper->m_d->clipVol_endPercentage=clipVolPercent;
315  helper->m_d->forceCircular = forceCircular;
316  return helper;
317 }

◆ animatedZoomToPath()

VP1CameraHelper * VP1CameraHelper::animatedZoomToPath ( SoCamera *  camera,
SoGroup *  sceneroot,
SoPath *  path,
double  duration_in_secs = 1.0,
double  clipVolPercent = 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 
)
static

Definition at line 371 of file VP1CameraHelper.cxx.

375 {
376  VP1CameraHelper * helper = new VP1CameraHelper(camera,sceneroot);
377  helper->m_d->actual_animatedZoomToPath( path,duration_in_secs, slack, lookat, upvec );
378  helper->m_d->varySpeed=varySpeed;
379  helper->m_d->forceCircular = forceCircular;
380  return helper;
381 }

◆ animatedZoomToPoint()

VP1CameraHelper * VP1CameraHelper::animatedZoomToPoint ( SoCamera *  camera,
SoGroup *  sceneroot,
SbVec3f  targetpoint,
double  duration_in_secs = 1.0,
double  clipVolPercent = 100.0,
bool  varySpeed = true,
bool  forceCircular = false 
)
static

Definition at line 592 of file VP1CameraHelper.cxx.

595 {
596  VP1CameraHelper * helper = new VP1CameraHelper(camera,sceneroot);
597  helper->m_d->actual_animatedZoomToPoint( targetpoint,duration_in_secs );
598  helper->m_d->varySpeed=varySpeed;
599  helper->m_d->forceCircular = forceCircular;
600  return helper;
601 }

◆ animatedZoomToSubTree()

VP1CameraHelper * 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 
)
static

Definition at line 413 of file VP1CameraHelper.cxx.

417 {
418  VP1CameraHelper * helper = new VP1CameraHelper(camera,sceneroot);
419  helper->m_d->actual_animatedZoomToSubTree( subtreeroot,duration_in_secs,slack,lookat,upvec );
420  helper->m_d->varySpeed=varySpeed;
421  helper->m_d->forceCircular = forceCircular;
422  return helper;
423 }

◆ animationFinished

void VP1CameraHelper::animationFinished ( )
signal

◆ animationFinishedAbnormally

void VP1CameraHelper::animationFinishedAbnormally ( )
signal

◆ clipVolumePercentageOfATLAS

void VP1CameraHelper::clipVolumePercentageOfATLAS ( double  )
signal

◆ forceAbort()

void VP1CameraHelper::forceAbort ( )

Definition at line 150 of file VP1CameraHelper.cxx.

151 {
153  if (it!=Imp::helpers.end())
154  Imp::helpers.erase(it);
155  m_d->instance_invalid = true;
156  m_d->camera->unrefNoDelete();
157  m_d->camera = 0;
158 }

◆ getLastAndNextFrameFileNames()

void VP1CameraHelper::getLastAndNextFrameFileNames ( const QString &  outputdir,
const QString &  prefix,
QString &  lastOfExistingFiles,
QString &  nextAvailableFile 
)
static

Definition at line 793 of file VP1CameraHelper.cxx.

796 {
797  lastOfExistingFiles="";
798  QString filename;
799  int i(0);
800  while (true) {
801  filename=outputdir+"/"+prefix+"_"+QString::number(i++).rightJustified(6,'0')+".png";
802  if (!QFile::exists(filename)) {
803  nextAvailableFile=filename;
804  return;
805  }
806  lastOfExistingFiles = filename;
807  }
808 }

◆ setOutputImagesMode()

void VP1CameraHelper::setOutputImagesMode ( VP1ExaminerViewer ra,
const QString &  outputdir,
int  width = 1024,
int  height = 768,
double  fps = 24,
const QString &  prefix = "vp1_frame" 
)

Definition at line 164 of file VP1CameraHelper.cxx.

170 {
171  if (!ra) {
172  VP1Msg::messageDebug("VP1CameraHelper::setOutputImagesMode ERROR: Bad input. Null render area.");
173  return;
174  }
175  if (fps<1) {
176  VP1Msg::messageDebug("VP1CameraHelper::setOutputImagesMode ERROR: Bad input. Bad FPS = "+QString::number(fps));
177  return;
178  }
179  if (!QDir(outputdir).exists()) {
180  VP1Msg::messageDebug("VP1CameraHelper::setOutputImagesMode ERROR: Bad input. Output dir "+outputdir+" does not exist.");
181  return;
182  }
183  if (width<1||width>4000||height<1||height>4000) {
184  VP1Msg::messageDebug("VP1CameraHelper::setOutputImagesMode ERROR: Bad input. Bad dimensions: "
185  +QString::number(width)+"x"+QString::number(height));
186  return;
187  }
188  if (prefix.isEmpty()) {
189  VP1Msg::messageDebug("VP1CameraHelper::setOutputImagesMode ERROR: Bad input. Empty prefix.");
190  return;
191  }
192  m_d->fps = fps;
193  m_d->outputdir = outputdir;
194  m_d->width = width;
195  m_d->height = height;
196  m_d->prefix = prefix;
197  m_d->renderArea = ra;
198 }

Member Data Documentation

◆ m_d

Imp* VP1CameraHelper::m_d
private

Definition at line 103 of file VP1CameraHelper.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
VP1CameraHelper::Imp::forceCircular
bool forceCircular
Definition: VP1CameraHelper.cxx:48
VP1CameraHelper::Imp::seekdistanceabs
SbBool seekdistanceabs
Definition: VP1CameraHelper.cxx:59
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
VP1CameraHelper::Imp::seeksensorCB
static void seeksensorCB(void *data, SoSensor *)
Definition: VP1CameraHelper.cxx:682
VP1CameraHelper::Imp::camera_ref
int32_t camera_ref
Definition: VP1CameraHelper.cxx:100
VP1CameraHelper
Definition: VP1CameraHelper.h:31
VP1CameraHelper::Imp::height
int height
Definition: VP1CameraHelper.cxx:82
VP1CameraHelper::Imp::seeksensor
SoTimerSensor * seeksensor
Definition: VP1CameraHelper.cxx:54
skel.it
it
Definition: skel.GENtoEVGEN.py:396
VP1CameraHelper::Imp::inseekmode
SbBool inseekmode
Definition: VP1CameraHelper.cxx:56
VP1CameraHelper::Imp::sceneroot
SoGroup * sceneroot
Definition: VP1CameraHelper.cxx:46
VP1CameraHelper::VP1CameraHelper
VP1CameraHelper(SoCamera *, SoGroup *)
Definition: VP1CameraHelper.cxx:202
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
VP1CameraHelper::Imp::ntotframes
int ntotframes
Definition: VP1CameraHelper.cxx:79
VP1CameraHelper::Imp::seekdistance
float seekdistance
Definition: VP1CameraHelper.cxx:58
VP1CameraHelper::Imp::instance_invalid
bool instance_invalid
Definition: VP1CameraHelper.cxx:101
VP1CameraHelper::Imp::iframe
int iframe
Definition: VP1CameraHelper.cxx:80
lumiFormat.i
int i
Definition: lumiFormat.py:85
VP1CameraHelper::Imp::camera
SoCamera * camera
Definition: VP1CameraHelper.cxx:45
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
python.Constants.TRUE
bool TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Control/AthenaCommon/python/Constants.py:22
VP1CameraHelper::Imp::theclass
VP1CameraHelper * theclass
Definition: VP1CameraHelper.cxx:44
VP1CameraHelper::Imp::prefix
QString prefix
Definition: VP1CameraHelper.cxx:77
VP1CameraHelper::Imp::renderArea
VP1ExaminerViewer * renderArea
Definition: VP1CameraHelper.cxx:75
VP1CameraHelper::Imp::searchaction
SoSearchAction * searchaction
Definition: VP1CameraHelper.cxx:96
VP1CameraHelper::Imp::seektopoint
SbBool seektopoint
Definition: VP1CameraHelper.cxx:57
python.selection.number
number
Definition: selection.py:20
VP1CameraHelper::Imp::fps
double fps
Definition: VP1CameraHelper.cxx:78
python.Constants.FALSE
bool FALSE
Definition: Control/AthenaCommon/python/Constants.py:23
VP1CameraHelper::Imp::helpers
static std::map< SoCamera *, VP1CameraHelper * > helpers
Definition: VP1CameraHelper.cxx:114
VP1CameraHelper::Imp::matrixaction
SoGetMatrixAction * matrixaction
Definition: VP1CameraHelper.cxx:97
VP1CameraHelper::Imp::width
int width
Definition: VP1CameraHelper.cxx:81
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
VP1CameraHelper::Imp::outputdir
QString outputdir
Definition: VP1CameraHelper.cxx:76
VP1CameraHelper::m_d
Imp * m_d
Definition: VP1CameraHelper.h:102
python.dummyaccess.exists
def exists(filename)
Definition: dummyaccess.py:9
VP1CameraHelper::Imp::seekperiod
float seekperiod
Definition: VP1CameraHelper.cxx:55