ATLAS Offline Software
Loading...
Searching...
No Matches
VP1ExaminerViewer Class Reference

#include <VP1ExaminerViewer.h>

Inheritance diagram for VP1ExaminerViewer:
Collaboration diagram for VP1ExaminerViewer:

Classes

class  Imp

Public Member Functions

 VP1ExaminerViewer (QWidget *parent=0, bool detectorViewButtons=true, const char *name=0, SbBool embed=TRUE, SoQtFullViewer::BuildFlag flag=BUILD_ALL, SoQtViewer::Type type=BROWSER)
 VP1ExaminerViewer (const VP1ExaminerViewer &)=delete
VP1ExaminerVieweroperator= (const VP1ExaminerViewer &)=delete
virtual ~VP1ExaminerViewer ()
virtual void removeDecorationMenuOption ()
virtual QByteArray saveState ()
virtual void restoreFromState (QByteArray)
virtual void viewAll ()
virtual void toggleCameraType ()
virtual void setCameraType (SoType type)
virtual void setSeekMode (SbBool enable)
virtual void setViewing (SbBool enable)
virtual void setBufferingType (SoQtViewer::BufferType)
virtual void setAntialiasing (SbBool smoothing, int numPasses)
virtual void setTransparencyType (SoGLRenderAction::TransparencyType)
virtual void setDrawStyle (SoQtViewer::DrawType, SoQtViewer::DrawStyle)
virtual void showPopupMenu ()
void setAmbientLight (int)
int ambientLight () const
virtual void setSceneGraph (SoNode *)
virtual SoNode * getSceneGraph ()
void fadeLastRecordedFrameToCurrent (double time_seconds)
bool isAntiAlias () const
void setAntiAlias (bool)
void startTour ()
bool startTourEachEvent () const
void startCustomTour ()
void dumpSceneToFile (QString filename="")
void dumpSceneToVRMLFile (QString filename="")
void produceSVGImage (QString filename="")
void produceEPSImage (QString filename="")
void storeCameraParametersForReset ()
void resetCamera ()
bool currentCamIsPerspective () const
QByteArray currentCameraState () const
QPixmap getSnapShotFromCamState (bool camStateIsPerspective, QByteArray camState, int width, int height, bool transp=false)
void setStereoOffsetSlot (float offset)
float getStereoOffsetSlot ()
SbBool setStereoTypeSlot (SoQtViewer::StereoType type)
SoQtViewer::StereoType getStereoTypeSlot (void) const
void setAnaglyphStereoColorMasksSlot (const SbBool left[3], const SbBool right[3])
void getAnaglyphStereoColorMasksSlot (SbBool left[3], SbBool right[3])
void launchStereoEditor ()

Static Public Member Functions

static QString str (const QString &s)
static QString str (const char *c)
static QString str (const bool b)
static QString str (const QColor &)
static QString str (const SbColor &)
static QString str (const VP1Interval &)
static QString str (const SbVec2d &)
static QString str (const SbVec2f &)
static QString str (const SbVec2s &)
static QString str (const SbVec3d &)
static QString str (const SbVec3f &)
static QString str (const SbVec3s &)
static QString str (const SbVec4d &)
static QString str (const SbVec4f &)
static QString str (short int n)
static QString str (unsigned short int n)
static QString str (long n)
static QString str (ulong n)
static QString str (int n)
static QString str (uint n)
static QString str (qlonglong n)
static QString str (qulonglong n)
static QString str (const double &d)
static QString str (const float &f)
static QString str (const void *)
template<class T>
static QString str (const T *t)
template<class T>
static QString str (const QFlags< T > &f)
template<class T>
static QString str (const HepGeom::BasicVector3D< T > &t)
static QString str (const Amg::Vector3D &t)
template<class T>
static QString str (const QList< T > &t)

Public Attributes

float stereo_offset_camera
float stereo_parallax_camera
float stereo_offset_viewer

Protected Member Functions

virtual void bottomWheelFinish ()
virtual void bottomWheelMotion (float val)
virtual void bottomWheelStart ()
virtual void leftWheelFinish ()
virtual void leftWheelMotion (float val)
virtual void leftWheelStart ()
virtual void rightWheelFinish ()
virtual void rightWheelMotion (float val)
virtual void rightWheelStart ()
virtual void createViewerButtons (QWidget *parent, SbPList *buttonlist)
virtual void buildPopupMenu ()
virtual SbBool processSoEvent (const SoEvent *const event)

Private Attributes

Impm_d {}

Friends

class VP1ExaminerViewer_SignalCatcher

Detailed Description

Definition at line 30 of file VP1ExaminerViewer.h.

Constructor & Destructor Documentation

◆ VP1ExaminerViewer() [1/2]

VP1ExaminerViewer::VP1ExaminerViewer ( QWidget * parent = 0,
bool detectorViewButtons = true,
const char * name = 0,
SbBool embed = TRUE,
SoQtFullViewer::BuildFlag flag = BUILD_ALL,
SoQtViewer::Type type = BROWSER )

Definition at line 526 of file VP1ExaminerViewer.cxx.

532: SoQtExaminerViewer(parent,(name?name:"VP1ExaminerViewer"),embed,flag,type,false/*delay createViewerButtons call*/),
533 m_d(new Imp(this,detectorViewButtons))
534{
535 VP1Msg::messageDebug("VP1ExaminerViewer::VP1ExaminerViewer()");
536 // Explicitly trigger the construction of viewer decorations.
537 QWidget * widget = buildWidget(getParentWidget());
538 if (rightWheelLabel)
539 rightWheelLabel->setVisible(false);//it will be shown again by the first setCameraType call
540 setBaseWidget(widget);
541 setLeftWheelString("Rotz");
542 m_d->rotationMode=Imp::ZROT;
543// setRightWheelString("Zoom");
544 setRightWheelString("Zoom test");
545 leftWheel->setMinimumHeight(20);
546 rightWheel->setMinimumHeight(20);
547
548
549 /* set the clipping strategy and fix the clipping
550 *
551 * N.B.
552 * this code has been taken and adapted from CMSSW:
553 * http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/ISpy/Client/src/ISpy3DView.cc?view=co
554 */
555 setAutoClippingStrategy(CONSTANT_NEAR_PLANE, 0.9, fixedDistanceClipPlanesCB, this);
556
557 // Let's build this now, otherwise there will be problems with making the connections later:
558 m_d->customtoureditor = new VP1CustomTourEditor(this);
559 QObject::connect(&(m_d->animationSequencer),SIGNAL(clipVolumePercentOfATLAS(double)),m_d->customtoureditor,SLOT(setClipVolumePercentOfATLAS(double)));
560 VP1Controller::setCustomTourEditor(m_d->customtoureditor);
561 m_d->customtoureditor->disableObjectWhenTourNotAvailable(m_d->customtour_execute);
562 if (m_d->customtoureditorState!=QByteArray()) {
563 m_d->customtoureditor->setState(m_d->customtoureditorState);
564 m_d->customtoureditorState = QByteArray();
565 }
566
567 // test Ric
568 VP1Msg::messageVerbose("is stereo: " + QString(isStereoViewing()) + " - offset: " + QString::number(getStereoOffsetSlot()) + " - type: " + QString::number(getStereoType()) );
569}
SbVec2f fixedDistanceClipPlanesCB(void *data, const SbVec2f &nearfar)
set the clipping strategy and fix the clipping
static void setCustomTourEditor(VP1CustomTourEditor *editor)
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39

◆ VP1ExaminerViewer() [2/2]

VP1ExaminerViewer::VP1ExaminerViewer ( const VP1ExaminerViewer & )
delete

◆ ~VP1ExaminerViewer()

VP1ExaminerViewer::~VP1ExaminerViewer ( )
virtual

Definition at line 921 of file VP1ExaminerViewer.cxx.

922{
923#if SOQT_MAJOR_VERSION <= 1 && SOQT_MINOR_VERSION <= 4 && SOQT_MICRO_VERSION <= 1
924 //Fix bug in SoQt, in which the menu does not get deleted (reported and fixed upstream after SoQt 1.4.1)
925 delete prefmenu;
926#endif
927 delete m_d;
928 SoQtExaminerViewer::setSceneGraph(0);
929}

Member Function Documentation

◆ ambientLight()

int VP1ExaminerViewer::ambientLight ( ) const

Definition at line 2434 of file VP1ExaminerViewer.cxx.

2435{
2436 return m_d->ambientLightPercentage;
2437}

◆ bottomWheelFinish()

void VP1ExaminerViewer::bottomWheelFinish ( )
protectedvirtual

Definition at line 1519 of file VP1ExaminerViewer.cxx.

1520{
1521 VP1Msg::messageVerbose("VP1ExaminerViewer::bottomWheelFinish()");
1522 m_d->grabFocus();
1523 SoQtExaminerViewer::bottomWheelFinish();
1524}

◆ bottomWheelMotion()

void VP1ExaminerViewer::bottomWheelMotion ( float val)
protectedvirtual

Definition at line 1527 of file VP1ExaminerViewer.cxx.

1528{
1529 VP1Msg::messageVerbose("VP1ExaminerViewer::bottomWheelMotion()");
1530 m_d->grabFocus();
1531 SoQtExaminerViewer::bottomWheelMotion(val);
1532}

◆ bottomWheelStart()

void VP1ExaminerViewer::bottomWheelStart ( )
protectedvirtual

Definition at line 1535 of file VP1ExaminerViewer.cxx.

1536{
1537 VP1Msg::messageVerbose("VP1ExaminerViewer::bottomWheelStart()");
1538 m_d->grabFocus();
1539 SoQtExaminerViewer::bottomWheelStart();
1540}

◆ buildPopupMenu()

void VP1ExaminerViewer::buildPopupMenu ( )
protectedvirtual

Definition at line 1370 of file VP1ExaminerViewer.cxx.

1371{
1372 //We don't actually use this popupmenu.
1373
1374 // SoQtExaminerViewer::buildPopupMenu();
1375}

◆ createViewerButtons()

void VP1ExaminerViewer::createViewerButtons ( QWidget * parent,
SbPList * buttonlist )
protectedvirtual

Definition at line 932 of file VP1ExaminerViewer.cxx.

933{
934 VP1Msg::messageVerbose("VP1ExaminerViewer::createViewerButtons");
935
936 SoQtExaminerViewer::createViewerButtons(parent,buttonlist);
937 //buttonlist holds void pointers to pushbuttons
938
939 if (buttonlist->getLength()==7) {
940 //Get pointers:
941 m_d->button_interact = static_cast<QPushButton*>(buttonlist->get(0));
942 m_d->button_examine = static_cast<QPushButton*>(buttonlist->get(1));
943 m_d->button_home = static_cast<QPushButton*>(buttonlist->get(2));
944 m_d->button_sethome = static_cast<QPushButton*>(buttonlist->get(3));
945 m_d->button_viewall = static_cast<QPushButton*>(buttonlist->get(4));
946 m_d->button_seek = static_cast<QPushButton*>(buttonlist->get(5));
947 m_d->button_togglecamera = static_cast<QPushButton*>(buttonlist->get(6));
948 //Other stuff? Connections? Change pixmaps?
949 m_d->button_interact->setToolTip("Pick mode (ESC/M toggles). Use this in order to select objects.");
950 m_d->button_examine->setToolTip("Navigation mode (ESC/M toggles). Use to ROTATE (left click), ZOOM (wheel or SHIFT+CTRL+left click) or PAN (middle click or SHIFT+left click or CTRL+left click).");
951 m_d->button_home->setToolTip("Change view to home view");
952 m_d->button_sethome->setToolTip("Store current view as new home");
953 m_d->button_viewall->setToolTip("View all objects currently displayed (V)");
954 m_d->button_seek->setToolTip("Seek to point (S). Sets cameras rotation centre to the clicked point and zooms towards it.");
955 m_d->button_togglecamera->setToolTip("Toggle (C) camera between perspective (P) and orthographic (O) mode.");
956 //These are just confusing anyway:
957 m_d->button_home->setVisible(false);
958 m_d->button_sethome->setVisible(false);
959 } else {
960 VP1Msg::message("VP1ExaminerViewer::createViewerButtons ERROR: Did not get list of exactly 7 buttons from base.");
961 }
962}
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30

◆ currentCameraState()

QByteArray VP1ExaminerViewer::currentCameraState ( ) const

Definition at line 1782 of file VP1ExaminerViewer.cxx.

1783{
1784 SoCamera * cam(getCamera());
1785 return cam ? VP1QtInventorUtils::serializeSoCameraParameters(*cam) : QByteArray();
1786}
static QByteArray serializeSoCameraParameters(const SoCamera &)

◆ currentCamIsPerspective()

bool VP1ExaminerViewer::currentCamIsPerspective ( ) const

Definition at line 1776 of file VP1ExaminerViewer.cxx.

1777{
1778 return getCameraType() == SoPerspectiveCamera::getClassTypeId();
1779}

◆ dumpSceneToFile()

void VP1ExaminerViewer::dumpSceneToFile ( QString filename = "")

Definition at line 2255 of file VP1ExaminerViewer.cxx.

2256{
2257 VP1Msg::messageVerbose("VP1ExaminerViewer::dumpSceneToFile()");
2258
2259 SoNode * rootnode = getSceneGraph();
2260 if (!rootnode)
2261 return;
2262
2263 QWidget * w = getWidget();
2264 if (!w)
2265 return;
2266
2267 if(filename.isEmpty()) {
2268 if (isAnimating())
2269 stopAnimating();
2270 filename = QFileDialog::getSaveFileName(w, "Select output file",
2271 (m_d->lastDumpFile.isEmpty()?VP1Settings::defaultFileSelectDirectory():m_d->lastDumpFile),
2272 "Inventor files (*.iv)",0,QFileDialog::DontResolveSymlinks);
2273 if(filename.isEmpty())
2274 return;
2275 if (!filename.endsWith(".iv"))
2276 filename += ".iv";
2277 m_d->lastDumpFile=filename;
2278 }
2279
2280 SoGroup * standardisedRoot(0);
2281 if ( rootnode->getTypeId().isDerivedFrom(SoGroup::getClassTypeId()))
2282 standardisedRoot = VP1HEPVisUtils::convertToStandardScene(static_cast<SoGroup*>(rootnode));
2283
2284 if (standardisedRoot&&VP1QtInventorUtils::writeGraphToFile(standardisedRoot, filename))
2285 VP1Msg::messageDebug("VP1ExaminerViewer: Dumped scene to file "+filename);
2286 else
2287 VP1Msg::messageDebug("VP1ExaminerViewer: Error: Problems dumping scene to file "+filename);
2288
2289}
virtual SoNode * getSceneGraph()
static SoGroup * convertToStandardScene(SoGroup *)
static bool writeGraphToFile(SoNode *root, const QString &filename)
static QString defaultFileSelectDirectory()

◆ dumpSceneToVRMLFile()

void VP1ExaminerViewer::dumpSceneToVRMLFile ( QString filename = "")

Definition at line 2291 of file VP1ExaminerViewer.cxx.

2291 {
2292 VP1Msg::messageVerbose("VP1ExaminerViewer::dumpSceneToVRMLFile()");
2293
2294 SoNode * rootnode = getSceneGraph();
2295 if (!rootnode)
2296 return;
2297
2298 QWidget * w = getWidget();
2299 if (!w)
2300 return;
2301
2302 if(filename.isEmpty()) {
2303 if (isAnimating())
2304 stopAnimating();
2305 filename = QFileDialog::getSaveFileName(w, "Select output file",
2306 (m_d->lastDumpFile.isEmpty()?VP1Settings::defaultFileSelectDirectory():m_d->lastDumpFile),
2307 "VRML2.0/X3D files (*.wrl)",0,QFileDialog::DontResolveSymlinks);
2308 if(filename.isEmpty())
2309 return;
2310 if (!filename.endsWith(".wrl"))
2311 filename += ".wrl";
2312 m_d->lastDumpFile=filename;
2313 }
2314
2315 SoGroup * standardisedRoot(0);
2316 if ( rootnode->getTypeId().isDerivedFrom(SoGroup::getClassTypeId()))
2317 standardisedRoot = VP1HEPVisUtils::convertToStandardScene(static_cast<SoGroup*>(rootnode));
2318
2319 if (standardisedRoot&&VP1QtInventorUtils::writeGraphToVRMLFile(standardisedRoot, filename))
2320 VP1Msg::messageDebug("VP1ExaminerViewer: Dumped scene to VRML file "+filename);
2321 else
2322 VP1Msg::messageDebug("VP1ExaminerViewer: Error: Problems dumping scene to VRML file "+filename);
2323
2324}
static bool writeGraphToVRMLFile(SoNode *root, const QString &filename)

◆ fadeLastRecordedFrameToCurrent()

void VP1ExaminerViewer::fadeLastRecordedFrameToCurrent ( double time_seconds)

Definition at line 3145 of file VP1ExaminerViewer.cxx.

3146{
3147 if (!m_d->ensureMenuInit())
3148 return;
3149 QString lastfile, nextfile;
3150 QString outdir = m_d->action_movieoutdir->data().toString();
3152 m_d->movieFrameFileNamePrefix,
3153 lastfile, nextfile );
3154
3155 QImage img0(lastfile);
3156
3157 if (lastfile.isEmpty()||img0.isNull()) {
3158 VP1Msg::messageDebug("VP1ExaminerViewer ERROR: No previous image found!");
3159 return;
3160 }
3161 if (nextfile.isEmpty())
3162 return;
3163
3164 QImage img1 = VP1QtInventorUtils::renderToImage(this, img0.width(),img0.height(),false/*transp*/);
3165 if (img1.isNull())
3166 return;
3167
3168 int nTransitionFrames = std::max(1,static_cast<int>(m_d->action_moviefps->data().toInt()*time_seconds+0.5));
3169 VP1Msg::messageDebug("VP1ExaminerViewer Creating "+VP1Msg::str(nTransitionFrames)+" transition frames");
3170
3171 for (int i = 0; i < nTransitionFrames; ++i) {
3172 double fadefact((i+1.0)/(nTransitionFrames+1.0));//Should not be 0.0 or 1.0
3173 QString dummy, filename;
3174 VP1CameraHelper::getLastAndNextFrameFileNames( outdir, m_d->movieFrameFileNamePrefix,dummy,filename );
3175 QImage img = VP1QtUtils::fadeImage(img0, img1, fadefact );
3176 if (img.isNull()) {
3177 VP1Msg::messageDebug("VP1ExaminerViewer ERROR: Problems creating image!");
3178 } else {
3179 if (!img.save(filename))
3180 VP1Msg::messageDebug("VP1ExaminerViewer ERROR: Could not save image file "+filename);
3181 }
3182 }
3183
3184 QString dummy, filename;
3185 VP1CameraHelper::getLastAndNextFrameFileNames( outdir, m_d->movieFrameFileNamePrefix,dummy,filename );
3186 if (!img1.save(filename))
3187 VP1Msg::messageDebug("VP1ExaminerViewer ERROR: Could not save image file "+filename);
3188
3189}
static void getLastAndNextFrameFileNames(const QString &outputdir, const QString &prefix, QString &lastOfExistingFiles, QString &nextAvailableFile)
static QImage renderToImage(VP1ExaminerViewer *ra, int pixels_x, int pixels_y, bool transparent_background=false, double actualRenderedSizeFact=1.0)
static QImage fadeImage(QImage img0, QImage img1, double fadefact)
static QString str(const QString &s)
Definition VP1String.h:49

◆ getAnaglyphStereoColorMasksSlot()

void VP1ExaminerViewer::getAnaglyphStereoColorMasksSlot ( SbBool left[3],
SbBool right[3] )

Definition at line 590 of file VP1ExaminerViewer.cxx.

590 {
591 SoQtExaminerViewer::getAnaglyphStereoColorMasks(left, right);
592}

◆ getSceneGraph()

SoNode * VP1ExaminerViewer::getSceneGraph ( )
virtual

Definition at line 3139 of file VP1ExaminerViewer.cxx.

3140{
3141 return (m_d->actualSceneGraph && m_d->actualSceneGraph->getNumChildren()>1) ? m_d->actualSceneGraph->getChild(1) : 0;
3142}

◆ getSnapShotFromCamState()

QPixmap VP1ExaminerViewer::getSnapShotFromCamState ( bool camStateIsPerspective,
QByteArray camState,
int width,
int height,
bool transp = false )

Definition at line 1789 of file VP1ExaminerViewer.cxx.

1791{
1792 SoCamera * cam = getCamera();
1793 if (!cam)
1794 return QPixmap();
1795 bool notifyenabled = cam->enableNotify(false);
1796
1797 bool currentPersp(currentCamIsPerspective());
1798 QByteArray currentState(currentCameraState());
1799 if (currentPersp!=camStateIsPerspective)
1802 QPixmap pm = VP1QtInventorUtils::renderToPixmap(this, width, height,transp);
1803 if (currentPersp!=camStateIsPerspective)
1805 VP1QtInventorUtils::deserializeSoCameraParameters(currentState,*(getCamera()));
1806
1807 if (notifyenabled) {
1808 cam->enableNotify(true);
1809 //We don't touch since we know that we didn't actually change anything: cam->touch();
1810 }
1811 return pm;
1812}
const double width
QByteArray currentCameraState() const
virtual void toggleCameraType()
bool currentCamIsPerspective() const
static QPixmap renderToPixmap(VP1ExaminerViewer *ra, int pixels_x, int pixels_y, bool transparent_background=false, double actualRenderedSizeFact=1.0)
static bool deserializeSoCameraParameters(QByteArray &, SoCamera &)

◆ getStereoOffsetSlot()

float VP1ExaminerViewer::getStereoOffsetSlot ( )

Definition at line 577 of file VP1ExaminerViewer.cxx.

577 {
578 return SoQtExaminerViewer::getStereoOffset();
579}

◆ getStereoTypeSlot()

SoQtViewer::StereoType VP1ExaminerViewer::getStereoTypeSlot ( void ) const

Definition at line 584 of file VP1ExaminerViewer.cxx.

584 {
585 return SoQtExaminerViewer::getStereoType();
586}

◆ isAntiAlias()

bool VP1ExaminerViewer::isAntiAlias ( ) const

Definition at line 1744 of file VP1ExaminerViewer.cxx.

1745{
1746 return m_d->isantialias;
1747 // SbBool smoothing; int numPasses;
1748 // getAntialiasing(smoothing, numPasses);
1749 // return smoothing&&numPasses>1;
1750}

◆ launchStereoEditor()

void VP1ExaminerViewer::launchStereoEditor ( )

Definition at line 2945 of file VP1ExaminerViewer.cxx.

2946{
2947 VP1Msg::messageVerbose("VP1ExaminerViewer::launchStereoEditor()");
2948
2949 if (!m_d->customstereoeditor) {
2950 m_d->customstereoeditor = new VP1CustomStereoEditor(this);
2951 // m_d->customstereoeditor->disableObjectWhenTourNotAvailable(m_d->customtour_execute);
2952 // if (m_d->customstereoeditorState!=QByteArray()) { //TODO: implement save stereo settings
2953 // m_d->customstereoeditor->setState(m_d->customstereoeditorState);
2954 // m_d->customstereoeditorState = QByteArray();
2955 // }
2956 }
2957 m_d->customstereoeditor->show();
2958 //Fixme: deal with minimised state!
2959 return;
2960}

◆ leftWheelFinish()

void VP1ExaminerViewer::leftWheelFinish ( )
protectedvirtual

Definition at line 1543 of file VP1ExaminerViewer.cxx.

1544{
1545 m_d->grabFocus();
1546 SoQtExaminerViewer::leftWheelFinish();
1547}

◆ leftWheelMotion()

void VP1ExaminerViewer::leftWheelMotion ( float val)
protectedvirtual

Definition at line 1550 of file VP1ExaminerViewer.cxx.

1551{
1552 m_d->grabFocus();
1553
1554 if (isAnimating())
1555 stopAnimating();
1556
1557 float newval = 0.0;
1558 if (m_d->rotationMode==Imp::XROT)
1559 newval = m_d->rotXWheelMotion(val, getLeftWheelValue());
1560 else
1561 newval = m_d->rotZWheelMotion(val, getLeftWheelValue());
1562
1563 SoQtFullViewer::leftWheelMotion(newval);//NB: We bypass SoQtExaminerViewer implementation
1564}

◆ leftWheelStart()

void VP1ExaminerViewer::leftWheelStart ( )
protectedvirtual

Definition at line 1567 of file VP1ExaminerViewer.cxx.

1568{
1569 m_d->grabFocus();
1570 SoQtExaminerViewer::leftWheelStart();
1571}

◆ operator=()

VP1ExaminerViewer & VP1ExaminerViewer::operator= ( const VP1ExaminerViewer & )
delete

◆ processSoEvent()

SbBool VP1ExaminerViewer::processSoEvent ( const SoEvent *const event)
protectedvirtual

Definition at line 1392 of file VP1ExaminerViewer.cxx.

1393{
1394// VP1Msg::messageDebug("VP1ExaminerViewer::processSoEvent()");
1395// std::cout << "event type: " << evt->getClassTypeId().getName() << " - " << evt->getTypeId().getName() << std::endl;
1396
1397 if (evt->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
1398 //We want to add a few shortcuts:
1399 // "A": View all
1400 // "P": Perspective camera
1401 // "O": Orthogonal camera
1402 // "C": Toggle camera mode
1403 // "M": Toggle view/selection mode.
1404 // If "Q" then we do NOT pass it on to the base class (because that closes the top window!!)
1405
1406 m_d->grabFocus(); //probably redundant since we got the event, but can't hurt.
1407
1408 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::V)) {
1409 viewAll();
1410 return true;//eat event
1411 }
1412 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::Q))
1413 return false;//do not eat event, but do not pass through to base.
1414 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::C)) {
1416 return true;//eat event
1417 }
1418 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::P)) {
1421 return true;//eat event
1422 }
1423 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::O)) {
1426 return true;//eat event
1427 }
1428 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::M)) {
1429 setViewing(!isViewing());
1430 return true;//eat event
1431 }
1432 if (SO_KEY_PRESS_EVENT(evt,SoKeyboardEvent::A)) {
1434 m_d->grabFocus();//Needed since the GL calls triggered when setting antialiasing makes us loose focus (we obviusly just had it).
1435 return true;//eat event
1436 }
1437
1438 //NB: We could emit keypressed signal when keyboardevent and base
1439 // class does not eat event.
1440
1441 } else if (evt->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
1442 m_d->grabFocus();//Any click grabs focus:
1443 if (isViewing()) {//In viewing mode we open a popup menu on right clicks:
1444 const SoMouseButtonEvent * ev_mouse = static_cast<const SoMouseButtonEvent*>(evt);
1445 if ((ev_mouse->getButton() == SoMouseButtonEvent::BUTTON2/*right click*/)) {
1446 if (ev_mouse->getState() == SoButtonEvent::DOWN) {
1447 showPopupMenu();
1448 }
1449 return true;//eat all right-clicks in viewing mode.
1450 }
1451 }
1452 }
1453
1454 return SoQtExaminerViewer::processSoEvent(evt);//pass event through
1455}
virtual void setViewing(SbBool enable)
virtual void showPopupMenu()

◆ produceEPSImage()

void VP1ExaminerViewer::produceEPSImage ( QString filename = "")

Definition at line 2375 of file VP1ExaminerViewer.cxx.

2376{
2377 QWidget * w = getWidget();
2378 if (!w)
2379 return;
2380 if(filename.isEmpty()) {
2381 if (isAnimating())
2382 stopAnimating();
2383 filename = QFileDialog::getSaveFileName(w, "Select output file",
2384 (m_d->lastEPSFile.isEmpty()?VP1Settings::defaultFileSelectDirectory():m_d->lastEPSFile),
2385 "Encapsulated Postscript files (*.eps)",0,QFileDialog::DontResolveSymlinks);
2386 if(filename.isEmpty())
2387 return;
2388 if (!filename.endsWith(".eps"))
2389 filename += ".eps";
2390 m_d->lastEPSFile=filename;
2391 }
2392
2393 VP1Msg::messageVerbose("Attempting to produce eps output: "+filename);
2394
2395 //The following code contributed by Laurent Duflot:
2396
2397 // first method : direct calls to gl2ps
2398 if (FILE *output = fopen (filename.toStdString().c_str(), "w"))
2399 {
2400 int buffsize = 0, state = GL2PS_OVERFLOW;
2401 while (state == GL2PS_OVERFLOW)
2402 {
2403 buffsize += 1024*1024;
2404 gl2psBeginPage ("VP1"/*fixme: should contain run/evt number*/, "VP1", NULL,
2407 | GL2PS_SILENT
2410 | 0,
2411 GL_RGBA, 0, NULL,0, 0, 0,
2412 buffsize, output, NULL);
2413 actualRedraw();
2414 state = gl2psEndPage();
2415 }
2416 fclose (output);
2417 }
2418}
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, GLint colorsize, GL2PSrgba *colormap, GLint nr, GLint ng, GLint nb, GLint buffersize, FILE *stream, const char *filename)
Definition gl2ps.cxx:5584
GL2PSDLL_API GLint gl2psEndPage(void)
Definition gl2ps.cxx:5751
#define GL2PS_BSP_SORT
Definition gl2ps.h:105
#define GL2PS_OCCLUSION_CULL
Definition gl2ps.h:124
#define GL2PS_SILENT
Definition gl2ps.h:122
#define GL2PS_OVERFLOW
Definition gl2ps.h:114
#define GL2PS_BEST_ROOT
Definition gl2ps.h:123
#define GL2PS_DRAW_BACKGROUND
Definition gl2ps.h:120
#define GL2PS_EPS
Definition gl2ps.h:95
#define GL2PS_USE_CURRENT_VIEWPORT
Definition gl2ps.h:129

◆ produceSVGImage()

void VP1ExaminerViewer::produceSVGImage ( QString filename = "")

Definition at line 2327 of file VP1ExaminerViewer.cxx.

2328{
2329 QWidget * w = getWidget();
2330 if (!w)
2331 return;
2332 if(filename.isEmpty()) {
2333 if (isAnimating())
2334 stopAnimating();
2335 filename = QFileDialog::getSaveFileName(w, "Select output file",
2336 (m_d->lastSVGFile.isEmpty()?VP1Settings::defaultFileSelectDirectory():m_d->lastSVGFile),
2337 "Scalable Vector Graphics files (*.svg)",0,QFileDialog::DontResolveSymlinks);
2338 if(filename.isEmpty())
2339 return;
2340 if (!filename.endsWith(".svg"))
2341 filename += ".svg";
2342 m_d->lastSVGFile=filename;
2343 }
2344
2345 VP1Msg::messageVerbose("Attempting to produce svg output: "+filename);
2346
2347 //The following code contributed by Laurent Duflot:
2348
2350
2351 // want to render from above the SceneGraph so we get what the camera sees
2352 SoNode *rootA = static_cast<SoNode*>(SoQtRenderArea::getSceneGraph());
2353 if (!rootA ) return;
2354 SoNode *cam = static_cast<SoNode*>(this->getCamera());
2355 if ( ! cam ) return;
2356 SoSearchAction search;
2357 search.setNode(cam);
2358 search.apply(rootA);
2359 assert(search.getPath());
2360 SoNode* hiddenRoot =
2361 static_cast<SoFullPath *>(search.getPath())->getNodeFromTail(1);
2362
2363 const SbViewportRegion& vpRegion = getViewportRegion();
2364 SoGL2PSAction* action = new SoGL2PSAction(vpRegion);
2365 action->setFileName(filename.toStdString().c_str());
2366 action->setFileFormat(SoGL2PSAction::SVG);
2367 action->enableFileWriting();
2368 action->apply(hiddenRoot);
2369 action->disableFileWriting();
2370 delete action;
2371
2372}
static void initClass()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition hcg.cxx:739

◆ removeDecorationMenuOption()

void VP1ExaminerViewer::removeDecorationMenuOption ( )
virtual

Definition at line 1378 of file VP1ExaminerViewer.cxx.

1379{
1380
1381 VP1Msg::messageVerbose("VP1ExaminerViewer::removeDecorationMenuOption()");
1382 if (m_d->decorationMenuRemoved || !prefmenu)
1383 return;
1384 m_d->decorationMenuRemoved = true;
1385 int id = prefmenu->getMenuItem("decoration");
1386 if (id!=-1)
1387 prefmenu->removeMenuItem(id);
1388
1389}

◆ resetCamera()

void VP1ExaminerViewer::resetCamera ( )

Definition at line 1761 of file VP1ExaminerViewer.cxx.

1762{
1763 VP1Msg::messageVerbose("VP1ExaminerViewer::resetCamera()");
1764 if (m_d->resetCamera_state==QByteArray())
1765 return;
1766 if (isAnimating())
1767 stopAnimating();
1768 if (m_d->resetCamera_isPerspective != (currentCamIsPerspective()))
1770 if (getCamera()&&m_d->resetCamera_state!=QByteArray())
1771 VP1QtInventorUtils::deserializeSoCameraParameters(m_d->resetCamera_state,*(getCamera()));//Fixme: Check return value?
1772}

◆ restoreFromState()

void VP1ExaminerViewer::restoreFromState ( QByteArray ba_state)
virtual

Definition at line 765 of file VP1ExaminerViewer.cxx.

766{
767 VP1Msg::messageVerbose("VP1ExaminerViewer::restoreFromState");
768
769 // ===> Setup stream for getting the contents of the byteArray:
770 QBuffer buffer(&ba_state);
771 buffer.open(QIODevice::ReadOnly);
772 QDataStream state(&buffer);
773 // ===> Check version and pass on state info to base class:
774 qint32 version;
775 state >> version;
776 if (version<0||version>6) {
777 VP1Msg::messageDebug("VP1ExaminerViewer Warning: Input state data is in wrong format - ignoring!");
778 return;
779 }
780 // ===> Decode the state info:
781
782 //Background color:
783 QColor bgdcol;
784 state >> bgdcol;
785 if (bgdcol.isValid())
786 setBackgroundColor(VP1QtInventorUtils::qcol2sbcol(bgdcol));
787 VP1Msg::messageVerbose("restoreState background color = "+str(bgdcol));
788
789 //Render buffer:
790 int ibuffer;
791 state >> ibuffer;
792 if (ibuffer==1) setBufferingType(BUFFER_SINGLE);
793 else if (ibuffer==2) setBufferingType(BUFFER_INTERACTIVE);
794 else setBufferingType(BUFFER_DOUBLE);
795 VP1Msg::messageVerbose("restoreState Render Buffer = ("+str(ibuffer)+")");
796
797 //camtype and camera parameters:
798 bool isperspective;
799 state >> isperspective;
800 if (isperspective != currentCamIsPerspective())
802 QByteArray ba_cam;
803 state>>ba_cam;
804 if (getCamera()&&ba_cam!=QByteArray())
805 VP1QtInventorUtils::deserializeSoCameraParameters(ba_cam,*(getCamera()));//Fixme: Check return value?
806 VP1Msg::messageVerbose("restoreState camera type = "+str(isperspective?"Perspective":"Orthographic"));
807
808 //misc:
809 bool isdeco, isheadlight, isviewing, decoremoved;
810 state >> isdeco; if (isdeco!=isDecoration()) setDecoration(isdeco);
811 state >> isheadlight; if (isheadlight!=isHeadlight()) setHeadlight(isheadlight);
812 state >> isviewing; if (isviewing!=isViewing()) setViewing(isviewing);
813 state >> decoremoved; if (decoremoved) removeDecorationMenuOption();
814 VP1Msg::messageVerbose("saveState (deco,headlight,viewing,nodecomenu) = ("
815 +str(isdeco)+", "+str(isheadlight)+", "+str(isviewing)+", "+str(decoremoved)+")");
816
817 //Antialiasing state:
818 if (version<=5) {
819 SbBool smoothing; int numPasses;
820 state >> smoothing;
821 state >> numPasses;
822 m_d->isantialias=smoothing;
823 }
824 if (version>=6) {
825 state >> m_d->isantialias;
826 }
827 setAntiAlias(m_d->isantialias);
828 VP1Msg::messageVerbose("restoreState (isantialias)) = ("+str(m_d->isantialias)+")");
829 // getAntialiasing(current_smoothing, current_numPasses);
830 // state >> smoothing;
831 // state >> numPasses;
832 // if (numPasses<9999&&(current_smoothing!=smoothing||current_numPasses!=numPasses))
833 // setAntialiasing(smoothing,numPasses);
834 // VP1Msg::messageVerbose("restoreState (smoothing,numPasses)) = ("+str(smoothing)+", "+str(numPasses)+")");
835
836 //Draw style:
837 int idrawstyle_still, idrawstyle_interactive;
838 state >> idrawstyle_still;
839 state >> idrawstyle_interactive;
840 setDrawStyle(STILL,Imp::intToDrawStyle(idrawstyle_still));
841 setDrawStyle(INTERACTIVE,Imp::intToDrawStyle(idrawstyle_interactive));
842 VP1Msg::messageVerbose("restoreState DrawStyle (still,interactive)) = ("+str(idrawstyle_still)+", "+str(idrawstyle_interactive)+")");
843
844 //Transparency type:
845 int itransp;
846 state >> itransp;
848 VP1Msg::messageVerbose("restoreState Transparency Type = ("+str(itransp)+")");
849
850 if (version>=1) {
851
852 m_d->ensureMenuInit();
853 bool b;
854 state >> b; m_d->popup_tourReturnToStartAction->setChecked(b);
855 state >> b; m_d->popup_tourStartEachEvent->setChecked(b);
856
857 qint32 ispeed;
858 state >> ispeed;
859 if (ispeed==-2) m_d->popup_tourSpeedVerySlow->setChecked(true);
860 else if (ispeed==-1) m_d->popup_tourSpeedSlow->setChecked(true);
861 else if (ispeed==1) m_d->popup_tourSpeedFast->setChecked(true);
862 else if (ispeed==2) m_d->popup_tourSpeedVeryFast->setChecked(true);
863
864 state >> b; m_d->popup_tourPartsVertex->setChecked(b);
865 state >> b; m_d->popup_tourPartsInDet->setChecked(b);
866 state >> b; m_d->popup_tourPartsCalo->setChecked(b);
867 state >> b; m_d->popup_tourPartsMuon->setChecked(b);
868
869 qint32 iloop;
870 state >> iloop;
871 if (iloop==2) m_d->popup_tourLoopTwice->setChecked(true);
872 else if (iloop==3) m_d->popup_tourLoopThrice->setChecked(true);
873 else if (iloop==999) m_d->popup_tourLoopForever->setChecked(true);
874
875 }
876
877 if (version>=2) {
878 state >> m_d->resetCamera_isPerspective;
879 state >> m_d->resetCamera_state;
880 if (m_d->popup_resetCameraAction) {
881 bool v(m_d->resetCamera_state!=QByteArray());
882 if (m_d->popup_resetCameraAction->isVisible()!=v)
883 m_d->popup_resetCameraAction->setVisible(v);
884 }
885 }
886 if (version>=3) {
887 m_d->storedViews.clear();
888 QList<QByteArray> persistifiedViews;
889 state >> persistifiedViews;
890 for(const QByteArray& ba_pv : persistifiedViews) {
891 Imp::StoredView sv(ba_pv);
892 if (sv.isValid())
893 m_d->storedViews << sv;
894 }
895 m_d->storedViewsChanged();
896 }
897
898 if (version>=4)
899 state >> m_d->ambientLightPercentage;
900
901 if (version>=5) {
902 QByteArray ba;
903 state >> ba;
904 if (ba!=QByteArray()) {
905 if (!m_d->customtoureditor)
906 m_d->customtoureditorState = std::move(ba);
907 else
908 m_d->customtoureditor->setState(ba);
909 }
910 }
911
912 m_d->updateEnvironmentNode();
913 m_d->updateAmbientLightText();
914
915 // ===> Finish up:
916 buffer.close();
917}
static SoQtViewer::DrawStyle intToDrawStyle(int)
virtual void setBufferingType(SoQtViewer::BufferType)
virtual void removeDecorationMenuOption()
virtual void setDrawStyle(SoQtViewer::DrawType, SoQtViewer::DrawStyle)
virtual void setTransparencyType(SoGLRenderAction::TransparencyType)
static SoGLRenderAction::TransparencyType intToTransparencyType(int)
static SbColor qcol2sbcol(const QColor &)

◆ rightWheelFinish()

void VP1ExaminerViewer::rightWheelFinish ( )
protectedvirtual

Definition at line 1574 of file VP1ExaminerViewer.cxx.

1575{
1576 m_d->grabFocus();
1577 SoQtExaminerViewer::rightWheelFinish();
1578}

◆ rightWheelMotion()

void VP1ExaminerViewer::rightWheelMotion ( float val)
protectedvirtual

Definition at line 1581 of file VP1ExaminerViewer.cxx.

1582{
1583 m_d->grabFocus();
1584 SoQtExaminerViewer::rightWheelMotion(val);
1585}

◆ rightWheelStart()

void VP1ExaminerViewer::rightWheelStart ( )
protectedvirtual

Definition at line 1588 of file VP1ExaminerViewer.cxx.

1589{
1590 m_d->grabFocus();
1591 SoQtExaminerViewer::rightWheelStart();
1592}

◆ saveState()

QByteArray VP1ExaminerViewer::saveState ( )
virtual

Definition at line 638 of file VP1ExaminerViewer.cxx.

639{
640 VP1Msg::messageVerbose("VP1ExaminerViewer::saveState");
641
642 // ===> Setup stream writing to a byteArray:
643 QByteArray byteArray;
644 QBuffer buffer(&byteArray);
645 buffer.open(QIODevice::WriteOnly);
646 QDataStream out(&buffer);
647
648 // ===> Write Data:
649 //Version:
650 out << (qint32)6; //version
651
652 //Background color:
653 QColor bgdcol(VP1QtInventorUtils::sbcol2qcol(getBackgroundColor()));
654 out << bgdcol;
655 VP1Msg::messageVerbose("saveState background color = "+str(bgdcol));
656
657 //Render buffer:
658 int ibuffer(0);
659 if (getBufferingType()==BUFFER_SINGLE)
660 ibuffer=1;
661 else if (getBufferingType()==BUFFER_INTERACTIVE)
662 ibuffer=2;
663 out << ibuffer;
664 VP1Msg::messageVerbose("saveState Render Buffer = ("+str(ibuffer)+")");
665
666 //Camera type and parameters:
667 bool isperspective(currentCamIsPerspective());
668 out << isperspective;
670 VP1Msg::messageVerbose("saveState camera type = "+str(isperspective?"Perspective":"Orthographic"));
671
672 //Misc:
673 const bool isdeco(isDecoration()), isheadlight(isHeadlight()),isviewing(isViewing());
674 out << isdeco;
675 out << isheadlight;
676 out << isviewing;
677 out << m_d->decorationMenuRemoved;
678 VP1Msg::messageVerbose("saveState (deco,headlight,viewing,nodecomenu) = ("
679 +str(isdeco)+", "+str(isheadlight)+", "+str(isviewing)+", "+str(m_d->decorationMenuRemoved)+")");
680
681 //Antialiasing state:
682 out << m_d->isantialias;//version 6+
683 VP1Msg::messageVerbose("saveState (isantialis)) = ("+str(m_d->isantialias)+")");
684 //OLD (up to version 5):
685 // SbBool smoothing; int numPasses;
686 // getAntialiasing(smoothing, numPasses);
687 // out << smoothing;
688 // out << numPasses;
689 // VP1Msg::messageVerbose("saveState (smoothing,numPasses)) = ("+str(smoothing)+", "+str(numPasses)+")");
690
691 //Draw style:
692 int idrawstyle_still = Imp::drawStyleToInt(getDrawStyle(STILL));
693 int idrawstyle_interactive = Imp::drawStyleToInt(getDrawStyle(INTERACTIVE));
694 out << idrawstyle_still;
695 out << idrawstyle_interactive;
696 VP1Msg::messageVerbose("saveState DrawStyle (still,interactive)) = ("+str(idrawstyle_still)+", "+str(idrawstyle_interactive)+")");
697
698 //Transparency type:
699 int itransp = VP1QtInventorUtils::transparencyTypeToInt(getTransparencyType());
700 out << itransp;
701 VP1Msg::messageVerbose("saveState Transparency Type = ("+str(itransp)+")");
702
704 // Added for version 1 //
706
707 m_d->ensureMenuInit();
708 out << m_d->popup_tourReturnToStartAction->isChecked();
709 out << m_d->popup_tourStartEachEvent->isChecked();
710
711 qint32 ispeed(0);//medium
712 if (m_d->popup_tourSpeedVerySlow->isChecked()) ispeed = -2;
713 else if (m_d->popup_tourSpeedSlow->isChecked()) ispeed = -1;
714 else if (m_d->popup_tourSpeedFast->isChecked()) ispeed = 1;
715 else if (m_d->popup_tourSpeedVeryFast->isChecked()) ispeed = 2;
716 out << ispeed;
717
718 out << m_d->popup_tourPartsVertex->isChecked();
719 out << m_d->popup_tourPartsInDet->isChecked();
720 out << m_d->popup_tourPartsCalo->isChecked();
721 out << m_d->popup_tourPartsMuon->isChecked();
722
723 qint32 iloop(1);
724 if (m_d->popup_tourLoopTwice->isChecked()) iloop = 2;
725 else if (m_d->popup_tourLoopThrice->isChecked()) iloop = 3;
726 else if (m_d->popup_tourLoopForever->isChecked()) iloop = 999;
727 out << iloop;
728
730 // Added for version 2 //
732 out << m_d->resetCamera_isPerspective;
733 out << m_d->resetCamera_state;
734
736 // Added for version 3 //
738
739 QList<QByteArray> persistifiedViews;
740 for(const Imp::StoredView & sv : m_d->storedViews){
741 persistifiedViews << sv.persistifiedState();
742 }
743 out << persistifiedViews;
744
746 // Added for version 4 //
748
749 out << m_d->ambientLightPercentage;
750
752 // Added for version 5 //
754
755 out << (m_d->customtoureditor ? m_d->customtoureditor->state() : QByteArray());
756
757 // ===> Finish up:
758 buffer.close();
759 return byteArray;
760
761}
static int drawStyleToInt(SoQtViewer::DrawStyle)
static QColor sbcol2qcol(const SbColor &)
static int transparencyTypeToInt(SoGLRenderAction::TransparencyType)

◆ setAmbientLight()

void VP1ExaminerViewer::setAmbientLight ( int a)

Definition at line 2421 of file VP1ExaminerViewer.cxx.

2422{
2423 VP1Msg::messageVerbose("setAmbientLight()");
2424
2425 a = std::max(0,std::min(100,a));
2426 if (m_d->ambientLightPercentage==a)
2427 return;
2428 m_d->ambientLightPercentage = a;
2429 m_d->updateAmbientLightText();
2430 m_d->updateEnvironmentNode();
2431}
static Double_t a

◆ setAnaglyphStereoColorMasksSlot()

void VP1ExaminerViewer::setAnaglyphStereoColorMasksSlot ( const SbBool left[3],
const SbBool right[3] )

Definition at line 587 of file VP1ExaminerViewer.cxx.

587 {
588 SoQtExaminerViewer::setAnaglyphStereoColorMasks(left, right);
589}

◆ setAntiAlias()

void VP1ExaminerViewer::setAntiAlias ( bool b)

Definition at line 1753 of file VP1ExaminerViewer.cxx.

1754{
1755 m_d->isantialias=b;
1756 b ? setAntialiasing(true,4) : setAntialiasing(false,1);
1757 std::cout << "antiAliasing set." << std::endl;
1758}
virtual void setAntialiasing(SbBool smoothing, int numPasses)

◆ setAntialiasing()

void VP1ExaminerViewer::setAntialiasing ( SbBool smoothing,
int numPasses )
virtual

Definition at line 1649 of file VP1ExaminerViewer.cxx.

1650{
1651 VP1Msg::messageDebug("VP1ExaminerViewer::setAntialiasing()");
1652
1653 SoQtExaminerViewer::setAntialiasing(smoothing, numPasses); // Needed for offscreen rendering (i.e. snapshots).
1654
1655
1656 // --- OLD AA method ---
1657 // QGLWidget* qglw = (QGLWidget*)getGLWidget();
1658 // QGLFormat fmt = qglw->format();
1659 // fmt.setSampleBuffers(smoothing);
1660 // fmt.setSamples(numPasses);
1661 // qglw->setFormat(fmt); // note: this is supposedly deprecated..
1662 // qglw->makeCurrent();
1663
1664 // if(smoothing && numPasses > 1)
1665 // glEnable(GL_MULTISAMPLE);
1666 // else
1667 // glDisable(GL_MULTISAMPLE);
1668
1669 bool printWarning = false;
1670 const char* env_aa;
1671 #ifndef BUILDVP1LIGHT
1672 env_aa = std::getenv("VP1_ADVANCED_ANTIALIASING");
1673 #else
1674 bool antialiasingIsOn = VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_ADVANCED_ANTIALIASING");
1675 if(antialiasingIsOn){
1676 env_aa = "1";
1677 } else {
1678 env_aa = "0";
1679 }
1680 #endif
1681 if (env_aa != NULL) {
1682 std::string env_aa_string( env_aa );
1683 if(env_aa_string == "1") {
1684
1685 // print a warning message, on the first time
1686 if ( ! std::getenv("VP1_ADVANCED_ANTIALIASING_PRINTMSG")) {
1687 VP1Msg::messageWarningRed("You switched ON advanced anti-aliasing. That's very good, but please notice that this method DOES NOT WORK on LXPLUS machines, currently, because of their old graphics drivers! If you are on LXPLUS, this will likely freeze VP1... If that's the case, please restart VP1 without the '-advanced-aa' flag.");
1688 }
1689 ::setenv("VP1_ADVANCED_ANTIALIASING_PRINTMSG", "1", 1/*override present value*/); // TODO: move to Qt settings
1690
1691 // --- NEW AA method (26Sep2017) --- it works, but not on LXPLUS!!
1692 if (smoothing) {
1693 VP1Msg::message("VP1ExaminerViewer: turning AA on.");
1694
1695 VP1Msg::message("Sep 2017: AA is now done using a new technique so please let hn-atlas-vp1-help@cern.ch know of any problems.");
1696 //FIXME - remove above messages at some point? EJWM.
1697
1698 if (getGLRenderAction()->isSmoothing() != smoothing)
1699 getGLRenderAction()->setSmoothing(smoothing); // --> quite ugly outcome!
1700
1701 int buffers = 4;
1702 #if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5)
1703 if (getSampleBuffers() != buffers)
1704 setSampleBuffers(buffers);
1705 #else
1706 if (buffers > 1)
1707 VP1Msg::message("Multisampling is not supported by SoQT < 1.5, this anti-aliasing mode is disabled");
1708 #endif
1709 }
1710 else {
1711 VP1Msg::message("VP1ExaminerViewer: turning AA off.");
1712 getGLRenderAction()->setSmoothing(smoothing);
1713 setSampleBuffers(0);
1714 }
1715 }
1716 else {
1717 printWarning = true;
1718 }
1719 }
1720 else {
1721 printWarning = true;
1722 }
1723
1724 if (printWarning) {
1725 VP1Msg::messageWarningRed("Anti-aliasing is using low-quality mode only, because of problems with the graphic drivers installed on LXPLUS machines. If you are not running VP1 on LXPLUS machine (for example, if you are running it on a custom SLC6 machine), you can start VP1 again using the command-line flag '-advanced-aa'.");
1726 }
1727
1728 m_d->isantialias=smoothing;
1729}
static void messageWarningRed(const QString &str, IVP1System *sys=0)
Definition VP1Msg.cxx:57
static bool expertSettingIsOn(const QString &type, const QString &name)

◆ setBufferingType()

void VP1ExaminerViewer::setBufferingType ( SoQtViewer::BufferType bt)
virtual

Definition at line 1643 of file VP1ExaminerViewer.cxx.

1644{
1645 SoQtExaminerViewer::setBufferingType(bt);
1646}

◆ setCameraType()

void VP1ExaminerViewer::setCameraType ( SoType type)
virtual

Definition at line 1481 of file VP1ExaminerViewer.cxx.

1482{
1483 VP1Msg::messageVerbose("VP1ExaminerViewer::setCameraType()");
1484 m_d->grabFocus();
1485 if (rightWheelLabel)
1486 rightWheelLabel->setUpdatesEnabled(false);
1487 SoQtExaminerViewer::setCameraType(type);
1488 setRightWheelString("Zoom");
1489 if (rightWheelLabel) {
1490 rightWheelLabel->setVisible(true);
1491 rightWheelLabel->setUpdatesEnabled(true);
1492 }
1493
1494 // get default stereo values and set them as starting point for the stereo editor
1495 if (getCamera()) {
1496 stereo_offset_camera = getCamera()->getStereoAdjustment();
1497 stereo_parallax_camera = getCamera()->getBalanceAdjustment();
1498 stereo_offset_viewer = getStereoOffset();
1499 }
1500}

◆ setDrawStyle()

void VP1ExaminerViewer::setDrawStyle ( SoQtViewer::DrawType t,
SoQtViewer::DrawStyle s )
virtual

Definition at line 1738 of file VP1ExaminerViewer.cxx.

1739{
1740 SoQtExaminerViewer::setDrawStyle(t,s);
1741}

◆ setSceneGraph()

void VP1ExaminerViewer::setSceneGraph ( SoNode * n)
virtual

Definition at line 3116 of file VP1ExaminerViewer.cxx.

3117{
3118 VP1Msg::messageVerbose("VP1ExaminerViewer::setSceneGraph()");
3119
3120 if (!m_d->actualSceneGraph) {
3121 m_d->actualSceneGraph = new SoGroup;
3122 m_d->actualSceneGraph->ref();
3123 if (!m_d->environmentNode) {
3124 m_d->environmentNode = new SoEnvironment;
3125 m_d->environmentNode->ref();
3126 }
3127 m_d->updateEnvironmentNode();
3128 m_d->actualSceneGraph->addChild(m_d->environmentNode);
3129 SoQtExaminerViewer::setSceneGraph(m_d->actualSceneGraph);
3130 }
3131 while(m_d->actualSceneGraph->getNumChildren()>1)
3132 m_d->actualSceneGraph->removeChild(1);
3133
3134 if (n)
3135 m_d->actualSceneGraph->addChild(n);
3136}

◆ setSeekMode()

void VP1ExaminerViewer::setSeekMode ( SbBool enable)
virtual

Definition at line 1503 of file VP1ExaminerViewer.cxx.

1504{
1505 VP1Msg::messageVerbose("VP1ExaminerViewer::setSeekMode()");
1506 m_d->grabFocus();
1507 SoQtExaminerViewer::setSeekMode(enable);
1508}

◆ setStereoOffsetSlot()

void VP1ExaminerViewer::setStereoOffsetSlot ( float offset)

Definition at line 573 of file VP1ExaminerViewer.cxx.

573 {
574 VP1Msg::messageDebug("VP1ExaminerViewer::setStereoOffsetSlot() - offset: " + QString::number(offset));
575 SoQtExaminerViewer::setStereoOffset(offset);
576}

◆ setStereoTypeSlot()

SbBool VP1ExaminerViewer::setStereoTypeSlot ( SoQtViewer::StereoType type)

Definition at line 580 of file VP1ExaminerViewer.cxx.

580 {
581 VP1Msg::messageDebug("VP1ExaminerViewer::setStereoTypeSlot() - type: " + QString::number(type));
582 return SoQtExaminerViewer::setStereoType(type);
583}

◆ setTransparencyType()

void VP1ExaminerViewer::setTransparencyType ( SoGLRenderAction::TransparencyType t)
virtual

Definition at line 1732 of file VP1ExaminerViewer.cxx.

1733{
1734 SoQtExaminerViewer::setTransparencyType(t);
1735}

◆ setViewing()

void VP1ExaminerViewer::setViewing ( SbBool enable)
virtual

Definition at line 1511 of file VP1ExaminerViewer.cxx.

1512{
1513 VP1Msg::messageVerbose("VP1ExaminerViewer::setViewing()");
1514 m_d->grabFocus();
1515 SoQtExaminerViewer::setViewing(enable);
1516}

◆ showPopupMenu()

void VP1ExaminerViewer::showPopupMenu ( )
virtual

Definition at line 2440 of file VP1ExaminerViewer.cxx.

2441{
2442 VP1Msg::messageVerbose("VP1ExaminerViewer: Showing popup menu.");
2443 if (!m_d->ensureMenuInit())
2444 return;
2445 m_d->updatePopupMenuStates();
2446
2447 //Execute
2448 QAction * selAct = m_d->popup_menu->exec(QCursor::pos());
2449
2450 //Act on selection:
2451 if (!selAct) {
2452 VP1Msg::messageVerbose(" => No selection.");
2453 return;
2454 }
2455 if ( selAct == m_d->popup_bgdColAction ) {
2456 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Change background colour.");
2457 if (isAnimating())
2458 stopAnimating();
2459 QColor oldcol = VP1QtInventorUtils::sbcol2qcol(getBackgroundColor());
2460 QColor col = QColorDialog::getColor(oldcol, getWidget());
2461 if (col!=oldcol)
2462 setBackgroundColor(VP1QtInventorUtils::qcol2sbcol(col));
2463 return;
2464 }
2465 if ( selAct == m_d->popup_ambientLightAction ) {
2466 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu ambient light editor triggered");
2467 bool ok;
2468 // int newamb = QInputDialog::getInteger(getWidget(), "Change ambient light",
2469 int newamb = QInputDialog::getInt(getWidget(), "Change ambient light",
2470 "New ambient light percentage:",
2471 ambientLight(),0,100,1,&ok);
2472 if (ok)
2473 setAmbientLight(newamb);
2474 return;
2475 }
2476 if ( selAct == m_d->popup_headLightAction ) {
2477 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu head light changed to "+VP1Msg::str(m_d->popup_headLightAction->isChecked()));
2478 setHeadlight(m_d->popup_headLightAction->isChecked());
2479 return;
2480 }
2481 if ( selAct == m_d->popup_hidedecorationsaction ) {
2482 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu hide controls changed to "+VP1Msg::str(m_d->popup_hidedecorationsaction->isChecked()));
2483 setDecoration(! m_d->popup_hidedecorationsaction->isChecked());
2484 return;
2485 }
2486 if ( selAct == m_d->popup_antiAliasAction ) {
2487 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu anti aliasing changed to "+VP1Msg::str(m_d->popup_antiAliasAction->isChecked()));
2488 setAntiAlias(m_d->popup_antiAliasAction->isChecked());
2489 m_d->grabFocus();//Needed since the GL calls triggered when setting antialiasing makes us loose focus (we obviusly just had it).
2490 VP1Msg::messageVerbose("Anti-aliasing, done.");
2491 return;
2492 }
2493 if ( selAct == m_d->popup_dumpSceneAction ) {
2494 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Dump scene to an *.iv (OpenInventor) file");
2496 return;
2497 }
2498 if ( selAct == m_d->popup_dumpSceneVRMLAction ) {
2499 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Dump scene to a *.wrl (VRML) file");
2501 return;
2502 }
2503
2504 if ( selAct == m_d->popup_toSVGAction ) {
2505 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Produce SVG image");
2507 return;
2508 }
2509
2510 if ( selAct == m_d->popup_toEPSAction ) {
2511 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Produce EPS image");
2513 return;
2514 }
2515
2516 if ( selAct == m_d->popup_resetCameraAction ) {
2517 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Reset camera");
2518 resetCamera();
2519 return;
2520 }
2521 if (m_d->popup_drawstyle_still_actions.contains(selAct)) {
2522 SoQtViewer::DrawStyle ds = Imp::intToViewerDrawStyle(selAct->data().toInt());
2523 if (VP1Msg::verbose())
2524 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu still draw style selected: "
2526 if (ds!=getDrawStyle(STILL))
2527 setDrawStyle(STILL,ds);
2528 return;
2529 }
2530 if (m_d->popup_drawstyle_interactive_actions.contains(selAct)) {
2531 SoQtViewer::DrawStyle ds = Imp::intToViewerDrawStyle(selAct->data().toInt());
2532 if (VP1Msg::verbose())
2533 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu interactive draw style selected: "
2535 if (ds!=getDrawStyle(INTERACTIVE))
2536 setDrawStyle(INTERACTIVE,ds);
2537 return;
2538 }
2539 if (m_d->popup_transptype_actions.contains(selAct)) {
2540 SoGLRenderAction::TransparencyType type = VP1QtInventorUtils::intToTransparencyType(selAct->data().toInt());
2541 if (VP1Msg::verbose())
2542 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu transparency type selected: "
2544 setTransparencyType(type);
2545 return;
2546 }
2547
2548 if (m_d->storeViewActions.contains(selAct)) {
2549 QString name = selAct->data().toString();
2550 VP1Msg::messageVerbose("Storing current view as "+name);
2551
2552 bool camPerspective = currentCamIsPerspective();
2553 QByteArray camState = currentCameraState();
2554 QPixmap snapShot = VP1QtInventorUtils::renderToPixmap(this, 40, 40,false);
2555
2556 Imp::StoredView sv(camState, camPerspective, snapShot, name);
2557 //Remove old stored views with that name (if any)
2558 int i(0);
2559 bool replaced(false);
2560 for(const Imp::StoredView & oldsv : m_d->storedViews) {
2561 if (oldsv.name()==name) {
2562 m_d->storedViews.replace(i,sv);
2563 replaced = true;
2564 break;
2565 }
2566 ++i;
2567 }
2568 if (!replaced)
2569 m_d->storedViews << sv;
2570 m_d->storedViewsChanged();
2571 return;
2572 }
2573
2574 if (m_d->zoomToViewActions.contains(selAct)) {
2575 QString name = selAct->data().toString();
2576 SoGroup * root = dynamic_cast<SoGroup*>(getSceneGraph());
2577 SoCamera * camera = getCamera();
2578 if (root&&camera) {
2579 for(const Imp::StoredView & sv : m_d->storedViews) {
2580 if (sv.name()==name) {
2581 if (isAnimating())
2582 stopAnimating();
2583 VP1CameraHelper::animatedZoomToCameraState( camera,root,sv.camState(),1.5, 100.0, 100.0, true );
2584 break;
2585 }
2586 }
2587 } else {
2588 VP1Msg::messageDebug("VP1CameraHelper Error: Attempting to zoom"
2589 " to stored view, but can't get root and camera pointers");
2590 }
2591 return;
2592 }
2593
2594
2595
2596 if (m_d->restoreViewActions.contains(selAct)) {
2597 QString name = selAct->data().toString();
2598 SoGroup * root = dynamic_cast<SoGroup*>(getSceneGraph());
2599 SoCamera * camera = getCamera();
2600 if (root&&camera) {
2601 for(const Imp::StoredView & sv : m_d->storedViews) {
2602 if (sv.name()==name) {
2603 if (!m_d->fitsCurrentCamType(sv))
2605 if (isAnimating())
2606 stopAnimating();
2607 QByteArray ba = sv.camState();
2609 break;
2610 }
2611 }
2612 } else {
2613 VP1Msg::messageDebug("VP1CameraHelper Error: Attempting to zoom"
2614 " to stored view, but can't get root and camera pointers");
2615 }
2616 return;
2617
2618 }
2619
2620 if (m_d->deleteViewActions.contains(selAct)) {
2621 QString name = selAct->data().toString();
2622 int i(0);
2623 for(const Imp::StoredView & sv : m_d->storedViews) {
2624 if (sv.name()==name) {
2625 m_d->storedViews.removeAt(i);
2626 break;
2627 }
2628 ++i;
2629 }
2630 m_d->storedViewsChanged();
2631 return;
2632 }
2633
2634 if (selAct==m_d->customtour_launcheditor) {
2635 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Launch custom tour editor.");
2636 if (!m_d->customtoureditor) {
2637 m_d->customtoureditor = new VP1CustomTourEditor(this);
2638 QObject::connect(&(m_d->animationSequencer),SIGNAL(clipVolumePercentOfATLAS(double)),m_d->customtoureditor,SLOT(setClipVolumePercentOfATLAS(double)));
2639 VP1Controller::setCustomTourEditor(m_d->customtoureditor);
2640 m_d->customtoureditor->disableObjectWhenTourNotAvailable(m_d->customtour_execute);
2641 if (m_d->customtoureditorState!=QByteArray()) {
2642 m_d->customtoureditor->setState(m_d->customtoureditorState);
2643 m_d->customtoureditorState = QByteArray();
2644 }
2645 }
2646 m_d->customtoureditor->show();
2647 //Fixme: deal with minimised state!
2648 return;
2649 }
2650
2651 if (selAct==m_d->customtour_execute) {
2652 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Execute custom tour.");
2654 return;
2655 }
2656
2657 if (selAct==m_d->action_movieenabled) {
2658 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu movie enabled changed.");
2659 m_d->updateMovieMenuVisuals();
2660 return;
2661 }
2662 if (selAct==m_d->action_moviewidth) {
2663 int old = m_d->action_moviewidth->data().toInt();
2664 bool ok;
2665 // int newwidth = QInputDialog::getInteger(getWidget(), "Change movie width",
2666 int newwidth = QInputDialog::getInt(getWidget(), "Change movie width",
2667 "New movie width:", old,1,4000,1,&ok);
2668 if (ok&&old!=newwidth) {
2669 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed movie width to "+VP1Msg::str(newwidth));
2670 m_d->action_moviewidth->setData(newwidth);
2671 m_d->updateMovieMenuVisuals();
2672 }
2673 return;
2674 }
2675 if (selAct==m_d->action_movieheight) {
2676 int old = m_d->action_movieheight->data().toInt();
2677 bool ok;
2678 // int newheight = QInputDialog::getInteger(getWidget(), "Change movie height",
2679 int newheight = QInputDialog::getInt(getWidget(), "Change movie height",
2680 "New movie height:", old,1,4000,1,&ok);
2681 if (ok&&old!=newheight) {
2682 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed movie height to "+VP1Msg::str(newheight));
2683 m_d->action_movieheight->setData(newheight);
2684 m_d->updateMovieMenuVisuals();
2685 }
2686 return;
2687 }
2688 if (selAct==m_d->action_moviefps) {
2689 int old = m_d->action_moviefps->data().toInt();
2690 bool ok;
2691 // int newfps = QInputDialog::getInteger(getWidget(), "Change movie FPS",
2692 int newfps = QInputDialog::getInt(getWidget(), "Change movie FPS",
2693 "New movie frames per second:", old,1,4000,1,&ok);
2694 if (ok&&old!=newfps) {
2695 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed movie fps to "+VP1Msg::str(newfps));
2696 m_d->action_moviefps->setData(newfps);
2697 m_d->updateMovieMenuVisuals();
2698 }
2699 return;
2700 }
2701 if (selAct==m_d->action_movieoutdir) {
2702 QString old = m_d->action_movieoutdir->data().toString();
2703 QString newoutdir = QFileDialog::getExistingDirectory ( getWidget(), "Select movie frame output directory",old);
2704 if (!newoutdir.isEmpty()&&old!=newoutdir) {
2705 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed movie outdir to "+VP1Msg::str(newoutdir));
2706 m_d->action_movieoutdir->setData(newoutdir);
2707 m_d->updateMovieMenuVisuals();
2708 }
2709 return;
2710 }
2711 if (selAct==m_d->action_moviefadetocurrentview) {
2713 return;
2714 }
2715
2716 if (selAct==m_d->popup_tourReturnToStartAction
2717 ||selAct==m_d->popup_tourStartEachEvent
2718 ||selAct==m_d->popup_tourSpeedVerySlow
2719 ||selAct==m_d->popup_tourSpeedSlow
2720 ||selAct==m_d->popup_tourSpeedMedium
2721 ||selAct==m_d->popup_tourSpeedFast
2722 ||selAct==m_d->popup_tourSpeedVeryFast
2723 ||selAct==m_d->popup_tourPartsVertex
2724 ||selAct==m_d->popup_tourPartsInDet
2725 ||selAct==m_d->popup_tourPartsCalo
2726 ||selAct==m_d->popup_tourPartsMuon
2727 ||selAct==m_d->popup_tourLoopOnce
2728 ||selAct==m_d->popup_tourLoopTwice
2729 ||selAct==m_d->popup_tourLoopThrice
2730 ||selAct==m_d->popup_tourLoopForever) {
2731 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu tour setting changed.");
2732 return;
2733 }
2734 if (selAct==m_d->popup_tourExecute) {
2735 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Tour Execute selected => starting tour.");
2736 startTour();
2737 return;
2738 }
2739
2740
2741 // stereo view actions
2742
2743
2744 if (selAct==m_d->stereo_launcheditor) {
2745 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu Launch custom STEREO editor.");
2746 if (!m_d->customstereoeditor) {
2747 m_d->customstereoeditor = new VP1CustomStereoEditor(this);
2748// m_d->customstereoeditor->disableObjectWhenTourNotAvailable(m_d->customtour_execute);
2749// if (m_d->customstereoeditorState!=QByteArray()) { //TODO: implement save stereo settings
2750// m_d->customstereoeditor->setState(m_d->customstereoeditorState);
2751// m_d->customstereoeditorState = QByteArray();
2752// }
2753 }
2754 m_d->customstereoeditor->show();
2755 //Fixme: deal with minimised state!
2756 return;
2757 }
2758
2759// N.B.!! --> those separate actions below are not needed anymore,
2760// because we introduced the stereo editor window
2761
2762// if (m_d->popup_stereo_offset_actions.contains(selAct)) {
2763//
2765// float old = m_d->stereo_offset_value; //->data().toFloat();
2766//
2767// // new value
2768// float offset = selAct->data().toFloat();
2769//
2770// int newoffset = offset;
2771// if (old != newoffset) {
2772// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu stereo offset selected: "
2773// +VP1Msg::str(newoffset));
2774// m_d->stereo_offset_value = newoffset;
2775// }
2776//
2777// setStereoOffsetSlot(offset);
2778// return;
2779// }
2780//
2781// if (selAct==m_d->popup_stereo_offset_value_action) {
2782//
2783// float old = m_d->popup_stereo_offset_value_action->data().toFloat();
2784// bool ok;
2785// int newoffset = QInputDialog::getDouble(getWidget(), "Change stereo OFFSET - 0.1 is the standard offset between left and right eye",
2786// "New stereo offset: ", old,0.1,4000,1,&ok);
2787// if (ok && old != newoffset) {
2788// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed stereo offset to "+VP1Msg::str(newoffset));
2789// m_d->popup_stereo_offset_value_action->setData(newoffset);
2790// setStereoOffsetSlot(newoffset);
2791// m_d->popup_stereo_offset_value_action->setText("Change STEREO offset [current: "+QString::number(newoffset)+"]");
2792// }
2793// return;
2794// }
2795//
2796 if (selAct==m_d->popup_focal_value_action) {
2797
2798 // float old = m_d->popup_focal_value_action->data().toFloat();
2799 bool ok;
2800 SoPerspectiveCamera * camera = dynamic_cast<SoPerspectiveCamera*>(getCamera());
2801 if (! (camera==NULL) ) {
2802 float current_value = camera->focalDistance.getValue();
2803 int newfocal = QInputDialog::getDouble(getWidget(),
2804 "Change focal length", // title
2805 "New focal length: ", // label
2806 current_value, // initial value
2807 0.1, // min value
2808 2147483647, // max value
2809 1, // decimals
2810 &ok);
2811 if (ok && current_value != newfocal) {
2812 VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed focal length to "+VP1Msg::str(newfocal));
2813 m_d->popup_focal_value_action->setData(newfocal);
2814 // SoCamera *camera = getCamera();
2815 camera->focalDistance.setValue(newfocal);
2816 // camera->heightAngle.setValue(newfocal);
2817 m_d->popup_focal_value_action->setText("Change FOCAL LENGTH value [current: "+QString::number(newfocal)+"]");
2818 }
2819 } else {
2820 VP1Msg::message("Warning! No 'camera'...");
2821 }
2822 return;
2823 }
2824//
2825//
2826// if (m_d->popup_stereo_type_actions.contains(selAct)) {
2827//
2828// SoQtViewer::StereoType type = m_d->intToViewerStereoType(selAct->data().toInt());
2829//
2830// if (VP1Msg::verbose())
2831// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu stereo type selected: "
2832// +m_d->viewerStereoType2PrettyString(type));
2833//
2834// setStereoTypeSlot(type);
2835//
2836// // enable the relevant menus
2837// if (type == SoQtViewer::STEREO_ANAGLYPH) {
2838// m_d->stereo_set_anaglyph_menu->setEnabled(true);
2839// } else {
2840// m_d->stereo_set_anaglyph_menu->setEnabled(false);
2841// }
2842//
2843//
2844// return;
2845// }
2846// if (m_d->popup_stereo_anaglyph_actions.contains(selAct)) {
2847//
2848// QString type = selAct->data().toString();
2849//
2850// if (VP1Msg::verbose())
2851// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu stereo anaglyph selected: "
2852// +type);
2853//
2854// // default values for normal Anaglyph red-cyan view
2855// SbBool leftFilter[3] = {true, false, false};
2856// SbBool rightFilter[3] = {false, true, true};
2857//
2858// if (type.contains("Left-eye")) {
2859// SbBool leftFilter[3] = {true, true, true};
2860// SbBool rightFilter[3] = {false, false, false};
2861// setAnaglyphStereoColorMasksSlot(leftFilter, rightFilter);
2862// }
2863// else if (type.contains("Right-eye")) {
2864// SbBool leftFilter[3] = {false, false, false};
2865// SbBool rightFilter[3] = {true, true, true};
2866// setAnaglyphStereoColorMasksSlot(leftFilter, rightFilter);
2867// }
2868// else {
2869// setAnaglyphStereoColorMasksSlot(leftFilter, rightFilter);
2870// }
2871// return;
2872// }
2873//
2874//
2875// // STEREO - Camera
2876// if (selAct==m_d->popup_stereo_offset_value_action_camera) {
2877//
2878// float old = m_d->popup_stereo_offset_value_action_camera->data().toFloat();
2879// bool ok;
2880// float newoffset = QInputDialog::getDouble(getWidget(), "Change stereo OFFSET (Camera) - 0.1 is the standard offset between left and right eye",
2881// "New stereo offset: ", old,0.1,4000,1,&ok);
2882// if (ok && old != newoffset) {
2883// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed CAMERA stereo offset to "+VP1Msg::str(newoffset));
2884// m_d->popup_stereo_offset_value_action_camera->setData(newoffset);
2885//
2886// SoCamera *camera = getCamera();
2887// camera->setStereoAdjustment(newoffset);
2889// m_d->popup_stereo_offset_value_action_camera->setText("Change CAMERA STEREO offset [current: "+QString::number(newoffset)+"]");
2890// }
2891// return;
2892// }
2893// if (selAct==m_d->popup_stereo_balance_value_action_camera) {
2894//
2895// float old = m_d->popup_stereo_balance_value_action_camera->data().toFloat();
2896// bool ok;
2897// float newoffset = QInputDialog::getDouble(getWidget(), "Change stereo OFFSET (Camera) - 0.1 is the standard offset between left and right eye",
2898// "New stereo offset: ", old,0.1,4000,1,&ok);
2899// if (ok && old != newoffset) {
2900// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu changed CAMERA stereo offset to "+VP1Msg::str(newoffset));
2901// m_d->popup_stereo_balance_value_action_camera->setData(newoffset);
2902//
2903// SoCamera *camera = getCamera();
2904// camera->setBalanceAdjustment(newoffset);
2906// m_d->popup_stereo_balance_value_action_camera->setText("Change CAMERA STEREO balance [current: "+QString::number(newoffset)+"]");
2907// }
2908// return;
2909// }
2910//
2911//
2912// if (m_d->popup_stereo_anaglyph_actions_camera.contains(selAct)) {
2913//
2914// QString type = selAct->data().toString();
2915//
2916// if (VP1Msg::verbose())
2917// VP1Msg::messageVerbose("VP1ExaminerViewer::showPopupMenu CAMERA stereo view mode selected: "
2918// +type);
2919//
2920// SoCamera *camera = getCamera();
2921//
2922// if (type.contains("Left-eye")) {
2923// camera->setStereoMode(SoCamera::LEFT_VIEW);
2924// }
2925// else if (type.contains("Right-eye")) {
2926// camera->setStereoMode(SoCamera::RIGHT_VIEW);
2927// }
2928// else {
2929// camera->setStereoMode(SoCamera::MONOSCOPIC);
2930// }
2931// return;
2932// }
2933
2934
2935
2936
2937 // default
2938 VP1Msg::messageDebug("VP1ExaminerViewer::showPopupMenu ERROR: Unknown selected item!");
2939 return;
2940
2941}
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)
static QString viewerDrawStyle2PrettyString(SoQtViewer::DrawStyle)
static SoQtViewer::DrawStyle intToViewerDrawStyle(int)
void fadeLastRecordedFrameToCurrent(double time_seconds)
void dumpSceneToVRMLFile(QString filename="")
void produceSVGImage(QString filename="")
void dumpSceneToFile(QString filename="")
void produceEPSImage(QString filename="")
static bool verbose()
Definition VP1Msg.h:31
static QString transparencyType2PrettyString(SoGLRenderAction::TransparencyType)

◆ startCustomTour()

void VP1ExaminerViewer::startCustomTour ( )

Definition at line 1245 of file VP1ExaminerViewer.cxx.

1246{
1247 VP1Msg::messageVerbose("startCustomTour begin.");
1248
1249 if (!m_d->customtoureditor||!m_d->customtoureditor->tourAvailable())
1250 return;
1251
1252 m_d->grabFocus();
1253 if (isAnimating())
1254 stopAnimating();
1255 bool jump(m_d->action_movieenabled->isChecked());
1256 if (currentCamIsPerspective()!=m_d->customtoureditor->tourIsPerspective()) {
1258 jump = true;
1259 }
1260 m_d->animationSequencer.sequence().clearAllFrames();
1261 m_d->customtoureditor->addTourToAnimationSequencer(m_d->animationSequencer,jump);
1262 m_d->applyMovieSettingsToAnimationSequencer();
1263 //Start animation:
1264 m_d->animationSequencer.startAnimating();
1265}

◆ startTour()

void VP1ExaminerViewer::startTour ( )

Definition at line 1165 of file VP1ExaminerViewer.cxx.

1166{
1167 VP1Msg::messageVerbose("VP1ExaminerViewer::startTour()");
1168 if (m_d->detectorViewButtons)
1169 m_d->takeTourButtonClicked();
1170}

◆ startTourEachEvent()

bool VP1ExaminerViewer::startTourEachEvent ( ) const

Definition at line 1173 of file VP1ExaminerViewer.cxx.

1174{
1175 VP1Msg::messageVerbose("VP1ExaminerViewer::startTourEachEvent()");
1176 return m_d->popup_tourStartEachEvent ? m_d->popup_tourStartEachEvent->isChecked() : false;
1177}

◆ storeCameraParametersForReset()

void VP1ExaminerViewer::storeCameraParametersForReset ( )

Definition at line 1815 of file VP1ExaminerViewer.cxx.

1816{
1817 if (m_d->resetCamera_state!=QByteArray())
1818 return;
1819 //Camera type and parameters:
1820 m_d->resetCamera_isPerspective = (currentCamIsPerspective());
1821 m_d->resetCamera_state = currentCameraState();
1822
1823 if (m_d->popup_resetCameraAction&&!m_d->popup_resetCameraAction->isVisible())
1824 m_d->popup_resetCameraAction->setVisible(true);
1825}

◆ str() [1/30]

QString VP1String::str ( const Amg::Vector3D & t)
inlinestaticinherited

Definition at line 98 of file VP1String.h.

98{ return "("+str(t.x())+", "+str(t.y())+", "+str(t.z())+")"; }

◆ str() [2/30]

QString VP1String::str ( const bool b)
inlinestaticinherited

Definition at line 53 of file VP1String.h.

53{ return b?"True":"False"; }

◆ str() [3/30]

QString VP1String::str ( const char * c)
inlinestaticinherited

Definition at line 50 of file VP1String.h.

50{ return c; }

◆ str() [4/30]

QString VP1String::str ( const double & d)
inlinestaticinherited

Definition at line 81 of file VP1String.h.

81{ return QString::number(d); }

◆ str() [5/30]

QString VP1String::str ( const float & f)
inlinestaticinherited

Definition at line 82 of file VP1String.h.

82{ return QString::number(f); }

◆ str() [6/30]

template<class T>
QString VP1String::str ( const HepGeom::BasicVector3D< T > & t)
inlinestaticinherited

Definition at line 95 of file VP1String.h.

95{ return "("+str(t.x())+", "+str(t.y())+", "+str(t.z())+")"; }

◆ str() [7/30]

QString VP1String::str ( const QColor & c)
staticinherited

Definition at line 30 of file VP1String.cxx.

31{
32 return c.isValid() ? c.name() : "Invalid";
33}

◆ str() [8/30]

template<class T>
QString VP1String::str ( const QFlags< T > & f)
inlinestaticinherited

Definition at line 91 of file VP1String.h.

91{ return "0x"+QString::number(f, 16).toUpper().rightJustified(8,'0'); }

◆ str() [9/30]

template<class T>
QString VP1String::str ( const QList< T > & t)
inlinestaticinherited

Definition at line 102 of file VP1String.h.

102{ return "QList of size"+QString::number(t.size()); }

◆ str() [10/30]

QString VP1String::str ( const QString & s)
inlinestaticinherited

Definition at line 49 of file VP1String.h.

49{ return s; }

◆ str() [11/30]

QString VP1String::str ( const SbColor & c)
staticinherited

Definition at line 36 of file VP1String.cxx.

37{
39}

◆ str() [12/30]

QString VP1String::str ( const SbVec2d & v)
staticinherited

Definition at line 61 of file VP1String.cxx.

61{ double x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }
#define y
#define x

◆ str() [13/30]

QString VP1String::str ( const SbVec2f & v)
staticinherited

Definition at line 62 of file VP1String.cxx.

62{ float x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }

◆ str() [14/30]

QString VP1String::str ( const SbVec2s & v)
staticinherited

Definition at line 63 of file VP1String.cxx.

63{ short x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }

◆ str() [15/30]

QString VP1String::str ( const SbVec3d & v)
staticinherited

Definition at line 64 of file VP1String.cxx.

64{ double x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }
#define z

◆ str() [16/30]

QString VP1String::str ( const SbVec3f & v)
staticinherited

Definition at line 65 of file VP1String.cxx.

65{ float x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }

◆ str() [17/30]

QString VP1String::str ( const SbVec3s & v)
staticinherited

Definition at line 66 of file VP1String.cxx.

66{ short x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }

◆ str() [18/30]

QString VP1String::str ( const SbVec4d & v)
staticinherited

Definition at line 67 of file VP1String.cxx.

67{ double x,y,z,t; v.getValue(x,y,z,t); return "("+str(x)+", "+str(y)+", "+str(z)+", "+str(t)+")"; }

◆ str() [19/30]

QString VP1String::str ( const SbVec4f & v)
staticinherited

Definition at line 68 of file VP1String.cxx.

68{ float x,y,z,t; v.getValue(x,y,z,t); return "("+str(x)+", "+str(y)+", "+str(z)+", "+str(t)+")"; }

◆ str() [20/30]

template<class T>
QString VP1String::str ( const T * t)
inlinestaticinherited

Definition at line 87 of file VP1String.h.

87{ return str(static_cast<const void* >(t)); }

◆ str() [21/30]

QString VP1String::str ( const void * p)
staticinherited

Definition at line 48 of file VP1String.cxx.

49{
50 if (p) {
51 std::ostringstream s;
52 s << p;
53 // Explicitly naming QString here avoids a cppcheck warning.
54 return QString (s.str().c_str());
55 } else {
56 return "NULL";
57 }
58}

◆ str() [22/30]

QString VP1String::str ( const VP1Interval & i)
staticinherited

Definition at line 42 of file VP1String.cxx.

43{
44 return i.toString();
45}

◆ str() [23/30]

QString VP1String::str ( int n)
inlinestaticinherited

Definition at line 77 of file VP1String.h.

77{ return QString::number(n); }

◆ str() [24/30]

QString VP1String::str ( long n)
inlinestaticinherited

Definition at line 75 of file VP1String.h.

75{ return QString::number(n); }

◆ str() [25/30]

QString VP1String::str ( qlonglong n)
inlinestaticinherited

Definition at line 79 of file VP1String.h.

79{ return QString::number(n); }

◆ str() [26/30]

QString VP1String::str ( qulonglong n)
inlinestaticinherited

Definition at line 80 of file VP1String.h.

80{ return QString::number(n); }

◆ str() [27/30]

QString VP1String::str ( short int n)
inlinestaticinherited

Definition at line 73 of file VP1String.h.

73{ return QString::number(n); }

◆ str() [28/30]

QString VP1String::str ( uint n)
inlinestaticinherited

Definition at line 78 of file VP1String.h.

78{ return QString::number(n); }

◆ str() [29/30]

QString VP1String::str ( ulong n)
inlinestaticinherited

Definition at line 76 of file VP1String.h.

76{ return QString::number(n); }

◆ str() [30/30]

QString VP1String::str ( unsigned short int n)
inlinestaticinherited

Definition at line 74 of file VP1String.h.

74{ return QString::number(n); }

◆ toggleCameraType()

void VP1ExaminerViewer::toggleCameraType ( )
virtual

Definition at line 1473 of file VP1ExaminerViewer.cxx.

1474{
1475 VP1Msg::messageVerbose("VP1ExaminerViewer::toggleCameraType()");
1476 m_d->grabFocus();
1477 SoQtExaminerViewer::toggleCameraType();
1478}

◆ viewAll()

void VP1ExaminerViewer::viewAll ( )
virtual

Definition at line 1458 of file VP1ExaminerViewer.cxx.

1459{
1460 VP1Msg::messageVerbose("VP1ExaminerViewer::viewAll()");
1461 m_d->grabFocus();
1463 //Fix for bad camera:
1466 //Fixme: Instead make a reset camera followed by a 0 second "zoom" to correct orientation?
1467 }
1468 SoQtExaminerViewer::viewAll();
1469
1470}

◆ VP1ExaminerViewer_SignalCatcher

friend class VP1ExaminerViewer_SignalCatcher
friend

Definition at line 131 of file VP1ExaminerViewer.h.

Member Data Documentation

◆ m_d

Imp* VP1ExaminerViewer::m_d {}
private

Definition at line 130 of file VP1ExaminerViewer.h.

130{};

◆ stereo_offset_camera

float VP1ExaminerViewer::stereo_offset_camera

Definition at line 91 of file VP1ExaminerViewer.h.

◆ stereo_offset_viewer

float VP1ExaminerViewer::stereo_offset_viewer

Definition at line 93 of file VP1ExaminerViewer.h.

◆ stereo_parallax_camera

float VP1ExaminerViewer::stereo_parallax_camera

Definition at line 92 of file VP1ExaminerViewer.h.


The documentation for this class was generated from the following files: