VisioDevKit-Sample
v2.0
|
Controls the camera & the Layer display. More...
Public Types | |
enum | VgMyConfigurableParam { eFarAwayHeight, eStackViewHeading, eStackViewPitch, eLayerMaxSize, eStackViewDistance, eLayerDistance, eLayerDistanceFromCurrent, eAnimateToDetailCameraDuration, eAnimateToGlobalCameraDuration, eAnimateToGlobalLayerDuration, eAnimateToDetailLayerDuration, eAnimateChangeOfLayerDuration, eAnimateCancelPinchDuration, eAnimateCancelDragDuration, eAnimateMaxViewPointDuration, eChangeLayerTriggerThreshold, eStackNonActiveLayerAngle, eStackActiveLayerAngle, eMaxDoubleParams } |
The below enum represents parameters that can be configured to change the behaviour of the VgMyStackedLayerAndCameraHandler object. More... | |
enum | eFromToViewEnum { eFromStackToDetailedView, eFromDetailedToStackView, eFromGlobalToGlobaView } |
typedef enum VgMyStackedLayerAndCameraHandler::VgMyConfigurableParam | VgMyConfigurableParam |
The below enum represents parameters that can be configured to change the behaviour of the VgMyStackedLayerAndCameraHandler object. More... | |
Public Member Functions | |
VgMyStackedLayerAndCameraHandler (VgApplication::VgIApplication *pVgApplication, VgMyLayerAndCameraListener *pListener, unsigned int pViewWidthInPixels, unsigned int pViewHeightInPixels) | |
virtual | ~VgMyStackedLayerAndCameraHandler () |
bool | isGlobalView () |
void | switchToGlobalView (bool pIsAnimated=true) |
Switches from the detailledView to the global view. More... | |
void | switchToDetailedView (bool pIsAnimated=true) |
Switches from the global to the detailled view. More... | |
const std::string & | getFocusedLayerName () |
Gets the focused layer's name. More... | |
void | gotoLayer (const std::string &pLayerName, bool pIsAnimated=true) |
Focus a specific layer. More... | |
unsigned int | getNumberOfLayers () |
Returns the number of layers. More... | |
bool | getLayerName (const unsigned int pLayerIndex, std::string &pLayerNameOut) |
Returns the layer name for a given indes. More... | |
void | gotoLayer (const unsigned int pLayerIndex, bool pIsAnimated=true) |
Focus a specific layer. More... | |
void | gotoViewpoint (const VgEngine::VgIViewPoint &pViewpoint, const std::string &pLayerName, bool pIsAnimated=true) |
Moves the camera to a specific view point. More... | |
void | gotoLookAtPosition (const VgEngine::VgPosition &pPosition, const std::string &pLayerName, bool pIsAnimated=true) |
Moves the camera so that it is focused on a given position. More... | |
void | refreshParameters (unsigned int pWidth, unsigned int pHeight) |
Refreshes the inner parameters. More... | |
unsigned int | getCurrentLayerIndex () const |
VgEngine::VgPosition * | getCameraPosition () |
void | onLayerSelected () |
void | onSelectorReady () |
void | animateCameraToViewPoint (const VgEngine::VgIViewPoint &pViewPoint, float pDuration, bool pIsAnimated) |
void | animateLayersFromCloseToStackView (eFromToViewEnum pDirection, float pDuration, bool pIsAnimated) |
VgEngine::VgPosition | getPositionForLayerInGlobalView (unsigned int pLayerIndex, unsigned int pFocusedLayer) |
Gets the position for a layer when in global view. More... | |
VgEngine::VgPosition | getPositionForLayerInDetailedView (unsigned int pLayerIndex, unsigned int pFocusedLayer) |
Gets the position for a layer when in detailed view. More... | |
void | animateLayerToPositionAndRotation (VgEngine::VgRefPtr< VgEngine::VgLayer >const &pLayer, const VgEngine::VgPosition &pStartPos, const VgEngine::VgPosition &pEndPos, VgEngine::VgRefPtr< VgEngine::VgIAnimationCallback >const &pCallback, float pDuration, float pStartAngle, float pEndAngle) |
Gets the position for a layer when in detailed view. More... | |
VgEngine::VgIViewPoint & | getStackViewPoint () |
void | setStackCenterPosition (const VgEngine::VgPosition &pCenter) |
Sets the stack center position. More... | |
const VgEngine::VgPosition & | getStackCenter () |
Get the stack center. More... | |
void | refreshStackView () |
Force the global stack view to redraw it self. More... | |
void | setParam (const VgMyConfigurableParam pParam, const double pDouble) |
Allows application to customise the look and feel of the VgMyStackedLayerAndCameraHandler. More... | |
double | getParam (const VgMyConfigurableParam pParam) |
Retrieve a parameter value. More... | |
void | updateManipulatorForGlobalView (bool pIsGlobalView) |
Updates the manipulator, according to the stack state. More... | |
Static Public Member Functions | |
static double | computeAngularDistance (double pA, double pB) |
Computes the angular distance between two angle values in degrees. More... | |
Protected Member Functions | |
VgEngine::VgRefPtr < VgEngine::VgIAnimationCallback > | registerCallback (VgEngine::VgRefPtr< VgEngine::VgIAnimationCallback > pCallback, unsigned int pLayerIndex) |
void | setDefaultStackParams () |
void | calculateDynamicStackParams () |
void | gotoLayerInGlobalView (const unsigned int pLayerIndex, bool pIsAnimated) |
void | gotoLayerInDetailedView (const unsigned int pLayerIndex, bool pIsAnimated) |
Protected Attributes | |
bool | mUsePinchToSwitchGlobalToDetailed |
VgApplication::VgIApplication * | mVgApplication |
VgMyLayerAndCameraListener * | mLayerUpdateListener |
unsigned int | mCurrentLayerIndex |
unsigned int | mPreviousLayerIndex |
bool | mIsLayerStackDisplayed |
bool | mIsViewModeInitialized |
VgEngine::VgIViewPoint | mCamStartViewPoint |
double | mParam [eMaxDoubleParams] |
VgEngine::VgPosition | mStackCenter |
VgEngine::VgIViewPoint | mCameraGlobalViewPoint |
VgEngine::VgRefPtr < VgEngine::VgIAnimationCallback > | mCameraCallback |
std::vector < VgEngine::VgRefPtr < VgEngine::VgIAnimationCallback > > | mLayersCallback |
VgEngine::VgRefPtr < FloorSelectorManipulator > | mManipulatorListener |
std::hash_map< std::string, float > | mLODsFactors |
std::hash_map< std::string, float > | mLoadFactors |
Controls the camera & the Layer display.
This helper simplifies the management of the camera wihtin a stack of layer. This layers are usually floors.
IMPLEMENTATION TIPS: This is an advanced class. You can customize it at will to change its behavior or get some inspiration to build other eye-candy display & behavior for your layers (carousel for example) This would require knowledge in 3D mathematics.
typedef enum VgMyStackedLayerAndCameraHandler::VgMyConfigurableParam VgMyStackedLayerAndCameraHandler::VgMyConfigurableParam |
The below enum represents parameters that can be configured to change the behaviour of the VgMyStackedLayerAndCameraHandler object.
The below enum represents parameters that can be configured to change the behaviour of the VgMyStackedLayerAndCameraHandler object.
VgMyStackedLayerAndCameraHandler::VgMyStackedLayerAndCameraHandler | ( | VgApplication::VgIApplication * | pVgApplication, |
VgMyLayerAndCameraListener * | pListener, | ||
unsigned int | pViewWidthInPixels, | ||
unsigned int | pViewHeightInPixels | ||
) |
|
virtual |
void VgMyStackedLayerAndCameraHandler::animateCameraToViewPoint | ( | const VgEngine::VgIViewPoint & | pViewPoint, |
float | pDuration, | ||
bool | pIsAnimated | ||
) |
void VgMyStackedLayerAndCameraHandler::animateLayersFromCloseToStackView | ( | eFromToViewEnum | pDirection, |
float | pDuration, | ||
bool | pIsAnimated | ||
) |
void VgMyStackedLayerAndCameraHandler::animateLayerToPositionAndRotation | ( | VgEngine::VgRefPtr< VgEngine::VgLayer >const & | pLayer, |
const VgEngine::VgPosition & | pStartPos, | ||
const VgEngine::VgPosition & | pEndPos, | ||
VgEngine::VgRefPtr< VgEngine::VgIAnimationCallback >const & | pCallback, | ||
float | pDuration, | ||
float | pStartAngle, | ||
float | pEndAngle | ||
) |
Gets the position for a layer when in detailed view.
pLayer | pointer to layer to manipulate |
pStartPos | starting position of layer. If not the same as its current position it will jump. |
pEndPos | ending position of layer. |
pCallback | callback at end of animation. |
pDuration | duration of animation in seconds. |
pStartAngle | start angle of layer, used for carrousel mode, otherwise use 0.0f |
pEndAngle | start angle of layer, used for carrousel mode, otherwise use 0.0f |
|
protected |
|
static |
Computes the angular distance between two angle values in degrees.
Takes the 360 degrees periodicity into account.
pA | The first angle (in degrees). |
pB | The second angle (in degrees). |
VgEngine::VgPosition* VgMyStackedLayerAndCameraHandler::getCameraPosition | ( | ) |
unsigned int VgMyStackedLayerAndCameraHandler::getCurrentLayerIndex | ( | ) | const |
|
virtual |
Gets the focused layer's name.
The "focused" layer is the one that is displayed in the detailled view. if the global view is displayed, the focused layer should be the most visible one.
Implements VgMyLayerAndCameraHandler.
|
virtual |
Returns the layer name for a given indes.
pLayerIndex | Layer index, should be less than getNumberOfLayers(). |
pLayerNameOut | string to set with layer name. |
Implements VgMyLayerAndCameraHandler.
|
virtual |
Returns the number of layers.
Implements VgMyLayerAndCameraHandler.
double VgMyStackedLayerAndCameraHandler::getParam | ( | const VgMyConfigurableParam | pParam | ) |
Retrieve a parameter value.
VgEngine::VgPosition VgMyStackedLayerAndCameraHandler::getPositionForLayerInDetailedView | ( | unsigned int | pLayerIndex, |
unsigned int | pFocusedLayer | ||
) |
Gets the position for a layer when in detailed view.
pLayerIndex | The index of the layer whose position is to be calculated |
pFocusedLayer | Layer The index of the layer which currently has the stacked view focus. |
VgEngine::VgPosition VgMyStackedLayerAndCameraHandler::getPositionForLayerInGlobalView | ( | unsigned int | pLayerIndex, |
unsigned int | pFocusedLayer | ||
) |
Gets the position for a layer when in global view.
pLayerIndex | The index of the layer whose position is to be calculated |
pFocusedLayer | Layer The index of the layer which currently has the stacked view focus. |
const VgEngine::VgPosition& VgMyStackedLayerAndCameraHandler::getStackCenter | ( | ) |
Get the stack center.
VgEngine::VgIViewPoint& VgMyStackedLayerAndCameraHandler::getStackViewPoint | ( | ) |
|
virtual |
Focus a specific layer.
pLayerName | Layer that will be focused. keeps current mode. |
pIsAnimated | If true then animates the transition, otherwise does not. |
Implements VgMyLayerAndCameraHandler.
|
virtual |
Focus a specific layer.
pLayerIndex | Layer index which is associated with the returned list given by VgLayerManager::getLayers(). keeps current mode. |
pIsAnimated | If true then animates the transition, otherwise does not. |
Implements VgMyLayerAndCameraHandler.
|
protected |
|
protected |
|
virtual |
Moves the camera so that it is focused on a given position.
The camera's view, heading, pitch are always conserved. The altitude of pPosition is automatically set to zero.
If the pLayerName isn't the currently focused layer, then before any camera movement is invoked, pLayerName becomes the focused layer.
pPosition | The position to focus on. |
pLayerName | The name of the layer associated with the position. |
pIsAnimated | If true then animates the transition, otherwise does not. |
Implements VgMyLayerAndCameraHandler.
|
virtual |
Moves the camera to a specific view point.
If the pLayerName isn't the currently focused layer, then before any camera movement is invoked, pLayerName becomes the focused layer.
pViewPoint | The view point to associate with the camera |
pLayerName | The layer which should be given the focus. |
pIsAnimated | If true then animates the transition, otherwise does not. |
Implements VgMyLayerAndCameraHandler.
|
virtual |
Implements VgMyLayerAndCameraHandler.
void VgMyStackedLayerAndCameraHandler::onLayerSelected | ( | ) |
void VgMyStackedLayerAndCameraHandler::onSelectorReady | ( | ) |
|
virtual |
Refreshes the inner parameters.
Typically, subclasses can use it to recompute their view parameters when the rendering size changes.
Implements VgMyLayerAndCameraHandler.
void VgMyStackedLayerAndCameraHandler::refreshStackView | ( | ) |
Force the global stack view to redraw it self.
Needs to be called after having changed any of the configurable parameters.
|
protected |
|
protected |
void VgMyStackedLayerAndCameraHandler::setParam | ( | const VgMyConfigurableParam | pParam, |
const double | pDouble | ||
) |
Allows application to customise the look and feel of the VgMyStackedLayerAndCameraHandler.
pParam | The parameter to be set. Please see the VgMyConfigurableParam type to gain an understanding of what each configurable parameter is responsible for. |
pDouble | The value to be set. |
void VgMyStackedLayerAndCameraHandler::setStackCenterPosition | ( | const VgEngine::VgPosition & | pCenter | ) |
Sets the stack center position.
The stack center position is shared by all the layer that make up the stack.
|
virtual |
Switches from the global to the detailled view.
Do nothing if alrady in detailled view.
pIsAnimated | If true then animates the transition, otherwise does not. |
Implements VgMyLayerAndCameraHandler.
|
virtual |
Switches from the detailledView to the global view.
Do nothing if already in global view.
pIsAnimated | If true then animates the transition, otherwise does not. |
Implements VgMyLayerAndCameraHandler.
void VgMyStackedLayerAndCameraHandler::updateManipulatorForGlobalView | ( | bool | pIsGlobalView | ) |
Updates the manipulator, according to the stack state.
pIsGlobalView | True if the stack state is currently the global view. False if the the stack state is detailed view. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |