KDE 4.7 PyKDE API Reference

- KDE's Python API

# RoutingModel Class Reference

`from PyKDE4.marble import *`

Inherits: QAbstractListModel → QAbstractItemModel → QObject
Namespace: Marble

## Detailed Description

## Enumerations

RoutingModelRoles | { CoordinateRole, TurnTypeIconRole, LongitudeRole, LatitudeRole }

## Signals

| currentRouteChanged ()
| deviatedFromRoute (bool deviated)
| positionChanged ()

## Methods

| __init__ (self, Marble.RouteRequest request, Marble.MarbleModel model, QObject parent=0)
| clear (self)
QVariant | data (self, QModelIndex index, int role=Qt.DisplayRole)
bool | deviatedFromRoute (self)
| exportGpx (self, QIODevice device)
QVariant | headerData (self, int section, Qt::Orientation orientation, int role=Qt.DisplayRole)
int | rightNeighbor (self, Marble.GeoDataCoordinates position, RouteRequestconst route)
Marble.Route | route (self)
int | rowCount (self, QModelIndex parent=QModelIndex())
bool | setCurrentRoute (self, Marble.GeoDataDocument document)
| updatePosition (self, Marble.GeoDataCoordinates a0, float a1)

## Signal Documentation

currentRouteChanged | ( |  | ) |

A different route was loaded

Signal syntax:
  `QObject.connect(source, SIGNAL("currentRouteChanged()"), target_slot)`

deviatedFromRoute | ( | bool | deviated
| ) |  |  |

returns whether the gps location is on route

Signal syntax:
  `QObject.connect(source, SIGNAL("deviatedFromRoute(bool)"), target_slot)`

positionChanged | ( |  | ) |

emits a signal regarding information about total time( seconds ) and distance( metres ) remaining to reach destination

Signal syntax:
  `QObject.connect(source, SIGNAL("positionChanged()"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | Marble.RouteRequest | request,
|  | Marble.MarbleModel | model,
|  | QObject | parent=0
| ) |  |  |

Constructor

clear | ( |  | self ) |

Clear any data held in the model

QVariant data | ( | self, |
|  | QModelIndex | index,
|  | int | role=Qt.DisplayRole
| ) |  |  |

Overload of QAbstractListModel

bool deviatedFromRoute | ( |  | self ) |

returns whether the gps location is on route

exportGpx | ( | self, |
|  | QIODevice | device
| ) |  |  |

Export waypoints and instructions in gpx format

QVariant headerData | ( | self, |
|  | int | section,
|  | Qt::Orientation | orientation,
|  | int | role=Qt.DisplayRole
| ) |  |  |

Overload of QAbstractListModel

int rightNeighbor | ( | self, |
|  | Marble.GeoDataCoordinates | position,
|  | RouteRequestconst | route
| ) |  |  |

Maps points from the provided route request to waypoints in the model according to their global minimal distance. Returns the right neighbor (next route request item along the waypoints) of the provided position. Provided route must not be null.

Returns:
  -1 If the provided route is empty, the index of the right neighbor along the waypoints otherwise (result is a valid RouteRequest index in that case)

Marble.Route route | ( |  | self ) |

int rowCount | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Overload of QAbstractListModel

bool setCurrentRoute | ( | self, |
|  | Marble.GeoDataDocument | document
| ) |  |  |

Old data in the model is discarded, the parsed content of the provided document is used as the new model data and a model reset is done

updatePosition | ( | self, |
|  | Marble.GeoDataCoordinates | a0,
|  | float | a1
| ) |  |  |

## Enumeration Documentation

RoutingModelRoles

Enumerator:

  CoordinateRole = Qt::UserRole+3 |
  TurnTypeIconRole |
  LongitudeRole |
  LatitudeRole |