libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
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
23
#include <
osmscoutclientqt/ClientQtImportExport.h
>
24
25
#include <
osmscout/navigation/PositionAgent.h
>
26
#include <
osmscout/util/Bearing.h
>
27
28
#include <QObject>
29
30
#include <memory>
31
#include <optional>
32
33
namespace
osmscout
{
34
40
class
OSMSCOUT_CLIENT_QT_API
VehiclePosition
:
public
QObject
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
48
public:
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),
64
bearing
(
bearing
),
65
nextStepCoord(nextStepCoord)
66
{}
67
68
VehiclePosition
&
operator=
(
const
VehiclePosition
&o)
69
{
70
vehicle=o.vehicle;
71
state=o.state;
72
coord=o.coord;
73
bearing
=o.
bearing
;
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
113
private
:
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
Bearing.h
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
PositionAgent.h
osmscout::VehiclePosition::getNextStepCoord
std::optional< GeoCoord > getNextStepCoord() const
Definition
VehiclePosition.h:103
osmscout::VehiclePosition::getLon
double getLon() const
Definition
VehiclePosition.h:83
osmscout::VehiclePosition::getState
PositionAgent::PositionState getState() const
Definition
VehiclePosition.h:108
osmscout::VehiclePosition::operator=
VehiclePosition & operator=(const VehiclePosition &o)
Definition
VehiclePosition.h:68
osmscout::VehiclePosition::getBearingRadians
double getBearingRadians() const
Definition
VehiclePosition.h:98
osmscout::VehiclePosition::lon
double lon
Definition
VehiclePosition.h:45
osmscout::VehiclePosition::bearing
double bearing
Definition
VehiclePosition.h:46
osmscout::VehiclePosition::getLat
double getLat() const
Definition
VehiclePosition.h:78
osmscout::VehiclePosition::lat
double lat
Definition
VehiclePosition.h:44
osmscout::VehiclePosition::getCoord
GeoCoord getCoord() const
Definition
VehiclePosition.h:88
osmscout::VehiclePosition::VehiclePosition
VehiclePosition(QObject *parent=nullptr)
Definition
VehiclePosition.h:49
osmscout::VehiclePosition::getBearing
std::optional< Bearing > getBearing() const
Definition
VehiclePosition.h:93
osmscout::VehiclePosition::VehiclePosition
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
osmscout
Definition
Area.h:39
osmscout::Vehicle
Vehicle
Definition
OSMScoutTypes.h:55
Generated by
1.17.0