Format with clang-format 3.8

This commit is contained in:
Patrick Niklaus
2016-05-27 21:05:04 +02:00
parent 21c47514da
commit 6e16eab6ec
202 changed files with 2485 additions and 1863 deletions
+2 -2
View File
@@ -159,8 +159,8 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
m_compressed_geometries[list_to_remove_index];
// found an existing list, append it to the list of edge_id_1
edge_bucket_list1.insert(edge_bucket_list1.end(), edge_bucket_list2.begin(),
edge_bucket_list2.end());
edge_bucket_list1.insert(
edge_bucket_list1.end(), edge_bucket_list2.begin(), edge_bucket_list2.end());
// remove the list of edge_id_2
m_edge_id_to_list_index_map.erase(edge_id_2);
+42 -22
View File
@@ -1,5 +1,5 @@
#include "extractor/edge_based_edge.hpp"
#include "extractor/edge_based_graph_factory.hpp"
#include "extractor/edge_based_edge.hpp"
#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/exception.hpp"
@@ -9,9 +9,9 @@
#include "util/simple_logger.hpp"
#include "util/timing_util.hpp"
#include "extractor/suffix_table.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_analysis.hpp"
#include "extractor/suffix_table.hpp"
#include <boost/assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
@@ -125,8 +125,7 @@ void EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u, const NodeI
NodeID current_edge_source_coordinate_id = node_u;
const auto edge_id_to_segment_id = [](const NodeID edge_based_node_id)
{
const auto edge_id_to_segment_id = [](const NodeID edge_based_node_id) {
if (edge_based_node_id == SPECIAL_NODEID)
{
return SegmentID{SPECIAL_SEGMENTID, false};
@@ -146,13 +145,18 @@ void EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u, const NodeI
BOOST_ASSERT(current_edge_target_coordinate_id != current_edge_source_coordinate_id);
// build edges
m_edge_based_node_list.emplace_back(
edge_id_to_segment_id(forward_data.edge_id),
edge_id_to_segment_id(reverse_data.edge_id), current_edge_source_coordinate_id,
current_edge_target_coordinate_id, forward_data.name_id,
m_compressed_edge_container.GetPositionForID(edge_id_1),
m_compressed_edge_container.GetPositionForID(edge_id_2), false, INVALID_COMPONENTID, i,
forward_data.travel_mode, reverse_data.travel_mode);
m_edge_based_node_list.emplace_back(edge_id_to_segment_id(forward_data.edge_id),
edge_id_to_segment_id(reverse_data.edge_id),
current_edge_source_coordinate_id,
current_edge_target_coordinate_id,
forward_data.name_id,
m_compressed_edge_container.GetPositionForID(edge_id_1),
m_compressed_edge_container.GetPositionForID(edge_id_2),
false,
INVALID_COMPONENTID,
i,
forward_data.travel_mode,
reverse_data.travel_mode);
m_edge_based_node_is_startpoint.push_back(forward_data.startpoint ||
reverse_data.startpoint);
@@ -190,8 +194,11 @@ void EdgeBasedGraphFactory::Run(const std::string &original_edge_data_filename,
TIMER_STOP(generate_nodes);
TIMER_START(generate_edges);
GenerateEdgeExpandedEdges(original_edge_data_filename, lua_state, edge_segment_lookup_filename,
edge_penalty_filename, generate_edge_lookup);
GenerateEdgeExpandedEdges(original_edge_data_filename,
lua_state,
edge_segment_lookup_filename,
edge_penalty_filename,
generate_edge_lookup);
TIMER_STOP(generate_edges);
@@ -325,8 +332,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
// linear number of turns only.
util::Percent progress(m_node_based_graph->GetNumberOfNodes());
SuffixTable street_name_suffix_table(lua_state);
guidance::TurnAnalysis turn_analysis(*m_node_based_graph, m_node_info_list, *m_restriction_map,
m_barrier_nodes, m_compressed_edge_container, name_table,
guidance::TurnAnalysis turn_analysis(*m_node_based_graph,
m_node_info_list,
*m_restriction_map,
m_barrier_nodes,
m_compressed_edge_container,
name_table,
street_name_suffix_table);
bearing_class_by_node_based_node.resize(m_node_based_graph->GetNumberOfNodes(),
@@ -349,9 +360,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
// the entry class depends on the turn, so we have to classify the interesction for
// every edge
const auto turn_classification = classifyIntersection(
node_v, turn_analysis.getIntersection(node_u, edge_from_u), *m_node_based_graph,
m_compressed_edge_container, m_node_info_list);
const auto turn_classification =
classifyIntersection(node_v,
turn_analysis.getIntersection(node_u, edge_from_u),
*m_node_based_graph,
m_compressed_edge_container,
m_node_info_list);
const auto entry_class_id = [&](const util::guidance::EntryClass entry_class) {
if (0 == entry_class_hash.count(entry_class))
@@ -412,8 +426,11 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
BOOST_ASSERT(m_compressed_edge_container.HasEntryForID(edge_from_u));
original_edge_data_vector.emplace_back(
m_compressed_edge_container.GetPositionForID(edge_from_u), edge_data1.name_id,
turn_instruction, entry_class_id, edge_data1.travel_mode);
m_compressed_edge_container.GetPositionForID(edge_from_u),
edge_data1.name_id,
turn_instruction,
entry_class_id,
edge_data1.travel_mode);
++original_edges_counter;
@@ -427,8 +444,11 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
// NOTE: potential overflow here if we hit 2^32 routable edges
BOOST_ASSERT(m_edge_based_edge_list.size() <= std::numeric_limits<NodeID>::max());
m_edge_based_edge_list.emplace_back(edge_data1.edge_id, edge_data2.edge_id,
m_edge_based_edge_list.size(), distance, true,
m_edge_based_edge_list.emplace_back(edge_data1.edge_id,
edge_data2.edge_id,
m_edge_based_edge_list.size(),
distance,
true,
false);
// Here is where we write out the mapping between the edge-expanded edges, and
+30 -20
View File
@@ -5,10 +5,10 @@
#include "util/range_table.hpp"
#include "util/exception.hpp"
#include "util/simple_logger.hpp"
#include "util/timing_util.hpp"
#include "util/fingerprint.hpp"
#include "util/lua_util.hpp"
#include "util/simple_logger.hpp"
#include "util/timing_util.hpp"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
@@ -133,8 +133,8 @@ void ExtractionContainers::PrepareNodes()
{
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
TIMER_START(sorting_used_nodes);
stxxl::sort(used_node_id_list.begin(), used_node_id_list.end(), OSMNodeIDSTXXLLess(),
stxxl_memory);
stxxl::sort(
used_node_id_list.begin(), used_node_id_list.end(), OSMNodeIDSTXXLLess(), stxxl_memory);
TIMER_STOP(sorting_used_nodes);
std::cout << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s" << std::endl;
@@ -147,7 +147,9 @@ void ExtractionContainers::PrepareNodes()
std::cout << "[extractor] Sorting all nodes ... " << std::flush;
TIMER_START(sorting_nodes);
stxxl::sort(all_nodes_list.begin(), all_nodes_list.end(), ExternalMemoryNodeSTXXLCompare(),
stxxl::sort(all_nodes_list.begin(),
all_nodes_list.end(),
ExternalMemoryNodeSTXXLCompare(),
stxxl_memory);
TIMER_STOP(sorting_nodes);
std::cout << "ok, after " << TIMER_SEC(sorting_nodes) << "s" << std::endl;
@@ -250,8 +252,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
// Remove all remaining edges. They are invalid because there are no corresponding nodes for
// them. This happens when using osmosis with bbox or polygon to extract smaller areas.
auto markSourcesInvalid = [](InternalExtractorEdge &edge)
{
auto markSourcesInvalid = [](InternalExtractorEdge &edge) {
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge.result.source;
edge.result.source = SPECIAL_NODEID;
@@ -315,13 +316,15 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
if (has_segment_function)
{
luabind::call_function<void>(
segment_state, "segment_function", boost::cref(edge_iterator->source_coordinate),
boost::cref(*node_iterator), distance, boost::ref(edge_iterator->weight_data));
luabind::call_function<void>(segment_state,
"segment_function",
boost::cref(edge_iterator->source_coordinate),
boost::cref(*node_iterator),
distance,
boost::ref(edge_iterator->weight_data));
}
const double weight = [distance](const InternalExtractorEdge::WeightData &data)
{
const double weight = [distance](const InternalExtractorEdge::WeightData &data) {
switch (data.type)
{
case InternalExtractorEdge::WeightType::EDGE_DURATION:
@@ -361,8 +364,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
// Remove all remaining edges. They are invalid because there are no corresponding nodes for
// them. This happens when using osmosis with bbox or polygon to extract smaller areas.
auto markTargetsInvalid = [](InternalExtractorEdge &edge)
{
auto markTargetsInvalid = [](InternalExtractorEdge &edge) {
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge.result.target;
edge.result.target = SPECIAL_NODEID;
@@ -374,8 +376,10 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
// Sort edges by start.
std::cout << "[extractor] Sorting edges by renumbered start ... " << std::flush;
TIMER_START(sort_edges_by_renumbered_start);
stxxl::sort(all_edges_list.begin(), all_edges_list.end(),
CmpEdgeByInternalStartThenInternalTargetID(), stxxl_memory);
stxxl::sort(all_edges_list.begin(),
all_edges_list.end(),
CmpEdgeByInternalStartThenInternalTargetID(),
stxxl_memory);
TIMER_STOP(sort_edges_by_renumbered_start);
std::cout << "ok, after " << TIMER_SEC(sort_edges_by_renumbered_start) << "s" << std::endl;
@@ -582,15 +586,19 @@ void ExtractionContainers::PrepareRestrictions()
{
std::cout << "[extractor] Sorting used ways ... " << std::flush;
TIMER_START(sort_ways);
stxxl::sort(way_start_end_id_list.begin(), way_start_end_id_list.end(),
FirstAndLastSegmentOfWayStxxlCompare(), stxxl_memory);
stxxl::sort(way_start_end_id_list.begin(),
way_start_end_id_list.end(),
FirstAndLastSegmentOfWayStxxlCompare(),
stxxl_memory);
TIMER_STOP(sort_ways);
std::cout << "ok, after " << TIMER_SEC(sort_ways) << "s" << std::endl;
std::cout << "[extractor] Sorting " << restrictions_list.size() << " restriction. by from... "
<< std::flush;
TIMER_START(sort_restrictions);
stxxl::sort(restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByFrom(),
stxxl::sort(restrictions_list.begin(),
restrictions_list.end(),
CmpRestrictionContainerByFrom(),
stxxl_memory);
TIMER_STOP(sort_restrictions);
std::cout << "ok, after " << TIMER_SEC(sort_restrictions) << "s" << std::endl;
@@ -682,7 +690,9 @@ void ExtractionContainers::PrepareRestrictions()
std::cout << "[extractor] Sorting restrictions. by to ... " << std::flush;
TIMER_START(sort_restrictions_to);
stxxl::sort(restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByTo(),
stxxl::sort(restrictions_list.begin(),
restrictions_list.end(),
CmpRestrictionContainerByTo(),
stxxl_memory);
TIMER_STOP(sort_restrictions_to);
std::cout << "ok, after " << TIMER_SEC(sort_restrictions_to) << "s" << std::endl;
+49 -25
View File
@@ -46,9 +46,9 @@
#include <fstream>
#include <iostream>
#include <thread>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <type_traits>
namespace osrm
{
@@ -174,7 +174,8 @@ int Extractor::run()
result_node.clear();
++number_of_nodes;
luabind::call_function<void>(
local_context.state, "node_function",
local_context.state,
"node_function",
boost::cref(static_cast<const osmium::Node &>(*entity)),
boost::ref(result_node));
resulting_nodes.push_back(std::make_pair(x, std::move(result_node)));
@@ -183,7 +184,8 @@ int Extractor::run()
result_way.clear();
++number_of_ways;
luabind::call_function<void>(
local_context.state, "way_function",
local_context.state,
"way_function",
boost::cref(static_cast<const osmium::Way &>(*entity)),
boost::ref(result_way));
resulting_ways.push_back(std::make_pair(x, std::move(result_way)));
@@ -234,8 +236,10 @@ int Extractor::run()
return 1;
}
extraction_containers.PrepareData(config.output_file_name, config.restriction_file_name,
config.names_file_name, main_context.state);
extraction_containers.PrepareData(config.output_file_name,
config.restriction_file_name,
config.names_file_name,
main_context.state);
WriteProfileProperties(config.profile_properties_output_path, main_context.properties);
@@ -268,10 +272,14 @@ int Extractor::run()
std::vector<bool> node_is_startpoint;
std::vector<EdgeWeight> edge_based_node_weights;
std::vector<QueryNode> internal_to_external_node_map;
auto graph_size = BuildEdgeExpandedGraph(
main_context.state, main_context.properties, internal_to_external_node_map,
edge_based_node_list, node_is_startpoint, edge_based_node_weights, edge_based_edge_list,
config.intersection_class_data_output_path);
auto graph_size = BuildEdgeExpandedGraph(main_context.state,
main_context.properties,
internal_to_external_node_map,
edge_based_node_list,
node_is_startpoint,
edge_based_node_weights,
edge_based_edge_list,
config.intersection_class_data_output_path);
auto number_of_node_based_nodes = graph_size.first;
auto max_edge_id = graph_size.second;
@@ -290,7 +298,8 @@ int Extractor::run()
FindComponents(max_edge_id, edge_based_edge_list, edge_based_node_list);
BuildRTree(std::move(edge_based_node_list), std::move(node_is_startpoint),
BuildRTree(std::move(edge_based_node_list),
std::move(node_is_startpoint),
internal_to_external_node_map);
TIMER_STOP(rtree);
@@ -485,7 +494,10 @@ Extractor::BuildEdgeExpandedGraph(lua_State *lua_state,
CompressedEdgeContainer compressed_edge_container;
GraphCompressor graph_compressor;
graph_compressor.Compress(barrier_nodes, traffic_lights, *restriction_map, *node_based_graph,
graph_compressor.Compress(barrier_nodes,
traffic_lights,
*restriction_map,
*node_based_graph,
compressed_edge_container);
compressed_edge_container.SerializeInternalVector(config.geometry_output_path);
@@ -493,12 +505,19 @@ Extractor::BuildEdgeExpandedGraph(lua_State *lua_state,
util::NameTable name_table(config.names_file_name);
EdgeBasedGraphFactory edge_based_graph_factory(
node_based_graph, compressed_edge_container, barrier_nodes, traffic_lights,
node_based_graph,
compressed_edge_container,
barrier_nodes,
traffic_lights,
std::const_pointer_cast<RestrictionMap const>(restriction_map),
internal_to_external_node_map, profile_properties, name_table);
internal_to_external_node_map,
profile_properties,
name_table);
edge_based_graph_factory.Run(config.edge_output_path, lua_state,
config.edge_segment_lookup_path, config.edge_penalty_path,
edge_based_graph_factory.Run(config.edge_output_path,
lua_state,
config.edge_segment_lookup_path,
config.edge_penalty_path,
config.generate_edge_lookup);
edge_based_graph_factory.GetEdgeBasedEdges(edge_based_edge_list);
@@ -509,9 +528,10 @@ Extractor::BuildEdgeExpandedGraph(lua_State *lua_state,
const std::size_t number_of_node_based_nodes = node_based_graph->GetNumberOfNodes();
WriteIntersectionClassificationData(
intersection_class_output_file, edge_based_graph_factory.GetBearingClassIds(),
edge_based_graph_factory.GetBearingClasses(), edge_based_graph_factory.GetEntryClasses());
WriteIntersectionClassificationData(intersection_class_output_file,
edge_based_graph_factory.GetBearingClassIds(),
edge_based_graph_factory.GetBearingClasses(),
edge_based_graph_factory.GetEntryClasses());
return std::make_pair(number_of_node_based_nodes, max_edge_id);
}
@@ -568,9 +588,10 @@ void Extractor::BuildRTree(std::vector<EdgeBasedNode> node_based_edge_list,
node_based_edge_list.resize(new_size);
TIMER_START(construction);
util::StaticRTree<EdgeBasedNode, std::vector<QueryNode>> rtree(
node_based_edge_list, config.rtree_nodes_output_path, config.rtree_leafs_output_path,
internal_to_external_node_map);
util::StaticRTree<EdgeBasedNode, std::vector<QueryNode>> rtree(node_based_edge_list,
config.rtree_nodes_output_path,
config.rtree_leafs_output_path,
internal_to_external_node_map);
TIMER_STOP(construction);
util::SimpleLogger().Write() << "finished r-tree construction in " << TIMER_SEC(construction)
@@ -630,8 +651,10 @@ void Extractor::WriteIntersectionClassificationData(
std::vector<unsigned> bearing_counts;
bearing_counts.reserve(bearing_classes.size());
std::uint64_t total_bearings = 0;
for (const auto &bearing_class : bearing_classes){
bearing_counts.push_back(static_cast<unsigned>(bearing_class.getAvailableBearings().size()));
for (const auto &bearing_class : bearing_classes)
{
bearing_counts.push_back(
static_cast<unsigned>(bearing_class.getAvailableBearings().size()));
total_bearings += bearing_class.getAvailableBearings().size();
}
@@ -639,10 +662,11 @@ void Extractor::WriteIntersectionClassificationData(
file_out_stream << bearing_class_range_table;
file_out_stream << total_bearings;
for( const auto &bearing_class : bearing_classes)
for (const auto &bearing_class : bearing_classes)
{
const auto &bearings = bearing_class.getAvailableBearings();
file_out_stream.write( reinterpret_cast<const char*>(&bearings[0]), sizeof(bearings[0]) * bearings.size() );
file_out_stream.write(reinterpret_cast<const char *>(&bearings[0]),
sizeof(bearings[0]) * bearings.size());
}
// FIXME
+61 -26
View File
@@ -7,8 +7,8 @@
#include "util/for_each_pair.hpp"
#include "util/simple_logger.hpp"
#include <boost/optional/optional.hpp>
#include "extractor/extractor_callbacks.hpp"
#include <boost/optional/optional.hpp>
#include <osmium/osm.hpp>
@@ -42,7 +42,9 @@ void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node,
external_memory.all_nodes_list.push_back(
{util::toFixed(util::FloatLongitude(input_node.location().lon())),
util::toFixed(util::FloatLatitude(input_node.location().lat())),
OSMNodeID(input_node.id()), result_node.barrier, result_node.traffic_lights});
OSMNodeID(input_node.id()),
result_node.barrier,
result_node.traffic_lights});
}
void ExtractorCallbacks::ProcessRestriction(
@@ -151,7 +153,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
auto name_length = std::min<unsigned>(MAX_STRING_LENGTH, parsed_way.name.size());
external_memory.name_char_data.reserve(name_id + name_length);
std::copy(parsed_way.name.c_str(), parsed_way.name.c_str() + name_length,
std::copy(parsed_way.name.c_str(),
parsed_way.name.c_str() + name_length,
std::back_inserter(external_memory.name_char_data));
external_memory.name_lengths.push_back(name_length);
@@ -169,7 +172,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
((parsed_way.forward_speed != parsed_way.backward_speed) ||
(parsed_way.forward_travel_mode != parsed_way.backward_travel_mode));
std::transform(input_way.nodes().begin(), input_way.nodes().end(),
std::transform(input_way.nodes().begin(),
input_way.nodes().end(),
std::back_inserter(external_memory.used_node_id_list),
[](const osmium::NodeRef &ref) { return OSMNodeID(ref.ref()); });
@@ -181,51 +185,82 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
BOOST_ASSERT(split_edge == false);
BOOST_ASSERT(parsed_way.backward_travel_mode != TRAVEL_MODE_INACCESSIBLE);
util::for_each_pair(
input_way.nodes().crbegin(), input_way.nodes().crend(),
input_way.nodes().crbegin(),
input_way.nodes().crend(),
[&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
external_memory.all_edges_list.push_back(InternalExtractorEdge(
OSMNodeID(first_node.ref()), OSMNodeID(last_node.ref()), name_id,
backward_weight_data, true, false, parsed_way.roundabout,
parsed_way.is_access_restricted, parsed_way.is_startpoint,
parsed_way.backward_travel_mode, false, road_classification));
external_memory.all_edges_list.push_back(
InternalExtractorEdge(OSMNodeID(first_node.ref()),
OSMNodeID(last_node.ref()),
name_id,
backward_weight_data,
true,
false,
parsed_way.roundabout,
parsed_way.is_access_restricted,
parsed_way.is_startpoint,
parsed_way.backward_travel_mode,
false,
road_classification));
});
external_memory.way_start_end_id_list.push_back(
{OSMWayID(input_way.id()), OSMNodeID(input_way.nodes().back().ref()),
{OSMWayID(input_way.id()),
OSMNodeID(input_way.nodes().back().ref()),
OSMNodeID(input_way.nodes()[input_way.nodes().size() - 2].ref()),
OSMNodeID(input_way.nodes()[1].ref()), OSMNodeID(input_way.nodes()[0].ref())});
OSMNodeID(input_way.nodes()[1].ref()),
OSMNodeID(input_way.nodes()[0].ref())});
}
else
{
const bool forward_only =
split_edge || TRAVEL_MODE_INACCESSIBLE == parsed_way.backward_travel_mode;
util::for_each_pair(
input_way.nodes().cbegin(), input_way.nodes().cend(),
input_way.nodes().cbegin(),
input_way.nodes().cend(),
[&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
external_memory.all_edges_list.push_back(InternalExtractorEdge(
OSMNodeID(first_node.ref()), OSMNodeID(last_node.ref()), name_id,
forward_weight_data, true, !forward_only, parsed_way.roundabout,
parsed_way.is_access_restricted, parsed_way.is_startpoint,
parsed_way.forward_travel_mode, split_edge, road_classification));
external_memory.all_edges_list.push_back(
InternalExtractorEdge(OSMNodeID(first_node.ref()),
OSMNodeID(last_node.ref()),
name_id,
forward_weight_data,
true,
!forward_only,
parsed_way.roundabout,
parsed_way.is_access_restricted,
parsed_way.is_startpoint,
parsed_way.forward_travel_mode,
split_edge,
road_classification));
});
if (split_edge)
{
BOOST_ASSERT(parsed_way.backward_travel_mode != TRAVEL_MODE_INACCESSIBLE);
util::for_each_pair(
input_way.nodes().cbegin(), input_way.nodes().cend(),
input_way.nodes().cbegin(),
input_way.nodes().cend(),
[&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
external_memory.all_edges_list.push_back(InternalExtractorEdge(
OSMNodeID(first_node.ref()), OSMNodeID(last_node.ref()), name_id,
backward_weight_data, false, true, parsed_way.roundabout,
parsed_way.is_access_restricted, parsed_way.is_startpoint,
parsed_way.backward_travel_mode, true, road_classification));
external_memory.all_edges_list.push_back(
InternalExtractorEdge(OSMNodeID(first_node.ref()),
OSMNodeID(last_node.ref()),
name_id,
backward_weight_data,
false,
true,
parsed_way.roundabout,
parsed_way.is_access_restricted,
parsed_way.is_startpoint,
parsed_way.backward_travel_mode,
true,
road_classification));
});
}
external_memory.way_start_end_id_list.push_back(
{OSMWayID(input_way.id()), OSMNodeID(input_way.nodes().back().ref()),
{OSMWayID(input_way.id()),
OSMNodeID(input_way.nodes().back().ref()),
OSMNodeID(input_way.nodes()[input_way.nodes().size() - 2].ref()),
OSMNodeID(input_way.nodes()[1].ref()), OSMNodeID(input_way.nodes()[0].ref())});
OSMNodeID(input_way.nodes()[1].ref()),
OSMNodeID(input_way.nodes()[0].ref())});
}
}
}
+4 -4
View File
@@ -151,10 +151,10 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
restriction_map.FixupArrivingTurnRestriction(node_w, node_v, node_u, graph);
// store compressed geometry in container
geometry_compressor.CompressEdge(forward_e1, forward_e2, node_v, node_w,
forward_weight1, forward_weight2);
geometry_compressor.CompressEdge(reverse_e1, reverse_e2, node_v, node_u,
reverse_weight1, reverse_weight2);
geometry_compressor.CompressEdge(
forward_e1, forward_e2, node_v, node_w, forward_weight1, forward_weight2);
geometry_compressor.CompressEdge(
reverse_e1, reverse_e2, node_v, node_u, reverse_weight1, reverse_weight2);
}
}
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include <algorithm>
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
@@ -38,12 +38,13 @@ IntersectionHandler::~IntersectionHandler() {}
std::size_t IntersectionHandler::countValid(const Intersection &intersection) const
{
return std::count_if(intersection.begin(), intersection.end(),
[](const ConnectedRoad &road) { return road.entry_allowed; });
return std::count_if(intersection.begin(), intersection.end(), [](const ConnectedRoad &road) {
return road.entry_allowed;
});
}
TurnType::Enum IntersectionHandler::findBasicTurnType(const EdgeID via_edge,
const ConnectedRoad &road) const
const ConnectedRoad &road) const
{
const auto &in_data = node_based_graph.GetEdgeData(via_edge);
@@ -94,9 +95,9 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
// obvious turn onto a through street is a merge
if (through_street)
{
return {TurnType::Merge, road.turn.angle > STRAIGHT_ANGLE
? DirectionModifier::SlightRight
: DirectionModifier::SlightLeft};
return {TurnType::Merge,
road.turn.angle > STRAIGHT_ANGLE ? DirectionModifier::SlightRight
: DirectionModifier::SlightLeft};
}
else
{
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
+30 -18
View File
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/motorway_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
@@ -233,8 +233,10 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
BOOST_ASSERT(!detail::isRampClass(intersection[1].turn.eid, node_based_graph));
intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(1, intersection), intersection[1]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(1, intersection),
intersection[1]);
}
else
{
@@ -275,8 +277,10 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
if (exiting_motorways == 2 && intersection.size() == 2)
{
intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(1, intersection), intersection[1]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(1, intersection),
intersection[1]);
util::SimpleLogger().Write(logDEBUG) << "Disabled U-Turn on a freeway";
intersection[0].entry_allowed = false; // UTURN on the freeway
}
@@ -329,7 +333,9 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
}
}
}
assignFork(via_eid, intersection[third_valid], intersection[second_valid],
assignFork(via_eid,
intersection[third_valid],
intersection[second_valid],
intersection[first_valid]);
}
else
@@ -389,8 +395,10 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
else // passing by the end of a motorway
{
intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(1, intersection), intersection[1]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(1, intersection),
intersection[1]);
}
}
else
@@ -414,8 +422,10 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
else // passing the end of a highway
{
intersection[2].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(2, intersection), intersection[2]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(2, intersection),
intersection[2]);
}
}
}
@@ -472,8 +482,8 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
}
else if (detail::isMotorwayClass(edge_data.road_classification.road_class))
{
road.turn.instruction = {TurnType::Merge, passed_highway_entry
? DirectionModifier::SlightRight
road.turn.instruction = {TurnType::Merge,
passed_highway_entry ? DirectionModifier::SlightRight
: DirectionModifier::SlightLeft};
}
else
@@ -516,16 +526,18 @@ Intersection MotorwayHandler::fallback(Intersection intersection) const
road.turn.instruction = {type, DirectionModifier::Straight};
else
{
road.turn.instruction = {type, road.turn.angle > STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
road.turn.instruction = {type,
road.turn.angle > STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
}
}
else
{
road.turn.instruction = {type, road.turn.angle < STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
road.turn.instruction = {type,
road.turn.angle < STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
}
}
return intersection;
+41 -34
View File
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/roundabout_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/coordinate_calculation.hpp"
@@ -52,8 +52,11 @@ operator()(const NodeID from_nid, const EdgeID via_eid, Intersection intersectio
const auto flags = getRoundaboutFlags(from_nid, via_eid, intersection);
const auto roundabout_type = getRoundaboutType(node_based_graph.GetTarget(via_eid));
// find the radius of the roundabout
return handleRoundabouts(roundabout_type, via_eid, flags.on_roundabout,
flags.can_exit_separately, std::move(intersection));
return handleRoundabouts(roundabout_type,
via_eid,
flags.on_roundabout,
flags.can_exit_separately,
std::move(intersection));
}
detail::RoundaboutFlags RoundaboutHandler::getRoundaboutFlags(
@@ -169,9 +172,13 @@ bool RoundaboutHandler::qualifiesAsRoundaboutIntersection(
// there is a single non-roundabout edge
const auto src_coordinate = getCoordinate(node);
const auto next_coordinate = getRepresentativeCoordinate(
node, node_based_graph.GetTarget(edge), edge, edge_data.reversed,
compressed_edge_container, node_info_list);
const auto next_coordinate =
getRepresentativeCoordinate(node,
node_based_graph.GetTarget(edge),
edge,
edge_data.reversed,
compressed_edge_container,
node_info_list);
result.push_back(
util::coordinate_calculation::bearing(src_coordinate, next_coordinate));
break;
@@ -206,40 +213,40 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
unsigned roundabout_name_id = 0;
std::unordered_set<unsigned> connected_names;
const auto getNextOnRoundabout = [this, &roundabout_name_id,
&connected_names](const NodeID node) {
EdgeID continue_edge = SPECIAL_EDGEID;
for (const auto edge : node_based_graph.GetAdjacentEdgeRange(node))
{
const auto &edge_data = node_based_graph.GetEdgeData(edge);
if (!edge_data.reversed && edge_data.roundabout)
const auto getNextOnRoundabout =
[this, &roundabout_name_id, &connected_names](const NodeID node) {
EdgeID continue_edge = SPECIAL_EDGEID;
for (const auto edge : node_based_graph.GetAdjacentEdgeRange(node))
{
if (SPECIAL_EDGEID != continue_edge)
const auto &edge_data = node_based_graph.GetEdgeData(edge);
if (!edge_data.reversed && edge_data.roundabout)
{
// fork in roundabout
return SPECIAL_EDGEID;
if (SPECIAL_EDGEID != continue_edge)
{
// fork in roundabout
return SPECIAL_EDGEID;
}
// roundabout does not keep its name
if (roundabout_name_id != 0 && roundabout_name_id != edge_data.name_id &&
requiresNameAnnounced(name_table.GetNameForID(roundabout_name_id),
name_table.GetNameForID(edge_data.name_id),
street_name_suffix_table))
{
return SPECIAL_EDGEID;
}
roundabout_name_id = edge_data.name_id;
continue_edge = edge;
}
// roundabout does not keep its name
if (roundabout_name_id != 0 && roundabout_name_id != edge_data.name_id &&
requiresNameAnnounced(name_table.GetNameForID(roundabout_name_id),
name_table.GetNameForID(edge_data.name_id),
street_name_suffix_table))
else if (!edge_data.roundabout)
{
return SPECIAL_EDGEID;
// remember all connected road names
connected_names.insert(edge_data.name_id);
}
roundabout_name_id = edge_data.name_id;
continue_edge = edge;
}
else if (!edge_data.roundabout)
{
// remember all connected road names
connected_names.insert(edge_data.name_id);
}
}
return continue_edge;
};
return continue_edge;
};
// the roundabout radius has to be the same for all locations we look at it from
// to guarantee this, we search the full roundabout for its vertices
// and select the three smalles ids
+6 -5
View File
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/turn_analysis.hpp"
#include "extractor/guidance/constants.hpp"
#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
@@ -109,9 +109,9 @@ TurnAnalysis::setTurnTypes(const NodeID from_nid, const EdgeID, Intersection int
const EdgeID onto_edge = road.turn.eid;
const NodeID to_nid = node_based_graph.GetTarget(onto_edge);
road.turn.instruction = {TurnType::Turn, (from_nid == to_nid)
? DirectionModifier::UTurn
: getTurnDirection(road.turn.angle)};
road.turn.instruction = {TurnType::Turn,
(from_nid == to_nid) ? DirectionModifier::UTurn
: getTurnDirection(road.turn.angle)};
}
return intersection;
}
@@ -142,7 +142,8 @@ Intersection TurnAnalysis::handleSliproads(const EdgeID source_edge_id,
// Find the continuation of the intersection we're on
auto next_road = std::find_if(
intersection.begin(), intersection.end(),
intersection.begin(),
intersection.end(),
[this, source_edge_data](const ConnectedRoad &road) {
const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid);
// Test to see if the source edge and the one we're looking at are the same road
@@ -52,10 +52,10 @@ classifyIntersection(NodeID nid,
turns.push_back({road.entry_allowed, bearing});
}
std::sort(turns.begin(), turns.end(),
[](const TurnPossibility left, const TurnPossibility right) {
return left.bearing < right.bearing;
});
std::sort(
turns.begin(), turns.end(), [](const TurnPossibility left, const TurnPossibility right) {
return left.bearing < right.bearing;
});
util::guidance::EntryClass entry_class;
util::guidance::BearingClass bearing_class;
@@ -81,7 +81,7 @@ classifyIntersection(NodeID nid,
std::size_t number = 0;
if (canBeDiscretized)
{
if(util::guidance::BearingClass::getDiscreteBearing(turns.back().bearing) <
if (util::guidance::BearingClass::getDiscreteBearing(turns.back().bearing) <
util::guidance::BearingClass::getDiscreteBearing(turns.front().bearing))
{
turns.insert(turns.begin(), turns.back());
+10 -6
View File
@@ -1,7 +1,7 @@
#include "extractor/guidance/turn_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_handler.hpp"
#include "util/guidance/toolkit.hpp"
@@ -257,9 +257,11 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
// check whether the obvious choice is actually a through street
if (obvious_index != 0)
{
intersection[obvious_index].turn.instruction = getInstructionForObvious(
intersection.size(), via_edge, isThroughStreet(obvious_index, intersection),
intersection[obvious_index]);
intersection[obvious_index].turn.instruction =
getInstructionForObvious(intersection.size(),
via_edge,
isThroughStreet(obvious_index, intersection),
intersection[obvious_index]);
if (has_same_name_turn &&
node_based_graph.GetEdgeData(intersection[obvious_index].turn.eid).name_id !=
in_data.name_id &&
@@ -314,8 +316,10 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
}
else if (fork_range.second - fork_range.first == 2)
{
assignFork(via_edge, intersection[fork_range.second],
intersection[fork_range.first + 1], intersection[fork_range.first]);
assignFork(via_edge,
intersection[fork_range.second],
intersection[fork_range.first + 1],
intersection[fork_range.first]);
}
// assign left/right turns
intersection = assignLeftTurns(via_edge, std::move(intersection), fork_range.second + 1);
+2 -2
View File
@@ -48,8 +48,8 @@ RestrictionMap::RestrictionMap(const std::vector<TurnRestriction> &restriction_l
}
++m_count;
BOOST_ASSERT(restriction.to.node < std::numeric_limits<NodeID>::max());
m_restriction_bucket_list.at(index)
.emplace_back(restriction.to.node, restriction.flags.is_only);
m_restriction_bucket_list.at(index).emplace_back(restriction.to.node,
restriction.flags.is_only);
}
}
+11 -13
View File
@@ -2,13 +2,13 @@
#include "extractor/profile_properties.hpp"
#include "extractor/external_memory_node.hpp"
#include "util/lua_util.hpp"
#include "util/exception.hpp"
#include "util/lua_util.hpp"
#include "util/simple_logger.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/optional/optional.hpp>
#include <boost/ref.hpp>
#include <boost/regex.hpp>
@@ -48,8 +48,8 @@ void RestrictionParser::ReadRestrictionExceptions(lua_State *lua_state)
{
luabind::set_pcall_callback(&luaErrorCallback);
// get list of turn restriction exceptions
luabind::call_function<void>(lua_state, "get_exceptions",
boost::ref(restriction_exceptions));
luabind::call_function<void>(
lua_state, "get_exceptions", boost::ref(restriction_exceptions));
const unsigned exception_count = restriction_exceptions.size();
util::SimpleLogger().Write() << "Found " << exception_count
<< " exceptions to turn restrictions:";
@@ -117,8 +117,7 @@ RestrictionParser::TryParse(const osmium::Relation &relation) const
// "restriction:<transportation_type>")
if (key.size() > 11)
{
const auto ex_suffix = [&](const std::string &exception)
{
const auto ex_suffix = [&](const std::string &exception) {
return boost::algorithm::ends_with(key, exception);
};
bool is_actually_restricted =
@@ -201,13 +200,12 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st
std::vector<std::string> exceptions;
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
return std::any_of(std::begin(exceptions), std::end(exceptions),
[&](const std::string &current_string)
{
return std::end(restriction_exceptions) !=
std::find(std::begin(restriction_exceptions),
std::end(restriction_exceptions), current_string);
});
return std::any_of(
std::begin(exceptions), std::end(exceptions), [&](const std::string &current_string) {
return std::end(restriction_exceptions) != std::find(std::begin(restriction_exceptions),
std::end(restriction_exceptions),
current_string);
});
}
}
}
+41 -37
View File
@@ -1,21 +1,21 @@
#include "extractor/scripting_environment.hpp"
#include "extractor/external_memory_node.hpp"
#include "extractor/extraction_helper_functions.hpp"
#include "extractor/extraction_node.hpp"
#include "extractor/extraction_way.hpp"
#include "extractor/internal_extractor_edge.hpp"
#include "extractor/external_memory_node.hpp"
#include "extractor/raster_source.hpp"
#include "extractor/profile_properties.hpp"
#include "extractor/raster_source.hpp"
#include "util/exception.hpp"
#include "util/lua_util.hpp"
#include "util/make_unique.hpp"
#include "util/exception.hpp"
#include "util/simple_logger.hpp"
#include "util/typedefs.hpp"
#include <luabind/tag_function.hpp>
#include <luabind/iterator_policy.hpp>
#include <luabind/operator.hpp>
#include <luabind/tag_function.hpp>
#include <osmium/osm.hpp>
@@ -44,10 +44,9 @@ template <class T> double lonToDouble(T const &object)
return static_cast<double>(util::toFloating(object.lon));
}
// Luabind does not like memr funs: instead of casting to the function's signature (mem fun ptr) we simply wrap it
auto get_nodes_for_way(const osmium::Way& way) -> decltype(way.nodes()) {
return way.nodes();
}
// Luabind does not like memr funs: instead of casting to the function's signature (mem fun ptr) we
// simply wrap it
auto get_nodes_for_way(const osmium::Way &way) -> decltype(way.nodes()) { return way.nodes(); }
// Error handler
int luaErrorCallback(lua_State *state)
@@ -78,19 +77,19 @@ void ScriptingEnvironment::InitContext(ScriptingEnvironment::Context &context)
luabind::module(context.state)
[luabind::def("durationIsValid", durationIsValid),
luabind::def("parseDuration", parseDuration),
luabind::class_<TravelMode>("mode")
.enum_("enums")[luabind::value("inaccessible", TRAVEL_MODE_INACCESSIBLE),
luabind::value("driving", TRAVEL_MODE_DRIVING),
luabind::value("cycling", TRAVEL_MODE_CYCLING),
luabind::value("walking", TRAVEL_MODE_WALKING),
luabind::value("ferry", TRAVEL_MODE_FERRY),
luabind::value("train", TRAVEL_MODE_TRAIN),
luabind::value("pushing_bike", TRAVEL_MODE_PUSHING_BIKE),
luabind::value("steps_up", TRAVEL_MODE_STEPS_UP),
luabind::value("steps_down", TRAVEL_MODE_STEPS_DOWN),
luabind::value("river_up", TRAVEL_MODE_RIVER_UP),
luabind::value("river_down", TRAVEL_MODE_RIVER_DOWN),
luabind::value("route", TRAVEL_MODE_ROUTE)],
luabind::class_<TravelMode>("mode").enum_(
"enums")[luabind::value("inaccessible", TRAVEL_MODE_INACCESSIBLE),
luabind::value("driving", TRAVEL_MODE_DRIVING),
luabind::value("cycling", TRAVEL_MODE_CYCLING),
luabind::value("walking", TRAVEL_MODE_WALKING),
luabind::value("ferry", TRAVEL_MODE_FERRY),
luabind::value("train", TRAVEL_MODE_TRAIN),
luabind::value("pushing_bike", TRAVEL_MODE_PUSHING_BIKE),
luabind::value("steps_up", TRAVEL_MODE_STEPS_UP),
luabind::value("steps_down", TRAVEL_MODE_STEPS_DOWN),
luabind::value("river_up", TRAVEL_MODE_RIVER_UP),
luabind::value("river_down", TRAVEL_MODE_RIVER_DOWN),
luabind::value("route", TRAVEL_MODE_ROUTE)],
luabind::class_<SourceContainer>("sources")
.def(luabind::constructor<>())
.def("load", &SourceContainer::LoadRasterSource)
@@ -101,16 +100,20 @@ void ScriptingEnvironment::InitContext(ScriptingEnvironment::Context &context)
luabind::class_<ProfileProperties>("ProfileProperties")
.def(luabind::constructor<>())
.property("traffic_signal_penalty", &ProfileProperties::GetTrafficSignalPenalty,
.property("traffic_signal_penalty",
&ProfileProperties::GetTrafficSignalPenalty,
&ProfileProperties::SetTrafficSignalPenalty)
.property("u_turn_penalty", &ProfileProperties::GetUturnPenalty,
.property("u_turn_penalty",
&ProfileProperties::GetUturnPenalty,
&ProfileProperties::SetUturnPenalty)
.def_readwrite("use_turn_restrictions", &ProfileProperties::use_turn_restrictions)
.def_readwrite("continue_straight_at_waypoint", &ProfileProperties::continue_straight_at_waypoint),
.def_readwrite("continue_straight_at_waypoint",
&ProfileProperties::continue_straight_at_waypoint),
luabind::class_<std::vector<std::string>>("vector")
.def("Add", static_cast<void (std::vector<std::string>::*)(const std::string &)>(
&std::vector<std::string>::push_back)),
luabind::class_<std::vector<std::string>>("vector").def(
"Add",
static_cast<void (std::vector<std::string>::*)(const std::string &)>(
&std::vector<std::string>::push_back)),
luabind::class_<osmium::Location>("Location")
.def<location_member_ptr_type>("lat", &osmium::Location::lat)
@@ -136,18 +139,19 @@ void ScriptingEnvironment::InitContext(ScriptingEnvironment::Context &context)
.def_readwrite("is_access_restricted", &ExtractionWay::is_access_restricted)
.def_readwrite("is_startpoint", &ExtractionWay::is_startpoint)
.def_readwrite("duration", &ExtractionWay::duration)
.property("forward_mode", &ExtractionWay::get_forward_mode,
&ExtractionWay::set_forward_mode)
.property("backward_mode", &ExtractionWay::get_backward_mode,
.property(
"forward_mode", &ExtractionWay::get_forward_mode, &ExtractionWay::set_forward_mode)
.property("backward_mode",
&ExtractionWay::get_backward_mode,
&ExtractionWay::set_backward_mode),
luabind::class_<osmium::WayNodeList>("WayNodeList")
.def(luabind::constructor<>()),
luabind::class_<osmium::WayNodeList>("WayNodeList").def(luabind::constructor<>()),
luabind::class_<osmium::NodeRef>("NodeRef")
.def(luabind::constructor<>())
// Dear ambitious reader: registering .location() as in:
// .def("location", +[](const osmium::NodeRef& nref){ return nref.location(); })
// will crash at runtime, since we're not (yet?) using libosnmium's NodeLocationsForWays cache
.def("id", &osmium::NodeRef::ref),
.def(luabind::constructor<>())
// Dear ambitious reader: registering .location() as in:
// .def("location", +[](const osmium::NodeRef& nref){ return nref.location(); })
// will crash at runtime, since we're not (yet?) using libosnmium's
// NodeLocationsForWays cache
.def("id", &osmium::NodeRef::ref),
luabind::class_<osmium::Way>("Way")
.def("get_value_by_key", &osmium::Way::get_value_by_key)
.def("get_value_by_key", &get_value_by_key<osmium::Way>)
+2 -2
View File
@@ -26,8 +26,8 @@ SuffixTable::SuffixTable(lua_State *lua_state)
try
{
// call lua profile to compute turn penalty
luabind::call_function<void>(lua_state, "get_name_suffix_list",
boost::ref(suffixes_vector));
luabind::call_function<void>(
lua_state, "get_name_suffix_list", boost::ref(suffixes_vector));
}
catch (const luabind::error &er)
{