[map] Minor fixes to the colored user mark.

This commit is contained in:
Maxim Pimenov 2019-04-10 17:04:38 +03:00 committed by Daria Volvenkova
parent 688b8d6826
commit f5444d43d3
2 changed files with 20 additions and 9 deletions

View file

@ -60,8 +60,8 @@ drape_ptr<df::UserPointMark::SymbolNameZoomInfo> DebugMarkPoint::GetSymbolNames(
return symbol;
}
ColoredDebugMarkPoint::ColoredDebugMarkPoint(m2::PointD const & ptOrg)
: UserMark(ptOrg, UserMark::Type::DEBUG_MARK)
ColoredMarkPoint::ColoredMarkPoint(m2::PointD const & ptOrg)
: UserMark(ptOrg, UserMark::Type::COLORED)
{
auto const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
@ -74,13 +74,21 @@ ColoredDebugMarkPoint::ColoredDebugMarkPoint(m2::PointD const & ptOrg)
m_coloredSymbols.m_zoomInfo.insert(std::make_pair(1, params));
}
void ColoredDebugMarkPoint::SetColor(dp::Color const & color)
void ColoredMarkPoint::SetColor(dp::Color const & color)
{
SetDirty();
m_coloredSymbols.m_zoomInfo.begin()->second.m_color = color;
}
drape_ptr<df::UserPointMark::ColoredSymbolZoomInfo> ColoredDebugMarkPoint::GetColoredSymbols() const
void ColoredMarkPoint::SetRadius(float radius)
{
SetDirty();
auto const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
m_coloredSymbols.m_zoomInfo.begin()->second.m_radiusInPixels = radius * vs;
}
drape_ptr<df::UserPointMark::ColoredSymbolZoomInfo> ColoredMarkPoint::GetColoredSymbols() const
{
return make_unique_dp<ColoredSymbolZoomInfo>(m_coloredSymbols);
}
@ -99,6 +107,7 @@ string DebugPrint(UserMark::Type type)
case UserMark::Type::SPEED_CAM: return "SPEED_CAM";
case UserMark::Type::LOCAL_ADS: return "LOCAL_ADS";
case UserMark::Type::TRANSIT: return "TRANSIT";
case UserMark::Type::COLORED: return "COLORED";
case UserMark::Type::USER_MARK_TYPES_COUNT: return "USER_MARK_TYPES_COUNT";
case UserMark::Type::USER_MARK_TYPES_COUNT_MAX: return "USER_MARK_TYPES_COUNT_MAX";
}

View file

@ -33,9 +33,9 @@ public:
RoadWarning,
};
enum Type: uint32_t
enum Type : uint32_t
{
BOOKMARK, // Should always be the first one
BOOKMARK, // Should always be the first one
API,
SEARCH,
STATIC,
@ -44,7 +44,8 @@ public:
ROAD_WARNING,
TRANSIT,
LOCAL_ADS,
DEBUG_MARK,
DEBUG_MARK, // Plain "DEBUG" results in a name collision.
COLORED,
USER_MARK_TYPES_COUNT,
USER_MARK_TYPES_COUNT_MAX = 1000,
};
@ -134,12 +135,13 @@ public:
drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const override;
};
class ColoredDebugMarkPoint : public UserMark
class ColoredMarkPoint : public UserMark
{
public:
ColoredDebugMarkPoint(m2::PointD const & ptOrg);
ColoredMarkPoint(m2::PointD const & ptOrg);
void SetColor(dp::Color const & color);
void SetRadius(float radius);
bool SymbolIsPOI() const override { return true; }
drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const override { return nullptr; }
drape_ptr<ColoredSymbolZoomInfo> GetColoredSymbols() const override;