1 #ifndef OSMSCOUT_NAVIGATION_DATA_AGENT_H 2 #define OSMSCOUT_NAVIGATION_DATA_AGENT_H 33 std::map<FileOffset,WayRef>
ways;
34 std::map<FileOffset,AreaRef>
areas;
39 std::map<DatabaseId, RoutableDBObjects>
dbMap;
55 RoutableObjectsRequestMessage(
const Timestamp& timestamp,
const GeoBox &bbox);
70 template <
typename DataLoader>
74 std::map<std::string,DatabaseId> databaseMapping;
76 DataLoader &dataLoader;
80 dataLoader(mapServiceProvider)
87 auto result=std::list<NavigationMessageRef>();
89 if (
auto* routeUpdateMessage = dynamic_cast<RouteUpdateMessage *>(message.get());
90 routeUpdateMessage !=
nullptr) {
92 databaseMapping.clear();
94 for (
auto &e:routeUpdateMessage->routeDescription->GetDatabaseMapping()){
95 databaseMapping[e.second]=e.first;
97 vehicle=routeUpdateMessage->vehicle;
98 }
else if (
auto* requestMessage = dynamic_cast<RoutableObjectsRequestMessage*>(message.get());
99 requestMessage !=
nullptr) {
101 if (databaseMapping.empty()){
106 requestMessage->bbox.GetMaxCoord()) >
Kilometers(2)){
107 log.
Warn() <<
"Requested routable data from huge region: " << requestMessage->bbox.GetDisplayText();
110 auto msg=std::make_shared<RoutableObjectsMessage>(requestMessage->timestamp, std::make_shared<RoutableObjects>());
112 dataLoader.loadRoutableObjects(requestMessage->bbox,
119 result.push_back(msg);
std::chrono::system_clock::time_point Timestamp
Definition: Time.h:27
Definition: OSMScoutTypes.h:59
Definition: DataAgent.h:30
OSMSCOUT_API Distance GetSphericalDistance(const GeoCoord &a, const GeoCoord &b)
Vehicle
Definition: OSMScoutTypes.h:55
Definition: DataAgent.h:37
std::shared_ptr< Way > WayRef
Definition: Way.h:202
Distance Kilometers(double km)
Definition: Distance.h:362
std::map< FileOffset, WayRef > ways
Definition: DataAgent.h:33
GeoBox bbox
Definition: DataAgent.h:40
std::shared_ptr< RoutableObjectsMessage > RoutableObjectsMessageRef
Definition: DataAgent.h:68
std::list< NavigationMessageRef > Process(const NavigationMessageRef &message) override
Definition: DataAgent.h:85
std::shared_ptr< Area > AreaRef
Definition: Area.h:358
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
std::map< DatabaseId, RoutableDBObjects > dbMap
Definition: DataAgent.h:39
GeoBox bbox
Precomputed (cache) bounding box.
Definition: DataAgent.h:53
RoutableObjectsRef data
Definition: DataAgent.h:63
std::map< FileOffset, AreaRef > areas
Definition: DataAgent.h:34
Log & Warn(bool state)
Definition: Logger.h:462
std::shared_ptr< RoutableObjects > RoutableObjectsRef
Definition: DataAgent.h:49
DataAgent(DataLoader &mapServiceProvider)
Definition: DataAgent.h:79
std::shared_ptr< NavigationMessage > NavigationMessageRef
Definition: Engine.h:56
std::shared_ptr< TypeConfig > TypeConfigRef
Definition: TypeConfig.h:1227
TypeConfigRef typeConfig
Definition: DataAgent.h:32
uint32_t DatabaseId
Definition: DBFileOffset.h:30