forked from organicmaps/organicmaps
Added min zoom level for user mark's title.
This commit is contained in:
parent
00d5e176be
commit
8a93bee586
8 changed files with 28 additions and 7 deletions
|
@ -236,6 +236,7 @@ void DrapeEngine::UpdateUserMarksGroup(MarkGroupID groupId, UserMarksProvider *
|
|||
renderInfo->m_depth = mark->GetDepth();
|
||||
renderInfo->m_depthLayer = mark->GetDepthLayer();
|
||||
renderInfo->m_minZoom = mark->GetMinZoom();
|
||||
renderInfo->m_minTitleZoom = mark->GetMinTitleZoom();
|
||||
renderInfo->m_isVisible = mark->IsVisible();
|
||||
renderInfo->m_pivot = mark->GetPivot();
|
||||
renderInfo->m_pixelOffset = mark->GetPixelOffset();
|
||||
|
|
|
@ -142,7 +142,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
|
|||
{
|
||||
ColoredSymbolViewParams params = itSym->second;
|
||||
if (params.m_shape == ColoredSymbolViewParams::Shape::Circle)
|
||||
symbolSize = m2::PointF(params.m_radiusInPixels, params.m_radiusInPixels);
|
||||
symbolSize = m2::PointF(params.m_radiusInPixels * 2.0f, params.m_radiusInPixels * 2.0f);
|
||||
else
|
||||
symbolSize = params.m_sizeInPixels;
|
||||
|
||||
|
@ -205,14 +205,14 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
|
|||
{
|
||||
symbolSize = renderInfo.m_symbolSizes->at(static_cast<size_t>(tileKey.m_zoomLevel - 1)) * vs;
|
||||
}
|
||||
else
|
||||
else if (!symbolName.empty())
|
||||
{
|
||||
textures->GetSymbolRegion(symbolName, region);
|
||||
symbolSize.x = max(region.GetPixelSize().x, symbolSize.x);
|
||||
symbolSize.y = max(region.GetPixelSize().y, symbolSize.y);
|
||||
}
|
||||
|
||||
if (renderInfo.m_titleDecl != nullptr)
|
||||
if (renderInfo.m_titleDecl != nullptr && renderInfo.m_minTitleZoom <= tileKey.m_zoomLevel)
|
||||
{
|
||||
for (auto const & titleDecl : *renderInfo.m_titleDecl)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace df
|
|||
struct UserMarkRenderParams
|
||||
{
|
||||
int m_minZoom = 1;
|
||||
int m_minTitleZoom = 1;
|
||||
m2::PointD m_pivot = m2::PointD(0.0, 0.0);
|
||||
m2::PointD m_pixelOffset = m2::PointD(0.0, 0.0);
|
||||
dp::Anchor m_anchor = dp::Center;
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
virtual bool HasSymbolPriority() const = 0;
|
||||
virtual bool HasTitlePriority() const = 0;
|
||||
virtual int GetMinZoom() const = 0;
|
||||
virtual int GetMinTitleZoom() const = 0;
|
||||
virtual FeatureID GetFeatureID() const = 0;
|
||||
virtual bool HasCreationAnimation() const = 0;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace
|
|||
char const kRouterTypeKey[] = "router";
|
||||
|
||||
double const kRouteScaleMultiplier = 1.5;
|
||||
float const kStopMarkerScale = 2.0f;
|
||||
float const kStopMarkerScale = 2.2f;
|
||||
float const kTransferMarkerScale = 4.0f;
|
||||
|
||||
string const kRoutePointsFile = "route_points.dat";
|
||||
|
@ -472,8 +472,11 @@ void CreateTransitMarks(vector<TransitMarkInfo> const & transitMarks, std::map<s
|
|||
static const int kSmallIconZoom = 1;
|
||||
static const int kMediumIconZoom = 10;
|
||||
static const int kLargeIconZoom = 15;
|
||||
|
||||
static const int kMinStopTitleZoom = 14;
|
||||
static const float kGateBgScale = 1.2f;
|
||||
static const int kTransferTitleOffset = 1;
|
||||
static const int kStopTitleOffset = 0;
|
||||
static const int kGateTitleOffset = 0;
|
||||
|
||||
auto const vs = df::VisualParams::Instance().GetVisualScale();
|
||||
for (size_t i = 0; i < transitMarks.size(); ++i)
|
||||
|
@ -493,6 +496,7 @@ void CreateTransitMarks(vector<TransitMarkInfo> const & transitMarks, std::map<s
|
|||
{
|
||||
TransitMark::GetDefaultTransitTitle(titleDecl);
|
||||
titleDecl.m_primaryText = mark.m_titles.front().m_text;
|
||||
titleDecl.m_primaryOffset.y = kGateTitleOffset;
|
||||
titleDecl.m_anchor = dp::Anchor::Top;
|
||||
titleDecl.m_primaryOptional = true;
|
||||
transitMark->AddTitle(titleDecl);
|
||||
|
@ -511,12 +515,14 @@ void CreateTransitMarks(vector<TransitMarkInfo> const & transitMarks, std::map<s
|
|||
TransitMark::GetDefaultTransitTitle(titleDecl);
|
||||
titleDecl.m_primaryText = mark.m_titles.front().m_text;
|
||||
titleDecl.m_primaryTextFont.m_color = df::GetColorConstant(mark.m_titles.front().m_color);
|
||||
titleDecl.m_primaryOffset.y = -kTransferTitleOffset;
|
||||
titleDecl.m_anchor = dp::Anchor::Bottom;
|
||||
titleDecl.m_primaryOptional = true;
|
||||
transitMark->AddTitle(titleDecl);
|
||||
|
||||
titleDecl.m_primaryText = mark.m_titles.back().m_text;
|
||||
titleDecl.m_primaryTextFont.m_color = df::GetColorConstant(mark.m_titles.back().m_color);
|
||||
titleDecl.m_primaryOffset.y = kTransferTitleOffset;
|
||||
titleDecl.m_anchor = dp::Anchor::Top;
|
||||
titleDecl.m_primaryOptional = true;
|
||||
transitMark->AddTitle(titleDecl);
|
||||
|
@ -542,6 +548,7 @@ void CreateTransitMarks(vector<TransitMarkInfo> const & transitMarks, std::map<s
|
|||
TransitMark::GetDefaultTransitTitle(titleDecl);
|
||||
titleDecl.m_primaryText = mark.m_titles.front().m_text;
|
||||
titleDecl.m_primaryTextFont.m_color = df::GetColorConstant(mark.m_titles.front().m_color);
|
||||
titleDecl.m_primaryOffset.y = kStopTitleOffset;
|
||||
titleDecl.m_anchor = dp::Anchor::Top;
|
||||
titleDecl.m_primaryOptional = true;
|
||||
transitMark->AddTitle(titleDecl);
|
||||
|
@ -586,9 +593,9 @@ void CreateTransitMarks(vector<TransitMarkInfo> const & transitMarks, std::map<s
|
|||
if (coloredSymbol.empty() || coloredSymbol.rbegin()->second.m_radiusInPixels != params.m_radiusInPixels)
|
||||
coloredSymbol.insert(make_pair(zoomLevel, params));
|
||||
}
|
||||
transitMark->SetMinZoom(16);
|
||||
transitMark->SetColoredSymbols(coloredSymbol);
|
||||
transitMark->SetPriority(UserMark::Priority::Transit_Stop);
|
||||
transitMark->SetMinTitleZoom(kMinStopTitleZoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ static std::string const kTransitMarkTextOutline = "RouteMarkPrimaryTextOutline"
|
|||
float const kRouteMarkPrimaryTextSize = 11.0f;
|
||||
float const kRouteMarkSecondaryTextSize = 10.0f;
|
||||
float const kRouteMarkSecondaryOffsetY = 2.0f;
|
||||
float const kTransitMarkTextSize = 13.0f;
|
||||
float const kTransitMarkTextSize = 12.0f;
|
||||
} // namespace
|
||||
|
||||
RouteMarkPoint::RouteMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
|
||||
|
@ -401,6 +401,12 @@ void TransitMark::SetMinZoom(int minZoom)
|
|||
m_minZoom = minZoom;
|
||||
}
|
||||
|
||||
void TransitMark::SetMinTitleZoom(int minTitleZoom)
|
||||
{
|
||||
SetDirty();
|
||||
m_minTitleZoom = minTitleZoom;
|
||||
}
|
||||
|
||||
void TransitMark::AddTitle(dp::TitleDecl const & titleDecl)
|
||||
{
|
||||
SetDirty();
|
||||
|
|
|
@ -123,6 +123,9 @@ public:
|
|||
void SetMinZoom(int minZoom);
|
||||
int GetMinZoom() const override { return m_minZoom; }
|
||||
|
||||
void SetMinTitleZoom(int minTitleZoom);
|
||||
int GetMinTitleZoom() const override { return m_minTitleZoom; }
|
||||
|
||||
void SetSymbolSizes(SymbolSizesZoomInfo const & symbolSizes);
|
||||
drape_ptr<SymbolSizesZoomInfo> GetSymbolSizes() const override;
|
||||
|
||||
|
@ -139,6 +142,7 @@ public:
|
|||
|
||||
private:
|
||||
int m_minZoom = 1;
|
||||
int m_minTitleZoom = 1;
|
||||
Priority m_priority;
|
||||
FeatureID m_featureId;
|
||||
TitlesInfo m_titles;
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
bool HasSymbolPriority() const override { return false; }
|
||||
bool HasTitlePriority() const override { return false; }
|
||||
int GetMinZoom() const override { return 1; }
|
||||
int GetMinTitleZoom() const override { return GetMinZoom(); }
|
||||
FeatureID GetFeatureID() const override { return FeatureID(); }
|
||||
bool HasCreationAnimation() const override { return false; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue