User marks displacement improvements.

This commit is contained in:
Daria Volvenkova 2019-03-18 20:48:56 +03:00 committed by Roman Kuznetsov
parent 3148af8df9
commit fccb7e3cd4
12 changed files with 208 additions and 175 deletions

View file

@ -863,7 +863,7 @@ drape_ptr<UserMarkRenderParams> DrapeEngine::GenerateMarkRenderInfo(UserPointMar
renderInfo->m_symbolSizes = mark->GetSymbolSizes();
renderInfo->m_symbolOffsets = mark->GetSymbolOffsets();
renderInfo->m_color = mark->GetColorConstant();
renderInfo->m_hasSymbolShapes = mark->HasSymbolShapes();
renderInfo->m_symbolIsPOI = mark->SymbolIsPOI();
renderInfo->m_hasTitlePriority = mark->HasTitlePriority();
renderInfo->m_priority = mark->GetPriority();
renderInfo->m_displacement = mark->GetDisplacement();

View file

@ -1405,7 +1405,7 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView, bool activeFram
{
StencilWriterGuard guard(make_ref(m_postprocessRenderer), m_context);
RenderUserMarksLayer(modelView, DepthLayer::UserMarkLayer);
RenderUserMarksLayer(modelView, DepthLayer::TransitMarkLayer);
RenderUserMarksLayer(modelView, DepthLayer::RoutingBottomMarkLayer);
RenderUserMarksLayer(modelView, DepthLayer::RoutingMarkLayer);
RenderSearchMarksLayer(modelView);
}
@ -1765,7 +1765,7 @@ void FrontendRenderer::BuildOverlayTree(ScreenBase const & modelView)
static std::vector<DepthLayer> layers = {DepthLayer::OverlayLayer,
DepthLayer::LocalAdsMarkLayer,
DepthLayer::NavigationLayer,
DepthLayer::TransitMarkLayer,
DepthLayer::RoutingBottomMarkLayer,
DepthLayer::RoutingMarkLayer};
BeginUpdateOverlayTree(modelView);
for (auto const & layerId : layers)

View file

@ -147,7 +147,7 @@ bool RenderGroup::IsUserMark() const
auto const depthLayer = GetDepthLayer(m_state);
return depthLayer == DepthLayer::UserLineLayer ||
depthLayer == DepthLayer::UserMarkLayer ||
depthLayer == DepthLayer::TransitMarkLayer ||
depthLayer == DepthLayer::RoutingBottomMarkLayer ||
depthLayer == DepthLayer::RoutingMarkLayer ||
depthLayer == DepthLayer::LocalAdsMarkLayer ||
depthLayer == DepthLayer::SearchMarkLayer;

View file

@ -20,7 +20,7 @@ enum class DepthLayer : uint8_t
TransitSchemeLayer,
UserMarkLayer,
NavigationLayer,
TransitMarkLayer,
RoutingBottomMarkLayer,
RoutingMarkLayer,
SearchMarkLayer,
GuiLayer,
@ -62,7 +62,7 @@ inline std::string DebugPrint(DepthLayer layer)
case DepthLayer::TransitSchemeLayer: return "TransitSchemeLayer";
case DepthLayer::UserMarkLayer: return "UserMarkLayer";
case DepthLayer::NavigationLayer: return "NavigationLayer";
case DepthLayer::TransitMarkLayer: return "TransitMarkLayer";
case DepthLayer::RoutingBottomMarkLayer: return "RoutingBottomMarkLayer";
case DepthLayer::RoutingMarkLayer: return "RoutingMarkLayer";
case DepthLayer::SearchMarkLayer: return "SearchMarkLayer";
case DepthLayer::GuiLayer: return "GuiLayer";

View file

@ -95,8 +95,7 @@ struct UserPointVertex : public gpu::BaseVertex
TColorAndAnimate m_colorAndAnimate;
};
std::string GetSymbolNameForZoomLevel(drape_ptr<UserPointMark::SymbolNameZoomInfo> const & symbolNames,
TileKey const & tileKey)
std::string GetSymbolNameForZoomLevel(ref_ptr<UserPointMark::SymbolNameZoomInfo> symbolNames, TileKey const & tileKey)
{
if (!symbolNames)
return {};
@ -109,9 +108,21 @@ std::string GetSymbolNameForZoomLevel(drape_ptr<UserPointMark::SymbolNameZoomInf
return {};
}
void GenerateColoredSymbolShapes(ref_ptr<dp::GraphicsContext> context,
m2::PointF GetSymbolOffsetForZoomLevel(ref_ptr<UserPointMark::SymbolOffsets> symbolOffsets, TileKey const & tileKey)
{
if (!symbolOffsets)
return m2::PointF::Zero();
CHECK_GREATER(tileKey.m_zoomLevel, 0, ());
CHECK_LESS_OR_EQUAL(tileKey.m_zoomLevel, scales::UPPER_STYLE_SCALE, ());
auto const offsetIndex = static_cast<size_t>(tileKey.m_zoomLevel - 1);
return symbolOffsets->at(offsetIndex);
}
void GenerateColoredSymbolShapes(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textures,
UserMarkRenderParams const & renderInfo, TileKey const & tileKey,
m2::PointD const & tileCenter, ref_ptr<dp::TextureManager> textures,
m2::PointD const & tileCenter, m2::PointF const & symbolOffset,
m2::PointF & symbolSize, dp::Batcher & batcher)
{
m2::PointF sizeInc(0.0f, 0.0f);
@ -143,59 +154,71 @@ void GenerateColoredSymbolShapes(ref_ptr<dp::GraphicsContext> context,
offset = StraightTextLayout::GetSymbolBasedTextOffset(symbolSize, titleDecl.m_anchor, renderInfo.m_anchor);
}
for (auto itSym = renderInfo.m_coloredSymbols->m_zoomInfo.rbegin();
itSym != renderInfo.m_coloredSymbols->m_zoomInfo.rend(); ++itSym)
ColoredSymbolViewParams params;
if (renderInfo.m_coloredSymbols->m_isSymbolStub)
{
if (itSym->first <= tileKey.m_zoomLevel)
params.m_anchor = renderInfo.m_anchor;
params.m_color = dp::Color::Transparent();
params.m_shape = ColoredSymbolViewParams::Shape::Rectangle;
params.m_sizeInPixels = symbolSize;
params.m_offset = symbolOffset;
}
else
{
for (auto itSym = renderInfo.m_coloredSymbols->m_zoomInfo.rbegin();
itSym != renderInfo.m_coloredSymbols->m_zoomInfo.rend(); ++itSym)
{
ColoredSymbolViewParams params = itSym->second;
m2::PointF coloredSize(0.0f, 0.0f);
if (params.m_shape == ColoredSymbolViewParams::Shape::Circle)
if (itSym->first <= tileKey.m_zoomLevel)
{
params.m_radiusInPixels = params.m_radiusInPixels + std::max(sizeInc.x, sizeInc.y) / 2.0f;
coloredSize = m2::PointF(params.m_radiusInPixels * 2.0f, params.m_radiusInPixels * 2.0f);
params = itSym->second;
break;
}
else
{
params.m_sizeInPixels = params.m_sizeInPixels + sizeInc;
coloredSize = params.m_sizeInPixels;
}
if (!isTextBg)
symbolSize = m2::PointF(std::max(coloredSize.x, symbolSize.x), std::max(coloredSize.y, symbolSize.y));
params.m_featureID = renderInfo.m_featureId;
params.m_tileCenter = tileCenter;
params.m_depthTestEnabled = renderInfo.m_depthTestEnabled;
params.m_depth = renderInfo.m_depth;
params.m_depthLayer = renderInfo.m_depthLayer;
params.m_minVisibleScale = renderInfo.m_minZoom;
params.m_specialDisplacement = renderInfo.m_displacement;
params.m_specialPriority = renderInfo.m_priority;
params.m_offset += offset;
if (renderInfo.m_symbolSizes != nullptr)
{
ColoredSymbolShape(renderInfo.m_pivot, params, tileKey,
kStartUserMarkOverlayIndex + renderInfo.m_index,
isTextBg ? symbolSizesInc : *renderInfo.m_symbolSizes.get())
.Draw(context, &batcher, textures);
}
else
{
ColoredSymbolShape(renderInfo.m_pivot, params, tileKey,
kStartUserMarkOverlayIndex + renderInfo.m_index, renderInfo.m_coloredSymbols->m_needOverlay)
.Draw(context, &batcher, textures);
}
break;
}
}
m2::PointF coloredSize(0.0f, 0.0f);
if (params.m_shape == ColoredSymbolViewParams::Shape::Circle)
{
params.m_radiusInPixels = params.m_radiusInPixels + std::max(sizeInc.x, sizeInc.y) / 2.0f;
coloredSize = m2::PointF(params.m_radiusInPixels * 2.0f, params.m_radiusInPixels * 2.0f);
}
else
{
params.m_sizeInPixels = params.m_sizeInPixels + sizeInc;
coloredSize = params.m_sizeInPixels;
}
if (!isTextBg)
symbolSize = m2::PointF(std::max(coloredSize.x, symbolSize.x), std::max(coloredSize.y, symbolSize.y));
params.m_featureID = renderInfo.m_featureId;
params.m_tileCenter = tileCenter;
params.m_depthTestEnabled = renderInfo.m_depthTestEnabled;
params.m_depth = renderInfo.m_depth;
params.m_depthLayer = renderInfo.m_depthLayer;
params.m_minVisibleScale = renderInfo.m_minZoom;
params.m_specialDisplacement = renderInfo.m_displacement;
params.m_specialPriority = renderInfo.m_priority;
params.m_offset += offset;
if (renderInfo.m_symbolSizes != nullptr)
{
ColoredSymbolShape(renderInfo.m_pivot, params, tileKey,
kStartUserMarkOverlayIndex + renderInfo.m_index,
isTextBg ? symbolSizesInc : *renderInfo.m_symbolSizes.get())
.Draw(context, &batcher, textures);
}
else
{
ColoredSymbolShape(renderInfo.m_pivot, params, tileKey,
kStartUserMarkOverlayIndex + renderInfo.m_index, renderInfo.m_coloredSymbols->m_needOverlay)
.Draw(context, &batcher, textures);
}
}
void GeneratePoiSymbolShape(ref_ptr<dp::GraphicsContext> context,
void GeneratePoiSymbolShape(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textures,
UserMarkRenderParams const & renderInfo, TileKey const & tileKey,
m2::PointD const & tileCenter, std::string const & symbolName,
ref_ptr<dp::TextureManager> textures, m2::PointF & symbolOffset,
dp::Batcher & batcher)
m2::PointF const & symbolOffset, dp::Batcher & batcher)
{
PoiSymbolViewParams params(renderInfo.m_featureId);
params.m_tileCenter = tileCenter;
@ -207,29 +230,19 @@ void GeneratePoiSymbolShape(ref_ptr<dp::GraphicsContext> context,
params.m_specialPriority = renderInfo.m_priority;
params.m_symbolName = symbolName;
params.m_anchor = renderInfo.m_anchor;
params.m_offset = symbolOffset;
bool const hasColoredOverlay = renderInfo.m_coloredSymbols != nullptr && renderInfo.m_coloredSymbols->m_needOverlay;
params.m_startOverlayRank = hasColoredOverlay ? dp::OverlayRank1 : dp::OverlayRank0;
if (renderInfo.m_symbolOffsets != nullptr)
{
ASSERT_GREATER(tileKey.m_zoomLevel, 0, ());
ASSERT_LESS_OR_EQUAL(tileKey.m_zoomLevel, scales::UPPER_STYLE_SCALE, ());
size_t offsetIndex = 0;
if (tileKey.m_zoomLevel > 0)
offsetIndex = static_cast<size_t>(std::min(tileKey.m_zoomLevel, scales::UPPER_STYLE_SCALE) - 1);
symbolOffset = renderInfo.m_symbolOffsets->at(offsetIndex);
params.m_offset = symbolOffset;
}
PoiSymbolShape(renderInfo.m_pivot, params, tileKey,
kStartUserMarkOverlayIndex + renderInfo.m_index)
.Draw(context, &batcher, textures);
}
void GenerateTextShapes(ref_ptr<dp::GraphicsContext> context,
void GenerateTextShapes(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textures,
UserMarkRenderParams const & renderInfo, TileKey const & tileKey,
m2::PointD const & tileCenter, m2::PointF const & symbolSize,
m2::PointF const & symbolOffset, ref_ptr<dp::TextureManager> textures,
m2::PointD const & tileCenter,m2::PointF const & symbolOffset, m2::PointF const & symbolSize,
dp::Batcher & batcher)
{
if (renderInfo.m_minTitleZoom > tileKey.m_zoomLevel)
@ -270,14 +283,14 @@ void GenerateTextShapes(ref_ptr<dp::GraphicsContext> context,
params.m_specialDisplacement = renderInfo.m_displacement;
params.m_specialPriority = renderInfo.m_priority;
params.m_startOverlayRank = dp::OverlayRank0;
if (renderInfo.m_hasSymbolShapes)
{
if (renderInfo.m_symbolNames != nullptr)
params.m_startOverlayRank++;
if (renderInfo.m_coloredSymbols != nullptr && renderInfo.m_coloredSymbols->m_needOverlay)
params.m_startOverlayRank++;
ASSERT_LESS(params.m_startOverlayRank, dp::OverlayRanksCount, ());
}
if (renderInfo.m_symbolNames != nullptr && renderInfo.m_symbolIsPOI)
params.m_startOverlayRank++;
if (renderInfo.m_coloredSymbols != nullptr && renderInfo.m_coloredSymbols->m_needOverlay)
params.m_startOverlayRank++;
ASSERT_LESS(params.m_startOverlayRank, dp::OverlayRanksCount, ());
}
if (renderInfo.m_symbolSizes != nullptr)
@ -355,9 +368,7 @@ void CacheUserMarks(ref_ptr<dp::GraphicsContext> context, TileKey const & tileKe
m2::PointD const tileCenter = tileKey.GetGlobalRect().Center();
m2::PointF symbolSize(0.0f, 0.0f);
m2::PointF symbolOffset(0.0f, 0.0f);
auto const symbolName = GetSymbolNameForZoomLevel(renderInfo.m_symbolNames, tileKey);
auto const symbolName = GetSymbolNameForZoomLevel(make_ref(renderInfo.m_symbolNames), tileKey);
if (!symbolName.empty())
{
dp::TextureManager::SymbolRegion region;
@ -365,111 +376,110 @@ void CacheUserMarks(ref_ptr<dp::GraphicsContext> context, TileKey const & tileKe
symbolSize = region.GetPixelSize();
}
dp::Color color = dp::Color::White();
if (!renderInfo.m_color.empty())
color = df::GetColorConstant(renderInfo.m_color);
m2::PointF symbolOffset = GetSymbolOffsetForZoomLevel(make_ref(renderInfo.m_symbolOffsets), tileKey);
if (renderInfo.m_hasSymbolShapes)
if (renderInfo.m_coloredSymbols != nullptr)
{
if (renderInfo.m_coloredSymbols != nullptr)
{
GenerateColoredSymbolShapes(context, renderInfo, tileKey, tileCenter, textures, symbolSize,
batcher);
}
if (renderInfo.m_symbolNames != nullptr)
{
GeneratePoiSymbolShape(context, renderInfo, tileKey, tileCenter, symbolName, textures,
symbolOffset, batcher);
}
GenerateColoredSymbolShapes(context, textures, renderInfo, tileKey, tileCenter, symbolOffset, symbolSize,
batcher);
}
else if (renderInfo.m_symbolNames != nullptr)
if (renderInfo.m_symbolNames != nullptr)
{
dp::TextureManager::SymbolRegion region;
dp::TextureManager::SymbolRegion backgroundRegion;
buffer.clear();
textures->GetSymbolRegion(symbolName, region);
auto const backgroundSymbol = GetBackgroundForSymbol(symbolName, textures);
if (!backgroundSymbol.empty())
textures->GetSymbolRegion(backgroundSymbol, backgroundRegion);
m2::RectF const & texRect = region.GetTexRect();
m2::RectF const & bgTexRect = backgroundRegion.GetTexRect();
m2::PointF const pxSize = region.GetPixelSize();
dp::Anchor const anchor = renderInfo.m_anchor;
m2::PointD const pt = MapShape::ConvertToLocal(renderInfo.m_pivot, tileCenter,
kShapeCoordScalar);
glsl::vec3 const pos = glsl::vec3(glsl::ToVec2(pt), renderInfo.m_depth);
bool const runAnim = renderInfo.m_hasCreationAnimation && renderInfo.m_justCreated;
glsl::vec2 left, right, up, down;
AlignHorizontal(pxSize.x * 0.5f, anchor, left, right);
AlignVertical(pxSize.y * 0.5f, anchor, up, down);
m2::PointD const pixelOffset = renderInfo.m_pixelOffset;
glsl::vec2 const offset(pixelOffset.x, pixelOffset.y);
up += offset;
down += offset;
glsl::vec4 colorAndAnimate(color.GetRedF(), color.GetGreenF(), color.GetBlueF(),
runAnim ? 1.0f : -1.0f);
buffer.emplace_back(pos, left + down,
glsl::ToVec4(m2::PointD(texRect.LeftTop()), m2::PointD(bgTexRect.LeftTop())),
colorAndAnimate);
buffer.emplace_back(pos, left + up,
glsl::ToVec4(m2::PointD(texRect.LeftBottom()), m2::PointD(bgTexRect.LeftBottom())),
colorAndAnimate);
buffer.emplace_back(pos, right + down,
glsl::ToVec4(m2::PointD(texRect.RightTop()), m2::PointD(bgTexRect.RightTop())),
colorAndAnimate);
buffer.emplace_back(pos, right + up,
glsl::ToVec4(m2::PointD(texRect.RightBottom()), m2::PointD(bgTexRect.RightBottom())),
colorAndAnimate);
gpu::Program program;
gpu::Program program3d;
if (renderInfo.m_isMarkAboveText)
if (renderInfo.m_symbolIsPOI)
{
program = runAnim ? gpu::Program::BookmarkAnimAboveText
: gpu::Program::BookmarkAboveText;
program3d = runAnim ? gpu::Program::BookmarkAnimAboveTextBillboard
: gpu::Program::BookmarkAboveTextBillboard;
GeneratePoiSymbolShape(context, textures, renderInfo, tileKey, tileCenter, symbolName, symbolOffset, batcher);
}
else
else if (renderInfo.m_symbolNames != nullptr)
{
program = runAnim ? gpu::Program::BookmarkAnim
: gpu::Program::Bookmark;
program3d = runAnim ? gpu::Program::BookmarkAnimBillboard
: gpu::Program::BookmarkBillboard;
dp::TextureManager::SymbolRegion region;
dp::TextureManager::SymbolRegion backgroundRegion;
buffer.clear();
textures->GetSymbolRegion(symbolName, region);
auto const backgroundSymbol = GetBackgroundForSymbol(symbolName, textures);
if (!backgroundSymbol.empty())
textures->GetSymbolRegion(backgroundSymbol, backgroundRegion);
m2::RectF const & texRect = region.GetTexRect();
m2::RectF const & bgTexRect = backgroundRegion.GetTexRect();
m2::PointF const pxSize = region.GetPixelSize();
dp::Anchor const anchor = renderInfo.m_anchor;
m2::PointD const pt = MapShape::ConvertToLocal(renderInfo.m_pivot, tileCenter,
kShapeCoordScalar);
glsl::vec3 const pos = glsl::vec3(glsl::ToVec2(pt), renderInfo.m_depth);
bool const runAnim = renderInfo.m_hasCreationAnimation && renderInfo.m_justCreated;
glsl::vec2 left, right, up, down;
AlignHorizontal(pxSize.x * 0.5f, anchor, left, right);
AlignVertical(pxSize.y * 0.5f, anchor, up, down);
m2::PointD const pixelOffset = renderInfo.m_pixelOffset;
glsl::vec2 const offset(pixelOffset.x, pixelOffset.y);
up += offset;
down += offset;
dp::Color color = dp::Color::White();
if (!renderInfo.m_color.empty())
color = df::GetColorConstant(renderInfo.m_color);
glsl::vec4 colorAndAnimate(color.GetRedF(), color.GetGreenF(), color.GetBlueF(),
runAnim ? 1.0f : -1.0f);
buffer.emplace_back(pos, left + down,
glsl::ToVec4(m2::PointD(texRect.LeftTop()), m2::PointD(bgTexRect.LeftTop())),
colorAndAnimate);
buffer.emplace_back(pos, left + up,
glsl::ToVec4(m2::PointD(texRect.LeftBottom()), m2::PointD(bgTexRect.LeftBottom())),
colorAndAnimate);
buffer.emplace_back(pos, right + down,
glsl::ToVec4(m2::PointD(texRect.RightTop()), m2::PointD(bgTexRect.RightTop())),
colorAndAnimate);
buffer.emplace_back(pos, right + up,
glsl::ToVec4(m2::PointD(texRect.RightBottom()), m2::PointD(bgTexRect.RightBottom())),
colorAndAnimate);
gpu::Program program;
gpu::Program program3d;
if (renderInfo.m_isMarkAboveText)
{
program = runAnim ? gpu::Program::BookmarkAnimAboveText
: gpu::Program::BookmarkAboveText;
program3d = runAnim ? gpu::Program::BookmarkAnimAboveTextBillboard
: gpu::Program::BookmarkAboveTextBillboard;
}
else
{
program = runAnim ? gpu::Program::BookmarkAnim
: gpu::Program::Bookmark;
program3d = runAnim ? gpu::Program::BookmarkAnimBillboard
: gpu::Program::BookmarkBillboard;
}
auto state = CreateRenderState(program, renderInfo.m_depthLayer);
state.SetProgram3d(program3d);
state.SetColorTexture(region.GetTexture());
state.SetTextureFilter(dp::TextureFilter::Nearest);
state.SetDepthTestEnabled(renderInfo.m_depthTestEnabled);
dp::AttributeProvider attribProvider(1, static_cast<uint32_t>(buffer.size()));
attribProvider.InitStream(0, UPV::GetBinding(), make_ref(buffer.data()));
batcher.InsertListOfStrip(context, state, make_ref(&attribProvider), dp::Batcher::VertexPerQuad);
}
auto state = CreateRenderState(program, renderInfo.m_depthLayer);
state.SetProgram3d(program3d);
state.SetColorTexture(region.GetTexture());
state.SetTextureFilter(dp::TextureFilter::Nearest);
state.SetDepthTestEnabled(renderInfo.m_depthTestEnabled);
dp::AttributeProvider attribProvider(1, static_cast<uint32_t>(buffer.size()));
attribProvider.InitStream(0, UPV::GetBinding(), make_ref(buffer.data()));
batcher.InsertListOfStrip(context, state, make_ref(&attribProvider), dp::Batcher::VertexPerQuad);
}
if (renderInfo.m_titleDecl != nullptr)
{
GenerateTextShapes(context, renderInfo, tileKey, tileCenter, symbolSize, symbolOffset,
textures, batcher);
GenerateTextShapes(context, textures, renderInfo, tileKey, tileCenter, symbolOffset, symbolSize, batcher);
}
if (renderInfo.m_badgeNames != nullptr)
{
ASSERT(!renderInfo.m_hasSymbolShapes || renderInfo.m_symbolNames == nullptr,
ASSERT(!renderInfo.m_symbolIsPOI || renderInfo.m_symbolNames == nullptr,
("Multiple POI shapes in an usermark are not supported yet"));
auto const badgeName = GetSymbolNameForZoomLevel(renderInfo.m_badgeNames, tileKey);
auto const badgeName = GetSymbolNameForZoomLevel(make_ref(renderInfo.m_badgeNames), tileKey);
if (!badgeName.empty())
{
GeneratePoiSymbolShape(context, renderInfo, tileKey, tileCenter, badgeName, textures,
symbolOffset, batcher);
GeneratePoiSymbolShape(context, textures, renderInfo, tileKey, tileCenter, badgeName, symbolOffset, batcher);
}
}
@ -511,8 +521,8 @@ void CacheUserLines(ref_ptr<dp::GraphicsContext> context, TileKey const & tileKe
ref_ptr<dp::TextureManager> textures, kml::TrackIdCollection const & linesId,
UserLinesRenderCollection & renderParams, dp::Batcher & batcher)
{
ASSERT_GREATER(tileKey.m_zoomLevel, 0, ());
ASSERT_LESS_OR_EQUAL(tileKey.m_zoomLevel, scales::GetUpperStyleScale(), ());
CHECK_GREATER(tileKey.m_zoomLevel, 0, ());
CHECK_LESS_OR_EQUAL(tileKey.m_zoomLevel, scales::GetUpperStyleScale(), ());
auto const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
bool const simplify = tileKey.m_zoomLevel <= kLineSimplifyLevelEnd;

View file

@ -28,7 +28,7 @@ struct UserMarkRenderParams
drape_ptr<UserPointMark::SymbolOffsets> m_symbolOffsets;
drape_ptr<UserPointMark::SymbolNameZoomInfo> m_badgeNames;
df::ColorConstant m_color;
bool m_hasSymbolShapes = false;
bool m_symbolIsPOI = false;
bool m_hasTitlePriority = false;
uint16_t m_priority = 0;
SpecialDisplacement m_displacement = SpecialDisplacement::UserMark;

View file

@ -40,6 +40,7 @@ public:
struct ColoredSymbolZoomInfo
{
std::map<int, df::ColoredSymbolViewParams> m_zoomInfo;
bool m_isSymbolStub = false;
bool m_needOverlay = true;
bool m_addTextSize = false;
};
@ -74,7 +75,7 @@ public:
virtual uint16_t GetPriority() const = 0;
virtual df::SpecialDisplacement GetDisplacement() const = 0;
virtual uint32_t GetIndex() const = 0;
virtual bool HasSymbolShapes() const = 0;
virtual bool SymbolIsPOI() const = 0;
virtual bool HasTitlePriority() const = 0;
virtual int GetMinZoom() const = 0;
virtual int GetMinTitleZoom() const = 0;

View file

@ -27,7 +27,7 @@ public:
drape_ptr<TitlesInfo> GetTitleDecl() const override;
uint16_t GetPriority() const override { return m_data.m_priority; }
bool HasSymbolShapes() const override { return true; }
bool SymbolIsPOI() const override { return true; }
bool HasTitlePriority() const override { return true; }
int GetMinZoom() const override { return static_cast<int>(m_data.m_minZoomLevel); }
FeatureID GetFeatureID() const override { return m_featureId; }

View file

@ -161,6 +161,14 @@ drape_ptr<df::UserPointMark::TitlesInfo> RouteMarkPoint::GetTitleDecl() const
return titles;
}
drape_ptr<df::UserPointMark::ColoredSymbolZoomInfo> RouteMarkPoint::GetColoredSymbols() const
{
auto coloredSymbol = make_unique_dp<ColoredSymbolZoomInfo>();
coloredSymbol->m_isSymbolStub = true;
return coloredSymbol;
}
void RouteMarkPoint::SetFollowingMode(bool enabled)
{
if (m_followingMode == enabled)
@ -659,6 +667,13 @@ drape_ptr<df::UserPointMark::SymbolNameZoomInfo> RoadWarningMark::GetSymbolNames
return symbol;
}
drape_ptr<df::UserPointMark::ColoredSymbolZoomInfo> RoadWarningMark::GetColoredSymbols() const
{
auto coloredSymbol = make_unique_dp<ColoredSymbolZoomInfo>();
coloredSymbol->m_isSymbolStub = true;
return coloredSymbol;
}
// static
std::string RoadWarningMark::GetLocalizedRoadWarningType(RoadWarningMarkType type)
{

View file

@ -62,7 +62,8 @@ public:
drape_ptr<TitlesInfo> GetTitleDecl() const override;
bool HasSymbolShapes() const override { return false; }
drape_ptr<ColoredSymbolZoomInfo> GetColoredSymbols() const override;
bool HasTitlePriority() const override { return true; }
df::SpecialDisplacement GetDisplacement() const override { return df::SpecialDisplacement::SpecialModeUserMark; }
@ -108,9 +109,9 @@ class TransitMark : public UserMark
public:
explicit TransitMark(m2::PointD const & ptOrg);
df::DepthLayer GetDepthLayer() const override { return df::DepthLayer::TransitMarkLayer; }
df::DepthLayer GetDepthLayer() const override { return df::DepthLayer::RoutingBottomMarkLayer; }
bool HasSymbolShapes() const override { return !m_symbolNames.empty() || !m_coloredSymbols.m_zoomInfo.empty(); }
bool SymbolIsPOI() const override { return true; }
bool HasTitlePriority() const override { return true; }
df::SpecialDisplacement GetDisplacement() const override { return df::SpecialDisplacement::SpecialModeUserMark; }
@ -173,7 +174,7 @@ public:
uint32_t GetIndex() const override { return m_index; }
df::DepthLayer GetDepthLayer() const override { return df::DepthLayer::RoutingMarkLayer; }
bool HasSymbolShapes() const override { return true; }
bool SymbolIsPOI() const override { return true; }
bool HasTitlePriority() const override { return true; }
uint16_t GetPriority() const override { return static_cast<uint16_t>(Priority::SpeedCamera); }
df::SpecialDisplacement GetDisplacement() const override { return df::SpecialDisplacement::SpecialModeUserMark; }
@ -211,6 +212,9 @@ public:
explicit RoadWarningMark(m2::PointD const & ptOrg);
dp::Anchor GetAnchor() const override { return dp::Anchor::Bottom; }
df::DepthLayer GetDepthLayer() const override { return df::DepthLayer::RoutingBottomMarkLayer; }
uint16_t GetPriority() const override { return static_cast<uint16_t>(Priority::RoadWarning); }
df::SpecialDisplacement GetDisplacement() const override { return df::SpecialDisplacement::SpecialModeUserMark; }
void SetIndex(uint32_t index);
uint32_t GetIndex() const override { return m_index; }
@ -229,6 +233,8 @@ public:
drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const override;
drape_ptr<ColoredSymbolZoomInfo> GetColoredSymbols() const override;
int GetAutoVisibleMinZoom() const override { return kAutoVisibleMinZoom; }
static std::string GetLocalizedRoadWarningType(RoadWarningMarkType type);

View file

@ -71,7 +71,7 @@ ColoredDebugMarkPoint::ColoredDebugMarkPoint(m2::PointD const & ptOrg)
params.m_radiusInPixels = 7.0f * vs;
params.m_color = dp::Color::Green();
m_coloredSymbols.m_needOverlay = false;
m_coloredSymbols.m_zoomInfo.insert(make_pair(1, params));
m_coloredSymbols.m_zoomInfo.insert(std::make_pair(1, params));
}
void ColoredDebugMarkPoint::SetColor(dp::Color const & color)

View file

@ -30,6 +30,7 @@ public:
TransitTransfer,
TransitKeyStop,
SpeedCamera,
RoadWarning,
};
enum Type: uint32_t
@ -75,7 +76,7 @@ public:
uint16_t GetPriority() const override { return static_cast<uint16_t >(Priority::Default); }
df::SpecialDisplacement GetDisplacement() const override { return df::SpecialDisplacement::UserMark; }
uint32_t GetIndex() const override { return 0; }
bool HasSymbolShapes() const override { return false; }
bool SymbolIsPOI() const override { return false; }
bool HasTitlePriority() const override { return false; }
int GetMinZoom() const override { return 1; }
int GetMinTitleZoom() const override { return GetMinZoom(); }
@ -139,7 +140,7 @@ public:
ColoredDebugMarkPoint(m2::PointD const & ptOrg);
void SetColor(dp::Color const & color);
bool HasSymbolShapes() const override { return true; }
bool SymbolIsPOI() const override { return true; }
drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const override { return nullptr; }
drape_ptr<ColoredSymbolZoomInfo> GetColoredSymbols() const override;