qstmgesturelib/recognisers/qstmpinchgesturerecogniser.h
changeset 0 1450b09d0cfd
child 3 0954f5dd2cd0
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef QSTMPINCHGESTURERECOGNISER_H_
       
    20 #define QSTMPINCHGESTURERECOGNISER_H_
       
    21 
       
    22 #include <qstmgestureengine_if.h>
       
    23 #include <qstmgesture_if.h>
       
    24 #include <qstmgesturelistener_if.h>
       
    25 
       
    26 
       
    27 namespace qstmGesture
       
    28 {
       
    29 /*!
       
    30  * Recognise pinching gesture. !!! very experimental !!!
       
    31  * It seems that in capacitive touch in Symbian 9.4 touching with two
       
    32  * fingers causes fast EDrag events which are far from each other.
       
    33  * This gesture recogniser tries to use that feature
       
    34  * to determine when the gestures looks like a pinch.
       
    35  * Would requires a lot of tuning to be really useful, if at all possible.
       
    36  * With current implementation it is easy to zoom in but
       
    37  * almost impossible to zoom out.
       
    38  */
       
    39 class QStm_PinchGestureRecogniser : public QStm_GestureRecogniser
       
    40 {
       
    41 public:
       
    42     static const QStm_GestureUid KUid = EGestureUidPinch;
       
    43 
       
    44     virtual ~QStm_PinchGestureRecogniser();
       
    45     virtual QStm_GestureRecognitionState recognise(int numOfActiveStreams, QStm_GestureEngineIf* ge) ;
       
    46     virtual void release(QStm_GestureEngineIf* ge) ;
       
    47 
       
    48     virtual QStm_GestureUid gestureUid() const { return KUid; }
       
    49 
       
    50     /* define the pinch triggering as speed value */
       
    51     /* after EHold has been seen, then any move which is faster than this will enter pinch gesture */
       
    52     /* note that the value varies depending on techology, speed is measured as pixels / ms */
       
    53     void setPinchingSpeed(float aSpeed) /*__SOFTFP */;
       
    54 
       
    55     QStm_PinchGestureRecogniser(QStm_GestureListenerIf* listener) ;
       
    56 
       
    57     void calculateZoomingLine() ;
       
    58     float calculateDistance() ;
       
    59     int adjustPinchMove(float& aPreviousDistance, float aNewDistance) ;
       
    60 
       
    61 private:
       
    62     bool     m_pinching ;
       
    63     float    m_pinchingspeed ;
       
    64     QPoint   m_pinchstart ;
       
    65     QPoint   m_pinchend ;
       
    66 
       
    67     float m_m ;
       
    68     float m_b ;
       
    69 
       
    70     float   m_ddistance ;
       
    71     bool    m_holdseen ;
       
    72     QPoint  m_holdseenAtPos ;
       
    73     QTime   m_holdseenAtTime ;
       
    74 };
       
    75 
       
    76 }
       
    77 
       
    78 #endif /* QSTMPINCHGESTURERECOGNISER_H_ */