VRUT::Navigation::NavigationStyleICEMSurfSpecific Class Reference

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

#include <navigation.h>

Inheritance diagram for VRUT::Navigation::NavigationStyleICEMSurfSpecific:

NavigationStyleInterface

List of all members.

Public Member Functions

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

Public Attributes

bool ctrlDown
 Is the control key down?
bool shiftDown
 Is the control key down?
bool magnifyingGlass
 Is the maginfying glass mode enabled?
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.
bool rotateOperationStarted
 This helps us determine if we should set a new rotation center.
ParameterIdentificatorList otherButtonsInfo
 List of paramIDs for ICEMSurf navigation buttons.
ParameterIdentificatorList navigationModeButtonsInfo
 List of paramIDs for ICEMSurf navigation mode buttons.
ParameterIdentificatorList centerOfRotationButtonsInfo
 List of paramIDs for ICEMSurf center of rotation buttons.
ParameterIdentificatorList::iterator zoomInButtonIter
 Convenience iterator for the ICEMSurf zoom in button.
ParameterIdentificatorList::iterator zoomOutButtonIter
 Convenience iterator for the ICEMSurf zoom out button.
ParameterIdentificatorList::iterator sideViewButtonIter
 Convenience iterator for the ICEMSurf side view button.
ParameterIdentificatorList::iterator topViewButtonIter
 Convenience iterator for the ICEMSurf top view button.
ParameterIdentificatorList::iterator frontViewButtonIter
 Convenience iterator for the ICEMSurf front view button.
ParameterIdentificatorList::iterator rearViewButtonIter
 Convenience iterator for the ICEMSurf rear view button.
ParameterIdentificatorList::iterator freeButtonIter
 Convenience iterator for the ICEMSurf free button.
ParameterIdentificatorList::iterator walkButtonIter
 Convenience iterator for the ICEMSurf walk button.
ParameterIdentificatorList::iterator flyButtonIter
 Convenience iterator for the ICEMSurf fly button.
ParameterIdentificatorList::iterator turnHeadButtonIter
 Convenience iterator for the ICEMSurf turn head button.
ParameterIdentificatorList::iterator centerOfGeometryButtonIter
 Convenience iterator for the ICEMSurf center of geometry button.
ParameterIdentificatorList::iterator dynamicButtonIter
 Convenience iterator for the ICEMSurf dynamic center of geometry button.
ParameterIdentificatorList::iterator referencePointButtonIter
 Convenience iterator for the ICEMSurf reference point center of geometry button.

Private Attributes

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


Detailed Description

Type for ICEMSurf specific variables needed for a proper emulation.

Definition at line 379 of file navigation.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 2223 of file navigation.cpp.

02224 : NavigationStyleInterface(wxT("ICEM Surf"))
02225 {
02226        this->navigation = navigation;
02227 
02228        freeButtonIter = navigationModeButtonsInfo.insert(navigationModeButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("freeICEMSurf"), _id),1)));
02229        walkButtonIter = navigationModeButtonsInfo.insert(navigationModeButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("walkICEMSurf"), _id),0)));
02230        flyButtonIter = navigationModeButtonsInfo.insert(navigationModeButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("flyICEMSurf"), _id),0)));
02231        turnHeadButtonIter = navigationModeButtonsInfo.insert(navigationModeButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("turnHeadICEMSurf"), _id),0)));
02232 
02233        zoomOutButtonIter = otherButtonsInfo.insert(otherButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("zoomOutICEMSurf"), _id),0)));
02234        zoomInButtonIter = otherButtonsInfo.insert(otherButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("zoomInICEMSurf"), _id),0)));
02235        sideViewButtonIter = otherButtonsInfo.insert(otherButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("sideViewICEMSurf"), _id),0)));
02236        topViewButtonIter = otherButtonsInfo.insert(otherButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("topViewICEMSurf"), _id),0)));
02237        frontViewButtonIter = otherButtonsInfo.insert(otherButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("frontViewICEMSurf"), _id),0)));
02238        rearViewButtonIter = otherButtonsInfo.insert(otherButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("rearViewICEMSurf"), _id),0)));
02239 
02240        centerOfGeometryButtonIter = centerOfRotationButtonsInfo.insert(centerOfRotationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("centreOfGeometryCentreOfRotationICEMSurf"), _id),0)));
02241        dynamicButtonIter = centerOfRotationButtonsInfo.insert(centerOfRotationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("dynamicCentreOfRotationICEMSurf"), _id),0)));
02242        referencePointButtonIter = centerOfRotationButtonsInfo.insert(centerOfRotationButtonsInfo.begin(), ParameterIdentificatorList::value_type(NavigationOperationPair(Parameter::ParameterIdentificator(_name, wxT("referencePointCentreOfRotationICEMSurf"), _id),1)));
02243 
02244        ctrlDown = false;
02245        shiftDown = false;
02246        magnifyingGlass = false;
02247        axisAlignedRotateOperationStarted = false;
02248        axisAlignedXaxis = false;
02249        rotateOperationStarted = false;
02250 }


Member Function Documentation

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

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

Updates the module specific registered parameters.

Implements NavigationStyleInterface.

Definition at line 435 of file navigation.h.

00435 {}

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

Register ICEMSurf buttons into gui.

Implements NavigationStyleInterface.

Definition at line 2264 of file navigation.cpp.

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

Method for handling stateless buttons.

Implements NavigationStyleInterface.

Definition at line 2271 of file navigation.cpp.

02272 {
02273        NODE_ID cameraID = navigation->getCameraID();
02274        Scene * scene = navigation->GetSceneMgr()->GetScene(navigation->getSceneID());
02275        if (!scene)
02276               return;
02277 
02278        const SceneNode * camNode = scene->GetNode(cameraID);
02279        if (!camNode || !camNode->IsOfType(SceneNode::CAMERA))
02280               return;
02281 
02282        Camera * camera = (Camera *)(const_cast<SceneNode *>(camNode));
02283        WriteLocker camLock(*camera);
02284 
02285        if (zoomInButtonIter->paramValue)
02286        {
02287               navigation->zoom(scene, camera, cameraID, 1, -navigation->zoomStep);
02288               zoomInButtonIter->paramValue = 0;
02289        }
02290        if (zoomOutButtonIter->paramValue)
02291        {
02292               navigation->zoom(scene, camera, cameraID, 1, navigation->zoomStep);
02293               zoomOutButtonIter->paramValue = 0;
02294        }
02295 
02296        if (centerOfGeometryButtonIter->paramValue)
02297        {
02298               navigation->scenePivotWasSet = false;
02299        }
02300 
02301        if (sideViewButtonIter->paramValue)
02302        {
02303               navigation->alignView(SIDE);
02304        }
02305        if (topViewButtonIter->paramValue)
02306        {
02307               navigation->alignView(TOP);
02308        }
02309        if (frontViewButtonIter->paramValue)
02310        {
02311               navigation->alignView(FRONT);
02312        }
02313        if (rearViewButtonIter->paramValue)
02314        {
02315               navigation->alignView(REAR);
02316        }
02317 }

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

ICEMSurf key style.

Implements NavigationStyleInterface.

Definition at line 2319 of file navigation.cpp.

02320 {
02321        if (int(navigation->windowID) == evt.GetId() && evt.GetEventType() == wxEVT_KEY_DOWN)
02322        {
02323               switch (evt.GetKeyCode())
02324               {
02325               case WXK_CONTROL:
02326                      {
02327                             ctrlDown = true;
02328                             
02329                      }
02330                      break;
02331               case WXK_SHIFT:
02332                      {
02333                             if (ctrlDown && !shiftDown)
02334                             {
02335                                    magnifyingGlass = true;
02336                                    LOGDEBUG(wxT("Magnifying glass enabled"));
02337                             }
02338                             shiftDown = true;
02339                      }
02340                      break;
02341               }
02342        }
02343        else if (int(navigation->windowID) == evt.GetId() && evt.GetEventType() == wxEVT_KEY_UP)
02344        {
02345               switch (evt.GetKeyCode())
02346               {
02347               case WXK_CONTROL:
02348                      {
02349                             ctrlDown = false;
02350                             magnifyingGlass = false;
02351                      }
02352                      break;
02353               case WXK_SHIFT:
02354                      {
02355                             shiftDown = false;
02356                             magnifyingGlass = false;
02357                      }
02358                      break;
02359               }
02360        }
02361 }

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

ICEMSurf mouse style.

Try to sync with kernel so no redundant param updates occur

Implements NavigationStyleInterface.

Definition at line 2388 of file navigation.cpp.

02389 {
02390        NODE_ID cameraID = navigation->getCameraID();
02391        Scene * scene = navigation->GetSceneMgr()->GetScene(navigation->getSceneID());
02392        const SceneNode * camNode = scene->GetNode(cameraID);
02393        Camera * camera = (Camera *)(const_cast<SceneNode *>(camNode));
02394 
02395        //selectionClick(evt, scene, camera);
02396 
02397        navigation->mouseDelta = wxPoint(evt.GetPosition().x - navigation->lastPos.x, evt.GetPosition().y - navigation->lastPos.y);
02398 
02399        if (evt.GetEventType() == wxEVT_MOUSEWHEEL)
02400        {
02401               navigation->zoom(scene, camera, cameraID, -evt.GetWheelRotation(), navigation->zoomspeed);
02402        }
02403 
02404        if (shiftDown && ctrlDown && !magnifyingGlass && evt.Dragging())
02405        {
02406               if (!axisAlignedRotateOperationStarted)
02407               {
02408                      axisAlignedRotateOperationStarted = true;
02409                      if (abs(navigation->mouseDelta.x) > abs(navigation->mouseDelta.y))
02410                      {
02411                             axisAlignedXaxis = true;
02412                      }
02413                      else
02414                      {
02415                             axisAlignedXaxis = false;
02416                      }
02417                      LOGDEBUG(wxT("axis set"));
02418               }
02419               navigation->mouseDelta = wxPoint(axisAlignedXaxis ? navigation->mouseDelta.x : 0, axisAlignedXaxis ? 0 : navigation->mouseDelta.y);
02420        }
02421        else
02422        {
02423               axisAlignedRotateOperationStarted = false;
02424        }
02425 
02426        if (shiftDown && !magnifyingGlass)
02427        {
02428               if (evt.Dragging())
02429               {
02430                      if (evt.LeftIsDown())
02431                      {
02432                             if (turnHeadButtonIter->paramValue)
02433                             {
02434                                    navigation->turnHead(scene, camera, cameraID, navigation->mouseDelta, true);
02435                             }
02436                             else
02437                             {
02438                                    if (!rotateOperationStarted && dynamicButtonIter->paramValue)
02439                                    {
02440                                           LOGDEBUG(wxT("Scene pivot pick"));
02441                                           rotateOperationStarted = true;
02442                                           navigation->pickScenePivot(scene, camera, cameraID, evt);
02443                                    }
02444                                    bool rotateAroundScenePivot = (centerOfGeometryButtonIter->paramValue || dynamicButtonIter->paramValue) ? true : false;
02445                                    navigation->rotate(scene, camera, cameraID, evt.GetPosition(), wxPoint(navigation->mouseDelta.x, walkButtonIter->paramValue ? 0 : navigation->mouseDelta.y), false, walkButtonIter->paramValue ? true : false, rotateAroundScenePivot);
02446                             }
02447                      }
02448                      else if (evt.MiddleIsDown())
02449                      {
02450                             navigation->pan(scene, camera, cameraID, navigation->mouseDelta, navigation->panspeed);
02451                      }
02452                      else if (evt.RightIsDown())
02453                      {
02454                             if (freeButtonIter->paramValue || turnHeadButtonIter->paramValue)
02455                             {
02456                                    navigation->fovChangeOperationStarted = true;
02457 
02458                                    float previousFov = navigation->fov;
02459                                    navigation->fov -= navigation->mouseDelta.x;
02460                                    if (navigation->fov > 180.0f)
02461                                           navigation->fov = 180.0f;
02462                                    if (navigation->fov < 0.0f)
02463                                           navigation->fov = 0.0f;
02464 
02465                                    wxCommandEvent camEvt = Event::GET_EVT_SCENE_CAM_PROJECTION_SET(navigation->getSceneID(), navigation->getCameraID(), 0, 0, navigation->nearPlane, navigation->farPlane, navigation->fov);
02466                                    navigation->PostToKernel(camEvt, true);
02468                                    if (previousFov != navigation->fov)
02469                                           navigation->WaitForEvent(Event::EVT_SCENE_CAM_PROJECTION_CHANGED, 100, int(navigation->getSceneID()), int(navigation->getCameraID()));
02470                             }
02471                             else if (walkButtonIter->paramValue || flyButtonIter->paramValue)
02472                             {
02473                                    navigation->zoom(scene, camera, cameraID, navigation->mouseDelta.y, navigation->zoomspeed);
02474                             }
02475                      }
02476               }
02477               else {
02478                      rotateOperationStarted = false;
02479               }
02480        }
02481        else
02482               evt.Skip();
02483 
02484        //update the fov param id only when the user releases the button
02485        if (navigation->fovChangeOperationStarted && !evt.RightIsDown())
02486        {
02487               navigation->fovChangeOperationStarted = false;
02488               ReadLocker rLock(*camNode);
02489               wxCommandEvent ev1 = Event::GET_EVT_PARAM_SET_DO(navigation->fovParamID, wxString::Format(wxT("%g"), ((Camera *)camNode)->GetFOV()));
02490               navigation->PostToKernel(ev1);
02491        }
02492 
02493        navigation->lastPos = evt.GetPosition();
02494 }


Member Data Documentation

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

Definition at line 382 of file navigation.h.

Is the control key down?

Definition at line 385 of file navigation.h.

Is the control key down?

Definition at line 387 of file navigation.h.

Is the maginfying glass mode enabled?

Definition at line 389 of file navigation.h.

Are we rotating around a single axis?

Definition at line 391 of file navigation.h.

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

Definition at line 393 of file navigation.h.

This helps us determine if we should set a new rotation center.

Definition at line 395 of file navigation.h.

List of paramIDs for ICEMSurf navigation buttons.

Definition at line 398 of file navigation.h.

List of paramIDs for ICEMSurf navigation mode buttons.

Definition at line 400 of file navigation.h.

List of paramIDs for ICEMSurf center of rotation buttons.

Definition at line 402 of file navigation.h.

Convenience iterator for the ICEMSurf zoom in button.

Definition at line 405 of file navigation.h.

Convenience iterator for the ICEMSurf zoom out button.

Definition at line 407 of file navigation.h.

Convenience iterator for the ICEMSurf side view button.

Definition at line 409 of file navigation.h.

Convenience iterator for the ICEMSurf top view button.

Definition at line 411 of file navigation.h.

Convenience iterator for the ICEMSurf front view button.

Definition at line 413 of file navigation.h.

Convenience iterator for the ICEMSurf rear view button.

Definition at line 415 of file navigation.h.

Convenience iterator for the ICEMSurf free button.

Definition at line 417 of file navigation.h.

Convenience iterator for the ICEMSurf walk button.

Definition at line 419 of file navigation.h.

Convenience iterator for the ICEMSurf fly button.

Definition at line 421 of file navigation.h.

Convenience iterator for the ICEMSurf turn head button.

Definition at line 423 of file navigation.h.

Convenience iterator for the ICEMSurf center of geometry button.

Definition at line 425 of file navigation.h.

Convenience iterator for the ICEMSurf dynamic center of geometry button.

Definition at line 427 of file navigation.h.

Convenience iterator for the ICEMSurf reference point center of geometry button.

Definition at line 429 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