LinearGenerator.h 1.52 KB
Newer Older
1 2 3 4
#include "GeneratorBase.h"

#include <QGeoCoordinate>

5 6
#include "SettingsFact.h"

7 8 9
class MeasurementArea;
class SafeArea;

10 11 12 13 14 15 16 17 18 19 20 21
namespace routing {

class LinearGenerator : public GeneratorBase {
  Q_OBJECT
public:
  LinearGenerator(QObject *parent = nullptr);
  LinearGenerator(Data d, QObject *parent = nullptr);

  Q_PROPERTY(Fact *distance READ distance CONSTANT)
  Q_PROPERTY(Fact *alpha READ alpha CONSTANT)
  Q_PROPERTY(Fact *minLength READ minLength CONSTANT)

22 23
  virtual QString editorQml() const override;
  virtual QString mapVisualQml() const override;
24

25 26
  virtual QString abbreviation() const override;
  virtual QString type() const override;
27

28
  virtual bool get(Work &generator) override;
29

30 31 32 33 34 35 36 37 38
  //!
  //! \brief save Saves the generator.
  //! \param obj Json object for saveing.
  //! \return Returns true on success, false either.
  //!
  //! Saves distance, alpha and minLength.
  //! \note This methode does not save the data.
  //!
  virtual bool save(QJsonObject &obj) const override;
39
  virtual bool load(const QJsonObject &obj, QString &errorString) override;
40

41 42 43 44 45
  Fact *distance();
  Fact *alpha();
  Fact *minLength();

  static const char *settingsGroup;
46
  static const char *typeString;
47

48
private slots:
49
  void onAreaListChanged();
50 51 52 53
  void onDataChanged();

private:
  void init();
54
  void setMeasurementArea(MeasurementArea *area);
55 56 57 58 59

  QMap<QString, FactMetaData *> _metaDataMap;
  SettingsFact _distance;
  SettingsFact _alpha;
  SettingsFact _minLength;
60 61
  MeasurementArea *_measurementArea;
  SafeArea *_safeArea;
62 63 64
};

} // namespace routing