locationdataharvester/mylocationsengine/inc/maptileinterface.h
branchRCL_3
changeset 17 1fc85118c3ae
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
       
     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: Maptile interface header implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MAPTILEINTERFACE_H__
       
    19 #define __MAPTIlEINTERFACE_H__
       
    20 
       
    21 #include <e32std.h> 
       
    22 #include <e32base.h>
       
    23 // Header for landmarks db
       
    24 #include<EPos_CPosLandmarkDatabase.h>
       
    25 #include <maptilegeocoderplugin.h>
       
    26 
       
    27 
       
    28  
       
    29 /**
       
    30  * MMapTileObserver class.
       
    31  * Observer class for notifying the maptile related events 
       
    32  *
       
    33  */
       
    34 class MMapTileObserver
       
    35     {
       
    36 public:   
       
    37     
       
    38    /** Informs once maptile is retrived from the REST server
       
    39     * 
       
    40     * @param[in] aErrCode Error code
       
    41     * @param[in] aMapTilePath Path where the maptile image staroed
       
    42     * 
       
    43     */    
       
    44     virtual void MapTilefetchingCompleted( TInt aErrCode,const TDesC& aMapTilePath ) = 0;
       
    45     
       
    46     /** Informs once geo coordinates  retrived from the REST server
       
    47     * 
       
    48     * @param[in] aErrCode Error code
       
    49     * @param[in] aMapTilePath Path where the maptile image staroed
       
    50     * 
       
    51     */    
       
    52     virtual void GeoCodefetchingCompleted( TInt aErrCode, const TReal& aLatitude,
       
    53 	                const TReal& aLongitude, const TDesC& aMapTilePath ) = 0;
       
    54     
       
    55   
       
    56     
       
    57     };
       
    58 
       
    59 
       
    60 
       
    61 /** 
       
    62  * Class used for interacting with maptile and geocoder components .
       
    63  * This class raises the request for geocoding service and maptile
       
    64  * fetching service.
       
    65  */
       
    66 class CMapTileInterface : public CBase, MMaptileGeocoderObserver
       
    67 {
       
    68 public:
       
    69 
       
    70    /**
       
    71     * Factory method
       
    72     */
       
    73     static CMapTileInterface* NewL(); 
       
    74     
       
    75     /**
       
    76      * Interface for requesting GEO fields a landmark object containing address
       
    77      * 
       
    78      * @param[in] aLandmark Landmark containing address details
       
    79      * @param[in] aFilePath Path where the maptile image to be stored
       
    80      * @param[in] aObserver Observer for callback notification
       
    81      * 
       
    82      */
       
    83     void GetGeoCodeFromAddressL(  CPosLandmark*  aLandmark , 
       
    84             const TDesC& aFilePath, MMapTileObserver* aObserver  );
       
    85     
       
    86     /**
       
    87      * Interface for requesting GEO fields for the address
       
    88      * 
       
    89      * @param[in] aAddressDetails containing address details
       
    90      * @param[in] aFilePath Path where the maptile image to be stored
       
    91      * @param[in] aObserver Observer for callback notification
       
    92      */
       
    93     void GetGeoCodeFromAddressL(const TDesC& aAddressDetails,
       
    94             const TDesC& aFilePath, MMapTileObserver* aObserver);
       
    95     
       
    96     /**
       
    97      * Interface for requesting  for a landmark object.
       
    98      * @return CPosLandmark object.
       
    99      */
       
   100     CPosLandmark* GetLandMarkDetails();
       
   101         
       
   102     
       
   103     /**
       
   104      * Constructor
       
   105      */
       
   106     CMapTileInterface();
       
   107     
       
   108     /**
       
   109      * Destructor
       
   110      */
       
   111     ~CMapTileInterface();
       
   112     
       
   113     /**
       
   114      * Function for Retrieving maptile     
       
   115      */
       
   116     void GetMapTileL( const TReal& aLatitude, const TReal& aLongitude );    
       
   117 
       
   118 #ifdef MYLOCATIONENGINE_UNIT_TEST
       
   119 public:
       
   120 #else
       
   121 private:
       
   122 #endif
       
   123 	
       
   124 	/**
       
   125 	 * Converts geocoordinates to maptile pixel coordinate and update the 
       
   126 	 * image saving file path to MaptileFolder\RowCol.png
       
   127 	 */	
       
   128 	void UpdateFilePathL( const TReal& aLatitude, const TReal& aLongitude );
       
   129 	
       
   130     /**
       
   131      * Interface for requesting  for a landmark object.
       
   132      * @param[in] aAddressInfo , geo-code address details
       
   133      */
       
   134     void SetLandMarkDetailsL(MAddressInfo& aAddressInfo);
       
   135     
       
   136 #ifdef MYLOCATIONENGINE_UNIT_TEST
       
   137 public:
       
   138 #else
       
   139 protected:
       
   140 #endif
       
   141 	
       
   142     /**
       
   143      * Derived from MMaptileGeocoderObserver
       
   144      */
       
   145     void GeocodingCompleted( TInt aErrorcode, MAddressInfo& aAddressInfo );
       
   146     
       
   147     /**
       
   148      * Derived from MMaptileGeocoderObserver
       
   149      */
       
   150     void MapTileFetchingCompleted( TInt aErrorcode, const TDesC& aMapImagePath );
       
   151     
       
   152 #ifdef MYLOCATIONENGINE_UNIT_TEST
       
   153 public:
       
   154 #else
       
   155 private:
       
   156 #endif
       
   157     
       
   158     /**
       
   159      * Two phase construction
       
   160      */
       
   161     void ConstructL();
       
   162     
       
   163 #ifdef MYLOCATIONENGINE_UNIT_TEST
       
   164 public:
       
   165 #else
       
   166 private:
       
   167 #endif
       
   168 	
       
   169     //MaptileGeocode plugin interface instance
       
   170     CMaptileGeocoderPlugin* iMaptileGeocoder;
       
   171     //Flag to check street availability
       
   172     TBool iStreetAvailable;
       
   173     //Maptile image path
       
   174 	HBufC* iFilePath;
       
   175 	//Maptile observer
       
   176 	MMapTileObserver* iObserver ;
       
   177 	//pointer to landmark  from address information.
       
   178 	CPosLandmark  *iLandmark;
       
   179 
       
   180     };
       
   181 #endif // MAPTILEINTERFACE_H
       
   182