KDE 4.7 PyKDE API Reference

- KDE's Python API

# AlternativeRoutesModel Class Reference

`from PyKDE4.marble import *`

Inherits: QAbstractListModel → QAbstractItemModel → QObject
Namespace: Marble

## Detailed Description

## Enumerations
WritePolicy | { Instant, Lazy }
## Signals
| currentRouteChanged (Marble.GeoDataDocument newRoute)
## Methods
| __init__ (self, QObject parent=0)
| addRoute (self, Marble.GeoDataDocument document, Marble.AlternativeRoutesModel.WritePolicy policy=Marble.AlternativeRoutesModel.Lazy)
| clear (self)
Marble.GeoDataDocument | currentRoute (self)
QVariant | data (self, QModelIndex index, int role=Qt.DisplayRole)
QVariant | headerData (self, int section, Qt::Orientation orientation, int role=Qt.DisplayRole)
| newRequest (self, Marble.RouteRequest request)
Marble.GeoDataDocument | route (self, int index)
int | rowCount (self, QModelIndex parent=QModelIndex())
| setCurrentRoute (self, int index)
## Static Methods
QVector | deviation (Marble.GeoDataDocument routeA, Marble.GeoDataDocument routeB)
float | distance (Marble.GeoDataCoordinates satellite, Marble.GeoDataCoordinates lineA, Marble.GeoDataCoordinates lineB)
Marble.GeoDataLineString | waypoints (Marble.GeoDataDocument document)

## Signal Documentation

currentRouteChanged | ( | Marble.GeoDataDocument | newRoute
| ) |  |  |

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

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent=0
| ) |  |  |

Constructor

addRoute | ( | self, |
|  | Marble.GeoDataDocument | document,
|  | Marble.AlternativeRoutesModel.WritePolicy | policy=Marble.AlternativeRoutesModel.Lazy
| ) |  |  |

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

Parameters:

  | document | The route to add
  | policy | In lazy mode (default), a short amount of time is waited for other addRoute() calls before adding the route to the model. Otherwise, the model is changed immediately.

clear | ( |  | self ) |

Remove all alternative routes from the model

Marble.GeoDataDocument currentRoute | ( |  | self ) |

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

Overload of QAbstractListModel

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

Overload of QAbstractListModel

newRequest | ( | self, |
|  | Marble.RouteRequest | request
| ) |  |  |

Invalidate the current alternative routes and prepare for new ones to arrive

Marble.GeoDataDocument route | ( | self, |
|  | int | index
| ) |  |  |

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

Overload of QAbstractListModel

setCurrentRoute | ( | self, |
|  | int | index
| ) |  |  |

## Static Method Documentation

QVector deviation | ( | Marble.GeoDataDocument | routeA,
|  | Marble.GeoDataDocument | routeB
| ) |  |  |

Returns the minimal distance of each waypoint of routeA to routeB

float distance | ( | Marble.GeoDataCoordinates | satellite,
|  | Marble.GeoDataCoordinates | lineA,
|  | Marble.GeoDataCoordinates | lineB
| ) |  |  |

Returns the distance between the given point and the given great circle path

Marble.GeoDataLineString waypoints | ( | Marble.GeoDataDocument | document
| ) |  |  |

Returns the waypoints contained in the route as a linestring

## Enumeration Documentation

WritePolicy

Enumerator:

  Instant |
  Lazy |