CPosLandmark Class Reference

class CPosLandmark : public CBase

This is a container class for a landmark.

A landmark is principally a location with a name.

The landmark object can either be created by a client or retrieved from CPosLandmarkDatabase .

A landmark consists of a number of landmark attributes, e.g. landmark name, landmark position, coverage area, etc.

A landmark may also contain generic position fields. These position fields are defined in LbsFieldIds.h. Only text fields are supported.If the client wants to store a non-text field, the value must first be converted to a textual representation. EPositionPlaceId position field added in extension of TPositionFieldId to support Place id EPositionTimeStamp position field added in extension of TPositionFieldId to support TimeStamp

CPosLandmark contains functions for setting and getting landmark attributes and position fields.

Note: CPosLandmark is only a local representation of the landmark. To update the database, call CPosLandmarkDatabase::UpdateLandmarkL (or CPosLandmarkDatabase::AddLandmarkL for a new landmark).

eposlandmarks.lib
Since
S60 3.0

Inherits from

Public Member Functions
~CPosLandmark()
IMPORT_C voidAddCategoryL(TPosLmItemId)
IMPORT_C TPositionFieldIdFirstPositionFieldId()
IMPORT_C voidGetCategoriesL(RArray< TPosLmItemId > &)
IMPORT_C TIntGetCoverageRadius(TReal32 &)
IMPORT_C TIntGetIcon(TPtrC &, TInt &, TInt &)
IMPORT_C TIntGetLandmarkDescription(TPtrC &)
IMPORT_C TIntGetLandmarkName(TPtrC &)
IMPORT_C TIntGetPlaceId(TPtrC &)
IMPORT_C TIntGetPosition(TLocality &)
IMPORT_C TIntGetPositionField(TPositionFieldId, TPtrC &)
IMPORT_C TIntGetTimeStamp(TTime &)
IMPORT_C TBoolIsPartial()
IMPORT_C TBoolIsPositionFieldAvailable(TPositionFieldId)
IMPORT_C TPosLmItemIdLandmarkId()
IMPORT_C CPosLandmark *NewL()
IMPORT_C CPosLandmark *NewL(const CPosLandmark &)
IMPORT_C CPosLandmark *NewLC()
IMPORT_C CPosLandmark *NewLC(const CPosLandmark &)
IMPORT_C TPositionFieldIdNextPositionFieldId(TPositionFieldId)
IMPORT_C TUintNumOfAvailablePositionFields()
IMPORT_C voidRemoveCategory(TPosLmItemId)
IMPORT_C voidRemoveLandmarkAttributes(TAttributes)
IMPORT_C voidRemovePositionField(TPositionFieldId)
IMPORT_C voidSetCoverageRadius(TReal32)
IMPORT_C voidSetIconL(const TDesC &, TInt, TInt)
IMPORT_C voidSetLandmarkDescriptionL(const TDesC &)
voidSetLandmarkIdL(TPosLmItemId)
IMPORT_C voidSetLandmarkNameL(const TDesC &)
voidSetPartialL(TBool)
IMPORT_C voidSetPlaceIdL(const TDesC &)
IMPORT_C voidSetPositionFieldL(TPositionFieldId, const TDesC &)
IMPORT_C voidSetPositionL(const TLocality &)
IMPORT_C voidSetTimeStampL(const TTime)
Private Member Functions
CPosLandmark()
CPosLandmark(const CPosLandmark &)
voidConstructL()
voidConstructL(const CPosLandmark &)
CPosLandmark &operator=(const CPosLandmark &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum_TAttributes {
ENoAttribute = 0x0000, ELandmarkName = 0x0001, EPosition = 0x0002, ECoverageRadius = 0x0004, ECategoryInfo = 0x0008, EIcon = 0x0010, EDescription = 0x0020, EPlaceId = 0x0040, ETimeStamp = 0x0080, EAllAttributes = 0xFFFF
}
Public Member Type Definitions
typedef TUint32 TAttributes
Private Attributes
RArray< TPosLmItemId >iCategoryArray
TReal32 iCoverageRadius
HBufC *iIconFileName
TInt iIconIndex
TInt iIconMaskIndex
TPosLmItemId iId
TBool iIsPartial
HBufC *iLandmarkDescription
HBufC *iLandmarkName
TLocality *iPosition
RArray< TUint >iPositionFieldIds
CDesCArray *iPositionFieldStrings

Constructor & Destructor Documentation

CPosLandmark()

CPosLandmark()[private]

CPosLandmark(const CPosLandmark &)

CPosLandmark(const CPosLandmark &)[private]

Parameters

const CPosLandmark &

~CPosLandmark()

~CPosLandmark()[virtual]

Destructor.

Member Functions Documentation

AddCategoryL(TPosLmItemId)

IMPORT_C voidAddCategoryL(TPosLmItemIdaCategoryId)

Adds a category to the landmark.

If the specified category has already been added, nothing happens.

Parameters

TPosLmItemId aCategoryIdThe category to add.

ConstructL()

voidConstructL()[private]

ConstructL(const CPosLandmark &)

voidConstructL(const CPosLandmark &aLandmark)[private]

Parameters

const CPosLandmark & aLandmark

FirstPositionFieldId()

IMPORT_C TPositionFieldIdFirstPositionFieldId()const

Returns the first position field contained in the landmark.

This function is used to initiate iteration over the position fields. NextPositionFieldId() is called to continue the iteration.

GetCategoriesL(RArray< TPosLmItemId > &)

IMPORT_C voidGetCategoriesL(RArray< TPosLmItemId > &aCategoryIdArray)const

Retrieves the database item IDs for the categories contained in this landmark.

Parameters

RArray< TPosLmItemId > & aCategoryIdArrayOn return contains the list of this landmark's categories.

GetCoverageRadius(TReal32 &)

IMPORT_C TIntGetCoverageRadius(TReal32 &aCoverageRadius)const

Reads the landmark coverage radius.

Coverage radius is set if the landmark is big, e.g. a city. It defines the size of the area which the landmark represents.

Parameters

TReal32 & aCoverageRadiusOn return contains the coverage radius.

GetIcon(TPtrC &, TInt &, TInt &)

IMPORT_C TIntGetIcon(TPtrC &aIconFileName,
TInt &aIconIndex,
TInt &aIconMaskIndex
)const

Returns the link to the icon associated with the landmark.

Icons are found in icon files. It is referenced by the name of the icon file and the index of the icon within the file.

The landmark is not affected if the icon file is changed or removed. It only contains a link to the icon. This means that the link could be invalid.

Parameters

TPtrC & aIconFileNameThe full icon file name.
TInt & aIconIndexThe index of the icon within the icon file.
TInt & aIconMaskIndexThe index of the icon mask within the icon file. If no icon mask index is defined KPosLmIconMaskNotUsed is returned.

GetLandmarkDescription(TPtrC &)

IMPORT_C TIntGetLandmarkDescription(TPtrC &aLandmarkDescription)const

Reads the description of the landmark.

This function returns error code KErrNotFound if the landmark description is not set in this landmark object. This will be the case if the landmark is read from the database using partial read and landmark description is excluded. Note that if a landmark is fully read from the database, the landmark description is always included. If no description has been set for the landmark in the database, it is set to an empty string "".

Parameters

TPtrC & aLandmarkDescriptionOn return contains the landmark description.

GetLandmarkName(TPtrC &)

IMPORT_C TIntGetLandmarkName(TPtrC &aLandmarkName)const

Reads the name of the landmark.

This function returns error code KErrNotFound if the landmark name is not set in this landmark object. This will be the case if the landmark is read from the database using partial read and landmark name is excluded. Note that if a landmark is fully read from the database, the landmark name will always be included. If no name has been set for the landmark in the database, it will have an empty name string "".

Parameters

TPtrC & aLandmarkNameOn return contains the landmark name.

GetPlaceId(TPtrC &)

IMPORT_C TIntGetPlaceId(TPtrC &aPId)const

Gets the PlaceId of the landmark

Parameters

TPtrC & aPIdOn return contains the place id of the landmark

GetPosition(TLocality &)

IMPORT_C TIntGetPosition(TLocality &aPosition)const

Reads the landmark position.

Parameters

TLocality & aPositionOn return contains the landmark position.

GetPositionField(TPositionFieldId, TPtrC &)

IMPORT_C TIntGetPositionField(TPositionFieldIdaFieldId,
TPtrC &aFieldValue
)const

Reads the value of a position field.

Parameters

TPositionFieldId aFieldIdThe position field to read.
TPtrC & aFieldValueOn return contains the value of the position field.

GetTimeStamp(TTime &)

IMPORT_C TIntGetTimeStamp(TTime &aTimeStamp)const

Gets the timestamp of the landmark

Parameters

TTime & aTimeStampOn return contains the timestamp of the landamrk

IsPartial()

IMPORT_C TBoolIsPartial()const

Checks if the landmark is partial.

A client can read partial information about a landmark from the database. This function checks if only partial information is included in the landmark object. Partial landmark can not be used with CPosLandmarkDatabase::UpdateLandmarkL() .

For more about partial landmarks, see CPosLandmarkDatabase::ReadPartialLandmarkLC() .

IsPositionFieldAvailable(TPositionFieldId)

IMPORT_C TBoolIsPositionFieldAvailable(TPositionFieldIdaFieldId)const

Checks if the landmark contains a specific position field.

Parameters

TPositionFieldId aFieldIdThe position field.

LandmarkId()

IMPORT_C TPosLmItemIdLandmarkId()const

Reads the ID of the landmark entry in the database.

NewL()

IMPORT_C CPosLandmark *NewL()[static]

Two-phased constructor.

NewL(const CPosLandmark &)

IMPORT_C CPosLandmark *NewL(const CPosLandmark &aLandmark)[static]

Two-phased copy constructor.

Parameters

const CPosLandmark & aLandmarkThe landmark to copy.

NewLC()

IMPORT_C CPosLandmark *NewLC()[static]

Two-phased constructor.

NewLC(const CPosLandmark &)

IMPORT_C CPosLandmark *NewLC(const CPosLandmark &aLandmark)[static]

Two-phased copy constructor.

Parameters

const CPosLandmark & aLandmarkThe landmark to copy.

NextPositionFieldId(TPositionFieldId)

IMPORT_C TPositionFieldIdNextPositionFieldId(TPositionFieldIdaFieldId)const

Returns the next position field contained in the landmark.

This function is used to iterate the position fields in the landmark. FirstPositionFieldId() is called to get the first ID. This ID is passed to NextPositionFieldId() to obtain the second ID, etc.

If the client specifies an ID which is not contained in the landmark, this function will panic with code EPosInvalidPositionFieldId. It is therefore important that the client does not remove the current field while iterating. If the client still removes the current field, the client must pass the previous field.

panic
"Landmarks Client"-EPosInvalidPositionFieldId Client specified a field ID, which is not contained in the landmark.

Parameters

TPositionFieldId aFieldIdThe last position field which was read.

NumOfAvailablePositionFields()

IMPORT_C TUintNumOfAvailablePositionFields()const

Returns the number of position fields set in the landmark.

RemoveCategory(TPosLmItemId)

IMPORT_C voidRemoveCategory(TPosLmItemIdaCategoryId)

Removes a category from the landmark.

If the specified category is not in the landmark, nothing happens.

Parameters

TPosLmItemId aCategoryIdThe category to remove

RemoveLandmarkAttributes(TAttributes)

IMPORT_C voidRemoveLandmarkAttributes(TAttributesaAttributes)

Removes landmark attributes from the landmark.

Parameters

TAttributes aAttributesA bitmap specifying which landmark attributes to remove.

RemovePositionField(TPositionFieldId)

IMPORT_C voidRemovePositionField(TPositionFieldIdaFieldId)

Removes a position field from the landmark.

If the specified position field is not contained in the landmark, nothing will happen.

Parameters

TPositionFieldId aFieldIdThe position field to remove.

SetCoverageRadius(TReal32)

IMPORT_C voidSetCoverageRadius(TReal32aCoverageRadius)

Sets the landmark coverage radius.

Coverage radius is set if the landmark is big, e.g. a city. It defines the size of the area which the landmark represents.

If coverage radius is set to NaN, then the coverage radius will be removed.

Parameters

TReal32 aCoverageRadiusThe coverage radius.

SetIconL(const TDesC &, TInt, TInt)

IMPORT_C voidSetIconL(const TDesC &aIconFileName,
TIntaIconIndex,
TIntaIconMaskIndex
)

Associates the landmark with an icon.

Icons are found in icon files. To set an icon, the client must specify the name of the icon file and the index of the icon within the file.

The landmark is not affected if the icon file is changed or removed. It only contains a link to the icon.

leave
KErrArgument The icon file name is longer than KMaxFileName.
panic
"Landmarks Client"-EPosLmInvalidArgument The icon index is negative or the icon mask index is negative and not equal to KPosLmIconMaskNotUsed.

Parameters

const TDesC & aIconFileNameThe full icon file name.
TInt aIconIndexThe index of the icon within the icon file.
TInt aIconMaskIndexThe index of the icon mask within the icon file.

SetLandmarkDescriptionL(const TDesC &)

IMPORT_C voidSetLandmarkDescriptionL(const TDesC &aLandmarkDescription)

Sets a description for the landmark.

If no description is set for the landmark when it is written to the database, the landmark in the database will have an empty description string "".

leave
KErrArgument The name of the landmark is longer than KPosLmMaxDescriptionLength.

Parameters

const TDesC & aLandmarkDescriptionThe landmark description.

SetLandmarkIdL(TPosLmItemId)

voidSetLandmarkIdL(TPosLmItemIdaId)

Parameters

TPosLmItemId aId

SetLandmarkNameL(const TDesC &)

IMPORT_C voidSetLandmarkNameL(const TDesC &aLandmarkName)

Sets the name of the landmark.

If no name is set for the landmark when it is written to the database, the landmark in the database will have an empty name string "".

leave
KErrArgument If the name of the landmark is longer than KPosLmMaxTextFieldLength

Parameters

const TDesC & aLandmarkNameThe landmark name.

SetPartialL(TBool)

voidSetPartialL(TBoolaPartial)

Parameters

TBool aPartial

SetPlaceIdL(const TDesC &)

IMPORT_C voidSetPlaceIdL(const TDesC &aPId)
Sets the PlaceId for the landmark
leave
Symbian error codes

Parameters

const TDesC & aPIdThe place id of the landmark

SetPositionFieldL(TPositionFieldId, const TDesC &)

IMPORT_C voidSetPositionFieldL(TPositionFieldIdaFieldId,
const TDesC &aFieldValue
)

Sets a position field in the landmark.

leave
KErrArgument If the position field text is longer than KPosLmMaxTextFieldLength.

Parameters

TPositionFieldId aFieldIdThe position field to set.
const TDesC & aFieldValueThe new value for the position field.

SetPositionL(const TLocality &)

IMPORT_C voidSetPositionL(const TLocality &aPosition)

Sets the landmark position.

Latitude and longitude must be set in the position.

Only WGS 84 coordinates are allowed. KPositionDatumWgs84 must be set as datum.

leave
KErrArgument Latitude and/or longitude is not set or other datum than KPositionDatumWgs84 is used in aPosition.

Parameters

const TLocality & aPositionThe landmark position.

SetTimeStampL(const TTime)

IMPORT_C voidSetTimeStampL(const TTimeaTimeStamp)
Sets the timestamp of the landmark.
leave
KErrArgument If the full date & time have not been specified.

Parameters

const TTime aTimeStampTimestamp of the landmark(Full date & time)

operator=(const CPosLandmark &)

CPosLandmark &operator=(const CPosLandmark &)[private]

Parameters

const CPosLandmark &

Member Enumerations Documentation

Enum _TAttributes

Specifies a landmark attribute such as landmark name or landmark position.

Enumerators

ENoAttribute = 0x0000

No attribute specified.

ELandmarkName = 0x0001

The name of the landmark.

EPosition = 0x0002

The position of the landmark.

ECoverageRadius = 0x0004

The landmark coverage radius.

ECategoryInfo = 0x0008

The categories of the landmark.

EIcon = 0x0010

The icon that represents the landmark in a UI.

EDescription = 0x0020

A description of the landmark.

EPlaceId = 0x0040

PlaceId for the landmark

ETimeStamp = 0x0080

Timestamp associated with the landmark

EAllAttributes = 0xFFFF

Member Type Definitions Documentation

Typedef TAttributes

typedef TUint32 TAttributes

Bitmap for specifying a group of landmark attributes. Bit values are defined by _TAttributes .

Member Data Documentation

RArray< TPosLmItemId > iCategoryArray

RArray< TPosLmItemId >iCategoryArray[private]

TReal32 iCoverageRadius

TReal32 iCoverageRadius[private]

HBufC * iIconFileName

HBufC *iIconFileName[private]

TInt iIconIndex

TInt iIconIndex[private]

TInt iIconMaskIndex

TInt iIconMaskIndex[private]

TPosLmItemId iId

TPosLmItemId iId[private]

TBool iIsPartial

TBool iIsPartial[private]

HBufC * iLandmarkDescription

HBufC *iLandmarkDescription[private]

HBufC * iLandmarkName

HBufC *iLandmarkName[private]

TLocality * iPosition

TLocality *iPosition[private]

RArray< TUint > iPositionFieldIds

RArray< TUint >iPositionFieldIds[private]

CDesCArray * iPositionFieldStrings

CDesCArray *iPositionFieldStrings[private]