Added traffic light generation functions.
This commit is contained in:
parent
3360d27486
commit
e6a23ff101
|
@ -17,6 +17,12 @@ namespace osm2odr {
|
||||||
<< ", elevation_layer_height=" << settings.elevation_layer_height << ")";
|
<< ", elevation_layer_height=" << settings.elevation_layer_height << ")";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
void SetOsmWayTypes(OSM2ODRSettings& self, boost::python::list input) {
|
||||||
|
self.osm_highways_types = PythonLitstToVector<std::string>(input);
|
||||||
|
}
|
||||||
|
void SetTLExcludedWayTypes(OSM2ODRSettings& self, boost::python::list input) {
|
||||||
|
self.tl_excluded_highways_types = PythonLitstToVector<std::string>(input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void export_osm2odr() {
|
void export_osm2odr() {
|
||||||
|
@ -31,6 +37,10 @@ void export_osm2odr() {
|
||||||
.add_property("elevation_layer_height", &OSM2ODRSettings::elevation_layer_height, &OSM2ODRSettings::elevation_layer_height)
|
.add_property("elevation_layer_height", &OSM2ODRSettings::elevation_layer_height, &OSM2ODRSettings::elevation_layer_height)
|
||||||
.add_property("proj_string", &OSM2ODRSettings::proj_string, &OSM2ODRSettings::proj_string)
|
.add_property("proj_string", &OSM2ODRSettings::proj_string, &OSM2ODRSettings::proj_string)
|
||||||
.add_property("center_map", &OSM2ODRSettings::center_map, &OSM2ODRSettings::center_map)
|
.add_property("center_map", &OSM2ODRSettings::center_map, &OSM2ODRSettings::center_map)
|
||||||
|
.add_property("generate_traffic_lights", &OSM2ODRSettings::generate_traffic_lights, &OSM2ODRSettings::generate_traffic_lights)
|
||||||
|
.add_property("all_junctions_with_traffic_lights", &OSM2ODRSettings::all_junctions_traffic_lights, &OSM2ODRSettings::all_junctions_traffic_lights)
|
||||||
|
.def("set_osm_way_types", &SetOsmWayTypes, arg("way_types"))
|
||||||
|
.def("set_traffic_light_excluded_way_types", &SetTLExcludedWayTypes, arg("way_types"))
|
||||||
.def(self_ns::str(self_ns::self))
|
.def(self_ns::str(self_ns::self))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,16 @@ static boost::python::object OptionalToPythonObject(OptionalT &optional) {
|
||||||
return self.fn(std::forward<T1_>(t1)); \
|
return self.fn(std::forward<T1_>(t1)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
std::vector<T> PythonLitstToVector(boost::python::list &input) {
|
||||||
|
std::vector<T> result;
|
||||||
|
boost::python::ssize_t list_size = boost::python::len(input);
|
||||||
|
for (boost::python::ssize_t i = 0; i < list_size; ++i) {
|
||||||
|
result.emplace_back(boost::python::extract<T>(input[i]));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Convenient for const requests that needs to convert the return value to a
|
// Convenient for const requests that needs to convert the return value to a
|
||||||
// Python list.
|
// Python list.
|
||||||
#define CALL_RETURNING_LIST(cls, fn) +[](const cls &self) { \
|
#define CALL_RETURNING_LIST(cls, fn) +[](const cls &self) { \
|
||||||
|
|
Loading…
Reference in New Issue