EditPositionDialogController.h 2.56 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

#include <QObject>
#include <QGeoCoordinate>

#include "FactSystem.h"

class EditPositionDialogController : public QObject
{
    Q_OBJECT
    
public:
    EditPositionDialogController(void);
    
    Q_PROPERTY(QGeoCoordinate   coordinate  READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
    Q_PROPERTY(Fact*            latitude    READ latitude                       CONSTANT)
    Q_PROPERTY(Fact*            longitude   READ longitude                      CONSTANT)
    Q_PROPERTY(Fact*            zone        READ zone                           CONSTANT)
    Q_PROPERTY(Fact*            hemisphere  READ hemisphere                     CONSTANT)
    Q_PROPERTY(Fact*            easting     READ easting                        CONSTANT)
    Q_PROPERTY(Fact*            northing    READ northing                       CONSTANT)
31
    Q_PROPERTY(Fact*            mgrs        READ mgrs                           CONSTANT)
32 33 34 35 36 37 38 39

    QGeoCoordinate  coordinate(void) const { return _coordinate; }
    Fact* latitude  (void) { return &_latitudeFact; }
    Fact* longitude (void) { return &_longitudeFact; }
    Fact* zone      (void) { return &_zoneFact; }
    Fact* hemisphere(void) { return &_hemisphereFact; }
    Fact* easting   (void) { return &_eastingFact; }
    Fact* northing  (void) { return &_northingFact; }
40
    Fact* mgrs      (void) { return &_mgrsFact; }
41 42 43 44 45 46

    void setCoordinate(QGeoCoordinate coordinate);

    Q_INVOKABLE void initValues(void);
    Q_INVOKABLE void setFromGeo(void);
    Q_INVOKABLE void setFromUTM(void);
47
    Q_INVOKABLE void setFromMGRS(void);
48
    Q_INVOKABLE void setFromVehicle(void);
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

signals:
    void coordinateChanged(QGeoCoordinate coordinate);

private:
    static QMap<QString, FactMetaData*> _metaDataMap;

    QGeoCoordinate _coordinate;

    Fact _latitudeFact;
    Fact _longitudeFact;
    Fact _zoneFact;
    Fact _hemisphereFact;
    Fact _eastingFact;
    Fact _northingFact;
64
    Fact _mgrsFact;
65 66 67 68 69 70 71

    static const char*  _latitudeFactName;
    static const char*  _longitudeFactName;
    static const char*  _zoneFactName;
    static const char*  _hemisphereFactName;
    static const char*  _eastingFactName;
    static const char*  _northingFactName;
72
    static const char*  _mgrsFactName;
73
};