Before using this API, client applications need to open an existing landmark
database and obtain the database handle. This can be done using the CPosLandmarkDatabase
class
from Landmarks API.
To launch landmarks Editor/Viewer dialog with an existing landmark Id, at first, the client typically needs to obtain the landmark Id from an existing and opened database. Client applications can obtain existing landmark Ids in various ways, like using Landmarks API or Landmarks Search API (when the user interface is not involved) or using Landmarks UI Selector API (when a user interface is involved).
To launch the dialog, the client first needs to create an instance of CLmkEditorDlg
using
the NewL()
method and then calling the ExecuteLD()
method.
The parameters provided to the NewL()
method differentiate
the operation. The client can specify the Viewer or Editor mode while launching
the dialog.
In the Editor mode, any landmark attribute can be edited by the end user.
The end user can select a category or a set of categories for the landmark
from the Options menu of the editor. The modified landmark is saved into the
landmark database when the user presses "done" .
In the Viewer mode, the user can only view the attributes of the landmark. The user can view the landmark categories to which the current landmark belongs from the dialog’s Options menu.
The client can set its view or AppUI as the parent object of the landmarks
Editor\Viewer dialog, thereby creating a network of object providers using
the SetMopParent()
method.
The client can set its own help context by using the SetHelpContext()
method.
Although by default the Landmarks viewer dialog provides the Map and Navigation
related functionality, the client can choose to disable these menu items while
launching the dialog using the DisableMapAndNavigationMenuOptions()
method.
The following diagram illustrates steps involved in launching the landmark dialog in Editor or Viewer mode with an already existing landmark ID.
Figure 6: Launching the landmarks Editor\Viewer dialog with an already existing landmark ID
The following example code depicts launching of editor dialog with an already existing landmark ID.
void CMyLmUiAppView::LaunchLmkViewerWithLmkIdL(TLmkItemIdDbCombiInfo almItem) { //extract the database handle. CPosLandmarkDatabase* db =almItem.GetLmDb(); //extract the seleted landmarks item id TPosLmItemId itemId = almItem.GetItemId(); CLmkEditorDlg::TLmkEditorParams editParams; //set to make visible all the fields in viewer. editParams.iAttributes = CLmkEditorDlg::ELmkAll; //set to launch viewer editParams.iEditorMode = CLmkEditorDlg::ELmkViewer; CLmkEditorDlg *dlg = CLmkEditorDlg::NewL(*db,itemIdeditParams); dlg->DisableMapAndNavigationMenuOptions(); //Set the Help context TCoeHelpContext aContext; dlg->SetHelpContext(aContext); //Set Mop parent dlg->SetMopParent(this); dlg->ExecuteLD() }
To launch the landmark Editor/Viewer dialog for a new landmark (does not
exist in any landmark database), client applications need to create an instance
of CPosLandmark
with empty or partially filled attributes
(see Landmarks API ) and use it while instantiating the CLmkEditorDlg
class.
To launch the dialog, the client first needs to create an instance of CLmkEditorDlg
using
the NewL()
method and then call the ExecuteLD()
method.
The user can fill/modify different landmark attributes in the Editor dialog.
Once the new landmark is saved (by pressing "done" ) and the dialog is closed
by the user, the client application can retrieve the newly created landmark's
Id by using LandmarkId()
method of the same CPosLandmark
class.
The following diagram illustrates steps involved in launching the landmark dialog in Editor or Viewer mode with a new landmark object.
Figure 7: Launching the landmarks Editor\Viewer dialog with a new landmark.
The following example code depicts launching of editor dialog with a new landmark object.
void CLmUiRefAppView::LaunchLmkViewerWithLmkObjectL() { //Create an empty landmark object CPosLandmark* lmk = CPosLandmark::NewL(); CleanupStack::PushL(lmk); //Specify the various fields for landmark TLocality locality; locality.SetAccuracy(32.2,32.4); locality.SetCoordinate(56,25); locality.SetHorizontalAccuracy(33.1); locality.SetVerticalAccuracy(24.2); lmk->SetLandmarkNameL(_L("Forum Mall")); lmk->SetLandmarkDescriptionL(_L("Shopping Complex")); //Populate the landmark with the specified field information lmk->SetPositionL(locality); //open database CPosLandmarkDatabase* db = CPosLandmarkDatabase::OpenL(); CleanupStack::PushL(db); CLmkEditorDlg::TLmkEditorParams editParams; //set to make visible all the fields in viewer. editParams.iAttributes = CLmkEditorDlg::ELmkAll; //set to launch viewer editParams.iEditorMode = CLmkEditorDlg::ELmkViewer; CLmkEditorDlg *dlg = CLmkEditorDlg::NewL(*db,*lmk,editParams); dlg->ExecuteLD(); //Get the Id of the newly created Landmark TPosLmItemId lmkId = lmk->LandmarkId(); CleanupStack::PopAndDestroy(2);//db,lmk }
Landmark UI Add/Edit API uses the standard Symbian error reporting mechanism. Errors are reported through return codes or leaves.
The extra memory required to use this API is quite small and negligible.
There are no extensions defined to Landmarks UI Add/Edit API.