From f56294b5975db6f89bef0b3befdd564440e80806 Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Thu, 2 Aug 2018 19:41:39 +0200 Subject: [PATCH] correct use of numeric_limits --- src/cppgtfs | 2 +- src/pfaedle/osm/OsmBuilder.cpp | 2 +- src/util/geo/Box.h | 2 +- src/util/geo/Geo.h | 2 +- src/util/tests/TestMain.cpp | 6 ++++++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cppgtfs b/src/cppgtfs index eae77cf..727ddfe 160000 --- a/src/cppgtfs +++ b/src/cppgtfs @@ -1 +1 @@ -Subproject commit eae77cfdfb7eb64f87ddd48204ea9b90d6d5cfd8 +Subproject commit 727ddfecc952e7bd8e4b11ef34436454a50e7532 diff --git a/src/pfaedle/osm/OsmBuilder.cpp b/src/pfaedle/osm/OsmBuilder.cpp index db39e03..accf7cb 100644 --- a/src/pfaedle/osm/OsmBuilder.cpp +++ b/src/pfaedle/osm/OsmBuilder.cpp @@ -190,7 +190,7 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts, deleteOrphEdgs(g); LOG(VDEBUG) << "Collapsing edges..."; - // collapseEdges(g); + collapseEdges(g); LOG(VDEBUG) << "Deleting orphan nodes..."; deleteOrphNds(g); diff --git a/src/util/geo/Box.h b/src/util/geo/Box.h index 9642b31..b65f1d3 100644 --- a/src/util/geo/Box.h +++ b/src/util/geo/Box.h @@ -16,7 +16,7 @@ class Box { // maximum inverse box as default value of box Box() : _ll(std::numeric_limits::max(), std::numeric_limits::max()), - _ur(std::numeric_limits::min(), std::numeric_limits::min()) {} + _ur(std::numeric_limits::lowest(), std::numeric_limits::lowest()) {} Box(const Point& ll, const Point& ur) : _ll(ll), _ur(ur) {} const Point& getLowerLeft() const { return _ll; } const Point& getUpperRight() const { return _ur; } diff --git a/src/util/geo/Geo.h b/src/util/geo/Geo.h index 53eabae..dc52d4a 100644 --- a/src/util/geo/Geo.h +++ b/src/util/geo/Geo.h @@ -1167,7 +1167,7 @@ inline Polygon convexHull(const MultiPoint& l) { if (l.size() == 1) return convexHull(l[0]); Point left(std::numeric_limits::max(), 0); - Point right(std::numeric_limits::min(), 0); + Point right(std::numeric_limits::lowest(), 0); for (const auto& p : l) { if (p.getX() <= left.getX()) left = p; if (p.getX() >= right.getX()) right = p; diff --git a/src/util/tests/TestMain.cpp b/src/util/tests/TestMain.cpp index 399bc21..dbf1eb5 100644 --- a/src/util/tests/TestMain.cpp +++ b/src/util/tests/TestMain.cpp @@ -990,6 +990,12 @@ CASE("geometry") { geo::Line llll{geo::Point(1.2, 0), geo::Point(1, 2)}; EXPECT(geo::intersects(llll, bbox)); + Line l5new; + l5new.push_back(Point(-10, -5)); + l5new.push_back(Point(-8, -4)); + EXPECT(geo::getBoundingBox(l5new).getUpperRight().getX() == approx(-8)); + EXPECT(geo::getBoundingBox(l5new).getUpperRight().getY() == approx(-4)); + Line l5; l5.push_back(Point(0, 0)); l5.push_back(Point(1.5, 2));