Dali 3D User Interface Engine
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Dali::Internal::PanGestureProcessor Class Reference

Pan Gesture Event Processing: More...

#include <pan-gesture-processor.h>

Inheritance diagram for Dali::Internal::PanGestureProcessor:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::PanGestureProcessor:
Collaboration graph
[legend]

Public Member Functions

 PanGestureProcessor (Stage &stage, Integration::GestureManager &gestureManager)
 Create a pan gesture processor. More...
 
 ~PanGestureProcessor ()
 Non-virtual destructor; PanGestureProcessor is not a base class. More...
 
void Process (const Integration::PanGestureEvent &panEvent)
 This method is called whenever a pan gesture event occurs. More...
 
void AddGestureDetector (PanGestureDetector *gestureDetector)
 Adds a gesture detector to this gesture processor. More...
 
void RemoveGestureDetector (PanGestureDetector *gestureDetector)
 Removes the specified gesture detector from this gesture processor. More...
 
void GestureDetectorUpdated (PanGestureDetector *gestureDetector)
 This method updates the gesture detection parameters. More...
 
void SetPanGestureProperties (const PanGesture &pan)
 Sets the pan gesture properties stored in the scene object directly,. More...
 
void EnableProfiling ()
 Called to provide pan-gesture profiling information. More...
 
void SetPredictionMode (int mode)
 Called to set the prediction mode for pan gestures. More...
 
void SetPredictionAmount (unsigned int amount)
 Sets the prediction amount of the pan gesture. More...
 
void SetMaximumPredictionAmount (unsigned int amount)
 Sets the upper bound of the prediction amount for clamping. More...
 
void SetMinimumPredictionAmount (unsigned int amount)
 Sets the lower bound of the prediction amount for clamping. More...
 
void SetPredictionAmountAdjustment (unsigned int amount)
 Sets the amount of prediction interpolation to adjust when the pan velocity is changed. More...
 
void SetSmoothingMode (int mode)
 Called to set the prediction mode for pan gestures. More...
 
void SetSmoothingAmount (float amount)
 Sets the smoothing amount of the pan gesture. More...
 

Private Member Functions

 PanGestureProcessor (const PanGestureProcessor &)
 
PanGestureProcessoroperator= (const PanGestureProcessor &rhs)
 
void UpdateDetection ()
 Iterates through our GestureDetectors and determines if we need to ask the adaptor to update its detection policy. More...
 
void EmitPanSignal (Actor *actor, const GestureDetectorContainer &gestureDetectors, const Integration::PanGestureEvent &panEvent, Vector2 localCurrent, Gesture::State state, Dali::RenderTask renderTask)
 Creates a PanGesture and asks the specified detector to emit its detected signal. More...
 
void OnGesturedActorStageDisconnection ()
 Called when the gestured actor is removed from the stage. More...
 
bool CheckGestureDetector (GestureDetector *detector, Actor *actor)
 Called by the ProcessAndEmit() & GetGesturedActor() methods to check if the provided gesture-detector meets the parameters of the current gesture. More...
 
void EmitGestureSignal (Actor *actor, const GestureDetectorContainer &gestureDetectors, Vector2 actorCoordinates)
 Called by the ProcessAndEmit() method when the gesture meets all applicable criteria and should be overridden by deriving classes to emit the gesture signal on gesture-detectors provided for the actor the gesture has occurred on. More...
 

Private Attributes

StagemStage
 
Integration::GestureManagermGestureManager
 
PanGestureDetectorContainer mGestureDetectors
 
GestureDetectorContainer mCurrentPanEmitters
 
Dali::RenderTask mCurrentRenderTask
 
Vector2 mPossiblePanPosition
 
unsigned int mMinTouchesRequired
 
unsigned int mMaxTouchesRequired
 
Vector2 mLastVelocity
 The last recorded velocity in local actor coordinates. More...
 
Vector2 mLastScreenVelocity
 The last recorded velocity in screen coordinates. More...
 
const
Integration::PanGestureEvent * 
mCurrentPanEvent
 Pointer to current PanEvent, used when calling ProcessAndEmit() More...
 
SceneGraph::PanGesturemSceneObject
 Not owned, but we write to it directly. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Dali::Internal::GestureProcessor
 GestureProcessor (Gesture::Type type)
 Protected constructor. More...
 
virtual ~GestureProcessor ()
 Virtual protected destructor. More...
 
void GetGesturedActor (Actor *&actor, GestureDetectorContainer &gestureDetectors)
 Given the hit actor, this walks up the actor tree to determine the actor that is connected to one (or several) gesture detectors. More...
 
void ProcessAndEmit (HitTestAlgorithm::Results &hitTestResults)
 Calls the emission method in the deriving class for matching gesture-detectors with the hit-actor (or one of its parents). More...
 
virtual bool HitTest (Stage &stage, Vector2 screenCoordinates, HitTestAlgorithm::Results &hitTestResults)
 Hit test the screen coordinates, and place the results in hitTestResults. More...
 
void SetActor (Actor *actor)
 Sets the mCurrentGesturedActor and connects to the required signals. More...
 
void ResetActor ()
 Resets the set actor and disconnects any connected signals. More...
 
ActorGetCurrentGesturedActor ()
 Returns the current gestured actor if it is on stage. More...
 

Detailed Description

Pan Gesture Event Processing:

When we receive a pan gesture event, we do the following:

The above is only checked when our gesture starts. We continue sending the pan gesture to the same actor and detector until the pan ends or is cancelled.

Definition at line 56 of file pan-gesture-processor.h.

Constructor & Destructor Documentation

Dali::Internal::PanGestureProcessor::PanGestureProcessor ( Stage stage,
Integration::GestureManager gestureManager 
)

Create a pan gesture processor.

Parameters
[in]stageThe stage.
[in]gestureManagerThe gesture manager

Definition at line 104 of file pan-gesture-processor.cpp.

References Dali::Internal::SceneGraph::AddGestureMessage(), Dali::Internal::Stage::GetUpdateManager(), mSceneObject, and mStage.

Here is the call graph for this function:

Dali::Internal::PanGestureProcessor::~PanGestureProcessor ( )

Non-virtual destructor; PanGestureProcessor is not a base class.

Definition at line 121 of file pan-gesture-processor.cpp.

References Dali::Internal::Stage::GetUpdateManager(), Dali::Internal::Stage::IsInstalled(), mSceneObject, mStage, and Dali::Internal::SceneGraph::RemoveGestureMessage().

Here is the call graph for this function:

Dali::Internal::PanGestureProcessor::PanGestureProcessor ( const PanGestureProcessor )
private

Member Function Documentation

void Dali::Internal::PanGestureProcessor::AddGestureDetector ( PanGestureDetector gestureDetector)

Adds a gesture detector to this gesture processor.

If this is the first gesture detector being added, then this method registers the required gesture with the adaptor.

Parameters
[in]gestureDetectorThe gesture detector being added.

Definition at line 237 of file pan-gesture-processor.cpp.

References Dali::Internal::PanGestureDetector::GetMaximumTouchesRequired(), Dali::Internal::PanGestureDetector::GetMinimumTouchesRequired(), mGestureDetectors, mGestureManager, mMaxTouchesRequired, mMinTouchesRequired, mSceneObject, Dali::Integration::GestureManager::Register(), Dali::Internal::PanGestureDetector::SetSceneObject(), and UpdateDetection().

Referenced by Dali::Internal::GestureEventProcessor::AddGestureDetector().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Dali::Internal::PanGestureProcessor::CheckGestureDetector ( GestureDetector detector,
Actor actor 
)
privatevirtual

Called by the ProcessAndEmit() & GetGesturedActor() methods to check if the provided gesture-detector meets the parameters of the current gesture.

Parameters
[in]detectorThe gesture detector to check.
[in]actorThe actor that has been gestured.
Returns
true, if the detector meets the parameters, false otherwise.

Implements Dali::Internal::GestureProcessor.

Definition at line 480 of file pan-gesture-processor.cpp.

References Dali::Internal::PanGestureDetector::CheckAngleAllowed(), DALI_ASSERT_DEBUG, Dali::GetImplementation(), Dali::Internal::PanGestureDetector::GetMaximumTouchesRequired(), Dali::Internal::PanGestureDetector::GetMinimumTouchesRequired(), mCurrentPanEvent, mCurrentRenderTask, mPossiblePanPosition, Dali::Math::PI, Dali::Radian::radian, Dali::Internal::PanGestureDetector::RequiresDirectionalPan(), Dali::Internal::Actor::ScreenToLocal(), Dali::Vector2::x, and Dali::Vector2::y.

Here is the call graph for this function:

void Dali::Internal::PanGestureProcessor::EmitGestureSignal ( Actor actor,
const GestureDetectorContainer gestureDetectors,
Vector2  actorCoordinates 
)
privatevirtual

Called by the ProcessAndEmit() method when the gesture meets all applicable criteria and should be overridden by deriving classes to emit the gesture signal on gesture-detectors provided for the actor the gesture has occurred on.

Parameters
[in]actorThe actor which has been gestured.
[in]gestureDetectorsThe detectors that should emit the signal.
[in]actorCoordinatesThe local actor coordinates where the gesture took place.

Implements Dali::Internal::GestureProcessor.

Definition at line 550 of file pan-gesture-processor.cpp.

References DALI_ASSERT_DEBUG, EmitPanSignal(), Dali::GetImplementation(), mCurrentPanEmitters, mCurrentPanEvent, mCurrentRenderTask, Dali::Internal::Actor::OnStage(), Dali::Internal::GestureProcessor::ResetActor(), Dali::Internal::Actor::ScreenToLocal(), Dali::Internal::GestureProcessor::SetActor(), Dali::Vector2::x, and Dali::Vector2::y.

Here is the call graph for this function:

void Dali::Internal::PanGestureProcessor::EmitPanSignal ( Actor actor,
const GestureDetectorContainer gestureDetectors,
const Integration::PanGestureEvent &  panEvent,
Vector2  localCurrent,
Gesture::State  state,
Dali::RenderTask  renderTask 
)
private

Creates a PanGesture and asks the specified detector to emit its detected signal.

Parameters
[in]actorThe actor that has been panned.
[in]gestureDetectorsThe gesture detector container that should emit the signal.
[in]panEventThe panEvent received from the adaptor.
[in]localCurrentCurrent position relative to the actor attached to the detector.
[in]stateThe state of the gesture.
[in]renderTaskThe renderTask to use.

Definition at line 404 of file pan-gesture-processor.cpp.

References Dali::Internal::SceneGraph::PanGesture::AddGesture(), Dali::PanGesture::displacement, Dali::Internal::PanGestureDetector::EmitPanGestureSignal(), Dali::Gesture::Finished, Dali::GetImplementation(), Dali::Internal::anonymous_namespace{pan-gesture-processor.cpp}::MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY(), mLastScreenVelocity, mLastVelocity, mPossiblePanPosition, mSceneObject, Dali::PanGesture::numberOfTouches, Dali::PanGesture::position, Dali::PanGesture::screenDisplacement, Dali::PanGesture::screenPosition, Dali::Internal::Actor::ScreenToLocal(), Dali::PanGesture::screenVelocity, Dali::Gesture::Started, Dali::Gesture::time, Dali::PanGesture::velocity, Dali::Vector2::x, Dali::Vector2::y, and Dali::Vector2::ZERO.

Referenced by EmitGestureSignal(), and Process().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::EnableProfiling ( )

Called to provide pan-gesture profiling information.

Definition at line 313 of file pan-gesture-processor.cpp.

References Dali::Internal::SceneGraph::PanGesture::EnableProfiling(), and mSceneObject.

Referenced by Dali::Internal::GestureEventProcessor::EnablePanGestureProfiling().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::GestureDetectorUpdated ( PanGestureDetector gestureDetector)

This method updates the gesture detection parameters.

Parameters
[in]gestureDetectorThe gesture detector that has been updated.

Definition at line 295 of file pan-gesture-processor.cpp.

References DALI_ASSERT_DEBUG, mGestureDetectors, and UpdateDetection().

Referenced by Dali::Internal::GestureEventProcessor::GestureDetectorUpdated().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::OnGesturedActorStageDisconnection ( )
privatevirtual

Called when the gestured actor is removed from the stage.

Implements Dali::Internal::GestureProcessor.

Definition at line 475 of file pan-gesture-processor.cpp.

References mCurrentPanEmitters.

PanGestureProcessor& Dali::Internal::PanGestureProcessor::operator= ( const PanGestureProcessor rhs)
private
void Dali::Internal::PanGestureProcessor::Process ( const Integration::PanGestureEvent &  panEvent)
void Dali::Internal::PanGestureProcessor::RemoveGestureDetector ( PanGestureDetector gestureDetector)

Removes the specified gesture detector from this gesture processor.

If, after removing this gesture detector, there are no more gesture detectors registered, then this method unregisters the gesture from the adaptor.

Parameters
[in]gestureDetectorThe gesture detector being removed.

Definition at line 262 of file pan-gesture-processor.cpp.

References DALI_ASSERT_DEBUG, mCurrentPanEmitters, mGestureDetectors, mGestureManager, Dali::Gesture::Pan, Dali::Internal::GestureProcessor::ResetActor(), Dali::Integration::GestureManager::Unregister(), and UpdateDetection().

Referenced by Dali::Internal::GestureEventProcessor::RemoveGestureDetector().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetMaximumPredictionAmount ( unsigned int  amount)

Sets the upper bound of the prediction amount for clamping.

Parameters
[in]amountThe prediction amount in milliseconds

Definition at line 334 of file pan-gesture-processor.cpp.

References mSceneObject, and Dali::Internal::SceneGraph::PanGesture::SetMaximumPredictionAmount().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGestureMaximumPredictionAmount().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetMinimumPredictionAmount ( unsigned int  amount)

Sets the lower bound of the prediction amount for clamping.

Parameters
[in]amountThe prediction amount in milliseconds

Definition at line 339 of file pan-gesture-processor.cpp.

References mSceneObject, and Dali::Internal::SceneGraph::PanGesture::SetMinimumPredictionAmount().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGestureMinimumPredictionAmount().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetPanGestureProperties ( const PanGesture pan)

Sets the pan gesture properties stored in the scene object directly,.

Parameters
[in]panThe pan gesture to override the properties with.
Note
If we are already processing a normal pan, then this call is ignored.

Definition at line 302 of file pan-gesture-processor.cpp.

References Dali::Internal::SceneGraph::PanGesture::AddGesture(), mCurrentPanEmitters, and mSceneObject.

Referenced by Dali::Internal::GestureEventProcessor::SetGestureProperties().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetPredictionAmount ( unsigned int  amount)

Sets the prediction amount of the pan gesture.

Parameters
[in]amountThe prediction amount in milliseconds

Definition at line 329 of file pan-gesture-processor.cpp.

References mSceneObject, and Dali::Internal::SceneGraph::PanGesture::SetPredictionAmount().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGesturePredictionAmount().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetPredictionAmountAdjustment ( unsigned int  amount)

Sets the amount of prediction interpolation to adjust when the pan velocity is changed.

Parameters
[in]amountThe prediction amount in milliseconds

Definition at line 344 of file pan-gesture-processor.cpp.

References mSceneObject, and Dali::Internal::SceneGraph::PanGesture::SetPredictionAmountAdjustment().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGesturePredictionAmountAdjustment().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetPredictionMode ( int  mode)

Called to set the prediction mode for pan gestures.

Parameters
[in]modeThe prediction mode

Valid modes: 0 - No prediction 1 - Prediction using average acceleration

Definition at line 318 of file pan-gesture-processor.cpp.

References Dali::Internal::SceneGraph::PanGesture::DEFAULT_PREDICTION_MODE, mSceneObject, Dali::Internal::SceneGraph::PanGesture::NUM_PREDICTION_MODES, and Dali::Internal::SceneGraph::PanGesture::SetPredictionMode().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGesturePredictionMode().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetSmoothingAmount ( float  amount)

Sets the smoothing amount of the pan gesture.

Parameters
[in]amountThe smotthing amount from 0.0f (none) to 1.0f (full)

Definition at line 360 of file pan-gesture-processor.cpp.

References mSceneObject, and Dali::Internal::SceneGraph::PanGesture::SetSmoothingAmount().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGestureSmoothingAmount().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::SetSmoothingMode ( int  mode)

Called to set the prediction mode for pan gestures.

Parameters
[in]modeThe prediction mode

Valid modes: 0 - No smoothing 1 - average between last 2 values

Definition at line 349 of file pan-gesture-processor.cpp.

References Dali::Internal::SceneGraph::PanGesture::DEFAULT_SMOOTHING_MODE, mSceneObject, Dali::Internal::SceneGraph::PanGesture::NUM_SMOOTHING_MODES, and Dali::Internal::SceneGraph::PanGesture::SetSmoothingMode().

Referenced by Dali::Internal::GestureEventProcessor::SetPanGestureSmoothingMode().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::PanGestureProcessor::UpdateDetection ( )
private

Iterates through our GestureDetectors and determines if we need to ask the adaptor to update its detection policy.

If it does, it sends the appropriate gesture update request to adaptor.

Definition at line 365 of file pan-gesture-processor.cpp.

References DALI_ASSERT_DEBUG, Dali::Internal::PanGestureDetector::GetMaximumTouchesRequired(), Dali::Internal::PanGestureDetector::GetMinimumTouchesRequired(), mGestureDetectors, mGestureManager, mMaxTouchesRequired, mMinTouchesRequired, and Dali::Integration::GestureManager::Update().

Referenced by AddGestureDetector(), GestureDetectorUpdated(), and RemoveGestureDetector().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

GestureDetectorContainer Dali::Internal::PanGestureProcessor::mCurrentPanEmitters
private
const Integration::PanGestureEvent* Dali::Internal::PanGestureProcessor::mCurrentPanEvent
private

Pointer to current PanEvent, used when calling ProcessAndEmit()

Definition at line 231 of file pan-gesture-processor.h.

Referenced by CheckGestureDetector(), EmitGestureSignal(), and Process().

Dali::RenderTask Dali::Internal::PanGestureProcessor::mCurrentRenderTask
private

Definition at line 222 of file pan-gesture-processor.h.

Referenced by CheckGestureDetector(), EmitGestureSignal(), and Process().

PanGestureDetectorContainer Dali::Internal::PanGestureProcessor::mGestureDetectors
private
Integration::GestureManager& Dali::Internal::PanGestureProcessor::mGestureManager
private
Vector2 Dali::Internal::PanGestureProcessor::mLastScreenVelocity
private

The last recorded velocity in screen coordinates.

Definition at line 229 of file pan-gesture-processor.h.

Referenced by EmitPanSignal().

Vector2 Dali::Internal::PanGestureProcessor::mLastVelocity
private

The last recorded velocity in local actor coordinates.

Definition at line 228 of file pan-gesture-processor.h.

Referenced by EmitPanSignal().

unsigned int Dali::Internal::PanGestureProcessor::mMaxTouchesRequired
private

Definition at line 226 of file pan-gesture-processor.h.

Referenced by AddGestureDetector(), and UpdateDetection().

unsigned int Dali::Internal::PanGestureProcessor::mMinTouchesRequired
private

Definition at line 225 of file pan-gesture-processor.h.

Referenced by AddGestureDetector(), and UpdateDetection().

Vector2 Dali::Internal::PanGestureProcessor::mPossiblePanPosition
private

Definition at line 223 of file pan-gesture-processor.h.

Referenced by CheckGestureDetector(), EmitPanSignal(), and Process().

SceneGraph::PanGesture* Dali::Internal::PanGestureProcessor::mSceneObject
private
Stage& Dali::Internal::PanGestureProcessor::mStage
private

Definition at line 218 of file pan-gesture-processor.h.

Referenced by PanGestureProcessor(), Process(), and ~PanGestureProcessor().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali