Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlga Khlopkova <o.khlopkova@corp.mail.ru>2020-12-21 16:51:20 +0300
committerAnatoliy V Tomilov <tomilov@users.noreply.github.com>2020-12-22 14:14:20 +0300
commit1ac8d3d8f15e9d94fd0f0d84990df2c3a5a1f967 (patch)
tree7f38d2f46433c514f05d72f48f68b1920af6a37e /drape_frontend
parentd5a8b05658dc1af4f284378bcff7addeceab7a2d (diff)
[drape_frontend] Handle corner case in new subway map rendering.
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/transit_scheme_builder.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/drape_frontend/transit_scheme_builder.cpp b/drape_frontend/transit_scheme_builder.cpp
index 12a83560f7..32ea42049e 100644
--- a/drape_frontend/transit_scheme_builder.cpp
+++ b/drape_frontend/transit_scheme_builder.cpp
@@ -49,6 +49,7 @@ int constexpr kFinalStationMinZoomLevel = 10;
int constexpr kTransferMinZoomLevel = 11;
int constexpr kStopMinZoomLevel = 12;
uint16_t constexpr kFinalStationPriorityInc = 2;
+double constexpr kEps = 1e-5;
float constexpr kOuterMarkerDepth = kBaseMarkerDepth + 0.5f;
float constexpr kInnerMarkerDepth = kBaseMarkerDepth + 1.0f;
@@ -851,14 +852,12 @@ void TransitSchemeBuilder::PrepareSchemeSubway(MwmSchemeData & scheme)
void UpdateShapeInfos(std::vector<ShapeInfoPT> & shapeInfos, m2::PointD const & newDir,
std::set<std::string> const & colors)
{
- static double constexpr eps = 1e-5;
-
auto const newDirReverse = -newDir;
for (ShapeInfoPT & info : shapeInfos)
{
- if (base::AlmostEqualAbs(info.m_direction, newDir, eps) ||
- base::AlmostEqualAbs(info.m_direction, newDirReverse, eps))
+ if (base::AlmostEqualAbs(info.m_direction, newDir, kEps) ||
+ base::AlmostEqualAbs(info.m_direction, newDirReverse, kEps))
{
for (auto const & color : colors)
info.m_colors.insert(color);
@@ -1243,10 +1242,25 @@ std::pair<m2::PointD, size_t> GetFittingDirectionAndSize(
auto const dirSizeIn = GetFittingDirectionAndSize(shapeInfosIn);
auto const dirSizeOut = GetFittingDirectionAndSize(shapeInfosOut);
- if (dirSizeIn.second > dirSizeOut.second)
- return dirSizeIn;
+ return dirSizeIn.second > dirSizeOut.second ? dirSizeIn : dirSizeOut;
+}
+
+bool StopHasMultipleShapes(std::vector<ShapeInfoPT> const & shapeInfosIn,
+ std::vector<ShapeInfoPT> const & shapeInfosOut)
+{
+ size_t count = 0;
+
+ for (auto const & si : shapeInfosIn)
+ {
+ auto const it =
+ std::find_if(shapeInfosOut.begin(), shapeInfosOut.end(), [&si](ShapeInfoPT const & so) {
+ return base::AlmostEqualAbs(si.m_direction, so.m_direction, kEps);
+ });
+ if (it != shapeInfosOut.end())
+ ++count;
+ }
- return dirSizeOut;
+ return std::max(shapeInfosIn.size(), shapeInfosOut.size()) - count > 1;
}
void TransitSchemeBuilder::GenerateStop(
@@ -1257,7 +1271,7 @@ void TransitSchemeBuilder::GenerateStop(
auto const & [dir, linesCount] =
GetFittingDirectionAndSize(stopParams.m_shapeInfoIn, stopParams.m_shapeInfoOut);
bool const severalRoads =
- std::max(stopParams.m_shapeInfoIn.size(), stopParams.m_shapeInfoOut.size()) > 1;
+ StopHasMultipleShapes(stopParams.m_shapeInfoIn, stopParams.m_shapeInfoOut);
if (linesCount > 1 || severalRoads)
{