Settings.cpp 1.94 KB
Newer Older
1
#include "Settings.h"
2

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
WaypointManager::Settings::Settings()
    : _missionController(nullptr)
    , _isFlyView(true)
    , _arrivalReturnSpeed(5)
    , _flightSpeed(2)
    , _altitude(5)
{

}

bool WaypointManager::Settings::valid() const
{
    return    _missionController != nullptr
           && _homePosition.isValid();
}

void WaypointManager::Settings::setHomePosition(const QGeoCoordinate &c)
20 21 22
{
    _homePosition = c;
}
23 24 25 26 27 28 29

void WaypointManager::Settings::setMissionController(MissionController *controller)
{
    _missionController = controller;
}

void WaypointManager::Settings::setMasterController(PlanMasterController *controller)
30
{
31
    _masterController = controller;
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
}

void WaypointManager::Settings::setIsFlyView(bool isFlyView)
{
    _isFlyView = isFlyView;
}

void WaypointManager::Settings::setArrivalReturnSpeed(double speed)
{
    if (speed > 0)
        _arrivalReturnSpeed = speed;
}

void WaypointManager::Settings::setFlightSpeed(double speed)
{
    if ( speed > 0)
        _flightSpeed = speed;
}

void WaypointManager::Settings::setAltitude(double altitude)
{
    if ( altitude > 0)
        _altitude = altitude;
}

const QGeoCoordinate &WaypointManager::Settings::homePosition() const
{
    return _homePosition;
}

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
QGeoCoordinate &WaypointManager::Settings::homePosition()
{
    return _homePosition;
}

MissionController *WaypointManager::Settings::missionController() const
{
    return _missionController;
}

PlanMasterController *WaypointManager::Settings::masterController() const
{
    return _masterController;
}

77 78
Vehicle *WaypointManager::Settings::vehicle() const
{
79
    return _masterController->managerVehicle();
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
}

bool WaypointManager::Settings::isFlyView() const
{
    return _isFlyView;
}

double WaypointManager::Settings::arrivalReturnSpeed() const
{
    return _arrivalReturnSpeed;
}

double WaypointManager::Settings::flightSpeed() const
{
    return _flightSpeed;
}

double WaypointManager::Settings::altitude() const
{
    return _altitude;
}