libosmscout  1.1.1
RouteStateAgent.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_NAVIGATION_ROUTE_STATE_AGENT_H
2 #define OSMSCOUT_NAVIGATION_ROUTE_STATE_AGENT_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2018 Tim Teulings
7  Copyright (C) 2019 Lukas Karas
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
27 
28 #include <optional>
29 
30 namespace osmscout {
31 
35  struct OSMSCOUT_API RerouteRequestMessage CLASS_FINAL : public NavigationMessage
36  {
37  const GeoCoord from;
38  const std::optional<Bearing> initialBearing;
39  const GeoCoord to;
40 
41  RerouteRequestMessage(const Timestamp& timestamp,
42  const GeoCoord &from,
43  const std::optional<Bearing> &initialBearing,
44  const GeoCoord &to);
45  };
46 
47  struct OSMSCOUT_API TargetReachedMessage CLASS_FINAL : public NavigationMessage
48  {
49  const GeoCoord coord;
50  const GeoCoord target;
51  const Bearing targetBearing;
52  const Distance targetDistance;
53 
54  TargetReachedMessage(const Timestamp& timestamp,
55  const GeoCoord &coord,
56  const GeoCoord &target,
57  const Bearing &targetBearing,
58  const Distance &targetDistance);
59  };
60 
61  class OSMSCOUT_API RouteStateAgent CLASS_FINAL : public NavigationAgent
62  {
63  private:
64  Timestamp lastUpdate;
65  PositionAgent::PositionState state;
66  std::optional<Bearing> bearing;
67  GeoCoord target;
68  bool targetSetup{false};
69 
70  public:
71  explicit RouteStateAgent();
72  std::list<NavigationMessageRef> Process(const NavigationMessageRef& message) override;
73  };
74 }
75 #endif
std::chrono::system_clock::time_point Timestamp
Definition: Time.h:27
Definition: Area.h:86
const GeoCoord target
Definition: RouteStateAgent.h:50
const GeoCoord coord
Definition: RouteStateAgent.h:49
Definition: Area.h:38
const Distance targetDistance
Definition: RouteStateAgent.h:52
#define CLASS_FINAL
Definition: Compiler.h:26
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
const Bearing targetBearing
Definition: RouteStateAgent.h:51
const GeoCoord from
Definition: RouteStateAgent.h:37
Definition: Engine.h:78
std::shared_ptr< NavigationMessage > NavigationMessageRef
Definition: Engine.h:56
Definition: Engine.h:48
const std::optional< Bearing > initialBearing
Definition: RouteStateAgent.h:38
const GeoCoord to
Definition: RouteStateAgent.h:39