mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +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:
@@ -16,23 +16,26 @@ using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
uint32_t constexpr kPowOfTwoForFeatureCacheSize = 10; // cache contains 2 ^ kPowOfTwoForFeatureCacheSize elements
|
||||
uint32_t constexpr kPowOfTwoForFeatureCacheSize = 10; // cache contains 2 ^ kPowOfTwoForFeatureCacheSize elements
|
||||
|
||||
double constexpr kMwmRoadCrossingRadiusMeters = 2.0;
|
||||
|
||||
auto constexpr kInvalidSpeedKMPH = numeric_limits<double>::max();
|
||||
} // namespace
|
||||
|
||||
double GetRoadCrossingRadiusMeters() { return kMwmRoadCrossingRadiusMeters; }
|
||||
double GetRoadCrossingRadiusMeters()
|
||||
{
|
||||
return kMwmRoadCrossingRadiusMeters;
|
||||
}
|
||||
|
||||
FeaturesRoadGraphBase::CrossCountryVehicleModel::CrossCountryVehicleModel(VehicleModelFactoryPtrT modelFactory)
|
||||
: m_modelFactory(modelFactory)
|
||||
, m_maxSpeed(m_modelFactory->GetVehicleModel()->GetMaxWeightSpeed())
|
||||
, m_offroadSpeedKMpH(m_modelFactory->GetVehicleModel()->GetOffroadSpeed())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
SpeedKMpH FeaturesRoadGraphBase::CrossCountryVehicleModel::GetSpeed(FeatureType & f, SpeedParams const & speedParams) const
|
||||
SpeedKMpH FeaturesRoadGraphBase::CrossCountryVehicleModel::GetSpeed(FeatureType & f,
|
||||
SpeedParams const & speedParams) const
|
||||
{
|
||||
return GetVehicleModel(f.GetID())->GetSpeed(FeatureTypes(f), speedParams);
|
||||
}
|
||||
@@ -62,7 +65,8 @@ bool FeaturesRoadGraphBase::CrossCountryVehicleModel::IsPassThroughAllowed(Featu
|
||||
return GetVehicleModel(f.GetID())->IsPassThroughAllowed(FeatureTypes(f));
|
||||
}
|
||||
|
||||
VehicleModelInterface * FeaturesRoadGraphBase::CrossCountryVehicleModel::GetVehicleModel(FeatureID const & featureId) const
|
||||
VehicleModelInterface * FeaturesRoadGraphBase::CrossCountryVehicleModel::GetVehicleModel(
|
||||
FeatureID const & featureId) const
|
||||
{
|
||||
auto itr = m_cache.find(featureId.m_mwmId);
|
||||
if (itr != m_cache.end())
|
||||
@@ -99,15 +103,17 @@ void FeaturesRoadGraph::RoadInfoCache::Clear()
|
||||
|
||||
FeaturesRoadGraphBase::FeaturesRoadGraphBase(MwmDataSource & dataSource, IRoadGraph::Mode mode,
|
||||
shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory)
|
||||
: m_dataSource(dataSource), m_mode(mode), m_vehicleModel(vehicleModelFactory)
|
||||
{
|
||||
}
|
||||
: m_dataSource(dataSource)
|
||||
, m_mode(mode)
|
||||
, m_vehicleModel(vehicleModelFactory)
|
||||
{}
|
||||
|
||||
class CrossFeaturesLoader
|
||||
{
|
||||
public:
|
||||
CrossFeaturesLoader(FeaturesRoadGraphBase const & graph, IRoadGraph::ICrossEdgesLoader & edgesLoader)
|
||||
: m_graph(graph), m_edgesLoader(edgesLoader)
|
||||
: m_graph(graph)
|
||||
, m_edgesLoader(edgesLoader)
|
||||
{}
|
||||
|
||||
void operator()(FeatureType & ft)
|
||||
@@ -128,8 +134,8 @@ private:
|
||||
IRoadGraph::ICrossEdgesLoader & m_edgesLoader;
|
||||
};
|
||||
|
||||
void FeaturesRoadGraphBase::ForEachFeatureClosestToCross(
|
||||
m2::PointD const & cross, ICrossEdgesLoader & edgesLoader) const
|
||||
void FeaturesRoadGraphBase::ForEachFeatureClosestToCross(m2::PointD const & cross,
|
||||
ICrossEdgesLoader & edgesLoader) const
|
||||
{
|
||||
CrossFeaturesLoader featuresLoader(*this, edgesLoader);
|
||||
m2::RectD const rect = mercator::RectByCenterXYAndSizeInMeters(cross, kMwmRoadCrossingRadiusMeters);
|
||||
@@ -155,8 +161,8 @@ void FeaturesRoadGraphBase::FindClosestEdges(m2::RectD const & rect, uint32_t co
|
||||
finder.MakeResult(vicinities, count);
|
||||
}
|
||||
|
||||
vector<IRoadGraph::FullRoadInfo>
|
||||
FeaturesRoadGraphBase::FindRoads(m2::RectD const & rect, IsGoodFeatureFn const & isGoodFeature) const
|
||||
vector<IRoadGraph::FullRoadInfo> FeaturesRoadGraphBase::FindRoads(m2::RectD const & rect,
|
||||
IsGoodFeatureFn const & isGoodFeature) const
|
||||
{
|
||||
vector<IRoadGraph::FullRoadInfo> roads;
|
||||
|
||||
@@ -235,8 +241,8 @@ double FeaturesRoadGraphBase::GetSpeedKMpHFromFt(FeatureType & ft, SpeedParams c
|
||||
return m_vehicleModel.GetSpeed(ft, speedParams).m_weight;
|
||||
}
|
||||
|
||||
void FeaturesRoadGraphBase::ExtractRoadInfo(FeatureID const & featureId, FeatureType & ft,
|
||||
double speedKMpH, RoadInfo & ri) const
|
||||
void FeaturesRoadGraphBase::ExtractRoadInfo(FeatureID const & featureId, FeatureType & ft, double speedKMpH,
|
||||
RoadInfo & ri) const
|
||||
{
|
||||
ri.m_speedKMPH = speedKMpH;
|
||||
ri.m_bidirectional = !IsOneWay(ft);
|
||||
@@ -262,8 +268,8 @@ void FeaturesRoadGraphBase::ExtractRoadInfo(FeatureID const & featureId, Feature
|
||||
}
|
||||
}
|
||||
|
||||
IRoadGraph::RoadInfo const & FeaturesRoadGraphBase::GetCachedRoadInfo(
|
||||
FeatureID const & featureId, SpeedParams const & speedParams) const
|
||||
IRoadGraph::RoadInfo const & FeaturesRoadGraphBase::GetCachedRoadInfo(FeatureID const & featureId,
|
||||
SpeedParams const & speedParams) const
|
||||
{
|
||||
bool found = false;
|
||||
RoadInfo & ri = m_cache.Find(featureId, found);
|
||||
@@ -281,8 +287,8 @@ IRoadGraph::RoadInfo const & FeaturesRoadGraphBase::GetCachedRoadInfo(
|
||||
return ri;
|
||||
}
|
||||
|
||||
IRoadGraph::RoadInfo const & FeaturesRoadGraphBase::GetCachedRoadInfo(
|
||||
FeatureID const & featureId, FeatureType & ft, double speedKMPH) const
|
||||
IRoadGraph::RoadInfo const & FeaturesRoadGraphBase::GetCachedRoadInfo(FeatureID const & featureId, FeatureType & ft,
|
||||
double speedKMPH) const
|
||||
{
|
||||
bool found = false;
|
||||
RoadInfo & ri = m_cache.Find(featureId, found);
|
||||
|
||||
Reference in New Issue
Block a user