bool DBThread::TransformRouteDataToPoints(osmscout::Vehicle vehicle, const osmscout::RouteData& data, std::list<osmscout::Point>& points) { QMutexLocker locker(&mutex); if (!AssureRouter(vehicle)) { return false; } return router->TransformRouteDataToPoints(data, points); }
bool DBThread::TransformRouteDataToWay(osmscout::Vehicle vehicle, const osmscout::RouteData& data, osmscout::Way& way) { QMutexLocker locker(&mutex); if (!AssureRouter(vehicle)) { return false; } return router->TransformRouteDataToWay(data,way); }
bool DBThread::TransformRouteDataToRouteDescription(osmscout::Vehicle vehicle, const osmscout::RoutingProfile& routingProfile, const osmscout::RouteData& data, osmscout::RouteDescription& description, const std::string& start, const std::string& target) { QMutexLocker locker(&mutex); if (!AssureRouter(vehicle)) { return false; } if (!router->TransformRouteDataToRouteDescription(data,description)) { return false; } osmscout::TypeConfig *typeConfig=router->GetTypeConfig(); std::list<osmscout::RoutePostprocessor::PostprocessorRef> postprocessors; postprocessors.push_back(new osmscout::RoutePostprocessor::DistanceAndTimePostprocessor()); postprocessors.push_back(new osmscout::RoutePostprocessor::StartPostprocessor(start)); postprocessors.push_back(new osmscout::RoutePostprocessor::TargetPostprocessor(target)); postprocessors.push_back(new osmscout::RoutePostprocessor::WayNamePostprocessor()); postprocessors.push_back(new osmscout::RoutePostprocessor::CrossingWaysPostprocessor()); postprocessors.push_back(new osmscout::RoutePostprocessor::DirectionPostprocessor()); osmscout::RoutePostprocessor::InstructionPostprocessor *instructionProcessor=new osmscout::RoutePostprocessor::InstructionPostprocessor(); instructionProcessor->AddMotorwayType(typeConfig->GetWayTypeId("highway_motorway")); instructionProcessor->AddMotorwayLinkType(typeConfig->GetWayTypeId("highway_motorway_link")); instructionProcessor->AddMotorwayType(typeConfig->GetWayTypeId("highway_motorway_trunk")); instructionProcessor->AddMotorwayType(typeConfig->GetWayTypeId("highway_trunk")); instructionProcessor->AddMotorwayLinkType(typeConfig->GetWayTypeId("highway_trunk_link")); instructionProcessor->AddMotorwayType(typeConfig->GetWayTypeId("highway_motorway_primary")); postprocessors.push_back(instructionProcessor); if (!routePostprocessor.PostprocessRouteDescription(description, routingProfile, database, postprocessors)) { return false; } return true; }
bool DBThread::GetClosestRoutableNode(double lat, double lon, const osmscout::Vehicle& vehicle, double radius, osmscout::ObjectFileRef& object, size_t& nodeIndex) { QMutexLocker locker(&mutex); if (!AssureRouter(vehicle)) { return false; } object.Invalidate(); return router->GetClosestRoutableNode(lat, lon, vehicle, radius, object, nodeIndex); }
bool DBThread::CalculateRoute(osmscout::Vehicle vehicle, const osmscout::RoutingProfile& routingProfile, const osmscout::ObjectFileRef& startObject, size_t startNodeIndex, const osmscout::ObjectFileRef targetObject, size_t targetNodeIndex, osmscout::RouteData& route) { QMutexLocker locker(&mutex); if (!AssureRouter(vehicle)) { return false; } return router->CalculateRoute(routingProfile, startObject, startNodeIndex, targetObject, targetNodeIndex, route); }
bool DBThread::GetClosestRoutableNode(const osmscout::ObjectFileRef& refObject, const osmscout::Vehicle& vehicle, double radius, osmscout::ObjectFileRef& object, size_t& nodeIndex) { QMutexLocker locker(&mutex); if (!AssureRouter(vehicle)) { return false; } object.Invalidate(); if (refObject.GetType()==osmscout::refNode) { osmscout::NodeRef node; if (!database->GetNodeByOffset(refObject.GetFileOffset(), node)) { std::cout<<node->GetCoords().GetLat()<<std::endl; std::cout<<node->GetCoords().GetLon()<<std::endl; return false; } return router->GetClosestRoutableNode(node->GetCoords().GetLat(), node->GetCoords().GetLon(), vehicle, radius, object, nodeIndex); } else if (refObject.GetType()==osmscout::refArea) { osmscout::AreaRef area; if (!database->GetAreaByOffset(refObject.GetFileOffset(), area)) { return false; } osmscout::GeoCoord center; area->GetCenter(center); return router->GetClosestRoutableNode(center.GetLat(), center.GetLon(), vehicle, radius, object, nodeIndex); } else if (refObject.GetType()==osmscout::refWay) { osmscout::WayRef way; if (!database->GetWayByOffset(refObject.GetFileOffset(), way)) { return false; } return router->GetClosestRoutableNode(way->nodes[0].GetLat(), way->nodes[0].GetLon(), vehicle, radius, object, nodeIndex); } else { return true; } }