Finishing fist iteration of the OSM2ODR API
This commit is contained in:
parent
a3fa0f7bed
commit
ed4805557b
|
@ -6,21 +6,21 @@
|
|||
|
||||
#include <Converter.h>
|
||||
|
||||
class Converter {
|
||||
class OSM2ODR {
|
||||
public:
|
||||
std::string ConvertOSMToOpenDRIVE(std::string osm_file) {
|
||||
return converter::ConvertOSMToOpenDRIVE(osm_file);
|
||||
static std::string ConvertOSMToOpenDRIVE(std::string osm_file) {
|
||||
return osm2odr::ConvertOSMToOpenDRIVE(osm_file);
|
||||
}
|
||||
};
|
||||
|
||||
void export_converter() {
|
||||
using namespace converter;
|
||||
using namespace osm2odr;
|
||||
using namespace boost::python;
|
||||
|
||||
def("convert_to_odr", &ConvertOSMToOpenDRIVE, (arg("osm_file"), arg("offsetX") = 0, arg("offsetY") = 0));
|
||||
// def("convert_to_odr", &ConvertOSMToOpenDRIVE, (arg("osm_file"), arg("offsetX") = 0, arg("offsetY") = 0));
|
||||
|
||||
// class_<Converter>("Converter", init<>())
|
||||
// .def("convert_to_odr", &Converter::ConvertOSMToOpenDRIVE, (arg("osm_file")))
|
||||
// .staticmethod("convert_to_odr")
|
||||
// ;
|
||||
class_<OSM2ODR>("OSM2ODR", init<>())
|
||||
.def("convert_to_odr", &OSM2ODR::ConvertOSMToOpenDRIVE, (arg("osm_file")))
|
||||
.staticmethod("convert_to_odr")
|
||||
;
|
||||
}
|
||||
|
|
|
@ -25,14 +25,13 @@
|
|||
#include <utils/geom/GeoConvHelper.h>
|
||||
|
||||
|
||||
namespace converter {
|
||||
namespace osm2odr {
|
||||
|
||||
void fillOptions() {
|
||||
OptionsCont& oc = OptionsCont::getOptions();
|
||||
oc.addCallExample("-c <CONFIGURATION>", "generate net with options read from file");
|
||||
oc.addCallExample("-n ./nodes.xml -e ./edges.xml -v -t ./owntypes.xml",
|
||||
"generate net with given nodes, edges, and edge types doing verbose output");
|
||||
|
||||
// insert options sub-topics
|
||||
SystemFrame::addConfigurationOptions(oc); // this subtopic is filled here, too
|
||||
oc.addOptionSubTopic("Input");
|
||||
|
@ -66,16 +65,17 @@ namespace converter {
|
|||
return ok;
|
||||
}
|
||||
|
||||
std::string ConvertOSMToOpenDRIVE(std::string osm_file, double offsetX, double offsetY) {
|
||||
std::string ConvertOSMToOpenDRIVE(std::string osm_file, OSM2ODRSettings settings) {
|
||||
// std::string OptionsArgs = "--geometry.remove --ramps.guess --edges.join --junctions.join --keep-edges.by-type highway.motorway,highway.motorway_link,highway.trunk,highway.trunk_link,highway.primary,highway.primary_link,highway.secondary,highway.secondary_link,highway.tertiary,highway.tertiary_link,highway.unclassified,highway.residential --tls.discard-loaded --tls.discard-simple --default.lanewidth 4.0 --osm.layer-elevation 4";
|
||||
|
||||
std::vector<std::string> OptionsArgs = {
|
||||
"--proj", "+proj=tmerc",
|
||||
"--geometry.remove", "--ramps.guess", "--edges.join", "--junctions.join",
|
||||
"--geometry.remove", "--ramps.guess", "--edges.join", "--junctions.join", "--roundabouts.guess",
|
||||
"--keep-edges.by-type", "highway.motorway,highway.motorway_link,highway.trunk,highway.trunk_link,highway.primary,highway.primary_link,highway.secondary,highway.secondary_link,highway.tertiary,highway.tertiary_link,highway.unclassified,highway.residential",
|
||||
"--tls.discard-loaded", "--tls.discard-simple", "--default.lanewidth", "4.0",
|
||||
"--osm.layer-elevation", "4",
|
||||
"--osm-files", "TRUE", "--opendrive-output", "TRUE", // necessary for now to enable osm input and xodr output
|
||||
"--offset.x", std::to_string(offsetX), "--offset.y", std::to_string(offsetY)
|
||||
"--offset.x", std::to_string(settings.offsetX), "--offset.y", std::to_string(settings.offsetY)
|
||||
};
|
||||
|
||||
// OptionsCont::getOptions().clear();
|
||||
|
@ -129,4 +129,4 @@ namespace converter {
|
|||
|
||||
}
|
||||
|
||||
} // namespace converter
|
||||
} // namespace OSM2ODR
|
||||
|
|
|
@ -8,8 +8,13 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace converter {
|
||||
namespace osm2odr {
|
||||
|
||||
std::string ConvertOSMToOpenDRIVE(std::string osm_file, double offsetX = 0, double offsetY = 0);
|
||||
struct OSM2ODRSettings {
|
||||
double offsetX = 0;
|
||||
double offsetY = 0;
|
||||
};
|
||||
|
||||
} // namespace converter
|
||||
std::string ConvertOSMToOpenDRIVE(std::string osm_file, OSM2ODRSettings settings = OSM2ODRSettings());
|
||||
|
||||
} // namespace osm2odr
|
||||
|
|
Loading…
Reference in New Issue