mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[core] Use constexpr when possible
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
@@ -10,9 +10,9 @@ namespace
|
||||
// and add assertions about the highest bit.
|
||||
// The old scheme used the highest bit and the new one does not.
|
||||
// uint64_t const kTypeMask = 0x7F00000000000000;
|
||||
uint64_t const kTypeMask = 0xFF00000000000000;
|
||||
uint64_t const kReservedMask = 0x00FF000000000000;
|
||||
uint64_t const kSerialMask = 0x0000FFFFFFFFFFFF;
|
||||
uint64_t constexpr kTypeMask = 0xFF00000000000000;
|
||||
uint64_t constexpr kReservedMask = 0x00FF000000000000;
|
||||
uint64_t constexpr kSerialMask = 0x0000FFFFFFFFFFFF;
|
||||
} // namespace
|
||||
|
||||
namespace base
|
||||
|
||||
@@ -96,7 +96,7 @@ Slice<Container> MakeSlice(Container const & c, size_t offset)
|
||||
template <typename S>
|
||||
void RawSkew(size_t n, size_t maxValue, S const & s, size_t * sa)
|
||||
{
|
||||
size_t const kInvalidId = std::numeric_limits<size_t>::max();
|
||||
size_t constexpr kInvalidId = std::numeric_limits<size_t>::max();
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
size_t const kNumBytes = 256;
|
||||
size_t constexpr kNumBytes = 256;
|
||||
|
||||
// Fake trailing '$' for the BWT, used for original string
|
||||
// reconstruction.
|
||||
uint32_t const kEOS = 256;
|
||||
uint32_t constexpr kEOS = 256;
|
||||
|
||||
// FirstColumn represents the first column in the BWT matrix. As
|
||||
// during reverse BWT we need to reconstruct canonical first column,
|
||||
|
||||
@@ -414,7 +414,7 @@ unique_ptr<CompressedBitVector> CompressedBitVectorBuilder::FromBitPositions(vec
|
||||
// static
|
||||
unique_ptr<CompressedBitVector> CompressedBitVectorBuilder::FromBitGroups(vector<uint64_t> && bitGroups)
|
||||
{
|
||||
static uint64_t const kBlockSize = DenseCBV::kBlockSize;
|
||||
static uint64_t constexpr kBlockSize = DenseCBV::kBlockSize;
|
||||
|
||||
while (!bitGroups.empty() && bitGroups.back() == 0)
|
||||
bitGroups.pop_back();
|
||||
|
||||
@@ -89,7 +89,7 @@ class DenseCBV : public CompressedBitVector
|
||||
{
|
||||
public:
|
||||
friend class CompressedBitVectorBuilder;
|
||||
static uint64_t const kBlockSize = 64;
|
||||
static uint64_t constexpr kBlockSize = 64;
|
||||
|
||||
DenseCBV() = default;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
/// this value.
|
||||
///
|
||||
/// WARNING! Existing sections may not be properly aligned.
|
||||
static uint64_t const kSectionAlignment = 8;
|
||||
static uint64_t constexpr kSectionAlignment = 8;
|
||||
|
||||
bool IsExist(Tag const & tag) const { return GetInfo(tag) != 0; }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace impl
|
||||
{
|
||||
static char const kToHexTable[] = "0123456789ABCDEF";
|
||||
static char constexpr kToHexTable[] = "0123456789ABCDEF";
|
||||
|
||||
void ToHexRaw(void const * src, size_t size, void * dst)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ void HuffmanCoder::SetDepths(Node * root, uint32_t depth)
|
||||
// One would need more than 2^32 symbols to build a code that long.
|
||||
// On the other hand, 32 is short enough for our purposes, so do not
|
||||
// try to shrink the trees beyond this threshold.
|
||||
uint32_t const kMaxDepth = 32;
|
||||
uint32_t constexpr kMaxDepth = 32;
|
||||
|
||||
if (!root)
|
||||
return;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t static const kBufferSize = 16 * 1024;
|
||||
uint32_t static constexpr kBufferSize = 16 * 1024;
|
||||
|
||||
uint64_t m_res = 0;
|
||||
uint64_t m_numRead = 0;
|
||||
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
class BlockedTextStorageReader
|
||||
{
|
||||
public:
|
||||
inline static size_t const kDefaultCacheSize = 32;
|
||||
inline static size_t constexpr kDefaultCacheSize = 32;
|
||||
|
||||
BlockedTextStorageReader() : m_cache(kDefaultCacheSize) {}
|
||||
explicit BlockedTextStorageReader(size_t cacheSize) : m_cache(cacheSize) {}
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
namespace dp
|
||||
{
|
||||
int const kMinFrameUpdatePeriod = 5;
|
||||
int const kAvgFrameUpdatePeriod = 10;
|
||||
int const kMaxFrameUpdatePeriod = 15;
|
||||
uint32_t const kMinHandlesCount = 100;
|
||||
uint32_t const kMaxHandlesCount = 1000;
|
||||
int constexpr kMinFrameUpdatePeriod = 5;
|
||||
int constexpr kAvgFrameUpdatePeriod = 10;
|
||||
int constexpr kMaxFrameUpdatePeriod = 15;
|
||||
uint32_t constexpr kMinHandlesCount = 100;
|
||||
uint32_t constexpr kMaxHandlesCount = 1000;
|
||||
|
||||
size_t const kAverageHandlesCount[dp::OverlayRanksCount] = {300, 200, 50};
|
||||
int const kInvalidFrame = -1;
|
||||
size_t constexpr kAverageHandlesCount[dp::OverlayRanksCount] = {300, 200, 50};
|
||||
int constexpr kInvalidFrame = -1;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -466,7 +466,7 @@ void OverlayTree::Select(m2::PointD const & glbPoint, TOverlayContainer & result
|
||||
ScreenBase const & screen = GetModelView();
|
||||
m2::PointD const pxPoint = screen.GtoP(glbPoint);
|
||||
|
||||
double const kSearchRectHalfSize = 10.0;
|
||||
double constexpr kSearchRectHalfSize = 10.0;
|
||||
m2::RectD rect(pxPoint, pxPoint);
|
||||
rect.Inflate(kSearchRectHalfSize, kSearchRectHalfSize);
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace dp
|
||||
|
||||
namespace
|
||||
{
|
||||
int const kResourceSize = 2;
|
||||
int const kBytesPerPixel = 4;
|
||||
int constexpr kResourceSize = 2;
|
||||
int constexpr kBytesPerPixel = 4;
|
||||
} // namespace
|
||||
|
||||
ColorPalette::ColorPalette(m2::PointU const & canvasSize) : m_textureSize(canvasSize), m_cursor(m2::PointU::Zero()) {}
|
||||
|
||||
@@ -13,14 +13,14 @@ namespace vulkan
|
||||
{
|
||||
namespace
|
||||
{
|
||||
std::array<uint32_t, VulkanMemoryManager::kResourcesCount> const kMinBlockSizeInBytes = {{
|
||||
std::array<uint32_t, VulkanMemoryManager::kResourcesCount> constexpr kMinBlockSizeInBytes = {{
|
||||
1024 * 1024, // Geometry
|
||||
128 * 1024, // Uniform
|
||||
0, // Staging (no minimal size)
|
||||
0, // Image (no minimal size)
|
||||
}};
|
||||
|
||||
std::array<uint32_t, VulkanMemoryManager::kResourcesCount> const kDesiredSizeInBytes = {{
|
||||
std::array<uint32_t, VulkanMemoryManager::kResourcesCount> constexpr kDesiredSizeInBytes = {{
|
||||
80 * 1024 * 1024, // Geometry
|
||||
std::numeric_limits<uint32_t>::max(), // Uniform (unlimited)
|
||||
20 * 1024 * 1024, // Staging
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
double const kMaxAnimationTimeSec = 1.5; // in seconds
|
||||
double constexpr kMaxAnimationTimeSec = 1.5; // in seconds
|
||||
|
||||
} // namespace df
|
||||
|
||||
@@ -46,7 +46,7 @@ dp::Color ToDrapeColor(uint32_t src)
|
||||
|
||||
namespace
|
||||
{
|
||||
double const kMinVisibleFontSize = 8.0;
|
||||
double constexpr kMinVisibleFontSize = 8.0;
|
||||
|
||||
df::ColorConstant const kPoiDeletedMaskColor = "PoiDeletedMask";
|
||||
df::ColorConstant const kRoadShieldBlackTextColor = "RoadShieldBlackText";
|
||||
@@ -58,8 +58,8 @@ df::ColorConstant const kRoadShieldRedBackgroundColor = "RoadShieldRedBackground
|
||||
df::ColorConstant const kRoadShieldOrangeBackgroundColor = "RoadShieldOrangeBackground";
|
||||
df::ColorConstant const kRoadShieldUKYellowTextColor = "RoadShieldUKYellowText";
|
||||
|
||||
uint32_t const kPathTextBaseTextIndex = 128;
|
||||
uint32_t const kShieldBaseTextIndex = 0;
|
||||
uint32_t constexpr kPathTextBaseTextIndex = 128;
|
||||
uint32_t constexpr kShieldBaseTextIndex = 0;
|
||||
|
||||
#ifdef LINES_GENERATION_CALC_FILTERED_POINTS
|
||||
class LinesStat
|
||||
|
||||
@@ -50,7 +50,7 @@ df::ColorConstant const kArrow3DOutlineColor = "Arrow3DOutline";
|
||||
std::string const kDefaultArrowMesh = "arrow.obj";
|
||||
std::string const kDefaultArrowShadowMesh = "arrow_shadow.obj";
|
||||
|
||||
std::string_view const kMainFileId = "main_obj_file_id";
|
||||
std::string_view constexpr kMainFileId = "main_obj_file_id";
|
||||
|
||||
using TLoadingCompletion =
|
||||
std::function<void(std::vector<float> positions, std::vector<float> normals, std::vector<float> texCoords)>;
|
||||
@@ -351,7 +351,7 @@ bool Arrow3d::IsValid() const
|
||||
// static
|
||||
double Arrow3d::GetMaxBottomSize()
|
||||
{
|
||||
double const kBottomSize = 1.0;
|
||||
double constexpr kBottomSize = 1.0;
|
||||
return kBottomSize * arrow3d::kArrowSize * arrow3d::kArrow3dScaleMax * kOutlineScale;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace df
|
||||
{
|
||||
namespace
|
||||
{
|
||||
uint32_t const kDynamicStreamID = 0x7F;
|
||||
uint32_t constexpr kDynamicStreamID = 0x7F;
|
||||
|
||||
struct CirclesPackStaticVertex
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::
|
||||
pixelSize = m2::PointU(2 * static_cast<uint32_t>(m_params.m_radiusInPixels),
|
||||
2 * static_cast<uint32_t>(m_params.m_radiusInPixels));
|
||||
// Here we use an equilateral triangle to render circle (incircle of a triangle).
|
||||
static float const kSqrt3 = static_cast<float>(sqrt(3.0f));
|
||||
static float constexpr kSqrt3 = static_cast<float>(sqrt(3.0f));
|
||||
float r = m_params.m_radiusInPixels - m_params.m_outlineWidth;
|
||||
|
||||
V::TTexCoord uv2(uv.x, uv.y, norm(0.0, 0.0));
|
||||
@@ -195,7 +195,7 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::
|
||||
}
|
||||
|
||||
// Here we use an right triangle to render a quarter of circle.
|
||||
static float const kSqrt2 = static_cast<float>(sqrt(2.0f));
|
||||
static float constexpr kSqrt2 = static_cast<float>(sqrt(2.0f));
|
||||
float r = m_params.m_radiusInPixels - m_params.m_outlineWidth;
|
||||
V::TTexCoord uv2(uv.x, uv.y, norm(-halfWidthBody, halfHeightBody));
|
||||
buffer.push_back(V(position, V::TNormal(0.0, 0.0, r, 0.0f), uv2));
|
||||
|
||||
@@ -1519,7 +1519,7 @@ void FrontendRenderer::Render3dLayer(ScreenBase const & modelView)
|
||||
DEBUG_LABEL(m_context, "3D Layer");
|
||||
if (m_buildingsFramebuffer->IsSupported())
|
||||
{
|
||||
float const kOpacity = 0.7f;
|
||||
float constexpr kOpacity = 0.7f;
|
||||
m_screenQuadRenderer->RenderTexture(m_context, make_ref(m_gpuProgramManager), m_buildingsFramebuffer->GetTexture(),
|
||||
kOpacity);
|
||||
}
|
||||
@@ -2501,7 +2501,7 @@ void FrontendRenderer::UpdateScene(ScreenBase const & modelView)
|
||||
|
||||
auto removePredicate = [this](drape_ptr<RenderGroup> const & group)
|
||||
{
|
||||
uint32_t const kMaxGenerationRange = 5;
|
||||
uint32_t constexpr kMaxGenerationRange = 5;
|
||||
TileKey const & key = group->GetTileKey();
|
||||
|
||||
return (GetDepthLayer(group->GetState()) == DepthLayer::OverlayLayer && key.m_zoomLevel > GetCurrentZoom()) ||
|
||||
|
||||
@@ -22,26 +22,26 @@ df::ColorConstant const kTrackCarSpeedColor = "TrackCarSpeed";
|
||||
df::ColorConstant const kTrackPlaneSpeedColor = "TrackPlaneSpeed";
|
||||
df::ColorConstant const kTrackHumanSpeedColor = "TrackHumanSpeed";
|
||||
|
||||
int const kMinVisibleZoomLevel = 5;
|
||||
int constexpr kMinVisibleZoomLevel = 5;
|
||||
|
||||
uint32_t const kAveragePointsCount = 512;
|
||||
uint32_t constexpr kAveragePointsCount = 512;
|
||||
|
||||
// Radius of circles depending on zoom levels.
|
||||
std::array<float, 20> const kRadiusInPixel = {
|
||||
std::array<float, 20> constexpr kRadiusInPixel = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
0.8f, 0.8f, 1.5f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
2.5f, 2.5f, 2.5f, 2.5f, 3.0f, 4.0f, 4.5f, 4.5f, 5.0f, 5.5f};
|
||||
|
||||
double const kHumanSpeed = 2.6; // meters per second
|
||||
double const kCarSpeed = 6.2; // meters per second
|
||||
uint8_t const kMinDayAlpha = 90;
|
||||
uint8_t const kMaxDayAlpha = 144;
|
||||
uint8_t const kMinNightAlpha = 50;
|
||||
uint8_t const kMaxNightAlpha = 102;
|
||||
double const kUnknownDistanceTime = 5 * 60; // seconds
|
||||
double constexpr kHumanSpeed = 2.6; // meters per second
|
||||
double constexpr kCarSpeed = 6.2; // meters per second
|
||||
uint8_t constexpr kMinDayAlpha = 90;
|
||||
uint8_t constexpr kMaxDayAlpha = 144;
|
||||
uint8_t constexpr kMinNightAlpha = 50;
|
||||
uint8_t constexpr kMaxNightAlpha = 102;
|
||||
double constexpr kUnknownDistanceTime = 5 * 60; // seconds
|
||||
|
||||
double const kDistanceScalar = 0.4;
|
||||
double constexpr kDistanceScalar = 0.4;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool GpsPointsSortPredicate(GpsTrackPoint const & pt1, GpsTrackPoint const & pt2)
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
|
||||
bool Update(ScreenBase const & screen) override
|
||||
{
|
||||
static double const kVisibleTolerance = 0.1;
|
||||
static double const kVisibleStartAngle = math::DegToRad(0.0 + kVisibleTolerance);
|
||||
static double const kVisibleEndAngle = math::DegToRad(360.0 - kVisibleTolerance);
|
||||
static double constexpr kVisibleTolerance = 0.1;
|
||||
static double constexpr kVisibleStartAngle = math::DegToRad(0.0 + kVisibleTolerance);
|
||||
static double constexpr kVisibleEndAngle = math::DegToRad(360.0 - kVisibleTolerance);
|
||||
|
||||
auto const angle = static_cast<float>(ang::AngleIn2PI(screen.GetAngle()));
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
void CreateRoundCap(glsl::vec2 const & pos)
|
||||
{
|
||||
// Here we use an equilateral triangle to render circle (incircle of a triangle).
|
||||
static float const kSqrt3 = sqrt(3.0f);
|
||||
static float constexpr kSqrt3 = sqrt(3.0f);
|
||||
float const radius = GetHalfWidth();
|
||||
|
||||
m_capGeometry.emplace_back(CapVertex::TPosition(pos, m_params.m_depth),
|
||||
|
||||
@@ -14,7 +14,7 @@ void UpdateNormalBetweenSegments(LineSegment * segment1, LineSegment * segment2)
|
||||
|
||||
float const dotProduct = glsl::dot(segment1->m_leftNormals[EndPoint], segment2->m_leftNormals[StartPoint]);
|
||||
float const absDotProduct = fabs(dotProduct);
|
||||
float const kEps = 1e-5;
|
||||
float constexpr kEps = 1e-5;
|
||||
|
||||
if (fabs(absDotProduct - 1.0f) < kEps)
|
||||
{
|
||||
@@ -22,7 +22,7 @@ void UpdateNormalBetweenSegments(LineSegment * segment1, LineSegment * segment2)
|
||||
return;
|
||||
}
|
||||
|
||||
float const kMaxScalar = 5;
|
||||
float constexpr kMaxScalar = 5;
|
||||
float const crossProduct = glsl::cross(glsl::vec3(segment1->m_tangent, 0), glsl::vec3(segment2->m_tangent, 0)).z;
|
||||
if (crossProduct < 0)
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ void MyPosition::CacheSymbol(ref_ptr<dp::GraphicsContext> context, dp::TextureMa
|
||||
|
||||
void MyPosition::CachePointPosition(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> mng)
|
||||
{
|
||||
int const kSymbolsCount = 1;
|
||||
int constexpr kSymbolsCount = 1;
|
||||
dp::TextureManager::SymbolRegion pointSymbol;
|
||||
mng->GetSymbolRegion("current-position", pointSymbol);
|
||||
|
||||
|
||||
@@ -23,19 +23,19 @@ namespace df
|
||||
{
|
||||
namespace
|
||||
{
|
||||
int const kPositionRoutingOffsetY = 104;
|
||||
int constexpr kPositionRoutingOffsetY = 104;
|
||||
// Speed threshold to switch to GPS bearing. Use compass for slow walking only.
|
||||
double const kMinSpeedThresholdMps = 0.7; // 2.5 km/h
|
||||
double const kGpsBearingLifetimeSec = 5.0;
|
||||
double const kMaxTimeInBackgroundSec = 60.0 * 60 * 30; // 30 hours before starting detecting position again
|
||||
double const kMaxNotFollowRoutingTimeSec = 20.0;
|
||||
double const kMaxUpdateLocationInvervalSec = 30.0;
|
||||
double const kMaxBlockAutoZoomTimeSec = 10.0;
|
||||
double constexpr kMinSpeedThresholdMps = 0.7; // 2.5 km/h
|
||||
double constexpr kGpsBearingLifetimeSec = 5.0;
|
||||
double constexpr kMaxTimeInBackgroundSec = 60.0 * 60 * 30; // 30 hours before starting detecting position again
|
||||
double constexpr kMaxNotFollowRoutingTimeSec = 20.0;
|
||||
double constexpr kMaxUpdateLocationInvervalSec = 30.0;
|
||||
double constexpr kMaxBlockAutoZoomTimeSec = 10.0;
|
||||
|
||||
int const kZoomThreshold = 10;
|
||||
int const kMaxScaleZoomLevel = 16;
|
||||
int const kDefaultAutoZoom = 16;
|
||||
double const kUnknownAutoZoom = -1.0;
|
||||
int constexpr kZoomThreshold = 10;
|
||||
int constexpr kMaxScaleZoomLevel = 16;
|
||||
int constexpr kDefaultAutoZoom = 16;
|
||||
double constexpr kUnknownAutoZoom = -1.0;
|
||||
|
||||
inline int GetZoomLevel(ScreenBase const & screen)
|
||||
{
|
||||
@@ -231,7 +231,7 @@ void MyPositionController::DragStarted()
|
||||
|
||||
void MyPositionController::DragEnded(m2::PointD const & distance)
|
||||
{
|
||||
float const kBindingDistance = 0.1f;
|
||||
float constexpr kBindingDistance = 0.1f;
|
||||
m_needBlockAnimation = false;
|
||||
if (distance.Length() > kBindingDistance * std::min(m_pixelRect.SizeX(), m_pixelRect.SizeY()))
|
||||
StopLocationFollow();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
double const kDefault3dScale = 1.0;
|
||||
double constexpr kDefault3dScale = 1.0;
|
||||
|
||||
void Navigator::SetFromScreen(ScreenBase const & screen)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ void Navigator::SetFromScreen(ScreenBase const & screen, uint32_t tileSize, doub
|
||||
|
||||
if (!CheckMaxScale(tmp, tileSize, visualScale))
|
||||
{
|
||||
int const scale = scales::GetUpperStyleScale() - 1;
|
||||
int constexpr scale = scales::GetUpperStyleScale() - 1;
|
||||
m2::RectD newRect = df::GetRectForDrawScale(scale, screen.GetOrg());
|
||||
newRect.Scale(m_Screen.GetScale3d());
|
||||
CheckMinMaxVisibleScale(newRect, scale, m_Screen.GetScale3d());
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
uint32_t const kOverlayIndexBufferSize = 30000;
|
||||
uint32_t const kOverlayVertexBufferSize = 20000;
|
||||
uint32_t constexpr kOverlayIndexBufferSize = 30000;
|
||||
uint32_t constexpr kOverlayVertexBufferSize = 20000;
|
||||
|
||||
OverlayBatcher::OverlayBatcher(TileKey const & key) : m_batcher(kOverlayIndexBufferSize, kOverlayVertexBufferSize)
|
||||
{
|
||||
int const kAverageRenderDataCount = 5;
|
||||
int constexpr kAverageRenderDataCount = 5;
|
||||
m_data.reserve(kAverageRenderDataCount);
|
||||
|
||||
m_batcher.SetBatcherHash(key.GetHashValue(BatcherBucket::Overlay));
|
||||
|
||||
@@ -10,11 +10,11 @@ namespace df
|
||||
|
||||
namespace
|
||||
{
|
||||
double const kValidPathSplineTurn = 15 * math::pi / 180;
|
||||
double const kCosTurn = cos(kValidPathSplineTurn);
|
||||
double const kSinTurn = sin(kValidPathSplineTurn);
|
||||
double const kRoundStep = 23;
|
||||
int const kMaxStepsCount = 7;
|
||||
double constexpr kValidPathSplineTurn = 15 * math::pi / 180;
|
||||
double constexpr kCosTurn = cos(kValidPathSplineTurn);
|
||||
double constexpr kSinTurn = sin(kValidPathSplineTurn);
|
||||
double constexpr kRoundStep = 23;
|
||||
int constexpr kMaxStepsCount = 7;
|
||||
|
||||
bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3, int leftStepsCount,
|
||||
std::vector<m2::PointD> & roundedCorner)
|
||||
@@ -31,7 +31,7 @@ bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const
|
||||
return false;
|
||||
|
||||
double const vs = df::VisualParams::Instance().GetVisualScale();
|
||||
double const kMinCornerDist = 1.0;
|
||||
double constexpr kMinCornerDist = 1.0;
|
||||
if ((p3 - p1).SquaredLength() < kMinCornerDist * vs)
|
||||
{
|
||||
roundedCorner.push_back(p1);
|
||||
@@ -72,7 +72,7 @@ void ReplaceLastCorner(std::vector<m2::PointD> const & roundedCorner, m2::Spline
|
||||
bool IsValidSplineTurn(m2::PointD const & normalizedDir1, m2::PointD const & normalizedDir2)
|
||||
{
|
||||
double const dotProduct = m2::DotProduct(normalizedDir1, normalizedDir2);
|
||||
double const kEps = 1e-5;
|
||||
double constexpr kEps = 1e-5;
|
||||
return dotProduct > kCosTurn || fabs(dotProduct - kCosTurn) < kEps;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,18 +32,18 @@ std::string const kRouteFakeOutlineColor = "RouteFakeOutline";
|
||||
|
||||
namespace
|
||||
{
|
||||
std::array<float, 20> const kPreviewPointRadiusInPixel = {
|
||||
std::array<float, 20> constexpr kPreviewPointRadiusInPixel = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
0.8f, 0.8f, 2.0f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
2.5f, 2.5f, 2.5f, 2.5f, 3.0f, 4.0f, 4.5f, 4.5f, 5.0f, 5.5f};
|
||||
|
||||
int const kArrowAppearingZoomLevel = 14;
|
||||
int const kInvalidGroup = -1;
|
||||
int constexpr kArrowAppearingZoomLevel = 14;
|
||||
int constexpr kInvalidGroup = -1;
|
||||
|
||||
uint32_t const kPreviewPointsCount = 512;
|
||||
uint32_t constexpr kPreviewPointsCount = 512;
|
||||
|
||||
double const kInvalidDistance = -1.0;
|
||||
double constexpr kInvalidDistance = -1.0;
|
||||
|
||||
void InterpolateByZoom(SubrouteConstPtr const & subroute, ScreenBase const & screen, float & halfWidth, double & zoom)
|
||||
{
|
||||
@@ -111,7 +111,7 @@ bool AreEqualArrowBorders(std::vector<ArrowBorders> const & borders1, std::vecto
|
||||
if (borders1[i].m_groupIndex != borders2[i].m_groupIndex)
|
||||
return false;
|
||||
|
||||
double const kDistanceEps = 1e-5;
|
||||
double constexpr kDistanceEps = 1e-5;
|
||||
for (size_t i = 0; i < borders1.size(); i++)
|
||||
{
|
||||
if (fabs(borders1[i].m_startDistance - borders2[i].m_startDistance) > kDistanceEps)
|
||||
|
||||
@@ -21,34 +21,17 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
std::array<float, 20> const kRouteHalfWidthInPixelCar = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.2f, 1.5f, 1.5f, 1.7f, 2.0f, 2.0f, 2.3f, 2.5f, 2.7f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
3.0f, 3.5f, 4.5f, 5.5f, 7.0, 9.0f, 10.0f, 14.0f, 22.0f, 27.0f};
|
||||
|
||||
std::array<float, 20> const kRouteHalfWidthInPixelTransit = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.7f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
1.8f, 2.1f, 2.5f, 2.8f, 3.5, 4.5f, 5.0f, 7.0f, 11.0f, 13.0f};
|
||||
|
||||
std::array<float, 20> const kRouteHalfWidthInPixelOthers = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.1f, 1.2f, 1.3f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
1.5f, 1.7f, 2.3f, 2.7f, 3.5, 4.5f, 5.0f, 7.0f, 11.0f, 13.0f};
|
||||
|
||||
namespace rs
|
||||
{
|
||||
float const kLeftSide = 1.0f;
|
||||
float const kCenter = 0.0f;
|
||||
float const kRightSide = -1.0f;
|
||||
float constexpr kLeftSide = 1.0f;
|
||||
float constexpr kCenter = 0.0f;
|
||||
float constexpr kRightSide = -1.0f;
|
||||
|
||||
float const kRouteDepth = 99.0f;
|
||||
float const kMarkersDepth = 100.0f;
|
||||
float const kArrowsDepth = 200.0f;
|
||||
float const kDepthPerSubroute = 200.0f;
|
||||
float constexpr kRouteDepth = 99.0f;
|
||||
float constexpr kMarkersDepth = 100.0f;
|
||||
float constexpr kArrowsDepth = 200.0f;
|
||||
float constexpr kDepthPerSubroute = 200.0f;
|
||||
|
||||
void GetArrowTextureRegion(ref_ptr<dp::TextureManager> textures, dp::TextureManager::SymbolRegion & region)
|
||||
{
|
||||
@@ -106,7 +89,7 @@ void CalculatePoints(m2::PolylineD const & polyline, double start, double end, s
|
||||
|
||||
float SideByNormal(glsl::vec2 const & normal, bool isLeft)
|
||||
{
|
||||
float const kEps = 1e-5;
|
||||
float constexpr kEps = 1e-5;
|
||||
float const side = isLeft ? kLeftSide : kRightSide;
|
||||
return glsl::length(normal) < kEps ? kCenter : side;
|
||||
}
|
||||
@@ -399,10 +382,10 @@ void RouteShape::PrepareMarkersGeometry(std::vector<SubrouteMarker> const & mark
|
||||
{
|
||||
ASSERT(!markers.empty(), ());
|
||||
|
||||
static float const kSqrt3 = sqrt(3.0f);
|
||||
static float const kSqrt2 = sqrt(2.0f);
|
||||
static float const kInnerRadius = 0.6f;
|
||||
static float const kOuterRadius = 1.0f;
|
||||
static float constexpr kSqrt3 = sqrt(3.0f);
|
||||
static float constexpr kSqrt2 = sqrt(2.0f);
|
||||
static float constexpr kInnerRadius = 0.6f;
|
||||
static float constexpr kOuterRadius = 1.0f;
|
||||
|
||||
float const depth = baseDepth - 0.5f;
|
||||
float const innerDepth = baseDepth + 0.5f;
|
||||
@@ -589,7 +572,7 @@ drape_ptr<df::SubrouteMarkersData> RouteShape::CacheMarkers(ref_ptr<dp::Graphics
|
||||
|
||||
// Batching.
|
||||
{
|
||||
uint32_t const kBatchSize = 200;
|
||||
uint32_t constexpr kBatchSize = 200;
|
||||
dp::Batcher batcher(kBatchSize, kBatchSize);
|
||||
batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Routing));
|
||||
dp::SessionGuard guard(context, batcher,
|
||||
|
||||
@@ -20,25 +20,39 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
double const kArrowSize = 0.0008;
|
||||
double constexpr kArrowSize = 0.0008;
|
||||
|
||||
// Constants below depend on arrow texture.
|
||||
double const kArrowTextureWidth = 74.0;
|
||||
double const kArrowTextureHeight = 44.0;
|
||||
double const kArrowBodyHeight = 24.0;
|
||||
double const kArrowHeadTextureWidth = 32.0;
|
||||
double const kArrowTailTextureWidth = 4.0;
|
||||
double constexpr kArrowTextureWidth = 74.0;
|
||||
double constexpr kArrowTextureHeight = 44.0;
|
||||
double constexpr kArrowBodyHeight = 24.0;
|
||||
double constexpr kArrowHeadTextureWidth = 32.0;
|
||||
double constexpr kArrowTailTextureWidth = 4.0;
|
||||
|
||||
double const kArrowHeadSize = kArrowHeadTextureWidth / kArrowTextureWidth;
|
||||
float const kArrowHeadFactor = static_cast<float>(2.0 * kArrowHeadTextureWidth / kArrowTextureHeight);
|
||||
double const kArrowTailSize = kArrowTailTextureWidth / kArrowTextureWidth;
|
||||
float const kArrowTailFactor = static_cast<float>(2.0 * kArrowTailTextureWidth / kArrowTextureHeight);
|
||||
double const kArrowHeightFactor = kArrowTextureHeight / kArrowBodyHeight;
|
||||
double const kArrowAspect = kArrowTextureWidth / kArrowTextureHeight;
|
||||
double constexpr kArrowHeadSize = kArrowHeadTextureWidth / kArrowTextureWidth;
|
||||
float constexpr kArrowHeadFactor = static_cast<float>(2.0 * kArrowHeadTextureWidth / kArrowTextureHeight);
|
||||
double constexpr kArrowTailSize = kArrowTailTextureWidth / kArrowTextureWidth;
|
||||
float constexpr kArrowTailFactor = static_cast<float>(2.0 * kArrowTailTextureWidth / kArrowTextureHeight);
|
||||
double constexpr kArrowHeightFactor = kArrowTextureHeight / kArrowBodyHeight;
|
||||
double constexpr kArrowAspect = kArrowTextureWidth / kArrowTextureHeight;
|
||||
|
||||
extern std::array<float, 20> const kRouteHalfWidthInPixelCar;
|
||||
extern std::array<float, 20> const kRouteHalfWidthInPixelTransit;
|
||||
extern std::array<float, 20> const kRouteHalfWidthInPixelOthers;
|
||||
std::array<float, 20> constexpr kRouteHalfWidthInPixelCar = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.2f, 1.5f, 1.5f, 1.7f, 2.0f, 2.0f, 2.3f, 2.5f, 2.7f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
3.0f, 3.5f, 4.5f, 5.5f, 7.0, 9.0f, 10.0f, 14.0f, 22.0f, 27.0f};
|
||||
|
||||
std::array<float, 20> constexpr kRouteHalfWidthInPixelTransit = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.7f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
1.8f, 2.1f, 2.5f, 2.8f, 3.5, 4.5f, 5.0f, 7.0f, 11.0f, 13.0f};
|
||||
|
||||
std::array<float, 20> constexpr kRouteHalfWidthInPixelOthers = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.1f, 1.2f, 1.3f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
1.5f, 1.7f, 2.3f, 2.7f, 3.5, 4.5f, 5.0f, 7.0f, 11.0f, 13.0f};
|
||||
|
||||
enum class RouteType : uint8_t
|
||||
{
|
||||
@@ -59,7 +73,7 @@ struct RoutePattern
|
||||
|
||||
bool operator==(RoutePattern const & pattern) const
|
||||
{
|
||||
double const kEps = 1e-5;
|
||||
double constexpr kEps = 1e-5;
|
||||
return m_isDashed == pattern.m_isDashed && std::fabs(m_dashLength - pattern.m_dashLength) < kEps &&
|
||||
std::fabs(m_gapLength - pattern.m_gapLength) < kEps;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace
|
||||
{
|
||||
// The first zoom level in kAverageSegmentsCount.
|
||||
int constexpr kFirstZoomInAverageSegments = 10;
|
||||
std::array<size_t, 10> const kAverageSegmentsCount = {
|
||||
std::array<size_t, 10> constexpr kAverageSegmentsCount = {
|
||||
// 10 11 12 13 14 15 16 17 18 19
|
||||
10000, 5000, 10000, 5000, 2500, 5000, 2000, 1000, 500, 500};
|
||||
|
||||
@@ -131,7 +131,7 @@ void ExtractTrafficGeometry(FeatureType const & f, df::RoadClass const & roadCla
|
||||
ASSERT_EQUAL(segment.size(), 2, ());
|
||||
|
||||
// Skip zero-length segments.
|
||||
double const kEps = 1e-5;
|
||||
double constexpr kEps = 1e-5;
|
||||
if (segment[0].EqualDxDy(segment[1], kEps))
|
||||
break;
|
||||
|
||||
@@ -183,7 +183,7 @@ RuleDrawer::RuleDrawer(TCheckCancelledCallback const & checkCancelled, TIsCountr
|
||||
geometryConvertor.SetFromRect(m2::AnyRectD(r));
|
||||
m_trafficScalePtoG = geometryConvertor.GetScale();
|
||||
|
||||
int const kAverageOverlaysCount = 200;
|
||||
int constexpr kAverageOverlaysCount = 200;
|
||||
m_mapShapes[df::OverlayType].reserve(kAverageOverlaysCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace df
|
||||
{
|
||||
namespace
|
||||
{
|
||||
std::array<float, 20> const kHalfLineWidthInPixel = {
|
||||
std::array<float, 20> constexpr kHalfLineWidthInPixel = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
1.0f, 1.2f, 1.5f, 1.5f, 1.7f, 2.0f, 2.0f, 2.3f, 2.5f, 2.7f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace
|
||||
{
|
||||
std::string const kTrackSelectedSymbolName = "track_marker_selected";
|
||||
df::ColorConstant const kSelectionColor = "Selection";
|
||||
float const kLeftSide = 1.0f;
|
||||
float const kCenter = 0.0f;
|
||||
float const kRightSide = -1.0f;
|
||||
float constexpr kLeftSide = 1.0f;
|
||||
float constexpr kCenter = 0.0f;
|
||||
float constexpr kRightSide = -1.0f;
|
||||
|
||||
struct MarkerVertex
|
||||
{
|
||||
@@ -91,7 +91,7 @@ dp::BindingInfo GetSelectionLineVertexBindingInfo()
|
||||
|
||||
float SideByNormal(glsl::vec2 const & normal, bool isLeft)
|
||||
{
|
||||
float const kEps = 1e-5;
|
||||
float constexpr kEps = 1e-5;
|
||||
float const side = isLeft ? kLeftSide : kRightSide;
|
||||
return glsl::length(normal) < kEps ? kCenter : side;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ void TileInfo::ReadFeatureIndex(MapDataProvider const & model)
|
||||
|
||||
ThrowIfCancelled();
|
||||
|
||||
size_t const kAverageFeaturesCount = 256;
|
||||
size_t constexpr kAverageFeaturesCount = 256;
|
||||
m_featureInfo.reserve(kAverageFeaturesCount);
|
||||
|
||||
MwmSet::MwmId lastMwm;
|
||||
|
||||
@@ -101,7 +101,7 @@ void SubmitCircleStaticVertices(RoadClass roadClass, glsl::vec3 const & pivot, g
|
||||
glsl::vec2 const & uv, std::vector<TrafficCircleStaticVertex> & circlesGeometry)
|
||||
{
|
||||
// Here we use an equilateral triangle to render circle (incircle of a triangle).
|
||||
static float const kSqrt3 = sqrt(3.0f);
|
||||
static float constexpr kSqrt3 = sqrt(3.0f);
|
||||
auto const p = glsl::vec4(pivot, static_cast<float>(roadClass));
|
||||
circlesGeometry.emplace_back(p, glsl::vec4(rightNormal, -kSqrt3, -1.0f), uv);
|
||||
circlesGeometry.emplace_back(p, glsl::vec4(rightNormal, kSqrt3, -1.0f), uv);
|
||||
@@ -138,7 +138,7 @@ void TrafficGenerator::GenerateSegmentsGeometry(ref_ptr<dp::GraphicsContext> con
|
||||
traffic::TrafficInfo::Coloring const & coloring,
|
||||
ref_ptr<dp::TextureManager> texturesMgr)
|
||||
{
|
||||
static std::array<int, 3> const kGenerateCirclesZoomLevel = {14, 14, 16};
|
||||
static std::array<int, 3> constexpr kGenerateCirclesZoomLevel = {14, 14, 16};
|
||||
|
||||
ASSERT(m_colorsCacheValid, ());
|
||||
auto const colorTexture = m_colorsCache[static_cast<size_t>(traffic::SpeedGroup::G0)].GetTexture();
|
||||
@@ -161,7 +161,7 @@ void TrafficGenerator::GenerateSegmentsGeometry(ref_ptr<dp::GraphicsContext> con
|
||||
isLeftHand = (regionData.Get(feature::RegionData::RD_DRIVING) == "l");
|
||||
}
|
||||
|
||||
static std::array<float, 3> const kRoadClassDepths = {30.0f, 20.0f, 10.0f};
|
||||
static std::array<float, 3> constexpr kRoadClassDepths = {30.0f, 20.0f, 10.0f};
|
||||
|
||||
for (auto const & geomPair : geometry)
|
||||
{
|
||||
|
||||
@@ -31,41 +31,41 @@ int constexpr kMinVisibleArrowZoomLevel = 16;
|
||||
int constexpr kRoadClass2MinVisibleArrowZoomLevel = 17;
|
||||
int constexpr kOutlineMinZoomLevel = 14;
|
||||
|
||||
float const kTrafficArrowAspect = 128.0f / 8.0f;
|
||||
float constexpr kTrafficArrowAspect = 128.0f / 8.0f;
|
||||
|
||||
std::array<float, 20> const kLeftWidthInPixel = {
|
||||
std::array<float, 20> constexpr kLeftWidthInPixel = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
0.5f, 0.5f, 0.5f, 0.6f, 1.6f, 2.7f, 3.5f, 4.0f, 4.0f, 4.0f};
|
||||
|
||||
std::array<float, 20> const kRightWidthInPixel = {
|
||||
std::array<float, 20> constexpr kRightWidthInPixel = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.5f, 3.0f, 3.0f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
3.0f, 3.5f, 4.0f, 3.9f, 3.2f, 2.7f, 3.5f, 4.0f, 4.0f, 4.0f};
|
||||
|
||||
std::array<float, 20> const kRoadClass1WidthScalar = {
|
||||
std::array<float, 20> constexpr kRoadClass1WidthScalar = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.3,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
0.3, 0.35f, 0.45f, 0.55f, 0.6f, 0.8f, 1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
std::array<float, 20> const kRoadClass2WidthScalar = {
|
||||
std::array<float, 20> constexpr kRoadClass2WidthScalar = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.3f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
0.3f, 0.3f, 0.3f, 0.4f, 0.5f, 0.5f, 0.65f, 0.85f, 0.95f, 1.0f};
|
||||
|
||||
std::array<float, 20> const kTwoWayOffsetInPixel = {
|
||||
std::array<float, 20> constexpr kTwoWayOffsetInPixel = {
|
||||
// 1 2 3 4 5 6 7 8 9 10
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
0.0f, 0.5f, 0.5f, 0.75f, 1.7f, 2.5f, 2.5f, 2.5f, 2.5f, 2.5f};
|
||||
|
||||
std::array<int, 3> const kLineDrawerRoadClass1 = {12, 13, 14};
|
||||
std::array<int, 3> constexpr kLineDrawerRoadClass1 = {12, 13, 14};
|
||||
|
||||
std::array<int, 2> const kLineDrawerRoadClass2 = {15, 16};
|
||||
std::array<int, 2> constexpr kLineDrawerRoadClass2 = {15, 16};
|
||||
|
||||
float CalculateHalfWidth(ScreenBase const & screen, RoadClass const & roadClass, bool left)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ void TrafficRenderer::RenderTraffic(ref_ptr<dp::GraphicsContext> context, ref_pt
|
||||
float const leftPixelHalfWidth = CalculateHalfWidth(screen, renderData.m_roadClass, true /* left */);
|
||||
float const invLeftPixelLength = 1.0f / (2.0f * leftPixelHalfWidth * kTrafficArrowAspect);
|
||||
float const rightPixelHalfWidth = CalculateHalfWidth(screen, renderData.m_roadClass, false /* left */);
|
||||
float const kEps = 1e-5;
|
||||
float constexpr kEps = 1e-5;
|
||||
if (fabs(leftPixelHalfWidth) < kEps && fabs(rightPixelHalfWidth) < kEps)
|
||||
continue;
|
||||
|
||||
@@ -249,7 +249,7 @@ float TrafficRenderer::GetTwoWayOffset(RoadClass const & roadClass, int zoomLeve
|
||||
{
|
||||
// There is no offset for class-0 roads, the offset for them is created by
|
||||
// kLeftWidthInPixel and kRightWidthInPixel.
|
||||
int const kRoadClass0MinZoomLevel = 14;
|
||||
int constexpr kRoadClass0MinZoomLevel = 14;
|
||||
if (roadClass == RoadClass::Class0 && zoomLevel <= kRoadClass0MinZoomLevel)
|
||||
return 0.0f;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ void GenerateLineCaps(ref_ptr<dp::GraphicsContext> context, std::vector<SchemeSe
|
||||
for (auto const & segment : segments)
|
||||
{
|
||||
// Here we use an equilateral triangle to render a circle (incircle of a triangle).
|
||||
static float const kSqrt3 = sqrt(3.0f);
|
||||
static float constexpr kSqrt3 = sqrt(3.0f);
|
||||
auto const offset = lineOffset * segment.m_rightNormal;
|
||||
auto const pivot = glsl::vec3(segment.m_p2, depth);
|
||||
|
||||
@@ -1081,7 +1081,7 @@ void TransitSchemeBuilder::GenerateLine(ref_ptr<dp::GraphicsContext> context, st
|
||||
auto const color =
|
||||
glsl::vec4(colorConst.GetRedF(), colorConst.GetGreenF(), colorConst.GetBlueF(), colorConst.GetAlphaF());
|
||||
size_t const kAverageSize = path.size() * 6;
|
||||
size_t const kAverageCapSize = 12;
|
||||
size_t constexpr kAverageCapSize = 12;
|
||||
geometry.reserve(kAverageSize + kAverageCapSize * 2);
|
||||
|
||||
std::vector<SchemeSegment> segments;
|
||||
@@ -1133,8 +1133,8 @@ void TransitSchemeBuilder::GenerateStop(ref_ptr<dp::GraphicsContext> context, St
|
||||
return;
|
||||
}
|
||||
|
||||
float const kInnerScale = 0.8f;
|
||||
float const kOuterScale = 2.0f;
|
||||
float constexpr kInnerScale = 0.8f;
|
||||
float constexpr kOuterScale = 2.0f;
|
||||
|
||||
auto const lineId = *stopParams.m_stopsInfo.begin()->second.m_lines.begin();
|
||||
auto const colorName = df::GetTransitColorName(lines.at(lineId).m_color);
|
||||
@@ -1210,8 +1210,8 @@ void TransitSchemeBuilder::GenerateStop(ref_ptr<dp::GraphicsContext> context, St
|
||||
return;
|
||||
}
|
||||
|
||||
float const kInnerScale = 0.8f;
|
||||
float const kOuterScale = 2.0f;
|
||||
float constexpr kInnerScale = 0.8f;
|
||||
float constexpr kOuterScale = 2.0f;
|
||||
|
||||
::transit::TransitId lineId = *stopParams.m_stopsInfo.begin()->second.m_lines.begin();
|
||||
|
||||
@@ -1397,8 +1397,8 @@ void TransitSchemeBuilder::GenerateTransfer(ref_ptr<dp::GraphicsContext> context
|
||||
}
|
||||
}
|
||||
|
||||
float const kInnerScale = 1.0f;
|
||||
float const kOuterScale = 1.5f;
|
||||
float constexpr kInnerScale = 1.0f;
|
||||
float constexpr kOuterScale = 1.5f;
|
||||
|
||||
auto const outerColor = GetColorConstant(kTransitTransferOuterColor);
|
||||
auto const innerColor = GetColorConstant(kTransitTransferInnerColor);
|
||||
@@ -1423,8 +1423,8 @@ void TransitSchemeBuilder::GenerateTransfer(ref_ptr<dp::GraphicsContext> context
|
||||
|
||||
CHECK_GREATER(maxLinesCount, 0, ());
|
||||
|
||||
float const kInnerScale = 1.0f;
|
||||
float const kOuterScale = 1.5f;
|
||||
float constexpr kInnerScale = 1.0f;
|
||||
float constexpr kOuterScale = 1.5f;
|
||||
|
||||
auto const outerColor = GetColorConstant(kTransitTransferOuterColor);
|
||||
auto const innerColor = GetColorConstant(kTransitTransferInnerColor);
|
||||
|
||||
@@ -1246,11 +1246,11 @@ void UserEventStream::UpdateDoubleTapAndHold(Touch const & touch)
|
||||
{
|
||||
TEST_CALL(DOUBLE_TAP_AND_HOLD);
|
||||
ASSERT_EQUAL(m_state, STATE_DOUBLE_TAP_HOLD, ());
|
||||
float const kPowerModifier = 10.0f;
|
||||
float constexpr kPowerModifier = 10.0f;
|
||||
#if defined(OMIM_OS_IPHONE) || defined(OMIM_OS_MAC)
|
||||
int const kPlatformScaleModifier = -1;
|
||||
int constexpr kPlatformScaleModifier = -1;
|
||||
#else
|
||||
int const kPlatformScaleModifier = 1;
|
||||
int constexpr kPlatformScaleModifier = 1;
|
||||
#endif
|
||||
double const scaleFactor = exp(kPowerModifier * (touch.m_location.y - m_startDoubleTapAndHold.y) /
|
||||
GetCurrentScreen().PixelRectIn3d().SizeY() * kPlatformScaleModifier);
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
int const kDoNotChangeZoom = -1;
|
||||
double const kDoNotAutoZoom = -1.0;
|
||||
int constexpr kDoNotChangeZoom = -1;
|
||||
double constexpr kDoNotAutoZoom = -1.0;
|
||||
|
||||
using TAnimationCreator = std::function<drape_ptr<Animation>(ref_ptr<Animation>)>;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace df
|
||||
{
|
||||
std::array<int, 3> const kLineIndexingLevels = {1, 7, 11};
|
||||
std::array<int, 3> constexpr kLineIndexingLevels = {1, 7, 11};
|
||||
|
||||
UserMarkGenerator::UserMarkGenerator(TFlushFn const & flushFn) : m_flushFn(flushFn)
|
||||
{
|
||||
|
||||
@@ -128,21 +128,21 @@ uint32_t VisualParams::GetTileSize() const
|
||||
uint32_t VisualParams::GetTouchRectRadius() const
|
||||
{
|
||||
ASSERT_INITED;
|
||||
float const kRadiusInPixels = 20.0f;
|
||||
float constexpr kRadiusInPixels = 20.0f;
|
||||
return static_cast<uint32_t>(kRadiusInPixels * GetVisualScale());
|
||||
}
|
||||
|
||||
double VisualParams::GetDragThreshold() const
|
||||
{
|
||||
ASSERT_INITED;
|
||||
double const kDragThresholdInPixels = 10.0;
|
||||
double constexpr kDragThresholdInPixels = 10.0;
|
||||
return kDragThresholdInPixels * GetVisualScale();
|
||||
}
|
||||
|
||||
double VisualParams::GetScaleThreshold() const
|
||||
{
|
||||
ASSERT_INITED;
|
||||
double const kScaleThresholdInPixels = 2.0;
|
||||
double constexpr kScaleThresholdInPixels = 2.0;
|
||||
return kScaleThresholdInPixels * GetVisualScale();
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void ExtractZoomFactors(ScreenBase const & s, double & zoom, int & index, float
|
||||
|
||||
double GetNormalizedZoomLevel(double screenScale, int minZoom)
|
||||
{
|
||||
double const kMaxZoom = scales::GetUpperStyleScale() + 1.0;
|
||||
double constexpr kMaxZoom = scales::GetUpperStyleScale() + 1.0;
|
||||
return math::Clamp((GetZoomLevel(screenScale) - minZoom) / (kMaxZoom - minZoom), 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ editor::XMLFeature ChangesetWrapper::GetMatchingNodeFeatureFromOSM(m2::PointD co
|
||||
|
||||
editor::XMLFeature ChangesetWrapper::GetMatchingAreaFeatureFromOSM(std::vector<m2::PointD> const & geometry)
|
||||
{
|
||||
auto const kSamplePointsCount = 3;
|
||||
auto constexpr kSamplePointsCount = 3;
|
||||
bool hasRelation = false;
|
||||
// Try several points in case of poor osm response.
|
||||
for (auto const & pt : NaiveSample(geometry, kSamplePointsCount))
|
||||
|
||||
@@ -29,7 +29,7 @@ using AreaType = bg::default_area_result<Polygon>::type;
|
||||
using ForEachRefFn = std::function<void(XMLFeature const & xmlFt)>;
|
||||
using ForEachWayFn = std::function<void(pugi::xml_node const & way, std::string const & role)>;
|
||||
|
||||
double const kPointDiffEps = 1e-5;
|
||||
double constexpr kPointDiffEps = 1e-5;
|
||||
|
||||
void AddInnerIfNeeded(pugi::xml_document const & osmResponse, pugi::xml_node const & way, Polygon & dest)
|
||||
{
|
||||
|
||||
@@ -48,11 +48,11 @@ bool Ge0Parser::Parse(std::string const & url, Result & result)
|
||||
|
||||
bool Ge0Parser::ParseAfterPrefix(std::string const & url, size_t from, Result & result)
|
||||
{
|
||||
size_t const kEncodedZoomAndCoordinatesLength = 10;
|
||||
size_t constexpr kEncodedZoomAndCoordinatesLength = 10;
|
||||
if (url.size() < from + kEncodedZoomAndCoordinatesLength)
|
||||
return false;
|
||||
|
||||
size_t const kMaxNameLength = 256;
|
||||
size_t constexpr kMaxNameLength = 256;
|
||||
|
||||
size_t const posZoom = from;
|
||||
size_t const posLatLon = posZoom + 1;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
namespace ge0
|
||||
{
|
||||
// Max number of base64 bytes to encode a geo point.
|
||||
inline static int const kMaxPointBytes = 10;
|
||||
inline static int const kMaxCoordBits = kMaxPointBytes * 3;
|
||||
inline static int constexpr kMaxPointBytes = 10;
|
||||
inline static int constexpr kMaxCoordBits = kMaxPointBytes * 3;
|
||||
|
||||
// Generates a short url.
|
||||
//
|
||||
|
||||
@@ -235,7 +235,7 @@ void ClipPathByRectBeforeSmooth(m2::RectD const & rect, std::vector<m2::PointD>
|
||||
|
||||
m2::PointD guideFront;
|
||||
m2::PointD guideBack;
|
||||
double const kEps = 1e-5;
|
||||
double constexpr kEps = 1e-5;
|
||||
if (path.front().EqualDxDy(path.back(), kEps))
|
||||
{
|
||||
guideFront = path[path.size() - 2];
|
||||
|
||||
@@ -114,7 +114,7 @@ impl::Polygon PointsToPolygon(Container const & points)
|
||||
template <typename Container>
|
||||
impl::MultiPolygon TrianglesToPolygon(Container const & points)
|
||||
{
|
||||
size_t const kTriangleSize = 3;
|
||||
size_t constexpr kTriangleSize = 3;
|
||||
if (points.size() % kTriangleSize != 0)
|
||||
MYTHROW(geometry::NotAPolygonException, ("Count of points must be multiple of", kTriangleSize));
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ public:
|
||||
std::uniform_real_distribution<> distrX(m_rect.minX(), m_rect.maxX());
|
||||
std::uniform_real_distribution<> distrY(m_rect.minY(), m_rect.maxY());
|
||||
|
||||
size_t const kMaxIterations = 1000;
|
||||
size_t constexpr kMaxIterations = 1000;
|
||||
for (size_t it = 0; it < kMaxIterations; ++it)
|
||||
{
|
||||
auto const x = distrX(engine);
|
||||
|
||||
@@ -36,7 +36,7 @@ bool IsPointOnSegment(PointD const & pt, PointD const & p1, PointD const & p2)
|
||||
// better ideas how to check whether pt belongs to (p1, p2) segment
|
||||
// more precisely or without kEps, feel free to submit a pull
|
||||
// request.
|
||||
double const kEps = 1e-100;
|
||||
double constexpr kEps = 1e-100;
|
||||
return IsPointOnSegmentEps(pt, p1, p2, kEps);
|
||||
}
|
||||
|
||||
|
||||
@@ -490,8 +490,8 @@ bool EditableMapObject::ValidatePhoneList(string const & phone)
|
||||
if (phone.empty())
|
||||
return true;
|
||||
|
||||
auto const kMaxNumberLen = 15;
|
||||
auto const kMinNumberLen = 5;
|
||||
auto constexpr kMaxNumberLen = 15;
|
||||
auto constexpr kMinNumberLen = 5;
|
||||
|
||||
if (phone.size() < kMinNumberLen)
|
||||
return false;
|
||||
|
||||
@@ -130,9 +130,9 @@ public:
|
||||
};
|
||||
|
||||
inline static std::string const kHeaderMagic = "mwmftosm";
|
||||
inline static Version const kLatestVersion = FeatureIdToGeoObjectIdSerDes::Version::V0;
|
||||
inline static size_t const kMagicAndVersionSize = 9;
|
||||
inline static size_t const kHeaderOffset = 16;
|
||||
inline static Version constexpr kLatestVersion = FeatureIdToGeoObjectIdSerDes::Version::V0;
|
||||
inline static size_t constexpr kMagicAndVersionSize = 9;
|
||||
inline static size_t constexpr kHeaderOffset = 16;
|
||||
|
||||
struct HeaderV0
|
||||
{
|
||||
|
||||
@@ -303,7 +303,7 @@ int GetMinDrawableScale(FeatureType & ft)
|
||||
|
||||
int GetMinDrawableScale(TypesHolder const & types, m2::RectD const & limitRect)
|
||||
{
|
||||
int const upBound = scales::GetUpperStyleScale();
|
||||
int constexpr upBound = scales::GetUpperStyleScale();
|
||||
|
||||
for (int level = 0; level <= upBound; ++level)
|
||||
if (IsDrawableForIndex(types, limitRect, level))
|
||||
@@ -315,7 +315,7 @@ int GetMinDrawableScale(TypesHolder const & types, m2::RectD const & limitRect)
|
||||
/*
|
||||
int GetMinDrawableScaleGeometryOnly(TypesHolder const & types, m2::RectD const & limitRect)
|
||||
{
|
||||
int const upBound = scales::GetUpperStyleScale();
|
||||
int constexpr upBound = scales::GetUpperStyleScale();
|
||||
|
||||
for (int level = 0; level <= upBound; ++level)
|
||||
{
|
||||
@@ -329,7 +329,7 @@ int GetMinDrawableScaleGeometryOnly(TypesHolder const & types, m2::RectD const &
|
||||
|
||||
int GetMinDrawableScaleClassifOnly(TypesHolder const & types)
|
||||
{
|
||||
int const upBound = scales::GetUpperStyleScale();
|
||||
int constexpr upBound = scales::GetUpperStyleScale();
|
||||
|
||||
for (int level = 0; level <= upBound; ++level)
|
||||
if (IsDrawableForIndexClassifOnly(types, level))
|
||||
@@ -406,7 +406,7 @@ bool IsDrawableForRules(TypesHolder const & types, int level, int rules)
|
||||
|
||||
pair<int, int> GetDrawableScaleRangeForRules(TypesHolder const & types, int rules)
|
||||
{
|
||||
int const upBound = scales::GetUpperStyleScale();
|
||||
int constexpr upBound = scales::GetUpperStyleScale();
|
||||
int lowL = -1;
|
||||
for (int level = 0; level <= upBound; ++level)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ std::string_view constexpr kPair = "Pair";
|
||||
std::string_view constexpr kExtendedData = "ExtendedData";
|
||||
std::string const kCompilation = "mwm:compilation";
|
||||
|
||||
std::string_view const kCoordinates = "coordinates";
|
||||
std::string_view constexpr kCoordinates = "coordinates";
|
||||
|
||||
bool IsTrack(std::string const & s)
|
||||
{
|
||||
|
||||
@@ -41,9 +41,9 @@ std::string const kLastEditedBookmarkColor = "LastBookmarkColor";
|
||||
std::string const kMetadataFileName = "bm.json";
|
||||
std::string const kSortingTypeProperty = "sortingType";
|
||||
std::string const kLargestBookmarkSymbolName = "bookmark-default-m";
|
||||
size_t const kMinCommonTypesCount = 3;
|
||||
double const kNearDistanceInMeters = 20 * 1000.0;
|
||||
double const kMyPositionTrackSnapInMeters = 20.0;
|
||||
size_t constexpr kMinCommonTypesCount = 3;
|
||||
double constexpr kNearDistanceInMeters = 20 * 1000.0;
|
||||
double constexpr kMyPositionTrackSnapInMeters = 20.0;
|
||||
|
||||
std::string const kKMZMimeType = "application/vnd.google-earth.kmz";
|
||||
std::string const kGPXMimeType = "application/gpx+xml";
|
||||
@@ -809,7 +809,7 @@ void BookmarkManager::UpdateElevationMyPosition(kml::TrackId const & trackId)
|
||||
double myPositionDistance = TrackSelectionMark::kInvalidDistance;
|
||||
if (m_myPositionMark->HasPosition())
|
||||
{
|
||||
double const kEps = 1e-5;
|
||||
double constexpr kEps = 1e-5;
|
||||
if (m_lastElevationMyPosition.EqualDxDy(m_myPositionMark->GetPivot(), kEps))
|
||||
return;
|
||||
m_lastElevationMyPosition = m_myPositionMark->GetPivot();
|
||||
@@ -833,7 +833,7 @@ void BookmarkManager::UpdateElevationMyPosition(kml::TrackId const & trackId)
|
||||
auto es = GetEditSession();
|
||||
auto trackSelectionMark = GetMarkForEdit<TrackSelectionMark>(markId);
|
||||
|
||||
double const kEpsMeters = 1e-2;
|
||||
double constexpr kEpsMeters = 1e-2;
|
||||
if (!AlmostEqualAbs(trackSelectionMark->GetMyPositionDistance(), myPositionDistance, kEpsMeters))
|
||||
{
|
||||
trackSelectionMark->SetMyPositionDistance(myPositionDistance);
|
||||
|
||||
@@ -256,7 +256,7 @@ int main(int argc, char * argv[])
|
||||
GpsInfo const extrapolated = LinearExtrapolation(info1, info2, timeMs);
|
||||
m2::PointD const extrapolatedMerc = mercator::FromLatLon(extrapolated.m_latitude, extrapolated.m_longitude);
|
||||
|
||||
double const kHalfSquareSide = 100.0;
|
||||
double constexpr kHalfSquareSide = 100.0;
|
||||
// |kHalfSquareSide| is chosen based on maximum value of GpsInfo::m_horizontalAccuracy
|
||||
// which is used calculation of projection in production code.
|
||||
m2::RectD const posSquare =
|
||||
|
||||
@@ -112,7 +112,7 @@ size_t constexpr kMaxTrafficCacheSizeBytes = 64 /* Mb */ * 1024 * 1024;
|
||||
// This is temporary solution while we don't have a good filter.
|
||||
bool ParseSetGpsTrackMinAccuracyCommand(string const & query)
|
||||
{
|
||||
char const kGpsAccuracy[] = "?gpstrackaccuracy:";
|
||||
char constexpr kGpsAccuracy[] = "?gpstrackaccuracy:";
|
||||
if (!query.starts_with(kGpsAccuracy))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
char const kMinHorizontalAccuracyKey[] = "GpsTrackingMinAccuracy";
|
||||
char constexpr kMinHorizontalAccuracyKey[] = "GpsTrackingMinAccuracy";
|
||||
|
||||
// Minimal horizontal accuracy is required to skip 'bad' points.
|
||||
// Use 250 meters to allow points from a pure GPS + GPS through wifi.
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace std::chrono;
|
||||
namespace
|
||||
{
|
||||
|
||||
char const kEnabledKey[] = "GpsTrackingEnabled";
|
||||
char constexpr kEnabledKey[] = "GpsTrackingEnabled";
|
||||
|
||||
inline std::string GetFilePath()
|
||||
{
|
||||
|
||||
@@ -44,9 +44,9 @@ using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
char const kRouterTypeKey[] = "router";
|
||||
char constexpr kRouterTypeKey[] = "router";
|
||||
|
||||
double const kRouteScaleMultiplier = 1.5;
|
||||
double constexpr kRouteScaleMultiplier = 1.5;
|
||||
|
||||
string const kRoutePointsFile = "route_points.dat";
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ static std::string const kTransitMarkPrimaryTextOutline = "TransitMarkPrimaryTex
|
||||
static std::string const kTransitMarkSecondaryText = "TransitMarkSecondaryText";
|
||||
static std::string const kTransitMarkSecondaryTextOutline = "TransitMarkSecondaryTextOutline";
|
||||
|
||||
float const kRouteMarkPrimaryTextSize = 10.5f;
|
||||
float const kRouteMarkSecondaryTextSize = 10.0f;
|
||||
float const kRouteMarkSecondaryOffsetY = 2.0f;
|
||||
float const kTransitMarkTextSize = 12.0f;
|
||||
float constexpr kRouteMarkPrimaryTextSize = 10.5f;
|
||||
float constexpr kRouteMarkSecondaryTextSize = 10.0f;
|
||||
float constexpr kRouteMarkSecondaryOffsetY = 2.0f;
|
||||
float constexpr kTransitMarkTextSize = 12.0f;
|
||||
|
||||
static std::string const kSpeedCameraMarkText = "SpeedCameraMarkText";
|
||||
static std::string const kSpeedCameraMarkBg = "SpeedCameraMarkBg";
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace
|
||||
{
|
||||
using BookmarkIdDoc = pair<bookmarks::Id, bookmarks::Doc>;
|
||||
|
||||
double const kDistEqualQueryMeters = 100.0;
|
||||
double constexpr kDistEqualQueryMeters = 100.0;
|
||||
double const kDistEqualQueryMercator = mercator::MetersToMercator(kDistEqualQueryMeters);
|
||||
|
||||
// Cancels search query by |handle|.
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace
|
||||
{
|
||||
df::ColorConstant const kColorConstant = "SearchmarkDefault";
|
||||
|
||||
float const kVisitedSymbolOpacity = 0.7f;
|
||||
float const kOutOfFiltersSymbolOpacity = 0.4f;
|
||||
float constexpr kVisitedSymbolOpacity = 0.7f;
|
||||
float constexpr kOutOfFiltersSymbolOpacity = 0.4f;
|
||||
|
||||
std::array<std::string, SearchMarkType::Count> const kSymbols = {
|
||||
"search-result", // Default.
|
||||
|
||||
@@ -195,7 +195,7 @@ void TrafficManager::UpdateMyPosition(MyPosition const & myPosition)
|
||||
{
|
||||
// Side of square around |myPosition|. Every mwm which is covered by the square
|
||||
// will get traffic info.
|
||||
double const kSquareSideM = 5000.0;
|
||||
double constexpr kSquareSideM = 5000.0;
|
||||
m_currentPosition = {myPosition, true /* initialized */};
|
||||
|
||||
if (!IsEnabled() || IsInvalidState() || m_isPaused)
|
||||
|
||||
@@ -25,18 +25,18 @@ map<TransitType, string> const kTransitSymbols = {{TransitType::Subway, "transit
|
||||
|
||||
namespace
|
||||
{
|
||||
float const kStopMarkerScale = 2.2f;
|
||||
float const kTransferMarkerScale = 4.0f;
|
||||
float const kGateBgScale = 1.2f;
|
||||
float constexpr kStopMarkerScale = 2.2f;
|
||||
float constexpr kTransferMarkerScale = 4.0f;
|
||||
float constexpr kGateBgScale = 1.2f;
|
||||
|
||||
int const kSmallIconZoom = 1;
|
||||
int const kMediumIconZoom = 10;
|
||||
int constexpr kSmallIconZoom = 1;
|
||||
int constexpr kMediumIconZoom = 10;
|
||||
|
||||
int const kMinStopTitleZoom = 13;
|
||||
int constexpr kMinStopTitleZoom = 13;
|
||||
|
||||
int const kTransferTitleOffset = 2;
|
||||
int const kStopTitleOffset = 0;
|
||||
int const kGateTitleOffset = 0;
|
||||
int constexpr kTransferTitleOffset = 2;
|
||||
int constexpr kStopTitleOffset = 0;
|
||||
int constexpr kGateTitleOffset = 0;
|
||||
|
||||
std::string const kZeroIcon = "zero-icon";
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ size_t constexpr kMaxTransitCacheSizeBytes = 5 /* Mb */ * 1024 * 1024;
|
||||
|
||||
size_t CalculateCacheSize(TransitDisplayInfo const & transitInfo)
|
||||
{
|
||||
size_t const kSegmentSize = 72;
|
||||
size_t constexpr kSegmentSize = 72;
|
||||
size_t cacheSize = 0;
|
||||
for (auto const & shape : transitInfo.m_shapesSubway)
|
||||
cacheSize += shape.second.GetPolyline().size() * kSegmentSize;
|
||||
|
||||
@@ -29,9 +29,9 @@ using std::string;
|
||||
|
||||
namespace
|
||||
{
|
||||
char const kBitsExt[] = ".bftsegbits";
|
||||
char const kNodesExt[] = ".bftsegnodes";
|
||||
char const kOffsetsExt[] = ".offsets";
|
||||
char constexpr kBitsExt[] = ".bftsegbits";
|
||||
char constexpr kNodesExt[] = ".bftsegnodes";
|
||||
char constexpr kOffsetsExt[] = ".offsets";
|
||||
|
||||
string GetAdditionalWorldScope()
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace downloader
|
||||
|
||||
std::optional<MetaConfig> ParseMetaConfig(std::string const & jsonStr)
|
||||
{
|
||||
char const kSettings[] = "settings";
|
||||
char const kServers[] = "servers";
|
||||
char constexpr kSettings[] = "settings";
|
||||
char constexpr kServers[] = "servers";
|
||||
|
||||
MetaConfig outMetaConfig;
|
||||
try
|
||||
|
||||
@@ -30,7 +30,7 @@ void FixupCarTurns(vector<RouteSegment> & routeSegments)
|
||||
// (1) the route enters to the roundabout;
|
||||
// (2) the route leaves the roundabout;
|
||||
uint32_t exitNum = 0;
|
||||
size_t const kInvalidEnter = numeric_limits<size_t>::max();
|
||||
size_t constexpr kInvalidEnter = numeric_limits<size_t>::max();
|
||||
size_t enterRoundAbout = kInvalidEnter;
|
||||
|
||||
for (size_t idx = 0; idx < routeSegments.size(); ++idx)
|
||||
|
||||
@@ -86,7 +86,7 @@ size_t PedestrianDirectionsEngine::GetTurnDirection(IRoutingResult const & resul
|
||||
|
||||
void PedestrianDirectionsEngine::FixupTurns(vector<RouteSegment> & routeSegments)
|
||||
{
|
||||
double const kMergeDistMeters = 15.0;
|
||||
double constexpr kMergeDistMeters = 15.0;
|
||||
|
||||
for (size_t idx = 0; idx < routeSegments.size(); ++idx)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static uint32_t const kDefaultFeatureId = 0;
|
||||
static uint32_t constexpr kDefaultFeatureId = 0;
|
||||
|
||||
/// \brief Serializes a range of restrictions form |begin| to |end| to |sink|.
|
||||
/// \param begin is an iterator to the first item to serialize.
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
using CountrySetT = std::unordered_set<std::string_view>;
|
||||
|
||||
// List of country names where mwm should be generated without speed cameras.
|
||||
std::vector<std::string> kSpeedCamerasProhibitedCountries = {
|
||||
CountrySetT kSpeedCamerasProhibitedCountries = {
|
||||
"Germany",
|
||||
"Macedonia",
|
||||
"Switzerland",
|
||||
@@ -17,11 +19,11 @@ std::vector<std::string> kSpeedCamerasProhibitedCountries = {
|
||||
};
|
||||
|
||||
// List of country names where an end user should be warned about speed cameras.
|
||||
std::vector<std::string> kSpeedCamerasPartlyProhibitedCountries = {
|
||||
CountrySetT kSpeedCamerasPartlyProhibitedCountries = {
|
||||
"France",
|
||||
};
|
||||
|
||||
bool IsMwmContained(platform::CountryFile const & mwm, std::vector<std::string> const & countryList)
|
||||
bool IsMwmContained(platform::CountryFile const & mwm, CountrySetT const & countryList)
|
||||
{
|
||||
return std::any_of(countryList.cbegin(), countryList.cend(),
|
||||
[&mwm](auto const & country) { return mwm.GetName().starts_with(country); });
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace routing
|
||||
{
|
||||
std::string const kDebugSpeedCamSetting = "DebugSpeedCam";
|
||||
std::string_view constexpr kDebugSpeedCamSetting = "DebugSpeedCam";
|
||||
|
||||
/// \returns true if any information about speed cameras is prohibited in |mwm|.
|
||||
bool AreSpeedCamerasProhibited(platform::CountryFile const & mwm);
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace search
|
||||
{
|
||||
namespace bookmarks
|
||||
{
|
||||
GroupId const kInvalidGroupId = std::numeric_limits<GroupId>::max();
|
||||
GroupId constexpr kInvalidGroupId = std::numeric_limits<GroupId>::max();
|
||||
} // namespace bookmarks
|
||||
} // namespace search
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace search
|
||||
{
|
||||
namespace
|
||||
{
|
||||
uint64_t const kModulo = 18446744073709551557LLU;
|
||||
uint64_t constexpr kModulo = 18446744073709551557LLU;
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
|
||||
@@ -38,7 +38,7 @@ string EditorDelegate::GetOriginalFeatureStreet(FeatureID const & fid) const
|
||||
|
||||
void EditorDelegate::ForEachFeatureAtPoint(osm::Editor::FeatureTypeFn && fn, m2::PointD const & point) const
|
||||
{
|
||||
auto const kToleranceMeters = 1e-2;
|
||||
auto constexpr kToleranceMeters = 1e-2;
|
||||
indexer::ForEachFeatureAtPoint(m_dataSource, std::move(fn), point, kToleranceMeters);
|
||||
}
|
||||
} // namespace search
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace search
|
||||
class FeaturesLayerMatcher
|
||||
{
|
||||
public:
|
||||
static uint32_t const kInvalidId = std::numeric_limits<uint32_t>::max();
|
||||
static uint32_t constexpr kInvalidId = std::numeric_limits<uint32_t>::max();
|
||||
static int constexpr kBuildingRadiusMeters = 50;
|
||||
static int constexpr kComplexPoiRadiusMeters = 300;
|
||||
static int constexpr kStreetRadiusMeters = 100;
|
||||
|
||||
@@ -1429,7 +1429,7 @@ void Geocoder::MatchPOIsAndBuildings(BaseContext & ctx, size_t curToken, CBV con
|
||||
|
||||
// Clusters of features by search type. Each cluster is a sorted
|
||||
// list of ids.
|
||||
size_t const kNumClusters = Model::TYPE_BUILDING + 1;
|
||||
size_t constexpr kNumClusters = Model::TYPE_BUILDING + 1;
|
||||
vector<uint32_t> clusters[kNumClusters];
|
||||
|
||||
// Appends |featureId| to the end of the corresponding cluster, if
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace
|
||||
{
|
||||
class SkipRegionInfo
|
||||
{
|
||||
static size_t const kCount = 2;
|
||||
static size_t constexpr kCount = 2;
|
||||
uint32_t m_types[kCount];
|
||||
|
||||
public:
|
||||
|
||||
@@ -20,8 +20,8 @@ using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
double const kMaxCityRadiusMeters = 30000.0;
|
||||
double const kMaxVillageRadiusMeters = 2000.0;
|
||||
double constexpr kMaxCityRadiusMeters = 30000.0;
|
||||
double constexpr kMaxVillageRadiusMeters = 2000.0;
|
||||
|
||||
struct Filter
|
||||
{
|
||||
@@ -126,7 +126,7 @@ int GetVillagesScale()
|
||||
|
||||
// Needed for backward compatibility. |kCompatibilityVillagesMinDrawableScale| should be set to
|
||||
// maximal value we have in mwms over all data versions.
|
||||
int const kCompatibilityVillagesMinDrawableScale = 13;
|
||||
int constexpr kCompatibilityVillagesMinDrawableScale = 13;
|
||||
ASSERT_LESS_OR_EQUAL(currentVillagesMinDrawableScale, kCompatibilityVillagesMinDrawableScale,
|
||||
("Set kCompatibilityVillagesMinDrawableScale to", currentVillagesMinDrawableScale));
|
||||
return max(currentVillagesMinDrawableScale, kCompatibilityVillagesMinDrawableScale);
|
||||
|
||||
@@ -307,7 +307,7 @@ void LocalityScorer::GetDocVecs(uint32_t localityId, vector<DocVec> & dvs) const
|
||||
|
||||
double LocalityScorer::GetSimilarity(QueryVec & qv, IdfMap & docIdfs, vector<DocVec> & dvc) const
|
||||
{
|
||||
double const kScale = 1e6;
|
||||
double constexpr kScale = 1e6;
|
||||
|
||||
double similarity = 0;
|
||||
for (auto & dv : dvc)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace search
|
||||
{
|
||||
namespace
|
||||
{
|
||||
double const kPositionToleranceMeters = 15.0;
|
||||
double constexpr kPositionToleranceMeters = 15.0;
|
||||
} // namespace
|
||||
|
||||
NestedRectsCache::NestedRectsCache(DataSource const & dataSource)
|
||||
|
||||
@@ -49,7 +49,7 @@ PostcodePoints::PostcodePoints(MwmValue const & value)
|
||||
m_points = CentersTable::LoadV1(*m_pointsSubReader);
|
||||
CHECK(m_points, ());
|
||||
|
||||
auto const kPostcodeRadiusMultiplier = 5.0;
|
||||
auto constexpr kPostcodeRadiusMultiplier = 5.0;
|
||||
auto const area = value.GetHeader().GetBounds().Area();
|
||||
auto const count = static_cast<double>(m_points->Count());
|
||||
CHECK_NOT_EQUAL(count, 0.0, ("Zero postcodes should not be serialized to", POSTCODE_POINTS_FILE_TAG, "section"));
|
||||
|
||||
@@ -143,7 +143,7 @@ bool EatVersion(string & s, uint32_t & version)
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t const kVersionLength = 6;
|
||||
size_t constexpr kVersionLength = 6;
|
||||
if (s.size() >= kVersionLength && all_of(s.begin(), s.begin() + kVersionLength, ::isdigit) &&
|
||||
(s.size() == kVersionLength || !isdigit(s[kVersionLength + 1])))
|
||||
{
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
namespace search
|
||||
{
|
||||
static uint8_t const kCategoriesLang = 128;
|
||||
static uint8_t const kPostcodesLang = 129;
|
||||
static uint8_t constexpr kCategoriesLang = 128;
|
||||
static uint8_t constexpr kPostcodesLang = 129;
|
||||
} // namespace search
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace storage
|
||||
{
|
||||
namespace
|
||||
{
|
||||
size_t const kInvalidId = std::numeric_limits<size_t>::max();
|
||||
size_t constexpr kInvalidId = std::numeric_limits<size_t>::max();
|
||||
} // namespace
|
||||
|
||||
// CountryInfoGetterBase ---------------------------------------------------------------------------
|
||||
|
||||
@@ -21,13 +21,13 @@ namespace
|
||||
{
|
||||
using namespace storage::diffs;
|
||||
|
||||
char const kMaxVersionKey[] = "max_version";
|
||||
char const kMwmsKey[] = "mwms";
|
||||
char const kNameKey[] = "name";
|
||||
char const kSizeKey[] = "size";
|
||||
char const kVersionKey[] = "version";
|
||||
char constexpr kMaxVersionKey[] = "max_version";
|
||||
char constexpr kMwmsKey[] = "mwms";
|
||||
char constexpr kNameKey[] = "name";
|
||||
char constexpr kSizeKey[] = "size";
|
||||
char constexpr kVersionKey[] = "version";
|
||||
|
||||
auto const kTimeoutInSeconds = 5.0;
|
||||
auto constexpr kTimeoutInSeconds = 5.0;
|
||||
|
||||
string SerializeCheckerData(LocalMapsInfo const & info)
|
||||
{
|
||||
|
||||
@@ -47,10 +47,10 @@ string const kDownloadQueueKey = "DownloadQueue";
|
||||
// is most likely already fixed on OSM. Not limited to the latest one or two versions,
|
||||
// because a user can forget to update maps after a new app version has been installed
|
||||
// automatically in the background.
|
||||
uint64_t const kMaxSecondsTillLastVersionUpdate = 3600 * 24 * 31 * 3;
|
||||
uint64_t constexpr kMaxSecondsTillLastVersionUpdate = 3600 * 24 * 31 * 3;
|
||||
// Editing maps older than approximately six months old is disabled, because the device
|
||||
// may have been offline for a long time.
|
||||
uint64_t const kMaxSecondsTillNoEdits = 3600 * 24 * 31 * 6;
|
||||
uint64_t constexpr kMaxSecondsTillNoEdits = 3600 * 24 * 31 * 6;
|
||||
|
||||
void DeleteCountryIndexes(LocalCountryFile const & localFile)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace traffic
|
||||
{
|
||||
uint32_t const kSpeedGroupThresholdPercentage[] = {8, 16, 33, 58, 83, 100, 100, 100};
|
||||
uint32_t constexpr kSpeedGroupThresholdPercentage[] = {8, 16, 33, 58, 83, 100, 100, 100};
|
||||
|
||||
SpeedGroup GetSpeedGroupByPercentage(double p)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ string MakeRemoteURL(string const & name, uint64_t version)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
char const kETag[] = "etag";
|
||||
char constexpr kETag[] = "etag";
|
||||
} // namespace
|
||||
|
||||
// TrafficInfo::RoadSegmentId -----------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user