libosmscout 1.1.1
Loading...
Searching...
No Matches
VehiclePosition.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_VEHICLEPOSITION_H
2#define OSMSCOUT_CLIENT_QT_VEHICLEPOSITION_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2019 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
27
28#include <QObject>
29
30#include <memory>
31#include <optional>
32
33namespace osmscout {
34
41{
42 Q_OBJECT
43
44 Q_PROPERTY(double lat READ getLat CONSTANT)
45 Q_PROPERTY(double lon READ getLon CONSTANT)
46 Q_PROPERTY(double bearing READ getBearingRadians CONSTANT)
47
48public:
49 explicit VehiclePosition(QObject *parent = nullptr) :
50 QObject(parent)
51 {}
52
53 VehiclePosition(const Vehicle& vehicle,
54 const PositionAgent::PositionState& state,
55 const GeoCoord& coord,
56 const std::optional<Bearing>& bearing,
57 const std::optional<GeoCoord>& nextStepCoord,
58 QObject* parent=nullptr)
59 :
60 QObject(parent),
61 vehicle(vehicle),
62 state(state),
63 coord(coord),
65 nextStepCoord(nextStepCoord)
66 {}
67
69 {
70 vehicle=o.vehicle;
71 state=o.state;
72 coord=o.coord;
74 nextStepCoord=o.nextStepCoord;
75 return *this;
76 }
77
78 double getLat() const
79 {
80 return coord.GetLat();
81 }
82
83 double getLon() const
84 {
85 return coord.GetLon();
86 }
87
88 GeoCoord getCoord() const
89 {
90 return coord;
91 }
92
93 std::optional<Bearing> getBearing() const
94 {
95 return bearing;
96 }
97
98 double getBearingRadians() const
99 {
100 return bearing ? bearing->AsRadians() : 0;
101 }
102
103 std::optional<GeoCoord> getNextStepCoord() const
104 {
105 return nextStepCoord;
106 }
107
108 PositionAgent::PositionState getState() const
109 {
110 return state;
111 }
112
113private:
114 Vehicle vehicle;
115 PositionAgent::PositionState state;
116 GeoCoord coord;
117 std::optional<Bearing> bearing;
118 std::optional<GeoCoord> nextStepCoord;
119};
120
121}
122
123#endif //OSMSCOUT_CLIENT_QT_VEHICLEPOSITION_H
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
std::optional< GeoCoord > getNextStepCoord() const
Definition VehiclePosition.h:103
double getLon() const
Definition VehiclePosition.h:83
PositionAgent::PositionState getState() const
Definition VehiclePosition.h:108
VehiclePosition & operator=(const VehiclePosition &o)
Definition VehiclePosition.h:68
double getBearingRadians() const
Definition VehiclePosition.h:98
double lon
Definition VehiclePosition.h:45
double bearing
Definition VehiclePosition.h:46
double getLat() const
Definition VehiclePosition.h:78
double lat
Definition VehiclePosition.h:44
GeoCoord getCoord() const
Definition VehiclePosition.h:88
VehiclePosition(QObject *parent=nullptr)
Definition VehiclePosition.h:49
std::optional< Bearing > getBearing() const
Definition VehiclePosition.h:93
VehiclePosition(const Vehicle &vehicle, const PositionAgent::PositionState &state, const GeoCoord &coord, const std::optional< Bearing > &bearing, const std::optional< GeoCoord > &nextStepCoord, QObject *parent=nullptr)
Definition VehiclePosition.h:53
Definition Area.h:39
Vehicle
Definition OSMScoutTypes.h:55