KDE 4.9 PyKDE API Reference

- KDE's Python API

# GeoDataTrack Class Reference

`from PyKDE4.marble import *`

Inherits: Marble.GeoDataGeometry → Marble.GeoDataObject → Marble.GeoNode
Namespace: Marble

## Detailed Description

GeoDataTrack A geometry for tracking objects made of (time, coordinates) pairs

GeoDataTrack implements the Track tag defined in Google's extension of the Open Geospatial Consortium standard KML 2.2 at http://code.google.com/apis/kml/documentation/kmlreference.html#gxtrack .

A track is made of points, each point has a coordinates and a time value associated with the coordinates. New points can be added using the addPoint() method. The coordinates of the tracked object at a particular time can be found using coordinatesAt(), you can specify if interpolation should be used using the setInterpolate() function.

By default, a LineString that passes through every coordinates in the track is drawn. You can customize it by changing the GeoDataLineStyle, for example if the GeoDataTrack is the geometry of feature, you can disable the line drawing with:

     feature->style()->lineStyle().setPenStyle( Qt.NoPen );

For convenience, the methods appendCoordinates() and appendWhen() are provided. They let you add points by specifying their coordinates and time value separately. When N calls to one of these methods are followed by N calls to the other, the first coordinates will be matched with the first time value, the second coordinates with the second time value, etc. This follows the way "coord" and "when" tags inside the Track tag should be parsed.

## Methods
| __init__ (self)
| __init__ (self, Marble.GeoDataGeometry other)
| addPoint (self, QDateTime when, Marble.GeoDataCoordinates coord)
| appendAltitude (self, float altitude)
| appendCoordinates (self, Marble.GeoDataCoordinates coord)
| appendWhen (self, QDateTime when)
| clear (self)
Marble.GeoDataCoordinates | coordinatesAt (self, QDateTime when)
Marble.GeoDataCoordinates | coordinatesAt (self, int index)
[Marble.GeoDataCoordinates] | coordinatesList (self)
QDateTime | firstWhen (self)
Marble.EnumGeometryId | geometryId (self)
bool | interpolate (self)
QDateTime | lastWhen (self)
Marble.GeoDataLatLonAltBox | latLonAltBox (self)
Marble.GeoDataLineString | lineString (self)
QString | nodeType (self)
| pack (self, QDataStream stream)
| removeAfter (self, QDateTime when)
| removeBefore (self, QDateTime when)
| setInterpolate (self, bool on)
int | size (self)
| unpack (self, QDataStream stream)
[QDateTime] | whenList (self)

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | Marble.GeoDataGeometry | other
| ) |  |  |

addPoint | ( | self, |
|  | QDateTime | when,
|  | Marble.GeoDataCoordinates | coord
| ) |  |  |

Add a new point with coordinates coord associated with the time value when

appendAltitude | ( | self, |
|  | float | altitude
| ) |  |  |

Add altitude information to the last appended coordinates

appendCoordinates | ( | self, |
|  | Marble.GeoDataCoordinates | coord
| ) |  |  |

Add the coordinates part for a new point. See this class description for more information.

See also:
  appendWhen

appendWhen | ( | self, |
|  | QDateTime | when
| ) |  |  |

Add the time value part for a new point. See this class description for more information.

See also:
  appendCoordinates

clear | ( |  | self ) |

Remove all the points contained in the track.

Marble.GeoDataCoordinates coordinatesAt | ( | self, |
|  | QDateTime | when
| ) |  |  |

Return coordinates at specified index. This is useful when the track contains coordinates without time information.

Marble.GeoDataCoordinates coordinatesAt | ( | self, |
|  | int | index
| ) |  |  |

Return coordinates at specified index. This is useful when the track contains coordinates without time information.

[Marble.GeoDataCoordinates] coordinatesList | ( |  | self ) |

Returns the coordinates of all the points in the map, sorted by their time value

QDateTime firstWhen | ( |  | self ) |

Return the time value of the first point in the track, or an invalid QDateTime if the track is empty.

Marble.EnumGeometryId geometryId | ( |  | self ) |

bool interpolate | ( |  | self ) |

Returns true if coordinatesAt() should use interpolation, false otherwise. The default is false.

See also:
  setInterpolate, coordinatesAt

QDateTime lastWhen | ( |  | self ) |

Return the time value of the last point in the track, or an invalid QDateTime if the track is empty.

Marble.GeoDataLatLonAltBox latLonAltBox | ( |  | self ) |

Marble.GeoDataLineString lineString | ( |  | self ) |

Return the GeoDataLineString representing the current track

QString nodeType | ( |  | self ) |

pack | ( | self, |
|  | QDataStream | stream
| ) |  |  |

removeAfter | ( | self, |
|  | QDateTime | when
| ) |  |  |

Remove all points from the track whose time value is greater than when.

removeBefore | ( | self, |
|  | QDateTime | when
| ) |  |  |

Remove all points from the track whose time value is less than when.

setInterpolate | ( | self, |
|  | bool | on
| ) |  |  |

Set whether coordinatesAt() should use interpolation.

See also:
  interpolate, coordinatesAt

int size | ( |  | self ) |

Returns the number of points in the track

unpack | ( | self, |
|  | QDataStream | stream
| ) |  |  |

[QDateTime] whenList | ( |  | self ) |

Returns the time value of all the points in the map, in chronological order.