WimaController.cc 2.42 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1
#include "WimaController.h"
2

3 4 5
const char* WimaController::wimaFileExtension   = "wima";
const char* WimaController::areaItemsName       = "AreaItems";
const char* WimaController::missionItemsName    = "MissionItems";
6

7 8 9 10 11 12 13 14
WimaController::WimaController(QObject *parent)
    : QObject               (parent)
    , _readyForSaveSend     (false)
    , _container            (nullptr)
    , _joinedArea           (this)
    , _opArea               (this)
    , _serArea              (this)
    , _corridor             (this)
15
{
16

17 18
}

19
QmlObjectListModel* WimaController::visualItems()
20
{
21
    return &_visualItems;
22 23
}

Valentin Platzgummer's avatar
Valentin Platzgummer committed
24 25 26 27
QStringList WimaController::loadNameFilters() const
{
    QStringList filters;

28
    filters << tr("Supported types (*.%1 *.%2)").arg(wimaFileExtension).arg(AppSettings::planFileExtension) <<
Valentin Platzgummer's avatar
Valentin Platzgummer committed
29 30
               tr("All Files (*.*)");
    return filters;
31 32 33 34 35
}

QStringList WimaController::saveNameFilters() const
{
    QStringList filters;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
36

37 38
    filters << tr("Supported types (*.%1 *.%2)").arg(wimaFileExtension).arg(AppSettings::planFileExtension);
    return filters;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
39 40
}

41 42
QGeoCoordinate WimaController::joinedAreaCenter() const
{
43
    return _joinedArea.center();
44 45
}

46 47 48 49 50 51 52 53 54 55 56 57
void WimaController::setMasterController(PlanMasterController *masterC)
{
    _masterController = masterC;
    emit masterControllerChanged();
}

void WimaController::setMissionController(MissionController *missionC)
{
    _missionController = missionC;
    emit missionControllerChanged();
}

58 59
void WimaController::setDataContainer(WimaDataContainer *container)
{
60
    if (_container == nullptr && container != nullptr) {
61
        _container = container;
62
        pullFromContainer();
63 64 65 66 67 68 69

        emit dataContainerChanged();
    }
}

void WimaController::startWimaController(bool flyView)
{
70

71 72
}

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
void WimaController::startMission()
{

}

void WimaController::abortMission()
{

}

void WimaController::pauseMission()
{

}

void WimaController::resumeMission()
{

}

93 94
bool WimaController::updateMission()
{
95
    return true;
96 97
}

98
void WimaController::saveToCurrent()
99 100 101
{
}

102 103 104 105 106
void WimaController::saveToFile(const QString& filename)
{

}

107
bool WimaController::loadFromCurrent()
108
{
109
    return true;
110 111 112 113
}

bool WimaController::loadFromFile(const QString &filename)
{
114
    return true;
115 116 117
}


118

119
QJsonDocument WimaController::saveToJson(FileType fileType)
120 121 122 123
{

}

124 125 126 127 128 129 130 131
void WimaController::setReadyForSaveSend(bool ready)
{
    if (ready != _readyForSaveSend) {
        _readyForSaveSend = ready;
        emit readyForSaveSendChanged(ready);
    }
}

132 133


134 135