Skip to content

Commit

Permalink
Add "boost/version.hpp" header in all files checking boost version an…
Browse files Browse the repository at this point in the history
…d minor clean up (#38)

* Add "boost/version.hpp" header in all files checking boost version.

* Replace `_geom.size() == 0` with `_geom.empty()` in src/osm/Way.cpp

* Replace `.size()` call with `{}` for vector initialisation in DAG.
Reword comments in findSuccessorsHelper.

* Improve variable name in `apps/osm2rdf-stats.cpp`

* Small cleanup of Config.h and Config.cpp

`osm2rdf::config::Config::fromArgs()`
- rename variable `op` to `parser`.
  `op` could be confused with operator instead of OptionParser.
- Rename `o` to `option` during enumeration of unknown options.

`osm2rdf::config::Config::getTempPath()` better argument and variable names

* Clarify IDs in LocationHandler and RelationHandler

* Remove indirect shadowing of `successors` in `GeometryHandler::dumpWayRelations` and use AreaFromType enum in more places
  • Loading branch information
lehmann-4178656ch committed Dec 15, 2022
1 parent d970b22 commit 2619fbb
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 163 deletions.
22 changes: 11 additions & 11 deletions apps/osm2rdf-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,25 @@ class OsmiumIdHandler : public osmium::handler::Handler {
}

static std::string idInfo(const uint64_t max) {
std::string s{"<= "};
std::string size{"<= "};
if (max <= std::numeric_limits<uint8_t>::max()) {
s += " uint8_t";
return s;
size += " uint8_t";
return size;
}
if (max <= std::numeric_limits<uint16_t>::max()) {
s += "uint16_t";
return s;
size += "uint16_t";
return size;
}
if (max <= std::numeric_limits<uint32_t>::max()) {
s += "uint32_t";
return s;
size += "uint32_t";
return size;
}
if (max <= std::numeric_limits<uint64_t>::max()) {
s += "uint64_t";
return s;
size += "uint64_t";
return size;
}
s += "unknown!";
return s;
size += "unknown!";
return size;
}

protected:
Expand Down
6 changes: 3 additions & 3 deletions include/osm2rdf/config/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct Config {
// case). Think of this is maximum portion of the radius that is
// "collapsed away" by the inner simplification, or added by the outer
// simplification
double simplifyGeometriesInnerOuter = 1/(3.14 * 20);
double simplifyGeometriesInnerOuter = 1 / (3.14 * 20);
bool dontUseInnerOuterGeoms = false;
bool approximateSpatialRels = false;

Expand Down Expand Up @@ -112,8 +112,8 @@ struct Config {
[[nodiscard]] std::string getInfo(std::string_view prefix) const;

// Generate a path inside the cache directory.
[[nodiscard]] std::filesystem::path getTempPath(const std::string& p,
const std::string& s) const;
[[nodiscard]] std::filesystem::path getTempPath(
const std::string& path, const std::string& suffix) const;
};
} // namespace osm2rdf::config

Expand Down
1 change: 1 addition & 0 deletions include/osm2rdf/geometry/Relation.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <boost/geometry/algorithms/equals.hpp>
#include "boost/geometry/geometries/geometries.hpp"
#include "boost/variant.hpp"
#include "boost/version.hpp"
#include "osm2rdf/geometry/Area.h"
#include "osm2rdf/geometry/Node.h"
#include "osm2rdf/geometry/Way.h"
Expand Down
1 change: 1 addition & 0 deletions include/osm2rdf/osm/GeometryHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "boost/archive/binary_oarchive.hpp"
#include "boost/geometry/index/rtree.hpp"
#include "boost/version.hpp"
#include "gtest/gtest_prod.h"
#include "osm2rdf/config/Config.h"
#include "osm2rdf/geometry/Area.h"
Expand Down
14 changes: 7 additions & 7 deletions include/osm2rdf/osm/LocationHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LocationHandler : public osmium::handler::Handler {
public:
virtual ~LocationHandler() {}
virtual void node(const osmium::Node& node) = 0;
virtual void way(osmium::Way& way) = 0; // NOLINT
virtual void way(osmium::Way& way) = 0;
[[nodiscard]] virtual osmium::Location get_node_location(
const osmium::object_id_type id) const = 0;
// Helper creating the correct instance.
Expand All @@ -50,9 +50,9 @@ class LocationHandlerImpl : public LocationHandler {
public:
explicit LocationHandlerImpl(const osm2rdf::config::Config& config);
void node(const osmium::Node& node);
void way(osmium::Way& way); // NOLINT
void way(osmium::Way& way);
[[nodiscard]] osmium::Location get_node_location(
const osmium::object_id_type id) const;
const osmium::object_id_type nodeId) const;

protected:
T _index;
Expand All @@ -66,9 +66,9 @@ class LocationHandlerImpl<osmium::index::map::SparseFileArray<
public:
explicit LocationHandlerImpl(const osm2rdf::config::Config& config);
void node(const osmium::Node& node);
void way(osmium::Way& way); // NOLINT
void way(osmium::Way& way);
[[nodiscard]] osmium::Location get_node_location(
const osmium::object_id_type id) const;
const osmium::object_id_type nodeId) const;

protected:
osm2rdf::util::CacheFile _cacheFile;
Expand All @@ -87,9 +87,9 @@ class LocationHandlerImpl<osmium::index::map::DenseFileArray<
public:
explicit LocationHandlerImpl(const osm2rdf::config::Config& config);
void node(const osmium::Node& node);
void way(osmium::Way& way); // NOLINT
void way(osmium::Way& way);
[[nodiscard]] osmium::Location get_node_location(
const osmium::object_id_type id) const;
const osmium::object_id_type nodeId) const;

protected:
osm2rdf::util::CacheFile _cacheFile;
Expand Down
1 change: 1 addition & 0 deletions include/osm2rdf/osm/Relation.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "RelationHandler.h"
#include "boost/serialization/nvp.hpp"
#include "boost/serialization/vector.hpp"
#include "boost/version.hpp"
#include "osm2rdf/geometry/Relation.h"
#include "osm2rdf/osm/Box.h"
#include "osm2rdf/osm/RelationHandler.h"
Expand Down
4 changes: 2 additions & 2 deletions include/osm2rdf/osm/RelationHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class RelationHandler : public osmium::handler::Handler {
void prepare_for_lookup();
void setLocationHandler(osm2rdf::osm::LocationHandler* locationHandler);
bool hasLocationHandler() const;
osmium::Location get_node_location(const uint64_t id) const;
std::vector<uint64_t> get_noderefs_of_way(const uint64_t id);
osmium::Location get_node_location(const uint64_t nodeId) const;
std::vector<uint64_t> get_noderefs_of_way(const uint64_t wayId);

protected:
osm2rdf::config::Config _config;
Expand Down
Loading

0 comments on commit 2619fbb

Please sign in to comment.