Home > @magiclane/maps-sdk > RouteBookmarks

RouteBookmarks class

Manages a persistent collection of saved routes (bookmarks).

Provides operations to create, add, import, update, remove and export saved routes. Use RouteBookmarks.create to open or create a named bookmarks collection backed by a file.

Signature:

export declare class RouteBookmarks extends GemAutoreleaseObject 

Extends: GemAutoreleaseObject

Constructors

Constructor

Modifiers

Description

(constructor)(id)

Constructs a new instance of the RouteBookmarks class

Properties

Property

Modifiers

Type

Description

_pointerId

protected

number | bigint

autoDeleteMode

boolean

Whether the underlying bookmarks database is automatically deleted when this object is destroyed.

When true, the database file is removed when the RouteBookmarks instance is disposed. Default value is false.

filePath

readonly

string

File path of the bookmarks collection used by this RouteBookmarks instance.

This is the platform-specific file path where the bookmarks database is stored.

pointerId

readonly

number | bigint

Gets the pointer ID for this RouteBookmarks instance.

size

readonly

number

Number of bookmarked routes in this collection.

sortOrder

RouteBookmarksSortOrder

Change the sort order used to present routes from this collection.

The default sort order is RouteBookmarksSortOrder.sortByDate. The UI should refresh any views after changing the sort order to reflect the updated ordering.

Methods

Method

Modifiers

Description

add(name, waypoints, preferences, overwrite)

Adds a new route or updates an existing one in this bookmarks collection.

Stores a route identified by name together with its waypoints and optional preferences. When a route with the same name already exists the operation will fail unless overwrite is set to true, in which case the existing route is replaced.

Only route-relevant preference fields are persisted.

addTrips(filename)

Import routes from a file and add them to this bookmarks collection.

The method attempts to parse and import trips from the given filename. On success it returns the number of imported routes. If the import fails the method returns an error code.

clear()

Remove all routes from this bookmarks collection.

After calling this method the collection will be empty.

create(name)

static

Open or create a bookmarks collection with the provided name.

The factory creates or opens the underlying bookmarks database for the given name and returns a RouteBookmarks instance that operates on that collection.

createInFolder(name, folderPath)

static

Open or create a bookmarks collection with the provided name and folder path.

The factory creates or opens the underlying bookmarks database for the given name and folderPath and returns a RouteBookmarks instance that operates on that collection.

exportToFile(index, path)

Export a bookmarked route to the filesystem.

Writes the route at index to the given filesystem path in a standard interchange format. The returned value communicates success or the type of failure.

find(name)

Find a bookmarked route by its name.

getName(index)

Returns the name of the bookmarked route at index, or null when the index is invalid.

getPreferences(index)

Retrieves the RoutePreferences saved with the route at index.

getTimestamp(index)

UTC timestamp of when the route was saved.

getWaypoints(index)

Returns the list of Landmark waypoints for the route at index.

remove(index)

Remove the bookmarked route at index.

update(index, name, waypoints, preferences)

Update an existing bookmarked route.

Only the fields provided will be updated; omit a parameter to leave the existing value intact.