119 mutable std::mutex stateMutex;
125 std::thread nodeWorkerThread;
128 std::thread wayWorkerThread;
131 std::thread wayLowZoomWorkerThread;
134 std::thread areaWorkerThread;
137 std::thread areaLowZoomWorkerThread;
140 std::thread routeWorkerThread;
143 std::map<CallbackId,TileStateCallback> tileStateCallbacks;
144 mutable std::mutex callbackMutex;
150 const Magnification& magnification)
const;
153 const TypeInfoSet& nodeTypes,
154 const GeoBox& boundingBox,
159 const TypeInfoSet& areaTypes,
160 const Magnification& magnification,
161 const GeoBox& boundingBox,
166 const TypeInfoSet& areaTypes,
167 const Magnification& magnification,
168 const GeoBox& boundingBox,
173 const TypeInfoSet& wayTypes,
174 const Magnification& magnification,
175 const GeoBox& boundingBox,
180 const TypeInfoSet& wayTypes,
181 const GeoBox& boundingBox,
186 const TypeInfoSet& routes,
187 const GeoBox& boundingBox,
191 template<
typename Object,
typename AreaObjectIndex,
typename ObjectByOffsetFn>
193 const TypeInfoSet& types,
194 const GeoBox& boundingBox,
198 AreaObjectIndex areaObjectIndex,
199 ObjectByOffsetFn objectByOffsetFn,
200 const std::string_view &objectTypeName,
201 const std::string_view &objectTypeNamePl)
const
203 if (!areaObjectIndex) {
215 TypeInfoSet cachedTypes(tileData.
GetTypes());
216 TypeInfoSet requestedTypes(types);
217 TypeInfoSet loadedTypes;
218 std::vector<FileOffset> offsets;
220 if (!cachedTypes.Empty()) {
221 requestedTypes.Remove(cachedTypes);
224 if (!requestedTypes.Empty()) {
225 if (!areaObjectIndex->GetOffsets(boundingBox,
229 log.
Error() <<
"Error getting " << objectTypeNamePl <<
" from area " << objectTypeName <<
" index!";
237 if (!offsets.empty()) {
239 std::sort(offsets.begin(),offsets.end());
245 std::vector<Object> objects;
247 if (!objectByOffsetFn(offsets, objects)) {
248 log.
Error() <<
"Error reading " << objectTypeNamePl <<
" in area!";
260 if (cachedTypes.Empty()){
261 tileData.
SetData(loadedTypes, std::move(objects));
263 tileData.
AddData(loadedTypes, objects);
273 NotifyTileStateCallbacks(tile);
278 void NodeWorkerLoop();
279 void WayWorkerLoop();
280 void WayLowZoomWorkerLoop();
281 void AreaWorkerLoop();
282 void AreaLowZoomWorkerLoop();
283 void RouteWorkerLoop();
285 std::future<bool> PushNodeTask(
const AreaSearchParameter& parameter,
286 const TypeInfoSet& nodeTypes,
287 const GeoBox& boundingBox,
289 const TileRef& tile)
const;
291 std::future<bool> PushAreaLowZoomTask(
const AreaSearchParameter& parameter,
292 const TypeInfoSet& areaTypes,
293 const Magnification& magnification,
294 const GeoBox& boundingBox,
296 const TileRef& tile)
const;
298 std::future<bool> PushAreaTask(
const AreaSearchParameter& parameter,
299 const TypeInfoSet& areaTypes,
300 const Magnification& magnification,
301 const GeoBox& boundingBox,
303 const TileRef& tile)
const;
305 std::future<bool> PushWayLowZoomTask(
const AreaSearchParameter& parameter,
306 const TypeInfoSet& wayTypes,
307 const Magnification& magnification,
308 const GeoBox& boundingBox,
310 const TileRef& tile)
const;
312 std::future<bool> PushWayTask(
const AreaSearchParameter& parameter,
313 const TypeInfoSet& wayTypes,
314 const GeoBox& boundingBox,
316 const TileRef& tile)
const;
318 std::future<bool> PushRouteTask(
const AreaSearchParameter& parameter,
319 const TypeInfoSet& routeTypes,
320 const GeoBox& boundingBox,
322 const TileRef& tile)
const;
324 void NotifyTileStateCallbacks(
const TileRef& tile)
const;
326 bool LoadMissingTileDataStyleSheet(
const AreaSearchParameter& parameter,
327 const StyleConfig& styleConfig,
328 std::list<TileRef>& tiles,
331 bool LoadMissingTileDataTypeDefinition(
const AreaSearchParameter& parameter,
332 const Magnification& magnification,
333 const TypeDefinition& typeDefinition,
334 std::list<TileRef>& tiles,
350 const GeoBox& boundingBox,
351 std::list<TileRef>& tiles)
const;
354 std::list<TileRef>& tiles)
const;
360 std::list<TileRef>& tiles)
const;
364 std::list<TileRef>& tiles)
const;
367 const Magnification& magnification,
368 const TypeDefinition& typeDefinition,
369 std::list<TileRef>& tiles)
const;
372 const Magnification& magnification,
373 const TypeDefinition& typeDefinition,
374 std::list<TileRef>& tiles)
const;
377 MapData& data)
const;
380 const TypeDefinition& typeDefinition,
381 MapData& data)
const;
384 std::list<GroundTile>& tiles)
const;
387 const Magnification& magnification,
388 std::list<GroundTile>& tiles)
const;