VRUT::Navigation::NavigationStyleMayaSpecific Class Reference

Type for Maya specific variables needed for a proper emulation. More...

#include <navigation.h>

Inheritance diagram for VRUT::Navigation::NavigationStyleMayaSpecific:

NavigationStyleInterface

List of all members.

Public Member Functions

 NavigationStyleMayaSpecific (const MODULE_ID &_id, const wxString &_name, Navigation *navigation)
 Constructor.
void getAndFixButtonValues (const wxCommandEvent &evt)
 Update other Maya buttons' value.
void registerButtons ()
 Register Maya buttons into gui.
void updateParams (const wxCommandEvent &evt)
 Updates the module specific registered parameters.
void buttonEvent ()
 Method for handling stateless buttons.
void keyStyle (wxKeyEvent &evt)
 Maya key style.
void mouseStyle (wxMouseEvent &evt)
 Maya mouse style.

Public Attributes

ParameterIdentificatorList navigationButtonsInfo
 List of paramIDs for Maya navigation buttons.
ParameterIdentificatorList::iterator selectButtonIter
 Convenience iterator for the Maya select button.
ParameterIdentificatorList::iterator tumbleButtonIter
 Convenience iterator for the Maya tumble button.
ParameterIdentificatorList::iterator trackButtonIter
 Convenience iterator for the Maya track button.
ParameterIdentificatorList::iterator dollyButtonIter
 Convenience iterator for the Maya dolly button.
ParameterIdentificatorList::iterator zoomButtonIter
 Convenience iterator for the Maya zoom button.
ParameterIdentificatorList::iterator rollButtonIter
 Convenience iterator for the Maya roll button.
ParameterIdentificatorList::iterator azimuthElevationButtonIter
 Convenience iterator for the Maya azimuthElevation button.
ParameterIdentificatorList::iterator yawPitchButtonIter
 Convenience iterator for the Maya yawPitch button.
ParameterIdentificatorList::iterator flyButtonIter
 Convenience iterator for the Maya fly button.
bool altDown
 Is the alt key being held down?
bool shiftDown
 Is the shift key being held down?
bool axisAlignedRotateOperationStarted
 Are we rotating around a single axis?
bool axisAlignedXaxis
 True if we rotate around the x axis, false if we rotate around the y axis.

Private Attributes

Navigationnavigation
 C++ does not allow the embedded class to see its surrounding class, so we need this pointer.


Detailed Description

Type for Maya specific variables needed for a proper emulation.

Definition at line 298 of file navigation.h.


Constructor & Destructor Documentation

Navigation::NavigationStyleMayaSpecific::NavigationStyleMayaSpecific ( const MODULE_ID _id,
const wxString &  _name,
Navigation navigation 
)

Constructor.

Definition at line 1832 of file navigation.cpp.

01833 : NavigationStyleInterface(wxT("Maya"))
01834 {
01835        this->navigation = navigation;
01836 
01837        selectButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("selectMaya"), _id),1)));
01838        tumbleButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("tumbleMaya"), _id),0)));
01839        trackButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("trackMaya"), _id),0)));
01840        dollyButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("dollyMaya"), _id),0)));
01841        zoomButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("zoomMaya"), _id),0)));
01842        rollButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("rollMaya"), _id),0)));
01843        azimuthElevationButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("azimuthElevationMaya"), _id),0)));
01844        yawPitchButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("yawPitchMaya"), _id),0)));
01845        flyButtonIter = navigationButtonsInfo.insert(navigationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("flyMaya"), _id),0)));
01846 
01847        altDown = false;
01848        shiftDown = false;
01849        axisAlignedRotateOperationStarted = false;
01850        axisAlignedXaxis = false;
01851 }


Member Function Documentation

void Navigation::NavigationStyleMayaSpecific::getAndFixButtonValues ( const wxCommandEvent &  evt  )  [virtual]

Update other Maya buttons' value.

Implements NavigationStyleInterface.

Definition at line 1853 of file navigation.cpp.

void Navigation::NavigationStyleMayaSpecific::registerButtons (  )  [virtual]

Register Maya buttons into gui.

Implements NavigationStyleInterface.

Definition at line 1859 of file navigation.cpp.

void VRUT::Navigation::NavigationStyleMayaSpecific::updateParams ( const wxCommandEvent &  evt  )  [inline, virtual]

Updates the module specific registered parameters.

Implements NavigationStyleInterface.

Definition at line 339 of file navigation.h.

00339 {}

void Navigation::NavigationStyleMayaSpecific::buttonEvent (  )  [virtual]

Method for handling stateless buttons.

Implements NavigationStyleInterface.

Definition at line 1864 of file navigation.cpp.

01865 {
01866        
01867 }

void Navigation::NavigationStyleMayaSpecific::keyStyle ( wxKeyEvent &  evt  )  [virtual]

Maya key style.

Implements NavigationStyleInterface.

Definition at line 1869 of file navigation.cpp.

01870 {
01871        if (int(navigation->windowID) == evt.GetId() && evt.GetEventType() == wxEVT_KEY_DOWN)
01872        {
01873               NODE_ID cameraID = navigation->getCameraID();
01874               Scene * scene = navigation->GetSceneMgr()->GetScene(navigation->getSceneID());
01875               if (!scene)
01876                      return;
01877 
01878               const SceneNode * camNode = scene->GetNode(cameraID);
01879               if (!camNode || !camNode->IsOfType(SceneNode::CAMERA))
01880                      return;
01881 
01882               Camera * camera = (Camera *)(const_cast<SceneNode *>(camNode));
01883               
01884               if (evt.GetUnicodeKey() == wxChar(L'F'))
01885               {
01886                      scene->Fit(cameraID);
01887               }
01888 
01889               switch (evt.GetKeyCode())
01890               {
01891               case WXK_ALT:
01892                      {
01893                             altDown = true;
01894                      }
01895                      break;
01896               case WXK_SHIFT:
01897                      {
01898                             shiftDown = true;
01899                      }
01900                      break;
01901               }
01902        }
01903        else if (int(navigation->windowID) == evt.GetId() && evt.GetEventType() == wxEVT_KEY_UP)
01904        {
01905               switch (evt.GetKeyCode())
01906               {
01907               case WXK_ALT:
01908                      {
01909                             altDown = false;
01910                      }
01911                      break;
01912               case WXK_SHIFT:
01913                      {
01914                             shiftDown = false;
01915                      }
01916                      break;
01917               }
01918        }
01919 }

void Navigation::NavigationStyleMayaSpecific::mouseStyle ( wxMouseEvent &  evt  )  [virtual]

Maya mouse style.

Try to sync with kernel so no redundant param updates occur

Implements NavigationStyleInterface.

Definition at line 1921 of file navigation.cpp.

01922 {
01923        NODE_ID cameraID = navigation->getCameraID();
01924        Scene * scene = navigation->GetSceneMgr()->GetScene(navigation->getSceneID());
01925        const SceneNode * camNode = scene->GetNode(cameraID);
01926        Camera * camera = (Camera *)(const_cast<SceneNode *>(camNode));
01927 
01928        navigation->mouseDelta = wxPoint(evt.GetPosition().x - navigation->lastPos.x, evt.GetPosition().y - navigation->lastPos.y);
01929 
01930        if (evt.GetEventType() == wxEVT_MOUSEWHEEL)
01931        {
01932               navigation->zoom(scene, camera, cameraID, -evt.GetWheelRotation(), navigation->zoomspeed);
01933        }
01934 
01935 
01936        if (shiftDown)
01937        {
01938               if (!axisAlignedRotateOperationStarted)
01939               {
01940                      axisAlignedRotateOperationStarted = true;
01941                      if (abs(navigation->mouseDelta.x) > abs(navigation->mouseDelta.y))
01942                      {
01943                             axisAlignedXaxis = true;
01944                      }
01945                      else
01946                      {
01947                             axisAlignedXaxis = false;
01948                      }
01949                      LOGDEBUG(wxT("axis set"));
01950               }
01951               navigation->mouseDelta = wxPoint(axisAlignedXaxis ? navigation->mouseDelta.x : 0, axisAlignedXaxis ? 0 : navigation->mouseDelta.y);
01952        }
01953        else
01954        {
01955               axisAlignedRotateOperationStarted = false;
01956        }
01957        if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
01958        {
01959               axisAlignedRotateOperationStarted = false;
01960        }
01961               
01962 
01963        if (altDown)
01964        {
01965               if (evt.Dragging() && evt.LeftIsDown())
01966               {
01967                      navigation->rotate(scene, camera, cameraID, evt.GetPosition(), navigation->mouseDelta, false, true, false);
01968               }
01969               else if (evt.Dragging() && evt.MiddleIsDown())
01970               {
01971                      navigation->pan(scene, camera, cameraID, navigation->mouseDelta, navigation->panspeed);
01972               }
01973               else if (evt.Dragging() && evt.RightIsDown())
01974               {
01975                      navigation->zoom(scene, camera, cameraID, -navigation->mouseDelta.x, navigation->zoomspeed);
01976               }
01977        }
01978        else {
01979 
01980               if (evt.LeftIsDown() && !evt.Dragging() && selectButtonIter->paramValue)
01981               {
01982                      navigation->select(scene, camera, evt);
01983               }
01984 
01985               if (flyButtonIter->paramValue)
01986               {
01987                      if (evt.Dragging() && evt.LeftIsDown())
01988                      {
01989                             navigation->turnHead(scene, camera, cameraID, navigation->mouseDelta, true);
01990                      }
01991               }
01992 
01993               if (evt.Dragging() && (evt.LeftIsDown() || evt.MiddleIsDown()))
01994               {
01995                      if (tumbleButtonIter->paramValue)
01996                      {
01997                             navigation->rotate(scene, camera, cameraID, evt.GetPosition(), navigation->mouseDelta, false, true, false);
01998                      }
01999                      else if (trackButtonIter->paramValue)
02000                      {
02001                             navigation->pan(scene, camera, cameraID, navigation->mouseDelta, navigation->panspeed);
02002                      }
02003                      else if (dollyButtonIter->paramValue)
02004                      {
02005                             navigation->zoom(scene, camera, cameraID, -navigation->mouseDelta.x, navigation->zoomspeed);
02006                      }
02007                      else if (zoomButtonIter->paramValue)
02008                      {
02009                             navigation->fovChangeOperationStarted = true;
02010 
02011                             float previousFov = navigation->fov;
02012                             navigation->fov -= navigation->mouseDelta.x;
02013                             if (navigation->fov > 180.0f)
02014                                    navigation->fov = 180.0f;
02015                             if (navigation->fov < 0.0f)
02016                                    navigation->fov = 0.0f;
02017 
02018                             wxCommandEvent camEvt = Event::GET_EVT_SCENE_CAM_PROJECTION_SET(navigation->getSceneID(), navigation->getCameraID(), 0, 0, navigation->nearPlane, navigation->farPlane, navigation->fov);
02019                             navigation->PostToKernel(camEvt, true);
02021                             if (previousFov != navigation->fov) //Event occurs only when the value changed otherwise it is discarded. If nothing changed we would be waiting 100ms which is causing an enormous lag.
02022                                    navigation->WaitForEvent(Event::EVT_SCENE_CAM_PROJECTION_CHANGED, 100, int(navigation->getSceneID()), int(navigation->getCameraID()));
02023                      }
02024                      else if (rollButtonIter->paramValue)
02025                      {
02026                             navigation->roll(scene, camera, cameraID, -navigation->mouseDelta.x, navigation->rotspeed, false);
02027                      }
02028                      else if (azimuthElevationButtonIter->paramValue)
02029                      {
02030                             navigation->rotate(scene, camera, cameraID, evt.GetPosition(), navigation->mouseDelta, false, false, false);
02031                      }
02032                      else if (yawPitchButtonIter->paramValue)
02033                      {
02034                             navigation->turnHead(scene, camera, cameraID, wxPoint(navigation->mouseDelta.x, -navigation->mouseDelta.y), true);
02035                      }
02036               }
02037               else
02038                      evt.Skip();
02039        }
02040 
02041        //update the fov param id only when the user releases the button
02042        if (navigation->fovChangeOperationStarted && !(evt.LeftIsDown() || evt.MiddleIsDown()))
02043        {
02044               navigation->fovChangeOperationStarted = false;
02045               ReadLocker rLock(*camNode);
02046               wxCommandEvent ev1 = Event::GET_EVT_PARAM_SET_DO(navigation->fovParamID, wxString::Format(wxT("%g"), ((Camera *)camNode)->GetFOV()));
02047               navigation->PostToKernel(ev1);
02048        }
02049 
02050        navigation->lastPos = evt.GetPosition();
02051 }


Member Data Documentation

C++ does not allow the embedded class to see its surrounding class, so we need this pointer.

Definition at line 301 of file navigation.h.

List of paramIDs for Maya navigation buttons.

Definition at line 304 of file navigation.h.

Convenience iterator for the Maya select button.

Definition at line 307 of file navigation.h.

Convenience iterator for the Maya tumble button.

Definition at line 309 of file navigation.h.

Convenience iterator for the Maya track button.

Definition at line 311 of file navigation.h.

Convenience iterator for the Maya dolly button.

Definition at line 313 of file navigation.h.

Convenience iterator for the Maya zoom button.

Definition at line 315 of file navigation.h.

Convenience iterator for the Maya roll button.

Definition at line 317 of file navigation.h.

Convenience iterator for the Maya azimuthElevation button.

Definition at line 319 of file navigation.h.

Convenience iterator for the Maya yawPitch button.

Definition at line 321 of file navigation.h.

Convenience iterator for the Maya fly button.

Definition at line 323 of file navigation.h.

Is the alt key being held down?

Definition at line 325 of file navigation.h.

Is the shift key being held down?

Definition at line 327 of file navigation.h.

Are we rotating around a single axis?

Definition at line 329 of file navigation.h.

True if we rotate around the x axis, false if we rotate around the y axis.

Definition at line 331 of file navigation.h.


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

Generated on Tue Mar 10 14:41:49 2009 for VRUT by  doxygen 1.5.5