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

#include <VP1CustomTourEditor.h>

Inheritance diagram for VP1CustomTourEditor:
Collaboration diagram for VP1CustomTourEditor:

Classes

class  Imp
 

Public Slots

void setClipVolumePercentOfATLAS (double)
 

Signals

void clipVolumePercentOfATLAS (double)
 
void clipVolumeRadiusChanged (double)
 

Public Member Functions

 VP1CustomTourEditor (VP1ExaminerViewer *)
 
void setState (QByteArray)
 
QByteArray state () const
 
virtual ~VP1CustomTourEditor ()
 
void disableObjectWhenTourNotAvailable (QObject *)
 
bool tourAvailable () const
 
bool tourIsPerspective () const
 
void addTourToAnimationSequencer (AnimationSequencer &, bool jumpDirectlyToFirstFrame) const
 

Protected Member Functions

void closeEvent (QCloseEvent *)
 

Private Slots

void frameStepToEarlier ()
 
void frameStepToLater ()
 
void frameDelete ()
 
void frameShow ()
 
void buttonClicked ()
 
void swap (VP1CustomTourFrameWidget *, VP1CustomTourFrameWidget *)
 
void enabledFrameListChanged ()
 

Private Attributes

Impm_d
 

Detailed Description

Definition at line 26 of file VP1CustomTourEditor.h.

Constructor & Destructor Documentation

◆ VP1CustomTourEditor()

VP1CustomTourEditor::VP1CustomTourEditor ( VP1ExaminerViewer viewer)

Definition at line 100 of file VP1CustomTourEditor.cxx.

101  : QWidget(0,Qt::WindowStaysOnTopHint), m_d(new Imp)
102 {
103 
104  m_d->theclass = this;
105  m_d->ui.setupUi(this);
106  m_d->ui.groupBox_utilityZoom->setChecked(false);
107  m_d->ui.widget_utilityZoomContents->setVisible(false);
108  m_d->viewer = viewer;
109  setWindowIcon(QIcon(QString(":/vp1/icons/icons/3d_32x32.png")));
110  m_d->frameHolderWidget = new QWidget;
111  m_d->ui.scrollArea->setWidgetResizable(true);
112  m_d->ui.scrollArea->setWidget(m_d->frameHolderWidget);
113 
114  connect(new QShortcut(QKeySequence(Qt::Key_Escape), this),SIGNAL(activated()),this,SLOT(hide()));
115  connect(m_d->ui.pushButton_close,SIGNAL(clicked()),this,SLOT(hide()));
116 
117  connect(m_d->ui.pushButton_addCurrentView,SIGNAL(clicked()),this,SLOT(buttonClicked()));
118  connect(m_d->ui.pushButton_refreshPreviews,SIGNAL(clicked()),this,SLOT(buttonClicked()));
119  connect(m_d->ui.pushButton_execute,SIGNAL(clicked()),this,SLOT(buttonClicked()));
120  connect(m_d->ui.pushButton_utilityZoomShow,SIGNAL(clicked()),this,SLOT(buttonClicked()));
121 
122  m_d->objectsToDisableWhenTourUnavailable << m_d->ui.pushButton_execute;
123 
125 }

◆ ~VP1CustomTourEditor()

VP1CustomTourEditor::~VP1CustomTourEditor ( )
virtual

Definition at line 128 of file VP1CustomTourEditor.cxx.

129 {
130  m_d->frameHolderWidget->deleteLater();
131  for (VP1CustomTourFrameWidget*frame : m_d->frames)
132  frame->deleteLater();
133  delete m_d;
134 }

Member Function Documentation

◆ addTourToAnimationSequencer()

void VP1CustomTourEditor::addTourToAnimationSequencer ( AnimationSequencer as,
bool  jumpDirectlyToFirstFrame 
) const

Definition at line 419 of file VP1CustomTourEditor.cxx.

420 {
421  if (!tourAvailable())
422  return;
423  bool firstInDirectJump(jumpDirectlyToFirstFrame);
424  for (VP1CustomTourFrameWidget*frame : m_d->frames) {
425  if (frame->frameIsEnabled()) {
426  double t(frame->zoomToFrameTime());
427  if (firstInDirectJump) {
428  t = 0.0;
429  firstInDirectJump = false;
430  }
431 
432  // std::cout<<"addTourToAnimationSequencer %="<<frame->clipVolumePercentOfATLAS()<<std::endl;
433  as.sequence().addFrame(frame->camState(),t,
435  frame->clipVolumePercentOfATLAS() );
436  if (frame->stayOnFrameTime()>0.0)
437  as.sequence().addFrame(frame->camState(),frame->stayOnFrameTime(),false, false, frame->clipVolumePercentOfATLAS());
438  }
439  }
440 }

◆ buttonClicked

void VP1CustomTourEditor::buttonClicked ( )
privateslot

Definition at line 299 of file VP1CustomTourEditor.cxx.

300 {
301  if (m_d->ui.pushButton_addCurrentView==sender()) {
304  m_d->addFrame(frame);
305  m_d->updateFrameSnapshot(frame);
307  } else if (m_d->ui.pushButton_refreshPreviews==sender()) {
308  for (VP1CustomTourFrameWidget*frame : m_d->frames)
309  m_d->updateFrameSnapshot(frame);
310  } else if (m_d->ui.pushButton_execute==sender()) {
312  } else if (m_d->ui.pushButton_utilityZoomShow==sender()) {
313  SoCamera * cam = m_d->viewer->getCamera();
314  SoNode * root = m_d->viewer->getSceneGraph();
315  if (!cam||!root||!root->getTypeId().isDerivedFrom(SoGroup::getClassTypeId()))
316  return;
317 
318  double r(m_d->ui.doubleSpinBox_radius->value()*1000.0/*meters*/);
319  double theta(m_d->ui.doubleSpinBox_theta->value()/180.0*M_PI);
320  theta += M_PI;
321  while (theta<0) theta += 2*M_PI;
322  while (theta>2*M_PI) theta -= 2*M_PI;
323  double a(r/sqrt(3.0));
324  SbBox3f box(-a,-a,-a,a,a,a);
325  SbVec3f lookat = SbVec3f(sin(theta),0,cos(theta));
326  SbVec3f upvec = SbVec3f(0,1,0);
327  bool notifyenabled = cam->enableNotify(false);
328  m_d->viewer->resetCamera();
329  VP1CameraHelper::animatedZoomToBBox( cam,static_cast<SoGroup*>(root),
330  box, 0.0, 100.0, 1.0,lookat,upvec);
331  if (notifyenabled)
332  cam->enableNotify(true);//Don't touch here - to avoid showing
333  //the reset cam state (the camera helper
334  //will touch it when modifying it)
335  }
336 }

◆ clipVolumePercentOfATLAS

void VP1CustomTourEditor::clipVolumePercentOfATLAS ( double  )
signal

◆ clipVolumeRadiusChanged

void VP1CustomTourEditor::clipVolumeRadiusChanged ( double  )
signal

◆ closeEvent()

void VP1CustomTourEditor::closeEvent ( QCloseEvent *  ev)
protected

Definition at line 137 of file VP1CustomTourEditor.cxx.

138 {
139  ev->ignore();
140  hide();
141 }

◆ disableObjectWhenTourNotAvailable()

void VP1CustomTourEditor::disableObjectWhenTourNotAvailable ( QObject *  o)

Definition at line 451 of file VP1CustomTourEditor.cxx.

452 {
453  if (o)
455 }

◆ enabledFrameListChanged

void VP1CustomTourEditor::enabledFrameListChanged ( )
privateslot

Definition at line 366 of file VP1CustomTourEditor.cxx.

367 {
368  int nEnabledPerspectiveFrames, nEnabledOrthographicFrames;
369  int n = m_d->countEnabledFrames( nEnabledPerspectiveFrames,
370  nEnabledOrthographicFrames );
371  QString s("dummy");
372  bool enable(true);
373  if (n<2) {
374  s = "Add at least two frames for tour";
375  enable=false;
376  } else {
377  if (nEnabledPerspectiveFrames>0&&nEnabledOrthographicFrames>0) {
378  s = "Mixed camera types are forbidden";
379  enable=false;
380  } else {
381  if (nEnabledPerspectiveFrames>0)
382  s="Perspective camera tour";
383  else
384  s="Orthographic camera tour";
385  }
386  }
387  m_d->ui.label_statustext->setText(s);
388 
389  for (QObject * o : m_d->objectsToDisableWhenTourUnavailable) {
390  if (o->isWidgetType())
391  static_cast<QWidget*>(o)->setEnabled(enable);
392  else
393  static_cast<QAction*>(o)->setEnabled(enable);
394  }
395 }

◆ frameDelete

void VP1CustomTourEditor::frameDelete ( )
privateslot

Definition at line 220 of file VP1CustomTourEditor.cxx.

221 {
222  VP1CustomTourFrameWidget * frame = dynamic_cast<VP1CustomTourFrameWidget*>(sender());
223  if (!frame)
224  return;
225  m_d->frames.removeAll(frame);
226  frame->deleteLater();
229 }

◆ frameShow

void VP1CustomTourEditor::frameShow ( )
privateslot

Definition at line 232 of file VP1CustomTourEditor.cxx.

233 {
234  VP1CustomTourFrameWidget * frame = dynamic_cast<VP1CustomTourFrameWidget*>(sender());
235  if (!frame)
236  return;
237 
239  //Zoom there:
240  SoCamera * cam = m_d->viewer->getCamera();
241  SoNode * root = m_d->viewer->getSceneGraph();
242  if (!cam||!root||!root->getTypeId().isDerivedFrom(SoGroup::getClassTypeId()))
243  return;
244 
245  if (m_d->viewer->isAnimating())
246  m_d->viewer->stopAnimating();
247  VP1CameraHelper::animatedZoomToCameraState( cam,static_cast<SoGroup*>(root),frame->camState(),
248  frame->zoomToFrameTime(),
249  frame->clipVolumePercentOfATLAS(),
251  frame->zoomToFrameForcedCircular() );
252  } else {
253  //Go there directly:
255  SoCamera * cam = m_d->viewer->getCamera();
256  if (!cam)
257  return;
258  QByteArray ba(frame->camState());
260  }
261 }

◆ frameStepToEarlier

void VP1CustomTourEditor::frameStepToEarlier ( )
privateslot

Definition at line 190 of file VP1CustomTourEditor.cxx.

191 {
192  int iframe(m_d->frames.indexOf(dynamic_cast<VP1CustomTourFrameWidget*>(sender())));
193  if (iframe<=0)
194  return;//not found or already at start
195 #if QTCORE_VERSION >= 0x050D00
196  m_d->frames.swapItemsAt(iframe-1,iframe);
197 #else
198  m_d->frames.swap(iframe-1,iframe);
199 #endif
201 }

◆ frameStepToLater

void VP1CustomTourEditor::frameStepToLater ( )
privateslot

Definition at line 204 of file VP1CustomTourEditor.cxx.

205 {
206  int iframe(m_d->frames.indexOf(dynamic_cast<VP1CustomTourFrameWidget*>(sender())));
207  if (iframe<0)
208  return;
209  if (iframe>=m_d->frames.count()-1)
210  return;//already at end
211 #if QTCORE_VERSION >= 0x050D00
212  m_d->frames.swapItemsAt(iframe,iframe+1);
213 #else
214  m_d->frames.swap(iframe,iframe+1);
215 #endif
217 }

◆ setClipVolumePercentOfATLAS

void VP1CustomTourEditor::setClipVolumePercentOfATLAS ( double  percent)
slot

Definition at line 442 of file VP1CustomTourEditor.cxx.

442  {
444 
445  // Let's assume ATLAS is 40m long. So emit this.
446  emit clipVolumeRadiusChanged( percent * 400 );
447 }

◆ setState()

void VP1CustomTourEditor::setState ( QByteArray  ba)

Definition at line 75 of file VP1CustomTourEditor.cxx.

76 {
77  for (VP1CustomTourFrameWidget*frame : m_d->frames)
78  frame->deleteLater();
79  m_d->frames.clear();
80 
81  VP1Deserialise s(ba);
82  if (s.version()!=0)
83  return;
84  QList<QByteArray> frameStates = s.restore<QList<QByteArray> >();
85  s.restore(m_d->ui.doubleSpinBox_theta);
86  s.restore(m_d->ui.doubleSpinBox_radius);
87  s.restore(m_d->ui.groupBox_utilityZoom);
88  s.warnUnrestored(this);
89 
90  m_d->ui.widget_utilityZoomContents->setVisible(m_d->ui.groupBox_utilityZoom->isChecked());
91 
92  for (QByteArray ba2 : frameStates)
96 }

◆ state()

QByteArray VP1CustomTourEditor::state ( ) const

Definition at line 58 of file VP1CustomTourEditor.cxx.

59 {
60  VP1Serialise s(0/*version*/);
61  QList<QByteArray> frameStates;
62  for (VP1CustomTourFrameWidget*frame : m_d->frames) {
63  frameStates << frame->serialise();
64  s.ignoreWidget(frame);
65  }
66  s.save(frameStates);
67  s.save(m_d->ui.doubleSpinBox_theta);
68  s.save(m_d->ui.doubleSpinBox_radius);
69  s.save(m_d->ui.groupBox_utilityZoom);
70  s.warnUnsaved(this);
71  return s.result();
72 }

◆ swap

void VP1CustomTourEditor::swap ( VP1CustomTourFrameWidget frame1,
VP1CustomTourFrameWidget frame2 
)
privateslot

Definition at line 279 of file VP1CustomTourEditor.cxx.

281 {
282  int iframe1(m_d->frames.indexOf(frame1));
283  int iframe2(m_d->frames.indexOf(frame2));
284  if ( iframe1==iframe2
285  ||iframe1<0
286  ||iframe2<0
287  ||iframe1>=m_d->frames.count()
288  ||iframe2>=m_d->frames.count() )
289  return;
290 #if QTCORE_VERSION >= 0x050D00
291  m_d->frames.swapItemsAt(iframe1,iframe2);
292 #else
293  m_d->frames.swap(iframe1,iframe2);
294 #endif
296 }

◆ tourAvailable()

bool VP1CustomTourEditor::tourAvailable ( ) const

Definition at line 398 of file VP1CustomTourEditor.cxx.

399 {
400  int nEnabledPerspectiveFrames, nEnabledOrthographicFrames;
401  int n = m_d->countEnabledFrames( nEnabledPerspectiveFrames,
402  nEnabledOrthographicFrames );
403  if (nEnabledPerspectiveFrames>0&&nEnabledOrthographicFrames>0)
404  return false;
405  return n>=2;
406 }

◆ tourIsPerspective()

bool VP1CustomTourEditor::tourIsPerspective ( ) const

Definition at line 409 of file VP1CustomTourEditor.cxx.

410 {
411  int nEnabledPerspectiveFrames, nEnabledOrthographicFrames;
412  m_d->countEnabledFrames( nEnabledPerspectiveFrames,
413  nEnabledOrthographicFrames );
414 
415  return nEnabledOrthographicFrames==0;
416 }

Member Data Documentation

◆ m_d

Imp* VP1CustomTourEditor::m_d
private

Definition at line 67 of file VP1CustomTourEditor.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
VP1Serialise
Definition: VP1Serialise.h:45
VP1CustomTourEditor::Imp::countEnabledFrames
int countEnabledFrames(int &nEnabledPerspectiveFrames, int &nEnabledOrthographicFrames) const
Definition: VP1CustomTourEditor.cxx:348
VP1QtInventorUtils::deserializeSoCameraParameters
static bool deserializeSoCameraParameters(QByteArray &, SoCamera &)
Definition: VP1QtInventorUtils.cxx:959
EvoMonitoring.percent
def percent(a, b)
Definition: EvoMonitoring.py:33
VP1CustomTourEditor::Imp::ui
Ui::VP1CustomTourEditorForm ui
Definition: VP1CustomTourEditor.cxx:42
VP1CustomTourEditor::Imp::updateFrameStepControlsEnablement
void updateFrameStepControlsEnablement()
Definition: VP1CustomTourEditor.cxx:264
VP1CustomTourFrameWidget::zoomToFrameWithVariableSpeed
bool zoomToFrameWithVariableSpeed() const
Definition: VP1CustomTourFrameWidget.cxx:156
VP1ExaminerViewer::toggleCameraType
virtual void toggleCameraType()
Definition: VP1ExaminerViewer.cxx:1472
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
VP1CustomTourEditor::enabledFrameListChanged
void enabledFrameListChanged()
Definition: VP1CustomTourEditor.cxx:366
M_PI
#define M_PI
Definition: ActiveFraction.h:11
VP1ExaminerViewer::currentCamIsPerspective
bool currentCamIsPerspective() const
Definition: VP1ExaminerViewer.cxx:1775
sendEI_SPB.root
root
Definition: sendEI_SPB.py:34
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
VP1CustomTourEditor::Imp::addFrame
void addFrame(VP1CustomTourFrameWidget *frame)
Definition: VP1CustomTourEditor.cxx:144
VP1CustomTourEditor::Imp::objectsToDisableWhenTourUnavailable
QList< QObject * > objectsToDisableWhenTourUnavailable
Definition: VP1CustomTourEditor.cxx:46
VP1CustomTourEditor::tourAvailable
bool tourAvailable() const
Definition: VP1CustomTourEditor.cxx:398
VP1CustomTourFrameWidget::zoomToFrameTime
double zoomToFrameTime() const
Definition: VP1CustomTourFrameWidget.cxx:167
ev
int ev
Definition: globals.cxx:25
VP1CustomTourEditor::Imp::updateFrameListVisuals
void updateFrameListVisuals()
Definition: VP1CustomTourEditor.cxx:158
VP1CustomTourEditor::clipVolumeRadiusChanged
void clipVolumeRadiusChanged(double)
VP1ExaminerViewer::getSceneGraph
virtual SoNode * getSceneGraph()
Definition: VP1ExaminerViewer.cxx:3138
beamspotman.n
n
Definition: beamspotman.py:731
VP1CustomTourEditor::Imp::updateFrameSnapshot
void updateFrameSnapshot(VP1CustomTourFrameWidget *)
Definition: VP1CustomTourEditor.cxx:339
VP1CustomTourFrameWidget::zoomToFrameForcedCircular
bool zoomToFrameForcedCircular() const
Definition: VP1CustomTourFrameWidget.cxx:161
AnimationSequence::addFrame
void addFrame(REGION reg, const SbVec3f &dir, const SbVec3f &upvec, double t, bool variableSpeed=false, bool forceCircular=false, double clip=100.0)
Definition: AnimationSequence.h:53
VP1ExaminerViewer::currentCameraState
QByteArray currentCameraState() const
Definition: VP1ExaminerViewer.cxx:1781
VP1CustomTourEditor::Imp::frameHolderWidget
QWidget * frameHolderWidget
Definition: VP1CustomTourEditor.cxx:44
VP1CustomTourFrameWidget::clipVolumePercentOfATLAS
double clipVolumePercentOfATLAS() const
Definition: VP1CustomTourFrameWidget.cxx:179
VP1CustomTourEditor::Imp::viewer
VP1ExaminerViewer * viewer
Definition: VP1CustomTourEditor.cxx:43
AnimationSequencer::sequence
AnimationSequence & sequence()
Definition: AnimationSequencer.cxx:75
VP1CustomTourEditor::m_d
Imp * m_d
Definition: VP1CustomTourEditor.h:66
VP1Deserialise
Definition: VP1Deserialise.h:44
VP1CustomTourFrameWidget::serialise
QByteArray serialise() const
Definition: VP1CustomTourFrameWidget.cxx:110
VP1ExaminerViewer::resetCamera
void resetCamera()
Definition: VP1ExaminerViewer.cxx:1760
VP1CustomTourEditor::Imp::frames
QList< VP1CustomTourFrameWidget * > frames
Definition: VP1CustomTourEditor.cxx:45
VP1CustomTourFrameWidget::camState
QByteArray camState() const
Definition: VP1CustomTourFrameWidget.cxx:191
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
VP1CustomTourFrameWidget::stayOnFrameTime
double stayOnFrameTime() const
Definition: VP1CustomTourFrameWidget.cxx:173
VP1ExaminerViewer::startCustomTour
void startCustomTour()
Definition: VP1ExaminerViewer.cxx:1244
VP1CustomTourEditor::clipVolumePercentOfATLAS
void clipVolumePercentOfATLAS(double)
a
TList * a
Definition: liststreamerinfos.cxx:10
VP1CustomTourEditor::Imp::theclass
VP1CustomTourEditor * theclass
Definition: VP1CustomTourEditor.cxx:41
VP1CustomTourFrameWidget::frameIsEnabled
bool frameIsEnabled() const
Definition: VP1CustomTourFrameWidget.cxx:149
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
VP1CustomTourEditor::buttonClicked
void buttonClicked()
Definition: VP1CustomTourEditor.cxx:299
VP1CustomTourFrameWidget
Definition: VP1CustomTourFrameWidget.h:23
VP1CustomTourFrameWidget::camStateIsPerspective
bool camStateIsPerspective() const
Definition: VP1CustomTourFrameWidget.cxx:185
VP1CameraHelper::animatedZoomToBBox
static 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)
Definition: VP1CameraHelper.cxx:460