libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::RoutingListModel Class Reference

#include <RoutingModel.h>

Inheritance diagram for osmscout::RoutingListModel:

Public Types

using Roles = RouteStep::Roles

Public Slots

void cancel ()
void clear ()
void onRouteComputed (QtRouteData route, int requestId)
void onRouteFailed (QString reason, int requestId)
void onRoutingProgress (int percent, int requestId)
void setStartAndTarget (LocationEntry *start, LocationEntry *target, QmlRoutingProfile *routingProfile, double vehicleBearing=-1)
 Compute new route.
void setStartAndTarget (LocationEntry *start, LocationEntry *target, QString vehicleStr="car", double vehicleBearing=-1)
 Compute new route.

Signals

void computingChanged ()
void routeFailed (QString reason)
void routeRequest (LocationEntryRef start, LocationEntryRef target, QmlRoutingProfileRef profile, int requestId, osmscout::BreakerRef breaker, std::optional< osmscout::Bearing > bearing)
void routingProgress (int percent)

Public Member Functions

Q_INVOKABLE QStringList availableVehicles ()
QVariant data (const QModelIndex &index, int role) const override
Qt::ItemFlags flags (const QModelIndex &index) const override
Q_INVOKABLE QObject * get (int row) const
QObject * getRoute () const
double getRouteDuration () const
 Route duration in seconds.
double getRouteLength () const
 Route length in meters.
OverlayWay * getRouteWay ()
bool isReady ()
Q_INVOKABLE QObject * locationEntryFromPosition (double lat, double lon, QString label="")
 Create LocationEntry from geographic coordinate with optional label.
RoutingListModel & operator= (const RoutingListModel &)=delete
RoutingListModel & operator= (RoutingListModel &&)=delete
QHash< int, QByteArray > roleNames () const override
 RoutingListModel (const RoutingListModel &)=delete
 RoutingListModel (QObject *parent=nullptr)
 RoutingListModel (RoutingListModel &&)=delete
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 ~RoutingListModel () override

Properties

int count
double duration
double length
bool ready
QObject * route
QObject * routeWay

Member Typedef Documentation

◆ Roles

Constructor & Destructor Documentation

◆ RoutingListModel() [1/3]

◆ RoutingListModel() [2/3]

osmscout::RoutingListModel::RoutingListModel ( const RoutingListModel & )
delete

References RoutingListModel().

◆ RoutingListModel() [3/3]

osmscout::RoutingListModel::RoutingListModel ( RoutingListModel && )
delete

References RoutingListModel().

◆ ~RoutingListModel()

osmscout::RoutingListModel::~RoutingListModel ( )
override

Member Function Documentation

◆ availableVehicles()

Q_INVOKABLE QStringList osmscout::RoutingListModel::availableVehicles ( )
inline

◆ cancel

void osmscout::RoutingListModel::cancel ( )
slot

◆ clear

void osmscout::RoutingListModel::clear ( )
slot

References route.

Referenced by onRouteFailed(), routingProgress(), and setStartAndTarget().

◆ computingChanged

void osmscout::RoutingListModel::computingChanged ( )
signal

◆ data()

QVariant osmscout::RoutingListModel::data ( const QModelIndex & index,
int role ) const
override

References osmscout::RouteStep::data(), and route.

Referenced by operator=().

◆ flags()

Qt::ItemFlags osmscout::RoutingListModel::flags ( const QModelIndex & index) const
override

Referenced by operator=().

◆ get()

QObject * osmscout::RoutingListModel::get ( int row) const

References route.

Referenced by operator=().

◆ getRoute()

QObject * osmscout::RoutingListModel::getRoute ( ) const
inline

References route.

◆ getRouteDuration()

double osmscout::RoutingListModel::getRouteDuration ( ) const

Route duration in seconds.

Returns

References osmscout::DurationAsSeconds(), and route.

Referenced by operator=().

◆ getRouteLength()

double osmscout::RoutingListModel::getRouteLength ( ) const

Route length in meters.

Returns

References route.

Referenced by operator=().

◆ getRouteWay()

OverlayWay * osmscout::RoutingListModel::getRouteWay ( )
inline

References route.

◆ isReady()

bool osmscout::RoutingListModel::isReady ( )
inline

References isReady().

Referenced by isReady().

◆ locationEntryFromPosition()

Q_INVOKABLE QObject * osmscout::RoutingListModel::locationEntryFromPosition ( double lat,
double lon,
QString label = "" )
inline

Create LocationEntry from geographic coordinate with optional label.

It may be used from QML when selecting route start/end via point on map.

◆ onRouteComputed

void osmscout::RoutingListModel::onRouteComputed ( QtRouteData route,
int requestId )
slot

References computingChanged(), and route.

Referenced by RoutingListModel(), and routingProgress().

◆ onRouteFailed

void osmscout::RoutingListModel::onRouteFailed ( QString reason,
int requestId )
slot

◆ onRoutingProgress

void osmscout::RoutingListModel::onRoutingProgress ( int percent,
int requestId )
slot

◆ operator=() [1/2]

RoutingListModel & osmscout::RoutingListModel::operator= ( const RoutingListModel & )
delete

References RoutingListModel().

◆ operator=() [2/2]

RoutingListModel & osmscout::RoutingListModel::operator= ( RoutingListModel && )
delete

◆ roleNames()

QHash< int, QByteArray > osmscout::RoutingListModel::roleNames ( ) const
override

References osmscout::RouteStep::roleNames().

Referenced by operator=().

◆ routeFailed

void osmscout::RoutingListModel::routeFailed ( QString reason)
signal

References routeFailed().

Referenced by onRouteFailed(), and routeFailed().

◆ routeRequest

void osmscout::RoutingListModel::routeRequest ( LocationEntryRef start,
LocationEntryRef target,
QmlRoutingProfileRef profile,
int requestId,
osmscout::BreakerRef breaker,
std::optional< osmscout::Bearing > bearing )
signal

◆ routingProgress

void osmscout::RoutingListModel::routingProgress ( int percent)
signal

◆ rowCount()

int osmscout::RoutingListModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
override

References route.

Referenced by operator=().

◆ setStartAndTarget [1/2]

void osmscout::RoutingListModel::setStartAndTarget ( LocationEntry * start,
LocationEntry * target,
QmlRoutingProfile * routingProfile,
double vehicleBearing = -1 )
slot

Compute new route.

Parameters
start
target
routingProfileprofile of the routing
vehicleBearingin radians, when negative, it is not taken into account

References cancel(), clear(), computingChanged(), osmscout::Bearing::Radians(), and routeRequest().

◆ setStartAndTarget [2/2]

void osmscout::RoutingListModel::setStartAndTarget ( LocationEntry * start,
LocationEntry * target,
QString vehicleStr = "car",
double vehicleBearing = -1 )
slot

Compute new route.

Parameters
start
target
vehicleStrpredefined vehicle string. It may be car|bicycle|foot
vehicleBearingin radians, when negative, it is not taken into account

References setStartAndTarget(), osmscout::vehicleBicycle, osmscout::vehicleCar, osmscout::vehicleFoot, and osmscout::vehicleStr().

Referenced by routingProgress(), and setStartAndTarget().

Property Documentation

◆ count

int osmscout::RoutingListModel::count
read

◆ duration

double osmscout::RoutingListModel::duration
read

◆ length

double osmscout::RoutingListModel::length
read

◆ ready

bool osmscout::RoutingListModel::ready
read

◆ route

QObject * osmscout::RoutingListModel::route
read

◆ routeWay

QObject * osmscout::RoutingListModel::routeWay
read

The documentation for this class was generated from the following files: