2016-03-10 06:43:36 -05:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (c) 2016, Project OSRM contributors
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
|
|
of conditions and the following disclaimer.
|
|
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#ifndef EXTRACTOR_HPP
|
|
|
|
#define EXTRACTOR_HPP
|
2014-07-02 08:05:37 -04:00
|
|
|
|
2016-01-11 10:55:22 -05:00
|
|
|
#include "extractor/edge_based_edge.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "extractor/edge_based_graph_factory.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "extractor/extractor_config.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "extractor/graph_compressor.hpp"
|
2014-07-02 08:05:37 -04:00
|
|
|
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "util/guidance/bearing_class.hpp"
|
|
|
|
#include "util/guidance/entry_class.hpp"
|
2016-06-30 03:31:08 -04:00
|
|
|
#include "util/guidance/turn_lanes.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2016-01-07 04:33:47 -05:00
|
|
|
#include "util/typedefs.hpp"
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
class ScriptingEnvironment;
|
2016-03-22 16:23:25 -04:00
|
|
|
struct ProfileProperties;
|
2016-03-21 17:42:47 -04:00
|
|
|
|
2016-01-07 04:33:47 -05:00
|
|
|
class Extractor
|
2014-07-02 08:05:37 -04:00
|
|
|
{
|
2015-12-11 17:11:04 -05:00
|
|
|
public:
|
2016-01-07 04:33:47 -05:00
|
|
|
Extractor(ExtractorConfig extractor_config) : config(std::move(extractor_config)) {}
|
2016-07-11 11:44:58 -04:00
|
|
|
int run(ScriptingEnvironment &scripting_environment);
|
2015-12-11 17:11:04 -05:00
|
|
|
|
|
|
|
private:
|
2015-10-01 15:47:29 -04:00
|
|
|
ExtractorConfig config;
|
2016-01-07 04:33:47 -05:00
|
|
|
|
2017-08-01 11:18:12 -04:00
|
|
|
std::tuple<guidance::LaneDescriptionMap,
|
|
|
|
std::vector<TurnRestriction>,
|
|
|
|
std::vector<ConditionalTurnRestriction>>
|
2017-06-16 08:35:04 -04:00
|
|
|
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
2017-05-11 06:13:52 -04:00
|
|
|
|
2016-06-11 11:23:29 -04:00
|
|
|
std::pair<std::size_t, EdgeID>
|
2016-07-11 11:44:58 -04:00
|
|
|
BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
2017-04-02 19:58:06 -04:00
|
|
|
std::vector<util::Coordinate> &coordinates,
|
2017-04-10 16:15:25 -04:00
|
|
|
extractor::PackedOSMIDs &osm_node_ids,
|
2017-05-16 13:22:41 -04:00
|
|
|
EdgeBasedNodeDataContainer &edge_based_nodes_container,
|
|
|
|
std::vector<EdgeBasedNodeSegment> &edge_based_node_segments,
|
2015-12-11 17:11:04 -05:00
|
|
|
std::vector<bool> &node_is_startpoint,
|
2016-01-07 04:33:47 -05:00
|
|
|
std::vector<EdgeWeight> &edge_based_node_weights,
|
2016-04-26 07:27:40 -04:00
|
|
|
util::DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
|
2017-05-11 06:13:52 -04:00
|
|
|
const std::string &intersection_class_output_file,
|
2017-06-16 08:35:04 -04:00
|
|
|
std::vector<TurnRestriction> &turn_restrictions,
|
2017-08-01 11:18:12 -04:00
|
|
|
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
2017-06-16 08:35:04 -04:00
|
|
|
guidance::LaneDescriptionMap &turn_lane_map);
|
2015-12-11 17:11:04 -05:00
|
|
|
void FindComponents(unsigned max_edge_id,
|
2017-05-17 01:54:23 -04:00
|
|
|
const util::DeallocatingVector<EdgeBasedEdge> &input_edge_list,
|
|
|
|
const std::vector<EdgeBasedNodeSegment> &input_node_segments,
|
|
|
|
EdgeBasedNodeDataContainer &nodes_container) const;
|
2017-05-16 13:22:41 -04:00
|
|
|
void BuildRTree(std::vector<EdgeBasedNodeSegment> edge_based_node_segments,
|
2015-12-11 17:11:04 -05:00
|
|
|
std::vector<bool> node_is_startpoint,
|
2017-04-02 19:58:06 -04:00
|
|
|
const std::vector<util::Coordinate> &coordinates);
|
2015-10-01 15:47:29 -04:00
|
|
|
std::shared_ptr<RestrictionMap> LoadRestrictionMap();
|
2016-01-05 10:51:13 -05:00
|
|
|
std::shared_ptr<util::NodeBasedDynamicGraph>
|
2015-10-01 15:47:29 -04:00
|
|
|
LoadNodeBasedGraph(std::unordered_set<NodeID> &barrier_nodes,
|
|
|
|
std::unordered_set<NodeID> &traffic_lights,
|
2017-04-02 19:58:06 -04:00
|
|
|
std::vector<util::Coordinate> &coordinates,
|
2017-04-10 16:15:25 -04:00
|
|
|
extractor::PackedOSMIDs &osm_node_ids);
|
2015-10-01 15:47:29 -04:00
|
|
|
|
2017-01-26 11:53:19 -05:00
|
|
|
// Writes compressed node based graph and its embedding into a file for osrm-partition to use.
|
|
|
|
static void WriteCompressedNodeBasedGraph(const std::string &path,
|
|
|
|
const util::NodeBasedDynamicGraph &graph,
|
2017-04-02 19:58:06 -04:00
|
|
|
const std::vector<util::Coordinate> &coordiantes);
|
2017-08-01 11:18:12 -04:00
|
|
|
|
|
|
|
void WriteConditionalRestrictions(
|
|
|
|
const std::string &path,
|
|
|
|
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions);
|
2014-07-02 08:05:37 -04:00
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#endif /* EXTRACTOR_HPP */
|