Merge commit 'eb264889e3' into traffic

This commit is contained in:
mvglasow
2025-10-10 18:40:35 +03:00
808 changed files with 31595 additions and 27751 deletions

View File

@@ -58,6 +58,7 @@ std::string GetBookmarkIconType(kml::BookmarkIcon const & icon)
std::string const kCustomImageProperty = "CustomImage";
std::string const kHasElevationProfileProperty = "has_elevation_profile";
int constexpr kInvalidColor = 0;
} // namespace
Bookmark::Bookmark(m2::PointD const & ptOrg) : Base(ptOrg, UserMark::BOOKMARK), m_groupId(kml::kInvalidMarkGroupId)
@@ -181,10 +182,16 @@ kml::PredefinedColor Bookmark::GetColor() const
return m_data.m_color.m_predefinedColor;
}
void Bookmark::InvalidateRGBAColor()
{
m_data.m_color.m_rgba = kInvalidColor;
}
void Bookmark::SetColor(kml::PredefinedColor color)
{
SetDirty();
m_data.m_color.m_predefinedColor = color;
InvalidateRGBAColor();
}
std::string Bookmark::GetPreferredName() const

View File

@@ -40,6 +40,7 @@ public:
void SetCustomName(std::string const & customName);
kml::PredefinedColor GetColor() const;
void InvalidateRGBAColor();
void SetColor(kml::PredefinedColor color);
m2::RectD GetViewport() const;

View File

@@ -2236,7 +2236,10 @@ void BookmarkManager::UpdateBookmark(kml::MarkId bmID, kml::BookmarkData const &
ASSERT(bookmark->GetGroupId() != kml::kInvalidMarkGroupId, ());
if (prevColor != bookmark->GetColor())
{
bookmark->InvalidateRGBAColor();
SetLastEditedBmColor(bookmark->GetColor());
}
}
void BookmarkManager::ChangeTrackColor(kml::TrackId trackId, dp::Color color)

View File

@@ -371,6 +371,27 @@ UNIT_TEST(Bookmarks_Timestamp)
DeleteCategoryFiles(arrCat);
}
UNIT_TEST(Bookmarks_ChangeColorForImportedBookmark)
{
Framework fm(kFrameworkParams);
BookmarkManager & bmManager = fm.GetBookmarkManager();
bmManager.EnableTestMode(true);
auto const cat1 = bmManager.CreateBookmarkCategory("cat1", false /* autoSave */);
kml::BookmarkData bm1;
kml::SetDefaultStr(bm1.m_name, "1");
bm1.m_point = m2::PointD(38, 20);
bm1.m_color.m_predefinedColor = kml::PredefinedColor::Blue;
bm1.m_color.m_rgba = 0x0066CCFF;
auto const * pBm1 = bmManager.GetEditSession().CreateBookmark(std::move(bm1), cat1);
bm1.m_color.m_predefinedColor = kml::PredefinedColor::Orange;
bmManager.GetEditSession().UpdateBookmark(pBm1->GetId(), bm1);
bmManager.SaveBookmarkCategory(cat1);
pBm1 = bmManager.GetBookmark(pBm1->GetId());
TEST_EQUAL(pBm1->GetData().m_color.m_predefinedColor, kml::PredefinedColor::Orange, ());
TEST_EQUAL(pBm1->GetData().m_color.m_rgba, 0, ());
}
UNIT_TEST(Bookmarks_Getting)
{
Framework fm(kFrameworkParams);

View File

@@ -284,11 +284,11 @@ UNIT_TEST(MapApiGe0)
TEST_EQUAL(p0.m_name, "Zoo Zürich", ());
}
{
ParsedMapApi api("http://comaps.app/o4B4pYZsRs/Zoo_Zürich");
ParsedMapApi api("http://comaps.at/o4B4pYZsRs/Zoo_Zürich");
TEST_EQUAL(api.GetRequestType(), UrlType::Map, ());
}
{
ParsedMapApi api("https://comaps.app/o4B4pYZsRs/Zoo_Zürich");
ParsedMapApi api("https://comaps.at/o4B4pYZsRs/Zoo_Zürich");
TEST_EQUAL(api.GetRequestType(), UrlType::Map, ());
}
{
@@ -386,7 +386,7 @@ UNIT_TEST(CrosshairApi)
TEST_EQUAL(api.GetAppName(), "Google Maps", ());
}
{
ParsedMapApi api("https://comaps.app/crosshair?cll=47.3813,8.5889&appname=Google%20Maps");
ParsedMapApi api("https://comaps.at/crosshair?cll=47.3813,8.5889&appname=Google%20Maps");
TEST_EQUAL(api.GetRequestType(), UrlType::Crosshair, ());
ms::LatLon latlon = api.GetCenterLatLon();
TEST_ALMOST_EQUAL_ABS(latlon.m_lat, 47.3813, kEps, ());

View File

@@ -97,6 +97,10 @@ void Info::SetFromFeatureType(FeatureType & ft)
m_uiSubtitle = FormatSubtitle(IsFeature() /* withTypes */, !emptyTitle /* withMainType */);
auto const branch = GetMetadata(feature::Metadata::FMD_BRANCH);
if (!branch.empty())
m_uiBranch = std::string(branch);
// apply to all types after checks
m_isHotel = ftypes::IsHotelChecker::Instance()(ft);
}

View File

@@ -121,6 +121,7 @@ public:
/// For showing in UI
std::string const & GetTitle() const { return m_uiTitle; }
std::string const & GetBranch() const { return m_uiBranch; }
/// Convenient wrapper for secondary feature name.
std::string const & GetSecondaryTitle() const { return m_uiSecondaryTitle; }
/// Convenient wrapper for type, cuisines, elevation, stars, wifi etc.
@@ -220,6 +221,7 @@ private:
/// UI
std::string m_uiTitle;
std::string m_uiBranch;
std::string m_uiSubtitle;
std::string m_uiSecondaryTitle;
std::string m_uiAddress;