locationmapnavfw/aiwprovider/src/mnmapviewcmdhandlerbase.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  CMnMapViewCmdHandlerBase class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <AiwGenericParam.hrh>
       
    20 #include <AiwCommon.hrh>
       
    21 
       
    22 #include <mnmapview.h>
       
    23 
       
    24 #include "mnaiwdebug.h"
       
    25 #include "mnmapviewcmdhandlerbase.h"
       
    26 
       
    27 // ================= LOCAL FUNCTIONS =======================
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CMnMapViewCmdHandlerBase::CMnMapViewCmdHandlerBase( CMnProvider& aProvider )
       
    35 :   CMnAiwCommandHandlerBase( aProvider )
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CMnMapViewCmdHandlerBase::~CMnMapViewCmdHandlerBase()
       
    43     {
       
    44     delete iMapView;
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void CMnMapViewCmdHandlerBase::SetExitObserverL( MMnProviderExitCallback& aExitCallback )
       
    51 	{
       
    52 	iMapView->SetExitObserverL( *this );
       
    53 	CMnAiwCommandHandlerBase::SetExitObserverL( aExitCallback );
       
    54 	}
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void CMnMapViewCmdHandlerBase::ConstructL( TRunMode aRunMode )
       
    60     {
       
    61     LOG("CMnMapViewCmdHandlerBase::ConstructL in");
       
    62     CMnAiwCommandHandlerBase::ConstructL();
       
    63     
       
    64     if ( aRunMode == ERunModeChained )
       
    65         {
       
    66         iMapView = CMnMapView::NewChainedL( Provider() );
       
    67         }
       
    68     else
       
    69         {
       
    70         iMapView = CMnMapView::NewL( Provider() );
       
    71         }
       
    72 
       
    73     iRunMode = aRunMode;
       
    74 
       
    75     LOG("CMnMapViewCmdHandlerBase::ConstructL out");
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CMnMapViewCmdHandlerBase::ReadMapOptionsL( 
       
    82     const TAiwGenericParam& aParam,
       
    83     TMnAiwMapViewOptionsParam& aMapOptions )
       
    84     {
       
    85     TPtrC8 data( aParam.Value().AsData() ); 
       
    86     if ( data.Size() == sizeof( TMnAiwMapViewOptionsParam ) )
       
    87         {
       
    88         TMnAiwMapViewOptionsParam options;
       
    89         TPckg<TMnAiwMapViewOptionsParam> optionsPack( options );
       
    90         optionsPack.Copy( data );
       
    91         aMapOptions = options;
       
    92         }
       
    93     else
       
    94         {
       
    95         User::Leave( KErrArgument );
       
    96         }
       
    97     }
       
    98     
       
    99 // -----------------------------------------------------------------------------
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 CMnMapView& CMnMapViewCmdHandlerBase::MapView()
       
   103     {
       
   104     return *iMapView;
       
   105     }
       
   106     
       
   107 // -----------------------------------------------------------------------------
       
   108 //  From class CMnAiwCommandHandlerBase
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CMnMapViewCmdHandlerBase::HandleAiwParamL( const TAiwGenericParam& aParam )
       
   112     {
       
   113     switch ( aParam.SemanticId() )
       
   114         {
       
   115         case EGenericParamMnMapViewOptions:
       
   116             {
       
   117             TMnAiwMapViewOptionsParam mapOptions;
       
   118             ReadMapOptionsL( aParam, mapOptions );
       
   119 
       
   120             iMapView->SetOptions( mapOptions.iOptions );
       
   121             iMapView->SetMapAreaL( mapOptions.iCenterPoint, mapOptions.iRadius );
       
   122             iMapView->SetCurrentLocationOption( 
       
   123                 ( CMnMapView::TCurrentLocationOption) mapOptions.iCurrentLocationOption );
       
   124 
       
   125             break;
       
   126             }
       
   127         default:
       
   128             CMnAiwCommandHandlerBase::HandleAiwParamL( aParam );
       
   129             break;
       
   130         }
       
   131     }
       
   132     
       
   133 // -----------------------------------------------------------------------------
       
   134 //  From class CMnAiwCommandHandlerBase
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 void CMnMapViewCmdHandlerBase::HandleAiwParamLandmarksL( RArray<TPtrC8>& aLandmarkDataList )
       
   138     {
       
   139     iMapView->AddLandmarksToShowL( aLandmarkDataList );
       
   140     }
       
   141     
       
   142 // -----------------------------------------------------------------------------
       
   143 //  From class CMnAiwCommandHandlerBase
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 void CMnMapViewCmdHandlerBase::HandleAiwParamLandmarksListL( 
       
   147     const TDesC& aDbUri, 
       
   148     RArray<TPosLmItemId>& aLmIds )
       
   149     {
       
   150     iMapView->AddLandmarksToShowL( aDbUri, aLmIds );
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 //  From class CMnAiwCommandHandlerBase
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 void CMnMapViewCmdHandlerBase::ResetParametersL()
       
   158     {
       
   159     iMapView->ResetLandmarksToShow();
       
   160     iMapView->ResetMapArea();
       
   161     iMapView->SetUseDefaultRequestText();
       
   162     iMapView->SetOptions( CMnMapView::EOptionNone );
       
   163     iMapView->SetCurrentLocationOption( CMnMapView::ECurrentLocationDisabled );
       
   164     }