Switch profiles from Lua to library interface
There's now an abstracted interface and no direct calls to Lua anymore. fixes #1974
This commit is contained in:
committed by
Patrick Niklaus
parent
9b737230d6
commit
1309dd2a0f
@@ -7,7 +7,6 @@
|
||||
#include "util/exception.hpp"
|
||||
#include "util/fingerprint.hpp"
|
||||
#include "util/io.hpp"
|
||||
#include "util/lua_util.hpp"
|
||||
#include "util/simple_logger.hpp"
|
||||
#include "util/timing_util.hpp"
|
||||
|
||||
@@ -17,8 +16,6 @@
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include <luabind/luabind.hpp>
|
||||
|
||||
#include <stxxl/sort>
|
||||
|
||||
#include <chrono>
|
||||
@@ -137,11 +134,11 @@ ExtractionContainers::ExtractionContainers()
|
||||
* - merge edges with nodes to include location of start/end points and serialize
|
||||
*
|
||||
*/
|
||||
void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environment,
|
||||
const std::string &output_file_name,
|
||||
const std::string &restrictions_file_name,
|
||||
const std::string &name_file_name,
|
||||
const std::string &turn_lane_file_name,
|
||||
lua_State *segment_state)
|
||||
const std::string &turn_lane_file_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -152,7 +149,7 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
|
||||
PrepareNodes();
|
||||
WriteNodes(file_out_stream);
|
||||
PrepareEdges(segment_state);
|
||||
PrepareEdges(scripting_environment);
|
||||
WriteEdges(file_out_stream);
|
||||
|
||||
PrepareRestrictions();
|
||||
@@ -304,7 +301,7 @@ void ExtractionContainers::PrepareNodes()
|
||||
std::cout << "ok, after " << TIMER_SEC(id_map) << "s" << std::endl;
|
||||
}
|
||||
|
||||
void ExtractionContainers::PrepareEdges(lua_State *segment_state)
|
||||
void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environment)
|
||||
{
|
||||
// Sort edges by start.
|
||||
std::cout << "[extractor] Sorting edges by start ... " << std::flush;
|
||||
@@ -386,8 +383,6 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
|
||||
const auto all_edges_list_end_ = all_edges_list.end();
|
||||
const auto all_nodes_list_end_ = all_nodes_list.end();
|
||||
|
||||
const auto has_segment_function = util::luaFunctionExists(segment_state, "segment_function");
|
||||
|
||||
while (edge_iterator != all_edges_list_end_ && node_iterator != all_nodes_list_end_)
|
||||
{
|
||||
// skip all invalid edges
|
||||
@@ -423,15 +418,8 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
|
||||
edge_iterator->source_coordinate,
|
||||
util::Coordinate(node_iterator->lon, node_iterator->lat));
|
||||
|
||||
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));
|
||||
}
|
||||
scripting_environment.ProcessSegment(
|
||||
edge_iterator->source_coordinate, *node_iterator, distance, edge_iterator->weight_data);
|
||||
|
||||
const double weight = [distance](const InternalExtractorEdge::WeightData &data) {
|
||||
switch (data.type)
|
||||
|
||||
Reference in New Issue
Block a user