Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::RouteBookmarks Class Reference

RouteBookmarks object. More...

Inheritance diagram for gem::RouteBookmarks:
Collaboration diagram for gem::RouteBookmarks:

Public Member Functions

 RouteBookmarks (RouteBookmarks &&routeBookmark)=default
 Default move constructor noexcept is deduced.
RouteBookmarksoperator= (RouteBookmarks &&routeBookmark)=default
 Default move assignment noexcept is deduced.
String getFilePath () const noexcept
 Get Bookmarks collection path.
void setSortOrder (ERouteBookmarksSortOrder order) noexcept
 Change the sort order of the routes.
int size () const noexcept
 Get number of routes.
const StringRef getName (int index) const noexcept
 Get name of the route specified by index.
const RoutePreferencesRef getPreferences (int index) const noexcept
 Get preferences of the route specified by index.
const LandmarkListRef getWaypoints (int index) const noexcept
 Get waypoints of the route specified by index.
const TimeRef getTimestamp (int index) const noexcept
 Get timestamp of the route specified by index.
RouteBookmarksupdate (int index, const String &name=String(), const LandmarkList &waypoints=LandmarkList(), const RoutePreferences &preferences=RoutePreferences()) noexcept
 Update a route.
RouteBookmarksadd (const String &name, const LandmarkList &waypoints, const RoutePreferences &preferences=RoutePreferences(), bool overwrite=false) noexcept
 Add a new route / update existing.
int addTrips (const String &filename, bool skipDuplicates=true) noexcept
 Add trips from the given filename.
RouteBookmarksremove (int index) noexcept
 Remove the item at the specified index.
int find (const String &name) noexcept
 Find a trip by name.
void clear () noexcept
 Clear all routes bookmarks.
int exportToFile (int index, const String &path) const noexcept
 Export the route to the given file.
template<typename TCollector>
bool iterateRoutes (TCollector collector) const noexcept
 Iterate all bookmarked routes.
RouteBookmarkssetAutoDeleteMode (bool mode) noexcept
 Set auto delete mode.
bool getAutoDeleteMode () const noexcept
 Get auto delete mode.

Static Public Member Functions

static StrongPointer< RouteBookmarksproduce (const String &name, const String &folder=String())
 Constructor.
static String getBaseUniqueName (const LandmarkList &lmks)
 Create a basic route unique name based on waypoints coordinates.
static int setWaypointTrackData (Landmark &lmk, const Path &track) noexcept
 Add the given track to waypoint.
static Path getWaypointTrackData (const Landmark &lmk) noexcept
 Extract track from the given waypoint.
static bool waypointHasTrackData (const Landmark &lmk) noexcept
 Check if waypoint has track data.
static int reverseWaypointTrackData (Landmark &lmk) noexcept
 Reverse waypoint track data.
static int setWaypointTrackDepartureAndDestination (Landmark &lmk, const Coordinates &dep, const Coordinates &dst) noexcept
 Truncate track data between the given departure and destination coordinates.

Detailed Description

RouteBookmarks object.

Implements share-read / write Api object over IRouteBookmarks.

Constructor & Destructor Documentation

◆ RouteBookmarks()

gem::RouteBookmarks::RouteBookmarks ( RouteBookmarks && routeBookmark)
default

Default move constructor noexcept is deduced.

Parameters
[in]routeBookmarkThe RouteBookmarks object to be moved.

Member Function Documentation

◆ add()

RouteBookmarks & gem::RouteBookmarks::add ( const String & name,
const LandmarkList & waypoints,
const RoutePreferences & preferences = RoutePreferences(),
bool overwrite = false )
inlinenoexcept

Add a new route / update existing.

Parameters
[in]nameThe new route name, must be unique. If a route with this name already exists, error::KExist is returned
[in]waypointsRoute waypoints list
[in]preferencesRoute preferences
[in]overwriteOverwrite route if name already exists

If a route with given name already exists and overwrite = true, the existing route is updated

Only route relevant preferences are saved: transport mode + avoid preferences

Returns
RouteBookmarks object

◆ addTrips()

int gem::RouteBookmarks::addTrips ( const String & filename,
bool skipDuplicates = true )
inlinenoexcept

Add trips from the given filename.

Parameters
[in]filenameThe imported bookmarks file path
[in]skipDuplicatesWhether or not to skip duplicates, Default true.
Returns
On success: the number of imported routes, otherwise the operation error

◆ exportToFile()

int gem::RouteBookmarks::exportToFile ( int index,
const String & path ) const
inlinenoexcept

Export the route to the given file.

Parameters
[in]indexThe route index to be exported
[in]pathThe file path where the route will be exported
Returns
0 if the route was successfully exported

◆ find()

int gem::RouteBookmarks::find ( const String & name)
inlinenoexcept

Find a trip by name.

Parameters
[in]nameThe route name
Returns
On success - the route index in current sort order, on failure - the error code

◆ getAutoDeleteMode()

bool gem::RouteBookmarks::getAutoDeleteMode ( ) const
inlinenoexcept

Get auto delete mode.

If auto delete mode is true, the database if automatically deleted when object is destroyed

Default is false

Returns
The auto delete mode

◆ getBaseUniqueName()

String gem::RouteBookmarks::getBaseUniqueName ( const LandmarkList & lmks)
inlinestatic

Create a basic route unique name based on waypoints coordinates.

Parameters
[in]lmksThe landmark names
Returns
The base unique name

◆ getFilePath()

String gem::RouteBookmarks::getFilePath ( ) const
inlinenoexcept

Get Bookmarks collection path.

Returns
The path of the bookmarks collection

◆ getName()

const StringRef gem::RouteBookmarks::getName ( int index) const
inlinenoexcept

Get name of the route specified by index.

Route name is the unique identifier of a route

Parameters
[in]indexThe index of the route in the current sort order
Returns
The route name

◆ getPreferences()

const RoutePreferencesRef gem::RouteBookmarks::getPreferences ( int index) const
inlinenoexcept

Get preferences of the route specified by index.

Parameters
[in]indexThe index of the route in the current sorting
Returns
The route preferences

◆ getTimestamp()

const TimeRef gem::RouteBookmarks::getTimestamp ( int index) const
inlinenoexcept

Get timestamp of the route specified by index.

Parameters
[in]indexThe index of the route in the current sort order
Returns
The route timestamp

◆ getWaypoints()

const LandmarkListRef gem::RouteBookmarks::getWaypoints ( int index) const
inlinenoexcept

Get waypoints of the route specified by index.

Parameters
[in]indexThe index of the route in the current sort order
Returns
The route waypoints list

◆ getWaypointTrackData()

Path gem::RouteBookmarks::getWaypointTrackData ( const Landmark & lmk)
inlinestaticnoexcept

Extract track from the given waypoint.

Parameters
[in]lmkThe landmark waypoint
Returns
The track as a path object

◆ iterateRoutes()

template<typename TCollector>
bool gem::RouteBookmarks::iterateRoutes ( TCollector collector) const
inlinenoexcept

Iterate all bookmarked routes.

Collector signature should be bool( const String&, const LandmarkList&, const RoutePreferences&, const Time& )

Collector should return true if iteration should continue and false if iteration should stop

Parameters
[in]collectorThe collector function
Returns
true if all routes were iterated, false if iteration was stopped

◆ operator=()

RouteBookmarks & gem::RouteBookmarks::operator= ( RouteBookmarks && routeBookmark)
default

Default move assignment noexcept is deduced.

Parameters
[in]routeBookmarkThe RouteBookmarks object to be moved.
Returns
The RouteBookmarks object.

◆ produce()

StrongPointer< RouteBookmarks > gem::RouteBookmarks::produce ( const String & name,
const String & folder = String() )
inlinestatic

Constructor.

Parameters
[in]nameCollection name
[in]folderCollection folder location. If not provided a default SDK location will be used
Returns
RouteBookmarks StrongPointer(std::shared_ptr) object

◆ remove()

RouteBookmarks & gem::RouteBookmarks::remove ( int index)
inlinenoexcept

Remove the item at the specified index.

Parameters
[in]indexThe route index to be removed
Returns
RouteBookmarks object

◆ reverseWaypointTrackData()

int gem::RouteBookmarks::reverseWaypointTrackData ( Landmark & lmk)
inlinestaticnoexcept

Reverse waypoint track data.

Parameters
[in,out]lmkThe landmark waypoint where track data is reversed
Returns
0 if the track was successfully reversed

◆ setAutoDeleteMode()

RouteBookmarks & gem::RouteBookmarks::setAutoDeleteMode ( bool mode)
inlinenoexcept

Set auto delete mode.

Parameters
[in]modeThe Auto-delete mode
Returns
RouteBookmarks object

◆ setSortOrder()

void gem::RouteBookmarks::setSortOrder ( ERouteBookmarksSortOrder order)
inlinenoexcept

Change the sort order of the routes.

Default order is ESortByDate. UI needs to refresh the list.

Parameters
[in]orderThe new sort order

◆ setWaypointTrackData()

int gem::RouteBookmarks::setWaypointTrackData ( Landmark & lmk,
const Path & track )
inlinestaticnoexcept

Add the given track to waypoint.

Parameters
[in,out]lmkThe landmark waypoint
[in]trackThe track as a path object
Returns
0 if the track was successfully added

◆ setWaypointTrackDepartureAndDestination()

int gem::RouteBookmarks::setWaypointTrackDepartureAndDestination ( Landmark & lmk,
const Coordinates & dep,
const Coordinates & dst )
inlinestaticnoexcept

Truncate track data between the given departure and destination coordinates.

Set dep = dest to create a track circuit

Parameters
[in,out]lmkThe landmark waypoint where track data is reversed
[in]depThe new track departure coordinate
[in]dstThe new track destination coordinate
Returns
0 if the track was successfully truncated ErrorCodes

◆ size()

int gem::RouteBookmarks::size ( ) const
inlinenoexcept

Get number of routes.

Returns
The number of routes in the collection

◆ update()

RouteBookmarks & gem::RouteBookmarks::update ( int index,
const String & name = String(),
const LandmarkList & waypoints = LandmarkList(),
const RoutePreferences & preferences = RoutePreferences() )
inlinenoexcept

Update a route.

Parameters
[in]indexThe index of the route in the current sort order
[in]nameThe new route name, must be unique. If a route with this name already exists, error::KExist is returned
[in]waypointsRoute waypoints list
[in]preferencesRoute preferences

Only route relevant preferences are saved: transport mode + avoid preferences

Returns
RouteBookmarks object

◆ waypointHasTrackData()

bool gem::RouteBookmarks::waypointHasTrackData ( const Landmark & lmk)
inlinestaticnoexcept

Check if waypoint has track data.

Parameters
[in]lmkThe landmark waypoint
Returns
Return true if waypoint has track data attached