locsrv_plat/map_image_conversion_plugin_api/inc/mncoordinateconverterbase.h
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2007 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:  CMnCoordinateConverterBase class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MN_COORDINATECONVERTERBASE_H
       
    20 #define MN_COORDINATECONVERTERBASE_H
       
    21 
       
    22 #include <mnmapimageparams.h>
       
    23 
       
    24 /** This is the base service interface to access coordinate conversion 
       
    25  *  functionality of MapImage service capable provider applications.
       
    26  *
       
    27  *  This interface must be implemented by Map and Navigation provider applications,
       
    28  *  which support @c KMnAppServiceMapImage service.
       
    29  *
       
    30  *  @lib mnclientlib.lib
       
    31  *  @since 5.0 */
       
    32 class CMnCoordinateConverterBase : public CBase
       
    33     {
       
    34     public:
       
    35         static CMnCoordinateConverterBase* NewL( TUid aProviderUid );
       
    36 
       
    37         /** Base destructor */
       
    38         IMPORT_C ~CMnCoordinateConverterBase();
       
    39         
       
    40         /** Returns drawing parameters of map image.
       
    41          *  @param aImageParams Parameters of map image. */
       
    42         IMPORT_C const TMnMapImageParams& MapImageParams() const;
       
    43         
       
    44         /** @internal */
       
    45         /*  Sets drawing parameters of map image. Implementation can read
       
    46          *  these by calling MapImageParams().
       
    47          *  @param aImageParams Parameters of map image. */
       
    48         void SetMapImageParams( const TMnMapImageParams& aImageParams );
       
    49 
       
    50         /** Calculates coordinate in pixels of the point corresponding to given
       
    51          *  world coordinate. 
       
    52          * 
       
    53          *  Given world coordinate is allowed to be beyond 
       
    54          *  image borders. In that case negative values in result value
       
    55          *  describe point to the left of left border and/or above top border of the
       
    56          *  image and values bigger than width or height describe point to the right
       
    57          *  of right image border or below its bottom border.
       
    58          * 
       
    59          *  If such calculation is not possible (e.e given world coordinate is not 
       
    60          *  part of the image) this function must return @c KErrUnknown.
       
    61          * 
       
    62          *  @param[in] aWorldCoordinate World coordinate (in WGS-84) 
       
    63          *  @param[out] aImagePoint Coordinate of corresponding pixel in image 
       
    64          *                          relative to image top left corner. 
       
    65          *  @return Error code of the operation:
       
    66          *      - @c KErrNone if calculation is successful
       
    67          *      - @c KErrArgument if map image parameters in are invalid.
       
    68          *      - @c KErrUnknown if calculation is not possible */
       
    69         virtual TInt GetImageCoordinate( 
       
    70             const TCoordinate& aWorldCoordinate, 
       
    71             TPoint& aImagePoint ) = 0;
       
    72         
       
    73         /** Calculates world coordinate of the given image point. 
       
    74          * 
       
    75          *  Given image point coordinate must be within the rectangle 
       
    76          *  ( TPoint( 0, 0 ), @ref Size() ).
       
    77          * 
       
    78          *  If such calculation is not possible (e.g. given image coordinate does not 
       
    79          *  match any world coordinate) this function must return @c KErrUnknown.
       
    80          * 
       
    81          *  @param[in] aImagePoint Coordinate of a point on map image in pixels, 
       
    82          *             relative to image top left corner. 
       
    83          *  @param[out] aWorldCoordinate On successful return, corresponding
       
    84          *                               world coordinate (in WGS-84).
       
    85          *  @return Error code of the operation:
       
    86          *      - @c KErrNone if calculation is successful
       
    87          *      - @c KErrArgument if image coordinate is out of bounds
       
    88          *      - @c KErrArgument if map image parameters in are invalid.
       
    89          *      - @c KErrUnknown if calculation is not possible  */
       
    90         virtual TInt GetWorldCoordinate( 
       
    91             const TPoint& aImagePoint, 
       
    92             TCoordinate& aWorldCoordinate ) = 0;
       
    93                     
       
    94     protected:    
       
    95         IMPORT_C CMnCoordinateConverterBase();
       
    96         
       
    97     private:
       
    98         TUid                iDtorIdKey;
       
    99         TMnMapImageParams   iImageParams;
       
   100     };
       
   101 
       
   102 #endif /*MN_COORDINATECONVERTERBASE_H*/