landmarks/locationlandmarks/searchclientlib/src/EPos_CPosLmAreaCriteria.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     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: Provides searching of landmarks based on area criteria
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "EPos_CPosLmAreaCriteria.h"
       
    22 
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CPosLmAreaCriteria::CPosLmAreaCriteria
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CPosLmAreaCriteria::CPosLmAreaCriteria()
       
    36 :   CPosLmSearchCriteria(ECriteriaArea)
       
    37     {
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CPosLmAreaCriteria::ConstructL
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CPosLmAreaCriteria::ConstructL(
       
    46     const TReal64& aSouthLatitude,
       
    47     const TReal64& aNorthLatitude,
       
    48     const TReal64& aWestLongitude,
       
    49     const TReal64& aEastLongitude)
       
    50     {
       
    51     User::LeaveIfError(SetSearchArea(aSouthLatitude, aNorthLatitude,
       
    52                                      aWestLongitude, aEastLongitude));
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CPosLmAreaCriteria::NewLC
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CPosLmAreaCriteria* CPosLmAreaCriteria::NewLC(
       
    61     const TReal64&  aSouthLatitude,
       
    62     const TReal64&  aNorthLatitude,
       
    63     const TReal64&  aWestLongitude,
       
    64     const TReal64&  aEastLongitude)
       
    65     {
       
    66     CPosLmAreaCriteria* self = new (ELeave) CPosLmAreaCriteria;
       
    67     CleanupStack::PushL(self);
       
    68     self->ConstructL(aSouthLatitude, aNorthLatitude,
       
    69                      aWestLongitude, aEastLongitude);
       
    70     return self;
       
    71     }
       
    72 
       
    73 // Destructor
       
    74 CPosLmAreaCriteria::~CPosLmAreaCriteria()
       
    75     {
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CPosLmAreaCriteria::GetSearchArea
       
    80 //
       
    81 // (other items were commented in a header).
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 EXPORT_C void CPosLmAreaCriteria::GetSearchArea(
       
    85     TReal64&  aSouthLatitude,
       
    86     TReal64&  aNorthLatitude,
       
    87     TReal64&  aWestLongitude,
       
    88     TReal64&  aEastLongitude) const
       
    89     {
       
    90     aSouthLatitude = iSouthLatitude;
       
    91     aNorthLatitude = iNorthLatitude;
       
    92     aWestLongitude = iWestLongitude;
       
    93     aEastLongitude = iEastLongitude;
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------
       
    97 // CPosLmAreaCriteria::SetSearchArea
       
    98 //
       
    99 // (other items were commented in a header).
       
   100 // ---------------------------------------------------------
       
   101 //
       
   102 EXPORT_C TInt CPosLmAreaCriteria::SetSearchArea(
       
   103     const TReal64&  aSouthLatitude,
       
   104     const TReal64&  aNorthLatitude,
       
   105     const TReal64&  aWestLongitude,
       
   106     const TReal64&  aEastLongitude)
       
   107     {
       
   108     if (aSouthLatitude < -90 ||
       
   109         aNorthLatitude < aSouthLatitude ||
       
   110         aNorthLatitude > 90 ||
       
   111         aWestLongitude < -180 ||
       
   112         aEastLongitude < -180 ||
       
   113         aWestLongitude >= 180 ||
       
   114         aEastLongitude > 180)
       
   115         {
       
   116         return KErrArgument;
       
   117         }
       
   118 
       
   119     iSouthLatitude = aSouthLatitude;
       
   120     iNorthLatitude = aNorthLatitude;
       
   121     iWestLongitude = aWestLongitude;
       
   122     iEastLongitude = aEastLongitude;
       
   123 
       
   124     return KErrNone;
       
   125     }
       
   126 
       
   127 //  End of File