Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #12

Merged
merged 57 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
5ec5361
chore: Refactor navteq_plugin.cpp to use const reference for dataDirs
Jul 12, 2024
6f151ae
add converter
Jul 12, 2024
e33ac69
extract water ways and bodies
Jul 12, 2024
1259658
chore: Refactor Converter.cpp and Converter.hpp
Jul 12, 2024
23a26d4
extract Railways
Jul 12, 2024
962acd0
add building converter
Jul 12, 2024
02f243d
chore: Update file associations in .vscode/settings.json
Jul 12, 2024
58cc1fd
add rest areas
Jul 12, 2024
f5c8b22
add hamletconverter
Jul 12, 2024
e5e18b1
add CityConverter
Jul 12, 2024
5bb62e6
add LanduseConverter
Jul 12, 2024
7e2151c
extract admin boundaries
Jul 13, 2024
c338c6e
add adminboundaries converter
Jul 15, 2024
428b255
move iso parse logic to converter
Jul 15, 2024
5ed90fd
Extract admin boundaries and refactor AdminBoundariesConverter
Jul 15, 2024
03b5716
Refactor code to add LINK_ID constant in Converter.hpp and remove LIN…
Jul 15, 2024
5b13a1d
Refactor code to remove unused variables and improve code readability
Jul 15, 2024
360b666
rfactoring
Jul 15, 2024
1c08a0e
refactoring
Jul 15, 2024
4f77e8b
add housenumber
Jul 15, 2024
c269b05
refactor navteq.hpp to remove unused code and improve readability
Jul 15, 2024
2e878b5
Refactor navteq_mappings.hpp to remove unused code and improve readab…
Jul 15, 2024
3940346
Refactor navteq_plugin.hpp to remove unused code and improve readability
Jul 15, 2024
80d1b3a
replace with std::fileystem
Jul 15, 2024
fcc282e
Refactor StreetConverter to remove unused code and improve readability
Jul 15, 2024
bee78f4
use gdal to access dbf files
Jul 15, 2024
c5c6245
refactor: Remove boost-filesystem dependency and use std::filesystem …
Jul 15, 2024
6f62681
Refactor Converter class to handle navteq admin level as string
Jul 16, 2024
e2bafd3
remove helper
Jul 16, 2024
705852a
fix datasource
Jul 16, 2024
a525bf9
convert everything except streets
Jul 16, 2024
41cd71a
single directory in the converter
Jul 16, 2024
80c92fa
use Here to ISO mapping to determine the region to convert
Jul 16, 2024
76d0abf
activate streetconverter again
Jul 16, 2024
1ace21b
refactor: Remove navteq_mappings.hpp file
Jul 16, 2024
4c79847
extract OSMTagger and housenumber creation
Jul 17, 2024
dcf5a6b
more extraction
Jul 17, 2024
b8490e6
remove global under construction map
Jul 17, 2024
988f50b
refactor: replace global maps
Jul 17, 2024
45cc703
Extract Housenumber conversion into its on converter
Jul 17, 2024
b9fad6b
extract more global states
Jul 17, 2024
82bcd5d
finished refactoring
Jul 17, 2024
77c4b40
fix error
Jul 17, 2024
3f7dd96
fix error with ramp names
Jul 17, 2024
dcc1c89
use global endpoint map
Jul 17, 2024
0333ebf
add country codes
Jul 17, 2024
bacc45e
fix query
Jul 17, 2024
b964fac
add missing region
Jul 17, 2024
2b77804
chore: Store considered conditional modifications in cdms_map
Jul 17, 2024
8c63a35
ignore timerestrictions
Jul 18, 2024
a32d651
fix country detection
Jul 19, 2024
db4ab84
only consider adminlvl 1 for mapping aracoe to govcode
Jul 19, 2024
60c3db8
cnsider MPH
Jul 19, 2024
ed9fb2e
consider special speed limits
Jul 22, 2024
7df0a7b
no direction for access restriction
Jul 22, 2024
9895b28
chore: Remove unused dependencies and update CMakeLists.txt
Jul 22, 2024
91becff
remove useless BK road handling for sweden
Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .devcontainer/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"dependencies": [
"boost-log",
"boost-program-options",
"boost-filesystem",
"icu",
"boost-timer",
"shapelib",
"libosmium",
{
"name": "gdal",
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"MIMode": "gdb",
"args": [
//"--bb=-25.0 32.9 31.4 71.7",
"--countries=ALB AND AUT BEL BGR BIH BLR CHE CYP CZE DEU DNK ESP EST FIN FRA FRO GBR GIB GRC GRL HRV HUN IMN IRL ISL ITA KOS LIE LTU LUX LVA MCO MDA MKD MLT MNE NCY NLD NOR POL PRT ROU SJM SMR SRB SVK SVN SWE VAT",
"/here-europe",
"--countries=ALB AUT BEL BGR BIH BLR CHE CYP CZE DEU DNK ESP EST FIN FRA GBR GRC HRV HUN IRL ISL ITA LTU LUX LVA MDA MKD MLT MNE NLD NOR POL PRT ROU SRB SVK SVN SWE ",
"${workspaceFolder}/here-data",
"build/europa.osm.pbf"
]
},
Expand Down
20 changes: 19 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"files.associations": {
"*.FTL": "csv",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
Expand Down Expand Up @@ -55,7 +56,24 @@
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp"
"typeinfo": "cpp",
"strstream": "cpp",
"bit": "cpp",
"charconv": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"source_location": "cpp",
"format": "cpp",
"numbers": "cpp",
"ranges": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"span": "cpp",
"stdfloat": "cpp",
"stop_token": "cpp",
"typeindex": "cpp",
"variant": "cpp"
},
"C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools",
"cmake.configureSettings": {
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ ENDIF()
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)

find_package(Boost REQUIRED COMPONENTS system filesystem log program_options)
find_package(Boost REQUIRED COMPONENTS system log program_options)
find_package(GDAL REQUIRED)
find_package(geos REQUIRED)
find_path(OSMIUM_INCLUDE_DIRS "osmium/version.hpp")
find_package(shapelib CONFIG REQUIRED)
find_package(ICU COMPONENTS uc data io i18n tu)

# Find includes in corresponding build directories
Expand All @@ -50,6 +49,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${ICU_LIBRARY}
PRIVATE GEOS::geos
PRIVATE ${OSMIUM_INCLUDE_DIRS}
PRIVATE GDAL::GDAL
PRIVATE shapelib::shp
PRIVATE expat bz2
)
7 changes: 4 additions & 3 deletions comm2osm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
#include <iostream>
#include <memory>
#include <ogrsf_frmts.h>
#include <set>
#include <vector>

#include "plugins/base_plugin.hpp"
#include "plugins/dummy/dummy_plugin.hpp"
#include "plugins/navteq/navteq_plugin.hpp"

boost::filesystem::path input_path, output_file;
std::filesystem::path input_path, output_file;
std::vector<double> boundingBox;
std::vector<std::string> countries;
std::set<std::string> countries;
static bool debug = false;

void check_args_and_setup(int argc, char *argv[]) {
Expand Down Expand Up @@ -99,7 +100,7 @@ int main(int argc, char *argv[]) {

std::vector<std::unique_ptr<base_plugin>> plugins;

boost::filesystem::path executable_path(argv[0]);
std::filesystem::path executable_path(argv[0]);

// plugins.emplace_back(std::make_unique<dummy_plugin>());
plugins.emplace_back(std::make_unique<navteq_plugin>(executable_path));
Expand Down
29 changes: 15 additions & 14 deletions plugins/base_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@

#include <assert.h>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <filesystem>
#include <set>

#include <osmium/io/error.hpp>

class base_plugin {
public:
std::string name;
boost::filesystem::path input_path;
boost::filesystem::path output_path;
boost::filesystem::path executable_path;
std::filesystem::path input_path;
std::filesystem::path output_path;
std::filesystem::path executable_path;

base_plugin() { this->name = ""; };
base_plugin(const std::string &name) { this->name = name; };
base_plugin(const std::string &name,
const boost::filesystem::path &executable_path) {
const std::filesystem::path &executable_path) {
this->name = name;
this->executable_path = executable_path.parent_path();
}
Expand All @@ -42,14 +43,14 @@ class base_plugin {
* \param inputh_path_rhs input path to set
* \param output_path_rhs output path to set (may be ommited)
* */
void plugin_setup(const boost::filesystem::path &input_path_rhs,
const boost::filesystem::path &output_path_rhs =
boost::filesystem::path()) {
void plugin_setup(
const std::filesystem::path &input_path_rhs,
const std::filesystem::path &output_path_rhs = std::filesystem::path()) {
input_path = input_path_rhs;
if (!boost::filesystem::is_directory(input_path))
if (!std::filesystem::is_directory(input_path))
throw(osmium::io_error("input_path '" + input_path.string() +
"' is not valid."));
if (boost::filesystem::is_directory(output_path_rhs.parent_path()))
if (std::filesystem::is_directory(output_path_rhs.parent_path()))
output_path = output_path_rhs;
}

Expand All @@ -74,9 +75,9 @@ class base_plugin {
*
* \return returns true if input is existing and valid
* */
virtual bool check_input(const boost::filesystem::path &input_path,
const boost::filesystem::path &output_path =
boost::filesystem::path("")) = 0;
virtual bool check_input(
const std::filesystem::path &input_path,
const std::filesystem::path &output_path = std::filesystem::path("")) = 0;

/**
* \brief Converts input to OSM files
Expand All @@ -92,7 +93,7 @@ class base_plugin {
virtual void setBoundingBox(double minX, double minY, double maxX,
double maxY) = 0;

virtual void setCountries(const std::vector<std::string> &_countries) = 0;
virtual void setCountries(const std::set<std::string> &_countries) = 0;

virtual void setDebug(bool debug) = 0;
};
Expand Down
3 changes: 1 addition & 2 deletions plugins/dummy/dummy_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ dummy_plugin::dummy_plugin() : base_plugin::base_plugin("Dummy Plugin") {}

dummy_plugin::~dummy_plugin() {}

bool dummy_plugin::check_input(boost::filesystem::path,
boost::filesystem::path) {
bool dummy_plugin::check_input(std::filesystem::path, std::filesystem::path) {
return true;
}

Expand Down
5 changes: 2 additions & 3 deletions plugins/dummy/dummy_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ class dummy_plugin : public base_plugin {
dummy_plugin();
virtual ~dummy_plugin();

bool
check_input(boost::filesystem::path input_path,
boost::filesystem::path output_path = boost::filesystem::path());
bool check_input(std::filesystem::path input_path,
std::filesystem::path output_path = std::filesystem::path());
void execute();
};

Expand Down
Loading
Loading