Added shield min_distance support

This commit is contained in:
Constantin Shalnev 2015-11-13 14:59:39 +03:00 committed by r.kuznetsov
parent 7fb96e01a4
commit 6302b6a88c
3 changed files with 12 additions and 2 deletions

View file

@ -488,7 +488,7 @@ void ApplyLineFeature::Finish()
dp::FontDecl font;
ShieldRuleProtoToFontDecl(m_shieldRule, font);
double pathPixelLength = m_spline->GetLength() * m_currentScaleGtoP;
double const pathPixelLength = m_spline->GetLength() * m_currentScaleGtoP;
int const textHeight = static_cast<int>(font.m_size);
// I don't know why we draw by this, but it's work before and will work now
@ -499,6 +499,8 @@ void ApplyLineFeature::Finish()
int const count = static_cast<int>((pathPixelLength / emptySpace) + 2);
double const splineStep = pathPixelLength / count;
float const mainScale = df::VisualParams::Instance().GetVisualScale();
TextViewParams viewParams;
viewParams.m_depth = m_shieldDepth;
viewParams.m_minVisibleScale = m_minVisibleScale;
@ -510,6 +512,7 @@ void ApplyLineFeature::Finish()
viewParams.m_primaryOffset = m2::PointF(0, 0);
viewParams.m_primaryOptional = true;
viewParams.m_secondaryOptional = true;
viewParams.m_extendingSize = m_shieldRule->has_min_distance() ? mainScale * m_shieldRule->min_distance() : 0;
m2::Spline::iterator it = m_spline.CreateIterator();
while (!it.BeginAgain())

View file

@ -54,6 +54,8 @@ struct LineViewParams : CommonViewParams
struct TextViewParams : CommonViewParams
{
TextViewParams() : m_extendingSize(0) {}
FeatureID m_featureID;
dp::FontDecl m_primaryTextFont;
string m_primaryText;
@ -63,6 +65,7 @@ struct TextViewParams : CommonViewParams
m2::PointF m_primaryOffset;
bool m_primaryOptional;
bool m_secondaryOptional;
uint32_t m_extendingSize;
};
struct PathTextViewParams : CommonViewParams

View file

@ -150,11 +150,15 @@ void TextShape::DrawSubString(StraightTextLayout const & layout, dp::FontDecl co
gpu::TTextDynamicVertexBuffer initialDynBuffer(dynamicBuffer.size());
m2::PointU const & pixelSize = layout.GetPixelSize();
m2::PointU const size = pixelSize + m2::PointU(m_params.m_extendingSize,
m_params.m_extendingSize) * 2;
drape_ptr<dp::OverlayHandle> handle = make_unique_dp<StraightTextHandle>(m_params.m_featureID,
layout.GetText(),
m_params.m_anchor,
glsl::ToVec2(m_basePoint),
glsl::vec2(pixelSize.x, pixelSize.y),
glsl::vec2(size.x, size.y),
baseOffset,
GetOverlayPriority(),
textures,