WimaMeasurementArea.h 2.59 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1
#pragma once
2

3
#include "QScopedPointer"
Valentin Platzgummer's avatar
Valentin Platzgummer committed
4
#include <QObject>
5

Valentin Platzgummer's avatar
Valentin Platzgummer committed
6
#include "WimaArea.h"
7

Valentin Platzgummer's avatar
Valentin Platzgummer committed
8
#include "SettingsFact.h"
9

Valentin Platzgummer's avatar
Valentin Platzgummer committed
10 11

class WimaMeasurementArea : public WimaArea
12
{
Valentin Platzgummer's avatar
Valentin Platzgummer committed
13
    Q_OBJECT
14
public:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
15 16
    WimaMeasurementArea(QObject* parent = nullptr);
    WimaMeasurementArea(const WimaMeasurementArea &other, QObject *parent = nullptr);
17
    WimaMeasurementArea &operator=(const WimaMeasurementArea &other);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
18

19 20 21
    Q_PROPERTY(Fact*                bottomLayerAltitude     READ bottomLayerAltitudeFact    CONSTANT)
    Q_PROPERTY(Fact*                numberOfLayers          READ numberOfLayersFact         CONSTANT)
    Q_PROPERTY(Fact*                layerDistance           READ layerDistanceFact          CONSTANT)
Valentin Platzgummer's avatar
Valentin Platzgummer committed
22 23 24 25 26 27 28 29 30 31 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

    // Overrides from WimaPolygon
    QString         mapVisualQML    (void) const { return "WimaMeasurementAreaMapVisual.qml";}
    QString         editorQML       (void) const { return "WimaMeasurementAreaEditor.qml";}

    // Property accessors
    Fact*           bottomLayerAltitudeFact (void)          { return &_bottomLayerAltitude;}
    Fact*           numberOfLayersFact      (void)          { return &_numberOfLayers;}
    Fact*           layerDistanceFact       (void)          { return &_layerDistance;}
    double          bottomLayerAltitude     (void) const    { return _bottomLayerAltitude.rawValue().toDouble();}
    int             numberOfLayers          (void) const    { return _numberOfLayers.rawValue().toInt();}
    double          layerDistance           (void) const    { return _layerDistance.rawValue().toDouble();}

    // Member Methodes
    void saveToJson(QJsonObject& json);
    bool loadFromJson(const QJsonObject& json, QString &errorString);

    // Friends
    friend void print(const WimaMeasurementArea& area, QString outputStr);
    friend void print(const WimaMeasurementArea& area);

    // Static Variables
    static const char* settingsGroup;
    static const char* bottomLayerAltitudeName;
    static const char* numberOfLayersName;
    static const char* layerDistanceName;
    static const char* WimaMeasurementAreaName;

signals:
    void bottomLayerAltitudeChanged     (void);
    void numberOfLayersChanged          (void);
    void layerDistanceChanged           (void);

public slots:
    void setBottomLayerAltitude (double altitude);
    void setNumberOfLayers      (double numLayers);
    void setLayerDistance       (double layerDistance);
59

Valentin Platzgummer's avatar
Valentin Platzgummer committed
60 61 62 63 64 65 66 67 68 69
private:
    // Member Methodes
    void init();

    // Members
    QMap<QString, FactMetaData*> _metaDataMap;

    SettingsFact            _bottomLayerAltitude;
    SettingsFact            _numberOfLayers;
    SettingsFact            _layerDistance;
70 71
};

Valentin Platzgummer's avatar
Valentin Platzgummer committed
72