javauis/amms_akn/mmacontrol/inc/cammsorientationcontrol.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Manipulates the virtual orientation of an object.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAMMSORIENTATIONCONTROL_H
       
    20 #define CAMMSORIENTATIONCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <OrientationBase.h>
       
    24 #include "cammscontrol.h"
       
    25 
       
    26 // CONSTANS
       
    27 _LIT(KAMMSOrientationControl, "OrientationControl");
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *
       
    33 *  Controls for the Orientation Control effect.
       
    34 *  This class delegates Orientation Control effect method calls to
       
    35 *  CListenerOrientation.
       
    36 *
       
    37 *
       
    38 *  @since 3.0
       
    39 */
       
    40 NONSHARABLE_CLASS(CAMMSOrientationControl): public CAMMSControl
       
    41 {
       
    42 public:  // Constructors and destructor
       
    43     /**
       
    44     * Destructor.
       
    45     */
       
    46     ~CAMMSOrientationControl();
       
    47 
       
    48 public: // New functions
       
    49     /**
       
    50     * Turns the object to the new orientation.
       
    51     *
       
    52     * The new orientation is given using rotation angles. A zero vector
       
    53     * corresponds to the orientation pointing directly towards the negative
       
    54     * Z-axis. Orientation is applied in the following order: heading,
       
    55     * pitch, and roll. Therefore, notice that heading turns the X-axis and
       
    56     * therefore affects the pitch, and similarly heading and pitch turn the
       
    57     * Z-axis and therefore affect the roll.
       
    58     *
       
    59     * @param aHeading The rotation around the Y-axis in degrees.
       
    60     * @param aPitch The rotation around the X-axis in degrees.
       
    61     * @param aRoll The rotation around the Z-axis in degrees.
       
    62     */
       
    63     virtual void SetOrientationL(TInt aHeading, TInt aPitch, TInt aRoll);
       
    64 
       
    65     /**
       
    66     * Turns the object to the new orientation.
       
    67     *
       
    68     * The orientation is specified using two vectors, one specifying the
       
    69     * direction of the front vector of the object in world coordinates, and
       
    70     * another specifying the "above" vector of the object. The right and up
       
    71     * vectors of the object are calculated by first normalizing both source
       
    72     * vectors, then calculating the right vector as the cross product of the
       
    73     * "above" vector and the front vector, and the up vector as a cross
       
    74     * product of the front and right vectors.
       
    75     *
       
    76     * Because both vectors are normalized, they may be of any length.
       
    77     *
       
    78     * @param aFrontX X value of Front vector
       
    79     * @param aFrontY Y value of Front vector
       
    80     * @param aFrontZ Z value of Front vector
       
    81     * @param aAboveX X value of Above vector
       
    82     * @param aAboveY Y value of Above vector
       
    83     * @param aAboveZ Z value of Above vector
       
    84     *
       
    85     * @par Leaving:
       
    86     * @li \c KErrArgument - In case any of the parameters is a zero vector
       
    87     * or they are parallel to each other.
       
    88     * In that case, the orientation of the object remains unchanged.
       
    89     */
       
    90     virtual void SetOrientationL(TInt aFrontX,
       
    91                                  TInt aFrontY,
       
    92                                  TInt aFrontZ,
       
    93                                  TInt aAboveX,
       
    94                                  TInt aAboveY,
       
    95                                  TInt aAboveZ);
       
    96 
       
    97     /**
       
    98     * Gets the orientation of the object using two vectors.
       
    99     *
       
   100     * Sets the location using cartesian right-handed coordinates that are
       
   101     * relative to the origin. The measures are defined in units specified
       
   102     * by GlobalManager.getUnitsPerMeter().
       
   103     * Referenced memory of the arguments will contain the coordinate values.
       
   104     *
       
   105     * @param aFrontX X value of Front vector
       
   106     * @param aFrontY Y value of Front vector
       
   107     * @param aFrontZ Z value of Front vector
       
   108     * @param aAboveX X value of Above vector
       
   109     * @param aAboveY Y value of Above vector
       
   110     * @param aAboveZ Z value of Above vector
       
   111     */
       
   112     virtual void OrientationVectors(TInt& aFrontX,
       
   113                                     TInt& aFrontY,
       
   114                                     TInt& aFrontZ,
       
   115                                     TInt& aAboveX,
       
   116                                     TInt& aAboveY,
       
   117                                     TInt& aAboveZ);
       
   118 
       
   119 protected:
       
   120     /**
       
   121     * C++ default constructor, protected to allow access from derived class
       
   122     * @param aPlayer Player that has this control.
       
   123     */
       
   124     CAMMSOrientationControl(CMMAPlayer* aPlayer);
       
   125 
       
   126 protected:  // Data
       
   127 
       
   128     /* Native orientation effect, set from derived classes */
       
   129     COrientation* iOrientationEffect;
       
   130 };
       
   131 
       
   132 #endif // CAMMSORIENTATIONCONTROL_H
       
   133 
       
   134