forked from organicmaps/organicmaps
fixing #339.
This commit is contained in:
parent
81cc6212c4
commit
e7130dc4ac
3 changed files with 34 additions and 11 deletions
|
@ -394,9 +394,11 @@ namespace fwork
|
|||
functor_t fun(p1);
|
||||
|
||||
f.ForEachPointRef(fun, m_zoom);
|
||||
|
||||
textLength += 50;
|
||||
|
||||
if ((fun.IsExist()) && (fun.m_length > textLength))
|
||||
{
|
||||
textLength += 50;
|
||||
p.m_startLength = (fun.m_length - textLength) / 2;
|
||||
p.m_endLength = p.m_startLength + textLength;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@ namespace yg
|
|||
|
||||
float rawTileStartLen = 0;
|
||||
|
||||
float rawTileLen = (float)lineStyle->rawTileLen();
|
||||
|
||||
if ((offset < 0) && (!lineStyle->m_isWrapped))
|
||||
offset = offset - rawTileLen * ceil(offset / rawTileLen);
|
||||
|
||||
bool skipToOffset = true;
|
||||
|
||||
for (size_t i = 0; i < pointsCount - 1; ++i)
|
||||
|
@ -84,15 +89,21 @@ namespace yg
|
|||
/// The rightmost tile goes non-antialised at left and antialiased at right side.
|
||||
|
||||
/// Length of the actual pattern data being tiling(without antialiasing zones).
|
||||
float rawTileLen = 0;
|
||||
rawTileLen = 0;
|
||||
|
||||
shared_ptr<BaseTexture> texture = skin()->getPage(lineStyle->m_pipelineID)->texture();
|
||||
|
||||
float texMaxY = lineStyle->m_texRect.maxY() - aaShift();
|
||||
float texMinY = lineStyle->m_texRect.minY() + aaShift();
|
||||
|
||||
m2::PointF const fNorm = norm * geomHalfWidth; // enough to calc it once
|
||||
|
||||
while (segLenRemain > 0)
|
||||
{
|
||||
rawTileLen = lineStyle->m_isWrapped
|
||||
? segLen
|
||||
: std::min(((float)lineStyle->rawTileLen() - rawTileStartLen), segLenRemain);
|
||||
|
||||
float texMaxY = lineStyle->m_texRect.maxY() - aaShift();
|
||||
float texMinY = lineStyle->m_texRect.minY() + aaShift();
|
||||
|
||||
float texMinX = lineStyle->m_isWrapped ? 0 : lineStyle->m_texRect.minX() + 2 + rawTileStartLen;
|
||||
float texMaxX = texMinX + rawTileLen;
|
||||
|
@ -104,7 +115,6 @@ namespace yg
|
|||
|
||||
m2::PointF rawTileEndPt(rawTileStartPt.x + dir.x * rawTileLen, rawTileStartPt.y + dir.y * rawTileLen);
|
||||
|
||||
m2::PointF const fNorm = norm * geomHalfWidth; // enough to calc it once
|
||||
m2::PointF coords[4] =
|
||||
{
|
||||
// vng: i think this "rawTileStartPt + fNorm" reading better, isn't it?
|
||||
|
@ -114,8 +124,6 @@ namespace yg
|
|||
m2::PointF(rawTileEndPt.x + fNorm.x, rawTileEndPt.y + fNorm.y)
|
||||
};
|
||||
|
||||
shared_ptr<BaseTexture> texture = skin()->getPage(lineStyle->m_pipelineID)->texture();
|
||||
|
||||
m2::PointF texCoords[4] =
|
||||
{
|
||||
texture->mapPixel(m2::PointF(texMinX, texMinY)),
|
||||
|
|
|
@ -161,11 +161,24 @@ namespace
|
|||
vector<m2::PointD> pts;
|
||||
vector<double> pattern;
|
||||
|
||||
pattern.push_back(20);
|
||||
pattern.push_back(30);
|
||||
|
||||
pts.push_back(m2::PointD(200, 80));
|
||||
pts.push_back(m2::PointD(300, 80));
|
||||
|
||||
AddTest(pts, pattern, yg::Color(0, 0, 0, 255), 4, 0, 150);
|
||||
|
||||
pts.clear();
|
||||
pts.push_back(m2::PointD(200, 90));
|
||||
pts.push_back(m2::PointD(300, 90));
|
||||
|
||||
AddTest(pts, pattern, yg::Color(0, 0, 0, 255), 4, 0, -150);
|
||||
|
||||
pts.clear();
|
||||
pts.push_back(m2::PointD(200, 100));
|
||||
pts.push_back(m2::PointD(400, 100));
|
||||
|
||||
pattern.push_back(20);
|
||||
pattern.push_back(30);
|
||||
|
||||
/// The path should start from -10px path offset.
|
||||
AddTest(pts, pattern, yg::Color(0, 0, 0, 255), 4, 0, -10);
|
||||
|
@ -1322,7 +1335,7 @@ namespace
|
|||
// UNIT_TEST_GL(TestDrawSingleSymbol);
|
||||
// UNIT_TEST_GL(TestDrawEmptySymbol);
|
||||
// UNIT_TEST_GL(TestDrawSingleSymbolAndSolidPath);
|
||||
UNIT_TEST_GL(TestDrawMultiLineStringWithPosition);
|
||||
// UNIT_TEST_GL(TestDrawMultiLineStringWithPosition);
|
||||
// UNIT_TEST_GL(TestDrawString);
|
||||
// UNIT_TEST_GL(TestDrawStringWithFixedFont);
|
||||
// UNIT_TEST_GL(TestDrawStringWithColor);
|
||||
|
@ -1344,7 +1357,7 @@ namespace
|
|||
// UNIT_TEST_GL(TestDrawPoly);
|
||||
// UNIT_TEST_GL(TestDrawSolidRect);
|
||||
// UNIT_TEST_GL(TestDrawPathWithSkinPageMiss);
|
||||
// UNIT_TEST_GL(TestDrawPathWithOffset);
|
||||
UNIT_TEST_GL(TestDrawPathWithOffset);
|
||||
// UNIT_TEST_GL(TestDrawPathJoin);
|
||||
// UNIT_TEST_GL(TestDrawPathSolid1PX);
|
||||
// UNIT_TEST_GL(TestDrawPathSolid2PX);
|
||||
|
|
Loading…
Add table
Reference in a new issue