Updraft
1.0
Open source glider flight visualisation tool.
|
This class encapsulates all data related to one task. More...
#include <taskdata.h>
Public Member Functions | |
virtual | ~TaskData () |
QString | toXml () const |
TaskPoint * | getTaskPoint (int position) |
Find and return TaskPoint on specified position. | |
const TaskPoint * | getTaskPoint (int position) const |
Same as non-const getTaskPoint() | |
bool | fromXml (const QString &serialized) |
Tries to parse xml file. | |
bool | insertTaskPoint (TaskPoint *taskPoint, int position) |
Inserts new TaskPoint. | |
void | moveTaskPoint (int from, int to) |
Changes position of TaskPoint in sequence. | |
void | deleteTaskPoint (int position) |
Deletes TaskPoint on desired position. | |
int | size () const |
Return number of task points in this declaration. | |
void | setAddTaskPointButton (int position) |
Set the information about the checked add TaskPoint button. | |
int | getAddTaskPointButton () const |
Get the currently checked add TaskPoint button. | |
qreal | totalDistance () const |
Return length between all turn points in meters. | |
qreal | officialDistance () const |
Return the FAI official length of the track. | |
bool | isClosed () const |
Return true if the task is a closed course. | |
bool | isFaiTriangle () const |
Return true if the task is a valid FAI triangle. | |
qreal | distance (int i, int j) const |
Returns shortest distance from turn point i to turn point j. | |
qreal | distanceAzimuth (int i, int j, qreal *azimuth) const |
Returns shortest distance from turn point i to turn point j and optionally azimuths i to j and j to i. | |
Private Types | |
typedef QVector< TaskPoint * > | PointsContainer |
Private Member Functions | |
TaskData () | |
Only DataHistory objects can create TaskData. | |
qreal | distanceReduction (int i) const |
Return the distance reduction of this task point caused by the use of FAI cylinders. | |
float | faiTriangleDistance () const |
Calculate official distance, or -1 if the task is not a FAI triangle. | |
TaskData (const TaskData &taskData) | |
Only DataHistory objects can make copies of TaskData. | |
Private Attributes | |
PointsContainer | taskPoints |
Ordered sequence of TaskPoints. | |
int | selectedAddButton |
Selected add TaskPoint button in the gui. | |
Friends | |
class | DataHistory |
This class encapsulates all data related to one task.
It can be used only with DataHistory and TaskFile. These three classes together form a Memento design pattern.
typedef QVector<TaskPoint*> Updraft::TaskData::PointsContainer [private] |
Updraft::TaskData::~TaskData | ( | ) | [virtual] |
Updraft::TaskData::TaskData | ( | ) | [inline, private] |
Only DataHistory objects can create TaskData.
Updraft::TaskData::TaskData | ( | const TaskData & | taskData | ) | [private] |
Only DataHistory objects can make copies of TaskData.
void Updraft::TaskData::deleteTaskPoint | ( | int | position | ) |
qreal Updraft::TaskData::distance | ( | int | i, |
int | j | ||
) | const |
Returns shortest distance from turn point i to turn point j.
Doesn't do any checks on the values i,j.
qreal Updraft::TaskData::distanceAzimuth | ( | int | i, |
int | j, | ||
qreal * | azimuth | ||
) | const |
Returns shortest distance from turn point i to turn point j and optionally azimuths i to j and j to i.
Doesn't do any checks on the values i,j.
i | Index of the first turn-point | |
j | Index of the second turn-point | |
[out] | azimuth | azimuth from point i to j |
qreal Updraft::TaskData::distanceReduction | ( | int | i | ) | const [private] |
Return the distance reduction of this task point caused by the use of FAI cylinders.
This reduction must be used twice for task points inside the track (that are entered and left).
float Updraft::TaskData::faiTriangleDistance | ( | ) | const [private] |
Calculate official distance, or -1 if the task is not a FAI triangle.
bool Updraft::TaskData::fromXml | ( | const QString & | serialized | ) |
Tries to parse xml file.
If it fails, TaskData is empty.
serialized | string with xml file content |
int Updraft::TaskData::getAddTaskPointButton | ( | ) | const |
Get the currently checked add TaskPoint button.
TaskPoint * Updraft::TaskData::getTaskPoint | ( | int | position | ) |
const TaskPoint * Updraft::TaskData::getTaskPoint | ( | int | position | ) | const |
Same as non-const getTaskPoint()
bool Updraft::TaskData::insertTaskPoint | ( | TaskPoint * | taskPoint, |
int | position | ||
) |
bool Updraft::TaskData::isClosed | ( | ) | const |
Return true if the task is a closed course.
This function accepts a endpoints located at most 500 m from start points. This is a bit broader definition than FAI rules has, but shouldn't be too much trouble.
bool Updraft::TaskData::isFaiTriangle | ( | ) | const |
Return true if the task is a valid FAI triangle.
void Updraft::TaskData::moveTaskPoint | ( | int | from, |
int | to | ||
) |
qreal Updraft::TaskData::officialDistance | ( | ) | const |
Return the FAI official length of the track.
void Updraft::TaskData::setAddTaskPointButton | ( | int | position | ) |
int Updraft::TaskData::size | ( | ) | const [inline] |
Return number of task points in this declaration.
qreal Updraft::TaskData::totalDistance | ( | ) | const |
Return length between all turn points in meters.
QString Updraft::TaskData::toXml | ( | ) | const |
friend class DataHistory [friend] |
int Updraft::TaskData::selectedAddButton [private] |
Selected add TaskPoint button in the gui.
If it is -1, it means that no button is selected
PointsContainer Updraft::TaskData::taskPoints [private] |
Ordered sequence of TaskPoints.