Favourites
This example demonstrates how to add a landmark to favourites and remove it again. The app searches for a fixed landmark (the Statue of Liberty), highlights it on the map and shows a details panel with a star button. Tapping the star saves the landmark to a persistent LandmarkStore, or removes it if it is already saved.
The star button reflects the favourite state: a filled star means the landmark is saved in the favourites store, while an outlined star means it is not.
Creating the Favourites Store
Favourites are persisted in a LandmarkStore. The store is created once the default map view is available and registered with the map's preferences so its landmarks are rendered on the map.
Searching for the Landmark
Once the worldwide road map is up to date, the example runs a text search for the target landmark. The coordinates passed to searchByFilter are only a reference point used to bias result relevance; they are not required for the search to work.
When the search completes, the first result is kept, the location details panel is shown, and the landmark is highlighted on the map.
The Details Panel and the Star Button
showLocationDetailsPanel fills in the landmark's name and description, and sets the star button's icon to match the current favourite state. Tapping the button toggles the landmark in or out of the store and re-highlights it (without flying the camera again).
Adding, Removing and Looking Up Favourites
To add a favourite, a copy of the landmark is made, given the favourite push-pin image, and saved with store.addLandmark. Removing one is a single store.removeLandmark(id) call.
Both operations need the stored landmark's id. Since a search result and a stored copy are distinct objects, getFavouriteId looks the landmark up by location: it queries the store for landmarks in a small area around the coordinates and returns the id of the first one that matches within a tolerance (or -1 if none is found). isFavourite is a thin wrapper over this check.
Highlighting the Landmark on the Map
highlightLandmarkOnMap clears any previous highlight and assigns the search-result pin image. Landmarks with a geographic contour (such as the Statue of Liberty) are centred on that area with centerOnRectArea and drawn with their contour; point landmarks are centred on their coordinate instead. The highlight options depend on whether the landmark is already a favourite - when it is, the stored favourite pin already marks it, so only the contour is drawn.

