libosmscout 1.1.1
Loading...
Searching...
No Matches
QmlRoutingProfile.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_QMLROUTINGPROFILE_H
2#define OSMSCOUT_CLIENT_QT_QMLROUTINGPROFILE_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2021 Lukas Karas
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
24
28#include <osmscout/TypeConfig.h>
29
30#include <QObject>
31#include <QVariant>
32
33#include <cmath>
34
35namespace osmscout {
36
43 Q_OBJECT
44 Q_PROPERTY(QmlVehicle vehicle READ getQmlVehicle WRITE setVehicle NOTIFY update)
45 Q_PROPERTY(double maxSpeed READ getMaxSpeed WRITE setMaxSpeed NOTIFY update)
46 Q_PROPERTY(QVariantMap speedTable READ getSpeedTable WRITE setSpeedTable NOTIFY update)
47
49 // meters
50 Q_PROPERTY(double penaltySameType READ getPenaltySameType WRITE setPenaltySameType NOTIFY update)
51 // meters
53 // seconds
54 Q_PROPERTY(double maxPenalty READ getMaxPenalty WRITE setMaxPenalty NOTIFY update)
55
56public:
57 // enums fields exported to qml have to start with uppercase...
64
66
67signals:
68 void update();
69
70public:
71 Q_INVOKABLE explicit QmlRoutingProfile(QObject *parent = nullptr);
73 ~QmlRoutingProfile() override = default;
74
77
81
82 double getMaxSpeed() const;
83 void setMaxSpeed(double);
84
85 QVariantMap getSpeedTable() const;
86 void setSpeedTable(const QVariantMap &);
87
88 bool getJunctionPenalty() const;
90
91 double getPenaltySameType() const;
92 void setPenaltySameType(double);
93
96
97 double getMaxPenalty() const;
98 void setMaxPenalty(double);
99
101
102private:
103 void setDefaults();
104
105private:
107 double maxSpeed=160;
108 std::map<std::string,SpeedVariant> speedTable;
109 bool applyJunctionPenalty=true;
110 Distance costLimitDistance=Kilometers(20);
111 double costLimitFactor=7.5;
112 osmscout::Distance penaltySameType=Meters(160);
113 osmscout::Distance penaltyDifferentType=Meters(250);
114 std::chrono::seconds maxPenalty=std::chrono::seconds(10);
115};
116
117using QmlRoutingProfileRef = std::shared_ptr<QmlRoutingProfile>;
118
119}
120
121Q_DECLARE_METATYPE(osmscout::QmlRoutingProfileRef)
122
123#endif //OSMSCOUT_CLIENT_QT_QMLROUTINGPROFILE_H
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Q_INVOKABLE QmlRoutingProfile(QObject *parent=nullptr)
double penaltyDifferentType
Definition QmlRoutingProfile.h:52
double getPenaltySameType() const
void setSpeedTable(const QVariantMap &)
double getPenaltyDifferentType() const
QmlVehicle
Definition QmlRoutingProfile.h:59
@ FootVehicle
Definition QmlRoutingProfile.h:60
@ BicycleVehicle
Definition QmlRoutingProfile.h:61
@ CarVehicle
Definition QmlRoutingProfile.h:62
Vehicle getVehicle() const
QmlVehicle getQmlVehicle() const
QVariantMap speedTable
Definition QmlRoutingProfile.h:46
bool applyJunctionPenalty
Definition QmlRoutingProfile.h:48
double maxSpeed
Definition QmlRoutingProfile.h:45
~QmlRoutingProfile() override=default
QmlRoutingProfile & operator=(const QmlRoutingProfile &other)
RoutingProfileRef MakeInstance(TypeConfigRef typeConfig) const
double maxPenalty
Definition QmlRoutingProfile.h:54
QmlRoutingProfile(const QmlRoutingProfile &other)
QVariantMap getSpeedTable() const
void setPenaltyDifferentType(double)
double penaltySameType
Definition QmlRoutingProfile.h:50
double getMaxPenalty() const
void setVehicle(QmlVehicle vehicle)
QmlRoutingProfile(Vehicle vehicle)
QmlVehicle vehicle
Definition QmlRoutingProfile.h:44
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
Definition Area.h:39
Distance Meters(double m)
Definition Distance.h:358
std::shared_ptr< RoutingProfile > RoutingProfileRef
Definition RoutingProfile.h:182
Distance Kilometers(double km)
Definition Distance.h:362
std::shared_ptr< QmlRoutingProfile > QmlRoutingProfileRef
Definition QmlRoutingProfile.h:117
Vehicle
Definition OSMScoutTypes.h:55
@ vehicleBicycle
Definition OSMScoutTypes.h:57
@ vehicleFoot
Definition OSMScoutTypes.h:56
@ vehicleCar
Definition OSMScoutTypes.h:58