CEDRIC  Revision_backup-2009-02
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
EventViewerWidget Class Reference

Base class for a cedric "Viewer" i.e. a manipulable camera onto a scenegraph. More...

#include <EventViewerWidget.h>

Inheritance diagram for EventViewerWidget:
FilterVisViewer

Public Types

enum  ViewModes { VIEW_ORTHO =0, VIEW_PERSPECTIVE, VIEW_PLANAR }
 Provided for convenience, should match with MyCamera::Projection) More...
 
enum  ViewHomePerspectives { TOP_VIEW =0, SIDE_VIEW, FRONT_VIEW }
 Supplied default camera perspectives. More...
 

Public Slots

void setViewMode (int viewMode)
 Set projection mode. More...
 
void setViewHome (int perspective)
 Set a default camera without changing projection. More...
 
void setHomePosition (osg::Vec3 center)
 Specify home position by hand (to disable call enableAutoHomePosition()) More...
 
void enableAutoHomePosition ()
 Compute home position according to bounding box (and if bounding box is not valid set (0,0,0) as center) More...
 
void home ()
 
void adjustDistance ()
 Compute and set distance for which camera fits bounding box. More...
 
void adjustCenter ()
 Reset center of view to origin (0,0,0) More...
 
void fitBoundingBox ()
 DOESN'T WORK CORRECTLY, SEE MyCamera. More...
 
void setRulerVisible (bool enable)
 Set visibility of rulers. More...
 
bool isRulerVisible () const
 Get visibility of rulers. More...
 
void forceContinuousUpdate (bool force)
 Pass through to OsgViewerWidget member m_viewerWidget. More...
 
void triggerRedraw ()
 Pass through to OsgViewerWidget member m_viewerWidget. More...
 
void changeProjectionAlpha (double alpha)
 Change projection plane in "Planar" view mode. More...
 
void viewSide ()
 
void viewTop ()
 
void viewFront ()
 

Signals

void positionChanged (float x, float y, float z)
 Unprojected mouse position (forwarded from MyCameraWidget) More...
 
void activeViewerChanged (EventViewerWidget *)
 

Public Member Functions

 EventViewerWidget (QWidget *parent=0)
 
virtual ~EventViewerWidget ()
 
virtual QSize minimumSizeHint () const
 Force a minimum size. More...
 
void setScenegraph (osg::Node *node)
 Set scenegraph containing all event geometry (e.g. tracks and setup) More...
 
virtual void setPhastScene (PhastScene *scene)
 Set scenegraph via PhastScene. More...
 
int getViewMode () const
 Provided for convenience, returns current projection mode. More...
 
double getProjectionAlpha () const
 Rotation angle in "Planar" view mode. More...
 
MyCameraWidget * getMyCameraWidget ()
 Access contained MyCameraWidget (usefull for making connections) More...
 
MyCamera * getMyCamera ()
 Provided for convenience to get MyCamera of MyCameraWidget member. More...
 
bool isContinuousUpdateForced () const
 Pass through from OsgViewerWidget member m_viewerWidget. More...
 
bool isLinked () const
 
void setLinked (bool l)
 
void linkTo (EventViewerWidget *viewer)
 
void unlinkFrom (EventViewerWidget *viewer)
 

Protected Slots

void updateRuler ()
 
void setPosition (float x, float y, float z)
 
void gotFocus (bool b)
 

Protected Member Functions

void getRulerProjection (osg::Vec3 &projEast, osg::Vec3 &projUp)
 
virtual void enterEvent (QEvent *)
 
virtual void leaveEvent (QEvent *)
 

Detailed Description

Base class for a cedric "Viewer" i.e. a manipulable camera onto a scenegraph.

This "Viewer" provides three ViewMode respectively for orthographic projection with free rotation, perspective projection with free rotation and a special mode labeled 'planar'. In the latter we have a orthographic projection strictly from the side and free rotation is not allowed. But instead the 'projection angle' alpha specifies a rotation around the beam axis which corresponds to choosing a projection plane similar as in TRAFFIC. This rotation is accomplished through an additional MatrixTransform node to which the scenegraph given by setScenegraph() is attached to.

For all viewing modes there are ViewHomePerspectives defined to setup a view from a specific direction (e.g. side and top view).

Besides the main view onto a scenegraph this widget can display vertical and horizontal rulers which automatically adjust to the current view. This is possible because the main view is based on MyCamera.

The viewer is surrounded by a coloured frame to indicate if this is the 'ative viewer (i.e. the viewer which has focus).

Author
Max Hermann <mhermann[at]mail.cern.ch>

Member Enumeration Documentation

Supplied default camera perspectives.

Enumerator
TOP_VIEW 
SIDE_VIEW 
FRONT_VIEW 

Provided for convenience, should match with MyCamera::Projection)

Enumerator
VIEW_ORTHO 
VIEW_PERSPECTIVE 
VIEW_PLANAR 

Constructor & Destructor Documentation

EventViewerWidget::EventViewerWidget ( QWidget *  parent = 0)
virtual EventViewerWidget::~EventViewerWidget ( )
inlinevirtual

Member Function Documentation

void EventViewerWidget::activeViewerChanged ( EventViewerWidget *  )
signal

Referenced by gotFocus(), home(), and setViewHome().

void EventViewerWidget::adjustCenter ( )
slot

Reset center of view to origin (0,0,0)

References MyCamera::center(), MyCameraWidget::getMyCamera(), and MyCamera::translate().

Referenced by home().

void EventViewerWidget::adjustDistance ( )
slot

Compute and set distance for which camera fits bounding box.

References MyCamera::east(), MyCamera::getAspect(), MyCamera::getFov(), MyCameraWidget::getMyCamera(), and MyCamera::setDistance().

Referenced by home().

void EventViewerWidget::changeProjectionAlpha ( double  alpha)
slot

Change projection plane in "Planar" view mode.

References OsgViewerWidget::triggerRedraw().

Referenced by home(), setViewHome(), and setViewMode().

void EventViewerWidget::enableAutoHomePosition ( )
inlineslot

Compute home position according to bounding box (and if bounding box is not valid set (0,0,0) as center)

virtual void EventViewerWidget::enterEvent ( QEvent *  )
inlineprotectedvirtual
void EventViewerWidget::fitBoundingBox ( )
inlineslot

DOESN'T WORK CORRECTLY, SEE MyCamera.

References MyCameraWidget::getMyCamera(), and MyCamera::zoom().

void EventViewerWidget::forceContinuousUpdate ( bool  force)
inlineslot

Pass through to OsgViewerWidget member m_viewerWidget.

References OsgViewerWidget::forceContinuousUpdate().

MyCamera* EventViewerWidget::getMyCamera ( )
inline
MyCameraWidget* EventViewerWidget::getMyCameraWidget ( )
inline
double EventViewerWidget::getProjectionAlpha ( ) const
inline

Rotation angle in "Planar" view mode.

Referenced by EventMultiViewer::setActiveViewer().

void EventViewerWidget::getRulerProjection ( osg::Vec3 &  projEast,
osg::Vec3 &  projUp 
)
protected
int EventViewerWidget::getViewMode ( ) const
inline

Provided for convenience, returns current projection mode.

Referenced by EventMultiViewer::setActiveViewer(), and EventMultiViewer::setLocalActionsEnabled().

void EventViewerWidget::gotFocus ( bool  b)
inlineprotectedslot

References activeViewerChanged().

Referenced by EventViewerWidget().

void EventViewerWidget::home ( )
slot
bool EventViewerWidget::isContinuousUpdateForced ( ) const
inline

Pass through from OsgViewerWidget member m_viewerWidget.

References OsgViewerWidget::isContinuousUpdateForced().

bool EventViewerWidget::isLinked ( ) const
inline
bool EventViewerWidget::isRulerVisible ( ) const
slot

Get visibility of rulers.

virtual void EventViewerWidget::leaveEvent ( QEvent *  )
inlineprotectedvirtual
void EventViewerWidget::linkTo ( EventViewerWidget *  viewer)
inline

References getMyCamera(), and MyCamera::link().

virtual QSize EventViewerWidget::minimumSizeHint ( ) const
inlinevirtual

Force a minimum size.

void EventViewerWidget::positionChanged ( float  x,
float  y,
float  z 
)
signal

Unprojected mouse position (forwarded from MyCameraWidget)

Referenced by EventViewerWidget().

void EventViewerWidget::setHomePosition ( osg::Vec3  center)
inlineslot

Specify home position by hand (to disable call enableAutoHomePosition())

Referenced by EventMultiViewer::createClusterVisPerspective().

void EventViewerWidget::setLinked ( bool  l)
inline
void EventViewerWidget::setPhastScene ( PhastScene *  scene)
virtual

Set scenegraph via PhastScene.

Reimplemented in FilterVisViewer.

References setScenegraph().

void EventViewerWidget::setPosition ( float  x,
float  y,
float  z 
)
protectedslot
void EventViewerWidget::setRulerVisible ( bool  enable)
slot

Set visibility of rulers.

Referenced by EventViewerWidget().

void EventViewerWidget::setScenegraph ( osg::Node *  node)
void EventViewerWidget::setViewHome ( int  perspective)
slot
void EventViewerWidget::setViewMode ( int  viewMode)
slot
void EventViewerWidget::triggerRedraw ( )
inlineslot

Pass through to OsgViewerWidget member m_viewerWidget.

References OsgViewerWidget::triggerRedraw().

Referenced by home().

void EventViewerWidget::unlinkFrom ( EventViewerWidget *  viewer)
inline

References getMyCamera(), and MyCamera::unlink().

Referenced by LinkedViewers::remove().

void EventViewerWidget::updateRuler ( )
protectedslot
void EventViewerWidget::viewFront ( )
inlineslot

References FRONT_VIEW, and setViewHome().

void EventViewerWidget::viewSide ( )
inlineslot

Convenience functions

References setViewHome(), and SIDE_VIEW.

void EventViewerWidget::viewTop ( )
inlineslot

References setViewHome(), and TOP_VIEW.