mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 21:13:35 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
#include "coding/point_coding.hpp"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
#include "geometry/polyline2d.hpp"
|
||||
#include "geometry/point_with_altitude.hpp"
|
||||
#include "geometry/polyline2d.hpp"
|
||||
|
||||
#include "base/logging.hpp"
|
||||
#include "base/math.hpp"
|
||||
@@ -42,7 +42,10 @@ m2::PointD GetPointOnEdge(routing::Edge const & e, double posAlong)
|
||||
|
||||
RoutingTest::RoutingTest(routing::IRoadGraph::Mode mode, routing::VehicleType type,
|
||||
std::set<std::string> const & neededMaps)
|
||||
: m_mode(mode), m_type(type), m_neededMaps(neededMaps), m_numMwmIds(std::make_unique<routing::NumMwmIds>())
|
||||
: m_mode(mode)
|
||||
, m_type(type)
|
||||
, m_neededMaps(neededMaps)
|
||||
, m_numMwmIds(std::make_unique<routing::NumMwmIds>())
|
||||
{
|
||||
classificator::Load();
|
||||
|
||||
@@ -73,10 +76,8 @@ RoutingTest::RoutingTest(routing::IRoadGraph::Mode mode, routing::VehicleType ty
|
||||
if (registeredMaps != m_neededMaps)
|
||||
{
|
||||
for (auto const & file : m_neededMaps)
|
||||
{
|
||||
if (registeredMaps.count(file) == 0)
|
||||
LOG(LERROR, ("Can't find map:", file));
|
||||
}
|
||||
TEST(false, ("Some maps can't be found. See error messages above."));
|
||||
}
|
||||
}
|
||||
@@ -99,7 +100,7 @@ void RoutingTest::TestRouters(m2::PointD const & startPos, m2::PointD const & fi
|
||||
|
||||
double constexpr kEpsilon = 1e-6;
|
||||
TEST(AlmostEqualAbs(routeFoundByAstar.GetTotalDistanceMeters(),
|
||||
routeFoundByAstarBidirectional.GetTotalDistanceMeters(), kEpsilon),
|
||||
routeFoundByAstarBidirectional.GetTotalDistanceMeters(), kEpsilon),
|
||||
());
|
||||
}
|
||||
|
||||
@@ -115,8 +116,7 @@ void RoutingTest::TestTwoPointsOnFeature(m2::PointD const & startPos, m2::PointD
|
||||
|
||||
m2::PointD const startPosOnFeature =
|
||||
GetPointOnEdge(startEdges.front().first, 0.0 /* the start point of the feature */);
|
||||
m2::PointD const finalPosOnFeature =
|
||||
GetPointOnEdge(finalEdges.front().first, 1.0 /* the end point of the feature */);
|
||||
m2::PointD const finalPosOnFeature = GetPointOnEdge(finalEdges.front().first, 1.0 /* the end point of the feature */);
|
||||
|
||||
TestRouters(startPosOnFeature, finalPosOnFeature);
|
||||
}
|
||||
@@ -126,13 +126,11 @@ std::unique_ptr<routing::IRouter> RoutingTest::CreateRouter(std::string const &
|
||||
std::vector<platform::LocalCountryFile> neededLocalFiles;
|
||||
neededLocalFiles.reserve(m_neededMaps.size());
|
||||
for (auto const & file : m_localFiles)
|
||||
{
|
||||
if (m_neededMaps.count(file.GetCountryName()) != 0)
|
||||
neededLocalFiles.push_back(file);
|
||||
}
|
||||
|
||||
std::unique_ptr<routing::IRouter> router = integration::CreateVehicleRouter(
|
||||
m_dataSource, *m_cig, m_trafficCache, neededLocalFiles, m_type);
|
||||
std::unique_ptr<routing::IRouter> router =
|
||||
integration::CreateVehicleRouter(m_dataSource, *m_cig, m_trafficCache, neededLocalFiles, m_type);
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -141,20 +139,19 @@ void RoutingTest::GetNearestEdges(m2::PointD const & pt,
|
||||
{
|
||||
routing::MwmDataSource dataSource(m_dataSource, nullptr /* numMwmIDs */);
|
||||
routing::FeaturesRoadGraph graph(dataSource, m_mode, CreateModelFactory());
|
||||
graph.FindClosestEdges(mercator::RectByCenterXYAndSizeInMeters(
|
||||
pt, routing::FeaturesRoadGraph::kClosestEdgesRadiusM),
|
||||
graph.FindClosestEdges(mercator::RectByCenterXYAndSizeInMeters(pt, routing::FeaturesRoadGraph::kClosestEdgesRadiusM),
|
||||
1 /* count */, edges);
|
||||
}
|
||||
|
||||
void TestRouter(routing::IRouter & router, m2::PointD const & startPos,
|
||||
m2::PointD const & finalPos, routing::Route & route)
|
||||
void TestRouter(routing::IRouter & router, m2::PointD const & startPos, m2::PointD const & finalPos,
|
||||
routing::Route & route)
|
||||
{
|
||||
routing::RouterDelegate delegate;
|
||||
LOG(LINFO, ("Calculating routing ...", router.GetName()));
|
||||
base::Timer timer;
|
||||
auto const resultCode = router.CalculateRoute(routing::Checkpoints(startPos, finalPos),
|
||||
m2::PointD::Zero() /* startDirection */,
|
||||
false /* adjust */, delegate, route);
|
||||
auto const resultCode =
|
||||
router.CalculateRoute(routing::Checkpoints(startPos, finalPos), m2::PointD::Zero() /* startDirection */,
|
||||
false /* adjust */, delegate, route);
|
||||
double const elapsedSec = timer.ElapsedSeconds();
|
||||
TEST_EQUAL(routing::RouterResultCode::NoError, resultCode, ());
|
||||
TEST(route.IsValid(), ());
|
||||
|
||||
Reference in New Issue
Block a user