CMS 3D CMS Logo

IgRZBrowser Class Reference

#include <Iguana/GLBrowsers/interface/IgRZBrowser.h>

Inheritance diagram for IgRZBrowser:

Ig3DBaseBrowser IgBrowser

List of all members.

Public Slots

virtual void invertCamera (void)
virtual void toggleCameraType (void)
virtual void viewPlaneX (void)
virtual void viewPlaneY (void)
virtual void viewPlaneZ (void)

Public Member Functions

 IgRZBrowser (IgState *state, IgSite *site, IgRZModel *model=0)

Static Public Member Functions

static const char * catalogLabel (void)

Protected Member Functions

virtual QWidget * buildBottomTrim (QWidget *parent)
virtual void buildDecoration (QWidget *parent)
virtual QWidget * buildLeftTrim (QWidget *parent)
virtual QWidget * buildRightTrim (QWidget *parent)

Static Protected Member Functions

static SbBool eventCallback (void *closure, QEvent *event)

Private Member Functions

virtual void init (void)


Detailed Description

Definition at line 19 of file IgRZBrowser.h.


Constructor & Destructor Documentation

IgRZBrowser::IgRZBrowser ( IgState state,
IgSite site,
IgRZModel model = 0 
)

Definition at line 17 of file IgRZBrowser.cc.

References init().

00020     : Ig3DBaseBrowser (state,
00021                        site,
00022                        model ? model : new IgRZModel (state))
00023 {
00024     init ();
00025 }


Member Function Documentation

QWidget * IgRZBrowser::buildBottomTrim ( QWidget *  parent  )  [protected, virtual]

Reimplemented from Ig3DBaseBrowser.

Definition at line 118 of file IgRZBrowser.cc.

References HLT_VtxMuL3::result.

00119 {
00120     QWidget     *result = new QWidget (parent);
00121     result->setFixedHeight (0);
00122     return result;    
00123 }

void IgRZBrowser::buildDecoration ( QWidget *  parent  )  [protected, virtual]

Definition at line 134 of file IgRZBrowser.cc.

00135 {
00136     Ig3DBaseBrowser::buildDecoration (parent);    
00137     return;    
00138 }

QWidget * IgRZBrowser::buildLeftTrim ( QWidget *  parent  )  [protected, virtual]

Reimplemented from Ig3DBaseBrowser.

Definition at line 110 of file IgRZBrowser.cc.

References HLT_VtxMuL3::result.

00111 {
00112     QWidget     *result = new QWidget (parent);
00113     result->setFixedWidth (0);
00114     return result;    
00115 }

QWidget * IgRZBrowser::buildRightTrim ( QWidget *  parent  )  [protected, virtual]

Reimplemented from Ig3DBaseBrowser.

Definition at line 126 of file IgRZBrowser.cc.

References HLT_VtxMuL3::result.

00127 {
00128     QWidget     *result = new QWidget (parent);
00129     result->setFixedWidth (0);
00130     return result;    
00131 }

const char * IgRZBrowser::catalogLabel ( void   )  [static]

Definition at line 14 of file IgRZBrowser.cc.

00015 { return "RZ"; }

SbBool IgRZBrowser::eventCallback ( void closure,
QEvent *  event 
) [static, protected]

Reimplemented from Ig3DBaseBrowser.

Definition at line 53 of file IgRZBrowser.cc.

References Ig3DBaseBrowser::eventCallback(), and cmssw-higgs-4mu::firstEvent.

Referenced by init().

00054 {
00055     static bool firstEvent = true;    
00056     static float oldX = 0.;
00057     static float oldY = 0.;
00058     IgRZBrowser *browser = static_cast<IgRZBrowser *> (closure);
00059     if (! browser->isViewing ())
00060         return false;
00061     if (! browser->getParentWidget ()->hasMouse () && firstEvent)
00062         return false;
00063     if (! Ig3DBaseBrowser::eventCallback (closure, event))
00064     {      
00065         if (QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *> (event))
00066         {
00067             if (mouseEvent->type () == QEvent::MouseMove
00068                 && mouseEvent->stateAfter () == Qt::NoButton)
00069             {
00070                 if (! firstEvent)
00071                 {
00072                     firstEvent = true;
00073                     return true;
00074                 }
00075             }
00076             else if (mouseEvent->state () == Qt::LeftButton)
00077             {
00078                 if (mouseEvent->stateAfter () == Qt::NoButton)
00079                     firstEvent = true;
00080                 else if (mouseEvent->type () == QEvent::MouseMove)
00081                 {
00082                     if (firstEvent)
00083                     {
00084                         oldX = mouseEvent->x ();
00085                         oldY = mouseEvent->y ();
00086                         firstEvent = false;
00087                     }
00088                     else
00089                     {
00090                         float deltaX = mouseEvent->x () - oldX;
00091                         float deltaY = oldY - mouseEvent->y ();
00092                         SoCamera *camera = browser->getCamera ();
00093                         SbVec3f oldPosition = camera->position.getValue ();
00094                         camera->position = oldPosition - 
00095                                            SbVec3f (deltaX/10, deltaY/10, 0);
00096                         oldX = mouseEvent->x ();
00097                         oldY = mouseEvent->y ();
00098                     }
00099                     return true;
00100                 }
00101             }
00102             return false;
00103         }
00104         return false;
00105     }
00106     return true;
00107 }

void IgRZBrowser::init ( void   )  [private, virtual]

Definition at line 28 of file IgRZBrowser.cc.

References eventCallback().

Referenced by IgRZBrowser().

00029 {
00030     SoQtExaminerViewer::setCameraType (SoOrthographicCamera::getClassTypeId ());
00031     SoOrthographicCamera * const camera = dynamic_cast <SoOrthographicCamera *> (this->getCamera ());
00032     if (!camera) return; // probably a scene-less viewer
00033 
00034     if (SoQtViewer::isHeadlight ()) SoQtViewer::setHeadlight (false);
00035 
00036 //     SbVec3f norient = SbVec3f (-1, 0, 0);
00037 //     camera->position = -norient * camera->position.getValue ().length ();
00038 //     camera->orientation = SbRotation (SbVec3f (0, 1, 0), -M_PI / 2.f);
00039 
00040     camera->position = SbVec3f (-14.815891, 0, 0);
00041     camera->orientation = SbRotation (SbVec3f (-0, -1, -0), 1.5707964);
00042     camera->aspectRatio = 1;
00043     camera->focalDistance = 14.815891;
00044     camera->height = 12.273887;
00045     camera->nearDistance = 0.1;
00046     camera->farDistance = 32767;
00047 
00048     setEventCallback (eventCallback, this); 
00049     setBackgroundColor (SbColor (1.0, 1.0, 1.0));
00050 }

void IgRZBrowser::invertCamera ( void   )  [virtual, slot]

Reimplemented from Ig3DBaseBrowser.

Definition at line 148 of file IgRZBrowser.cc.

00149 {
00150     SoCamera * const camera = this->getCamera ();
00151     if (!camera) return; // probably a scene-less viewer
00152 
00153     camera->position = camera->position.getValue () * -1.0F;    
00154 }

void IgRZBrowser::toggleCameraType ( void   )  [virtual, slot]

Reimplemented from Ig3DBaseBrowser.

Definition at line 141 of file IgRZBrowser.cc.

References Ig3DBaseBrowser::toggleCameraType().

00142 {
00143     SoQtExaminerViewer::toggleCameraType ();
00144     Ig3DBaseBrowser::toggleCameraType ();    
00145 }

void IgRZBrowser::viewPlaneX ( void   )  [virtual, slot]

Reimplemented from Ig3DBaseBrowser.

Definition at line 157 of file IgRZBrowser.cc.

References f.

Referenced by IgRZViewPropertiesCategory::alignAxis().

00158 {
00159     SoCamera * const camera = this->getCamera ();
00160     if (!camera) return; // probably a scene-less viewer
00161     
00162     camera->position = SbVec3f (-1, 0, 0) * camera->position.getValue ().length ();
00163     camera->orientation = SbRotation (SbVec3f (0, 1, 0), -M_PI / 2.f);
00164 }

void IgRZBrowser::viewPlaneY ( void   )  [virtual, slot]

Reimplemented from Ig3DBaseBrowser.

Definition at line 167 of file IgRZBrowser.cc.

References f.

Referenced by IgRZViewPropertiesCategory::alignAxis().

00168 {
00169     SoCamera * const camera = this->getCamera ();
00170     if (!camera) return; // probably a scene-less viewer
00171 
00172     SbVec3f norient = SbVec3f (0, -1, 0);
00173     camera->position = -norient * camera->position.getValue().length();
00174     camera->orientation = SbRotation (SbVec3f (0, 0, 1), -M_PI / 2.f) * 
00175                           SbRotation (SbVec3f (0, 0, -1), norient);
00176 }

void IgRZBrowser::viewPlaneZ ( void   )  [virtual, slot]

Reimplemented from Ig3DBaseBrowser.

Definition at line 179 of file IgRZBrowser.cc.

Referenced by IgRZViewPropertiesCategory::alignAxis().

00180 {
00181     SoCamera * const camera = this->getCamera ();
00182     if (!camera) return; // probably a scene-less viewer
00183   
00184     camera->position = SbVec3f (0, 0, 1) * camera->position.getValue ().length ();
00185     camera->orientation = SbRotation::identity ();
00186 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:38 2009 for CMSSW by  doxygen 1.5.4