Refactored (a bit) user mark containers

This commit is contained in:
r.kuznetsov 2017-10-20 17:23:55 +03:00 committed by Yuri Gorshenin
parent 652a1c538f
commit 7585a2c1e1
26 changed files with 263 additions and 303 deletions

View file

@ -675,7 +675,7 @@ Java_com_mapswithme_maps_Framework_nativeGetNameAndAddress(JNIEnv * env, jclass
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeClearApiPoints(JNIEnv * env, jclass clazz)
{
UserMarkNotificationGuard guard(frm()->GetBookmarkManager(), UserMarkType::API_MARK);
UserMarkNotificationGuard guard(frm()->GetBookmarkManager(), UserMark::Type::API);
guard.m_controller.Clear();
}

View file

@ -55,7 +55,7 @@ static NSString * const kKeyPath = @"subviews";
[Statistics logEvent:kStatEventName(kStatAPI, kStatBack)];
Framework & f = GetFramework();
f.DeactivateMapSelection(true);
UserMarkNotificationGuard guard(f.GetBookmarkManager(), UserMarkType::API_MARK);
UserMarkNotificationGuard guard(f.GetBookmarkManager(), UserMark::Type::API);
guard.m_controller.Clear();
self.isVisible = NO;
NSURL * url = [NSURL URLWithString:@(f.GetApiDataHolder().GetGlobalBackUrl().c_str())];

View file

@ -139,7 +139,7 @@ Track const * BookmarkCategory::GetTrack(size_t index) const
}
BookmarkCategory::BookmarkCategory(std::string const & name, Framework & framework)
: TBase(0.0 /* bookmarkDepth */, UserMarkType::BOOKMARK_MARK, framework)
: TBase(0.0 /* bookmarkDepth */, UserMark::Type::BOOKMARK, framework)
, m_name(name)
{
}

View file

@ -18,16 +18,26 @@
#include <algorithm>
using SearchUserMarkContainer = SpecifiedUserMarkContainer<SearchMarkPoint, UserMark::Type::SEARCH>;
using ApiUserMarkContainer = SpecifiedUserMarkContainer<ApiMarkPoint, UserMark::Type::API>;
using DebugUserMarkContainer = SpecifiedUserMarkContainer<DebugMarkPoint, UserMark::Type::DEBUG_MARK>;
using RouteUserMarkContainer = SpecifiedUserMarkContainer<RouteMarkPoint, UserMark::Type::ROUTING>;
using LocalAdsMarkContainer = SpecifiedUserMarkContainer<LocalAdsMark, UserMark::Type::LOCAL_ADS>;
using StaticUserMarkContainer = SpecifiedUserMarkContainer<SearchMarkPoint, UserMark::Type::STATIC>;
BookmarkManager::BookmarkManager(Framework & f)
: m_framework(f)
{
m_userMarkLayers.reserve(5);
m_userMarkLayers.emplace_back(new SearchUserMarkContainer(0.0 /* activePinDepth */, m_framework));
m_userMarkLayers.emplace_back(new ApiUserMarkContainer(0.0 /* activePinDepth */, m_framework));
m_userMarkLayers.emplace_back(new DebugUserMarkContainer(0.0 /* debugDepth */, m_framework));
m_userMarkLayers.emplace_back(new RouteUserMarkContainer(0.0 /* activePinDepth */, m_framework));
m_userMarkLayers.emplace_back(new LocalAdsMarkContainer(0.0 /* activePinDepth */, m_framework));
UserMarkContainer::InitStaticMarks(FindUserMarksContainer(UserMarkType::SEARCH_MARK));
m_userMarkLayers.reserve(6);
m_userMarkLayers.emplace_back(my::make_unique<SearchUserMarkContainer>(m_framework));
m_userMarkLayers.emplace_back(my::make_unique<ApiUserMarkContainer>(m_framework));
m_userMarkLayers.emplace_back(my::make_unique<DebugUserMarkContainer>(m_framework));
m_userMarkLayers.emplace_back(my::make_unique<RouteUserMarkContainer>(m_framework));
m_userMarkLayers.emplace_back(my::make_unique<LocalAdsMarkContainer>(m_framework));
auto staticMarksContainer = my::make_unique<StaticUserMarkContainer>(m_framework);
UserMarkContainer::InitStaticMarks(staticMarksContainer.get());
m_userMarkLayers.emplace_back(std::move(staticMarksContainer));
}
BookmarkManager::~BookmarkManager()
@ -187,45 +197,47 @@ bool BookmarkManager::DeleteBmCategory(size_t index)
namespace
{
class BestUserMarkFinder
class BestUserMarkFinder
{
public:
explicit BestUserMarkFinder(BookmarkManager::TTouchRectHolder const & rectHolder)
: m_rectHolder(rectHolder)
, m_d(numeric_limits<double>::max())
, m_mark(nullptr)
{}
void operator()(UserMarkContainer const * container)
{
public:
BestUserMarkFinder(BookmarkManager::TTouchRectHolder const & rectHolder)
: m_rectHolder(rectHolder)
, m_d(numeric_limits<double>::max())
, m_mark(NULL) {}
void operator() (UserMarkContainer const * container)
ASSERT(container != nullptr, ());
m2::AnyRectD const & rect = m_rectHolder(container->GetType());
if (UserMark const * p = container->FindMarkInRect(rect, m_d))
{
m2::AnyRectD const & rect = m_rectHolder(container->GetType());
if (UserMark const * p = container->FindMarkInRect(rect, m_d))
{
double const kEps = 1e-5;
if (m_mark == nullptr || !p->GetPivot().EqualDxDy(m_mark->GetPivot(), kEps))
m_mark = p;
}
static double const kEps = 1e-5;
if (m_mark == nullptr || !p->GetPivot().EqualDxDy(m_mark->GetPivot(), kEps))
m_mark = p;
}
}
UserMark const * GetFoundMark() const { return m_mark; }
UserMark const * GetFoundMark() const { return m_mark; }
private:
BookmarkManager::TTouchRectHolder const & m_rectHolder;
double m_d;
UserMark const * m_mark;
};
}
private:
BookmarkManager::TTouchRectHolder const & m_rectHolder;
double m_d;
UserMark const * m_mark;
};
} // namespace
UserMark const * BookmarkManager::FindNearestUserMark(m2::AnyRectD const & rect) const
{
return FindNearestUserMark([&rect](UserMarkType) { return rect; });
return FindNearestUserMark([&rect](UserMark::Type) { return rect; });
}
UserMark const * BookmarkManager::FindNearestUserMark(TTouchRectHolder const & holder) const
{
BestUserMarkFinder finder(holder);
finder(FindUserMarksContainer(UserMarkType::ROUTING_MARK));
finder(FindUserMarksContainer(UserMarkType::SEARCH_MARK));
finder(FindUserMarksContainer(UserMarkType::API_MARK));
finder(FindUserMarksContainer(UserMark::Type::ROUTING));
finder(FindUserMarksContainer(UserMark::Type::SEARCH));
finder(FindUserMarksContainer(UserMark::Type::API));
for (auto & cat : m_categories)
{
finder(cat.get());
@ -234,17 +246,17 @@ UserMark const * BookmarkManager::FindNearestUserMark(TTouchRectHolder const & h
return finder.GetFoundMark();
}
bool BookmarkManager::UserMarksIsVisible(UserMarkType type) const
bool BookmarkManager::UserMarksIsVisible(UserMark::Type type) const
{
return FindUserMarksContainer(type)->IsVisible();
}
UserMarksController & BookmarkManager::GetUserMarksController(UserMarkType type)
UserMarksController & BookmarkManager::GetUserMarksController(UserMark::Type type)
{
return *FindUserMarksContainer(type);
}
UserMarkContainer const * BookmarkManager::FindUserMarksContainer(UserMarkType type) const
UserMarkContainer const * BookmarkManager::FindUserMarksContainer(UserMark::Type type) const
{
auto const iter = find_if(m_userMarkLayers.begin(), m_userMarkLayers.end(),
[&type](unique_ptr<UserMarkContainer> const & cont)
@ -255,7 +267,7 @@ UserMarkContainer const * BookmarkManager::FindUserMarksContainer(UserMarkType t
return iter->get();
}
UserMarkContainer * BookmarkManager::FindUserMarksContainer(UserMarkType type)
UserMarkContainer * BookmarkManager::FindUserMarksContainer(UserMark::Type type)
{
auto iter = find_if(m_userMarkLayers.begin(), m_userMarkLayers.end(),
[&type](unique_ptr<UserMarkContainer> const & cont)
@ -266,7 +278,7 @@ UserMarkContainer * BookmarkManager::FindUserMarksContainer(UserMarkType type)
return iter->get();
}
UserMarkNotificationGuard::UserMarkNotificationGuard(BookmarkManager & mng, UserMarkType type)
UserMarkNotificationGuard::UserMarkNotificationGuard(BookmarkManager & mng, UserMark::Type type)
: m_controller(mng.GetUserMarksController(type))
{
}

View file

@ -38,8 +38,6 @@ public:
void ClearCategories();
void PrepareToShutdown();
/// Scans and loads all kml files with bookmarks in WritableDir.
void LoadBookmarks();
void LoadBookmark(string const & filePath);
@ -67,24 +65,24 @@ public:
void DeleteBmCategory(CategoryIter i);
bool DeleteBmCategory(size_t index);
using TTouchRectHolder = function<m2::AnyRectD(UserMarkType)>;
using TTouchRectHolder = function<m2::AnyRectD(UserMark::Type)>;
UserMark const * FindNearestUserMark(m2::AnyRectD const & rect) const;
UserMark const * FindNearestUserMark(TTouchRectHolder const & holder) const;
/// Additional layer methods
bool UserMarksIsVisible(UserMarkType type) const;
UserMarksController & GetUserMarksController(UserMarkType type);
bool UserMarksIsVisible(UserMark::Type type) const;
UserMarksController & GetUserMarksController(UserMark::Type type);
private:
UserMarkContainer const * FindUserMarksContainer(UserMarkType type) const;
UserMarkContainer * FindUserMarksContainer(UserMarkType type);
UserMarkContainer const * FindUserMarksContainer(UserMark::Type type) const;
UserMarkContainer * FindUserMarksContainer(UserMark::Type type);
};
class UserMarkNotificationGuard
{
public:
UserMarkNotificationGuard(BookmarkManager & mng, UserMarkType type);
UserMarkNotificationGuard(BookmarkManager & mng, UserMark::Type type);
~UserMarkNotificationGuard();
UserMarksController & m_controller;

View file

@ -413,6 +413,7 @@ Framework::Framework(FrameworkParams const & params)
m_ParsedMapApi.SetBookmarkManager(&m_bmManager);
m_routingManager.SetBookmarkManager(&m_bmManager);
m_searchMarks.SetBookmarkManager(&m_bmManager);
// Init strings bundle.
// @TODO. There are hardcoded strings below which are defined in strings.txt as well.
@ -1626,7 +1627,7 @@ bool Framework::Search(search::SearchParams const & params)
// Cancels previous search request (if any) and initiates new search request.
CancelQuery(intent.m_handle);
double const eps = SearchMarkPoint::GetMaxSearchMarkDimension(m_currentModelView);
double const eps = m_searchMarks.GetMaxDimension(m_currentModelView);
intent.m_params.m_minDistanceOnMapBetweenResults = eps;
Search(intent);
@ -1801,7 +1802,7 @@ void Framework::FillSearchResultsMarks(search::Results const & results)
void Framework::FillSearchResultsMarks(search::Results::ConstIter begin,
search::Results::ConstIter end)
{
UserMarkNotificationGuard guard(m_bmManager, UserMarkType::SEARCH_MARK);
UserMarkNotificationGuard guard(m_bmManager, UserMark::Type::SEARCH);
guard.m_controller.SetIsVisible(true);
guard.m_controller.SetIsDrawable(true);
@ -1833,12 +1834,15 @@ void Framework::FillSearchResultsMarks(search::Results::ConstIter begin,
if (r.m_metadata.m_isSponsoredHotel)
mark->SetMarkType(SearchMarkType::Booking);
//TODO: set mark in preparing state if some async filter will be applied.
//mark->SetPreparing(true);
}
}
void Framework::ClearSearchResultsMarks()
{
UserMarkNotificationGuard(m_bmManager, UserMarkType::SEARCH_MARK).m_controller.Clear();
UserMarkNotificationGuard(m_bmManager, UserMark::Type::SEARCH).m_controller.Clear();
}
bool Framework::GetDistanceAndAzimut(m2::PointD const & point,
@ -1980,16 +1984,11 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory,
if (m_connectToGpsTrack)
GpsTracker::Instance().Connect(bind(&Framework::OnUpdateGpsTrackPointsCallback, this, _1, _2));
m_drapeEngine->RequestSymbolsSize(SearchMarkPoint::GetAllSymbolsNames(),
[this](vector<m2::PointF> const & sizes)
{
GetPlatform().RunOnGuiThread([this, sizes](){ SearchMarkPoint::SetSearchMarksSizes(sizes); });
});
m_drapeApi.SetDrapeEngine(make_ref(m_drapeEngine));
m_routingManager.SetDrapeEngine(make_ref(m_drapeEngine), allow3d);
m_trafficManager.SetDrapeEngine(make_ref(m_drapeEngine));
m_localAdsManager.SetDrapeEngine(make_ref(m_drapeEngine));
m_searchMarks.SetDrapeEngine(make_ref(m_drapeEngine));
benchmark::RunGraphicsBenchmark(this);
}
@ -2029,6 +2028,7 @@ void Framework::DestroyDrapeEngine()
m_routingManager.SetDrapeEngine(nullptr, false);
m_trafficManager.SetDrapeEngine(nullptr);
m_localAdsManager.SetDrapeEngine(nullptr);
m_searchMarks.SetDrapeEngine(nullptr);
m_trafficManager.Teardown();
m_localAdsManager.Teardown();
@ -2232,7 +2232,7 @@ url_scheme::ParsedMapApi::ParsingResult Framework::ParseAndSetApiURL(string cons
// Clear every current API-mark.
{
UserMarkNotificationGuard guard(m_bmManager, UserMarkType::API_MARK);
UserMarkNotificationGuard guard(m_bmManager, UserMark::Type::API);
guard.m_controller.Clear();
guard.m_controller.SetIsVisible(true);
guard.m_controller.SetIsDrawable(true);
@ -2388,9 +2388,9 @@ void Framework::InvalidateUserMarks()
{
m_bmManager.InitBookmarks();
vector<UserMarkType> const types = {UserMarkType::SEARCH_MARK, UserMarkType::API_MARK,
UserMarkType::DEBUG_MARK, UserMarkType::ROUTING_MARK,
UserMarkType::LOCAL_ADS_MARK};
std::vector<UserMark::Type> const types = {UserMark::Type::SEARCH, UserMark::Type::API,
UserMark::Type::DEBUG_MARK, UserMark::Type::ROUTING,
UserMark::Type::LOCAL_ADS, UserMark::Type::STATIC};
for (size_t typeIndex = 0; typeIndex < types.size(); typeIndex++)
m_bmManager.GetUserMarksController(types[typeIndex]).NotifyChanges();
}
@ -2548,11 +2548,11 @@ df::SelectionShape::ESelectedObject Framework::OnTapEventImpl(TapEvent const & t
UserMark const * Framework::FindUserMarkInTapPosition(df::TapInfo const & tapInfo) const
{
UserMark const * mark = m_bmManager.FindNearestUserMark([this, &tapInfo](UserMarkType type)
UserMark const * mark = m_bmManager.FindNearestUserMark([this, &tapInfo](UserMark::Type type)
{
if (type == UserMarkType::BOOKMARK_MARK)
if (type == UserMark::Type::BOOKMARK)
return tapInfo.GetBookmarkSearchRect(m_currentModelView);
if (type == UserMarkType::ROUTING_MARK)
if (type == UserMark::Type::ROUTING)
return tapInfo.GetRoutingPointSearchRect(m_currentModelView);
return tapInfo.GetDefaultSearchRect(m_currentModelView);
});

View file

@ -188,6 +188,7 @@ protected:
location::TMyPositionModeChanged m_myPositionListener;
BookmarkManager m_bmManager;
SearchMarks m_searchMarks;
unique_ptr<booking::Api> m_bookingApi = make_unique<booking::Api>();
unique_ptr<viator::Api> m_viatorApi = make_unique<viator::Api>();

View file

@ -140,7 +140,7 @@ void CreateLocalAdsMarks(BookmarkManager * bmManager, CampaignData const & campa
// Here we copy campaign data, because we can create user marks only from UI thread.
GetPlatform().RunOnGuiThread([bmManager, campaignData]()
{
UserMarkNotificationGuard guard(*bmManager, UserMarkType::LOCAL_ADS_MARK);
UserMarkNotificationGuard guard(*bmManager, UserMark::Type::LOCAL_ADS);
for (auto const & data : campaignData)
{
auto userMark = guard.m_controller.CreateUserMark(data.second.m_position);
@ -159,7 +159,7 @@ void DeleteLocalAdsMarks(BookmarkManager * bmManager, MwmSet::MwmId const & mwmI
GetPlatform().RunOnGuiThread([bmManager, mwmId]()
{
UserMarkNotificationGuard guard(*bmManager, UserMarkType::LOCAL_ADS_MARK);
UserMarkNotificationGuard guard(*bmManager, UserMark::Type::LOCAL_ADS);
for (size_t i = 0; i < guard.m_controller.GetUserMarkCount();)
{
auto userMark = guard.m_controller.GetUserMark(i);
@ -180,7 +180,7 @@ void DeleteAllLocalAdsMarks(BookmarkManager * bmManager)
GetPlatform().RunOnGuiThread([bmManager]()
{
UserMarkNotificationGuard guard(*bmManager, UserMarkType::LOCAL_ADS_MARK);
UserMarkNotificationGuard guard(*bmManager, UserMark::Type::LOCAL_ADS);
guard.m_controller.Clear();
});
}

View file

@ -58,12 +58,3 @@ void LocalAdsMark::SetFeatureId(FeatureID const & id)
SetDirty();
m_featureId = id;
}
LocalAdsMarkContainer::LocalAdsMarkContainer(double layerDepth, Framework & fm)
: UserMarkContainer(layerDepth, UserMarkType::LOCAL_ADS_MARK, fm)
{}
UserMark * LocalAdsMarkContainer::AllocateUserMark(m2::PointD const & ptOrg)
{
return new LocalAdsMark(ptOrg, this);
}

View file

@ -42,11 +42,3 @@ private:
FeatureID m_featureId;
dp::TitleDecl m_titleDecl;
};
class LocalAdsMarkContainer : public UserMarkContainer
{
public:
LocalAdsMarkContainer(double layerDepth, Framework & fm);
protected:
UserMark * AllocateUserMark(m2::PointD const & ptOrg) override;
};

View file

@ -234,7 +234,7 @@ namespace
UserMark const * mark = GetMark(fm, pt);
ASSERT(mark != NULL, ());
ASSERT(mark->GetContainer() != NULL, ());
ASSERT(mark->GetContainer()->GetType() == UserMarkType::BOOKMARK_MARK, ());
ASSERT(mark->GetContainer()->GetType() == UserMark::Type::BOOKMARK, ());
return static_cast<Bookmark const *>(mark);
}
@ -246,7 +246,7 @@ namespace
BookmarkCategory const * GetCategory(Bookmark const * bm)
{
ASSERT(bm->GetContainer() != NULL, ());
ASSERT(bm->GetContainer()->GetType() == UserMarkType::BOOKMARK_MARK, ());
ASSERT(bm->GetContainer()->GetType() == UserMark::Type::BOOKMARK, ());
return static_cast<BookmarkCategory const *>(bm->GetContainer());
}
@ -256,7 +256,7 @@ namespace
if (mark == NULL)
return false;
if (mark->GetContainer()->GetType() != UserMarkType::BOOKMARK_MARK)
if (mark->GetContainer()->GetType() != UserMark::Type::BOOKMARK)
return false;
return true;

View file

@ -25,7 +25,7 @@ void ToMercatoToLatLon(double & lat, double & lon)
lat = MercatorBounds::YToLat(MercatorBounds::LatToY(lat));
}
UserMarkType const type = UserMarkType::API_MARK;
UserMark::Type const type = UserMark::Type::API;
class ApiTest
{
@ -104,7 +104,7 @@ bool IsValid(Framework & fm, string const & uriString)
api.SetBookmarkManager(&fm.GetBookmarkManager());
api.SetUriAndParse(uriString);
{
UserMarkNotificationGuard guard(fm.GetBookmarkManager(), UserMarkType::API_MARK);
UserMarkNotificationGuard guard(fm.GetBookmarkManager(), UserMark::Type::API);
guard.m_controller.Clear();
}

View file

@ -193,7 +193,7 @@ ParsedMapApi::ParsingResult ParsedMapApi::Parse(Uri const & uri)
return ParsingResult::Incorrect;
ASSERT(m_bmManager != nullptr, ());
UserMarkNotificationGuard guard(*m_bmManager, UserMarkType::API_MARK);
UserMarkNotificationGuard guard(*m_bmManager, UserMark::Type::API);
for (auto const & p : points)
{
m2::PointD glPoint(MercatorBounds::FromLatLon(p.m_lat, p.m_lon));
@ -446,7 +446,7 @@ void ParsedMapApi::Reset()
bool ParsedMapApi::GetViewportRect(m2::RectD & rect) const
{
ASSERT(m_bmManager != nullptr, ());
UserMarkNotificationGuard guard(*m_bmManager, UserMarkType::API_MARK);
UserMarkNotificationGuard guard(*m_bmManager, UserMark::Type::API);
size_t markCount = guard.m_controller.GetUserMarkCount();
if (markCount == 1 && m_zoomLevel >= 1)
@ -474,7 +474,7 @@ bool ParsedMapApi::GetViewportRect(m2::RectD & rect) const
ApiMarkPoint const * ParsedMapApi::GetSinglePoint() const
{
ASSERT(m_bmManager != nullptr, ());
UserMarkNotificationGuard guard(*m_bmManager, UserMarkType::API_MARK);
UserMarkNotificationGuard guard(*m_bmManager, UserMark::Type::API);
if (guard.m_controller.GetUserMarkCount() != 1)
return nullptr;

View file

@ -250,7 +250,7 @@ RoutingManager::RoutingManager(Callbacks && callbacks, Delegate & delegate)
#ifdef SHOW_ROUTE_DEBUG_MARKS
if (m_bmManager == nullptr)
return;
auto & controller = m_bmManager->GetUserMarksController(UserMarkType::DEBUG_MARK);
auto & controller = m_bmManager->GetUserMarksController(UserMark::Type::DEBUG_MARK);
controller.SetIsVisible(true);
controller.SetIsDrawable(true);
controller.CreateUserMark(pt);
@ -337,7 +337,7 @@ void RoutingManager::OnRoutePointPassed(RouteMarkType type, size_t intermediateI
{
// Remove route point.
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
routePoints.PassRoutePoint(type, intermediateIndex);
routePoints.NotifyChanges();
@ -540,7 +540,7 @@ void RoutingManager::CloseRouting(bool removeRoutePoints)
if (removeRoutePoints)
{
auto & controller = m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK);
auto & controller = m_bmManager->GetUserMarksController(UserMark::Type::ROUTING);
controller.Clear();
controller.NotifyChanges();
@ -555,7 +555,7 @@ void RoutingManager::SetLastUsedRouter(RouterType type)
void RoutingManager::HideRoutePoint(RouteMarkType type, size_t intermediateIndex)
{
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
RouteMarkPoint * mark = routePoints.GetRoutePoint(type, intermediateIndex);
if (mark != nullptr)
{
@ -566,7 +566,7 @@ void RoutingManager::HideRoutePoint(RouteMarkType type, size_t intermediateIndex
bool RoutingManager::IsMyPosition(RouteMarkType type, size_t intermediateIndex)
{
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
RouteMarkPoint * mark = routePoints.GetRoutePoint(type, intermediateIndex);
return mark != nullptr ? mark->IsMyPosition() : false;
}
@ -574,7 +574,7 @@ bool RoutingManager::IsMyPosition(RouteMarkType type, size_t intermediateIndex)
vector<RouteMarkData> RoutingManager::GetRoutePoints() const
{
vector<RouteMarkData> result;
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
for (auto const & p : routePoints.GetRoutePoints())
result.push_back(p->GetMarkData());
return result;
@ -582,7 +582,7 @@ vector<RouteMarkData> RoutingManager::GetRoutePoints() const
size_t RoutingManager::GetRoutePointsCount() const
{
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
return routePoints.GetRoutePointsCount();
}
@ -591,14 +591,14 @@ bool RoutingManager::CouldAddIntermediatePoint() const
if (!IsRoutingActive())
return false;
auto const & controller = m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK);
auto const & controller = m_bmManager->GetUserMarksController(UserMark::Type::ROUTING);
return controller.GetUserMarkCount() < RoutePointsLayout::kMaxIntermediatePointsCount + 2;
}
void RoutingManager::AddRoutePoint(RouteMarkData && markData)
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
// Always replace start and finish points.
if (markData.m_pointType == RouteMarkType::Start || markData.m_pointType == RouteMarkType::Finish)
@ -620,7 +620,7 @@ void RoutingManager::AddRoutePoint(RouteMarkData && markData)
void RoutingManager::RemoveRoutePoint(RouteMarkType type, size_t intermediateIndex)
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
routePoints.RemoveRoutePoint(type, intermediateIndex);
routePoints.NotifyChanges();
}
@ -628,7 +628,7 @@ void RoutingManager::RemoveRoutePoint(RouteMarkType type, size_t intermediateInd
void RoutingManager::RemoveRoutePoints()
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
routePoints.RemoveRoutePoints();
routePoints.NotifyChanges();
}
@ -636,7 +636,7 @@ void RoutingManager::RemoveRoutePoints()
void RoutingManager::RemoveIntermediateRoutePoints()
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
routePoints.RemoveIntermediateRoutePoints();
routePoints.NotifyChanges();
}
@ -645,7 +645,7 @@ void RoutingManager::MoveRoutePoint(RouteMarkType currentType, size_t currentInt
RouteMarkType targetType, size_t targetIntermediateIndex)
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
routePoints.MoveRoutePoint(currentType, currentIntermediateIndex,
targetType, targetIntermediateIndex);
routePoints.NotifyChanges();
@ -655,7 +655,7 @@ void RoutingManager::MoveRoutePoint(size_t currentIndex, size_t targetIndex)
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
size_t const sz = routePoints.GetRoutePointsCount();
auto const convertIndex = [sz](RouteMarkType & type, size_t & index) {
if (index == 0)
@ -687,7 +687,7 @@ void RoutingManager::MoveRoutePoint(size_t currentIndex, size_t targetIndex)
void RoutingManager::SetPointsFollowingMode(bool enabled)
{
ASSERT(m_bmManager != nullptr, ());
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
routePoints.SetFollowingMode(enabled);
routePoints.NotifyChanges();
}
@ -698,7 +698,7 @@ void RoutingManager::ReorderIntermediatePoints()
vector<m2::PointD> prevPositions;
prevPoints.reserve(RoutePointsLayout::kMaxIntermediatePointsCount);
prevPositions.reserve(RoutePointsLayout::kMaxIntermediatePointsCount);
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK));
RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMark::Type::ROUTING));
RouteMarkPoint * addedPoint = nullptr;
m2::PointD addedPosition;
@ -1065,7 +1065,7 @@ void RoutingManager::CancelRoutePointsTransaction(uint32_t transactionId)
// Revert route points.
ASSERT(m_bmManager != nullptr, ());
auto & controller = m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK);
auto & controller = m_bmManager->GetUserMarksController(UserMark::Type::ROUTING);
controller.Clear();
RoutePointsLayout routePoints(controller);
for (auto & markData : routeMarks)
@ -1106,7 +1106,7 @@ bool RoutingManager::LoadRoutePoints()
// If we have found my position, we use my position as start point.
MyPositionMarkPoint * myPosMark = UserMarkContainer::UserMarkForMyPostion();
ASSERT(m_bmManager != nullptr, ());
m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK).Clear();
m_bmManager->GetUserMarksController(UserMark::Type::ROUTING).Clear();
for (auto & p : points)
{
if (p.m_pointType == RouteMarkType::Start && myPosMark->HasPosition())

View file

@ -127,15 +127,6 @@ std::string RouteMarkPoint::GetSymbolName() const
}
}
RouteUserMarkContainer::RouteUserMarkContainer(double layerDepth, Framework & fm)
: UserMarkContainer(layerDepth, UserMarkType::ROUTING_MARK, fm)
{}
UserMark * RouteUserMarkContainer::AllocateUserMark(m2::PointD const & ptOrg)
{
return new RouteMarkPoint(ptOrg, this);
}
size_t const RoutePointsLayout::kMaxIntermediatePointsCount = 3;
RoutePointsLayout::RoutePointsLayout(UserMarksController & routeMarks)

View file

@ -71,14 +71,6 @@ private:
bool m_followingMode = false;
};
class RouteUserMarkContainer : public UserMarkContainer
{
public:
RouteUserMarkContainer(double layerDepth, Framework & fm);
protected:
UserMark * AllocateUserMark(m2::PointD const & ptOrg) override;
};
class RoutePointsLayout
{
public:

View file

@ -1,8 +1,24 @@
#include "map/search_mark.hpp"
#include "map/bookmark_manager.hpp"
#include "drape_frontend/drape_engine.hpp"
#include "platform/platform.hpp"
#include <algorithm>
std::vector<m2::PointF> SearchMarkPoint::m_searchMarksSizes;
namespace
{
std::vector<std::string> const kSymbols =
{
"search-result", // Default.
"search-booking", // Booking.
"search-adv", // LocalAds.
"search-cian", // TODO: delete me after Cian project is finished.
"non-found-search-result", // NotFound.
};
} // namespace
SearchMarkPoint::SearchMarkPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
: UserMark(ptOrg, container)
@ -16,14 +32,12 @@ std::string SearchMarkPoint::GetSymbolName() const
return "non-found-search-result";
}
auto const & symbols = GetAllSymbolsNames();
auto const index = static_cast<size_t>(m_type);
if (index >= static_cast<size_t>(SearchMarkType::Count))
if (m_type >= SearchMarkType::Count)
{
ASSERT(false, ("Unknown search mark symbol."));
return symbols[static_cast<size_t>(SearchMarkType::Default)];
return kSymbols[static_cast<size_t>(SearchMarkType::Default)];
}
return symbols[index];
return kSymbols[static_cast<size_t>(m_type)];
}
UserMark::Type SearchMarkPoint::GetMarkType() const
@ -33,77 +47,58 @@ UserMark::Type SearchMarkPoint::GetMarkType() const
void SearchMarkPoint::SetFoundFeature(FeatureID const & feature)
{
if (m_featureID == feature)
return;
SetDirty();
m_featureID = feature;
SetAttributeValue(m_featureID, feature);
}
void SearchMarkPoint::SetMatchedName(std::string const & name)
{
if (m_matchedName == name)
return;
SetDirty();
m_matchedName = name;
SetAttributeValue(m_matchedName, name);
}
void SearchMarkPoint::SetMarkType(SearchMarkType type)
{
if (m_type == type)
return;
SetDirty();
m_type = type;
SetAttributeValue(m_type, type);
}
void SearchMarkPoint::SetPreparing(bool isPreparing)
{
if (m_isPreparing == isPreparing)
SetAttributeValue(m_isPreparing, isPreparing);
}
SearchMarks::SearchMarks()
: m_bmManager(nullptr)
{}
void SearchMarks::SetDrapeEngine(ref_ptr<df::DrapeEngine> engine)
{
m_drapeEngine.Set(engine);
if (engine == nullptr)
return;
SetDirty();
m_isPreparing = isPreparing;
}
// static
std::vector<std::string> const & SearchMarkPoint::GetAllSymbolsNames()
{
static std::vector<std::string> const kSymbols =
m_drapeEngine.SafeCall(&df::DrapeEngine::RequestSymbolsSize, kSymbols,
[this](std::vector<m2::PointF> const & sizes)
{
"search-result", // Default.
"search-booking", // Booking.
"search-adv", // LocalAds.
"search-cian", // TODO: delete me after Cian project is finished.
"non-found-search-result", // NotFound.
};
return kSymbols;
GetPlatform().RunOnGuiThread([this, sizes](){ m_searchMarksSizes = sizes; });
});
}
// static
void SearchMarkPoint::SetSearchMarksSizes(std::vector<m2::PointF> const & sizes)
void SearchMarks::SetBookmarkManager(BookmarkManager * bmManager)
{
m_searchMarksSizes = sizes;
m_bmManager = bmManager;
}
// static
double SearchMarkPoint::GetMaxSearchMarkDimension(ScreenBase const & modelView)
double SearchMarks::GetMaxDimension(ScreenBase const & modelView) const
{
double dimension = 0.0;
for (size_t i = 0; i < static_cast<size_t>(SearchMarkType::Count); ++i)
{
m2::PointD const markSize = GetSearchMarkSize(static_cast<SearchMarkType>(i), modelView);
m2::PointD const markSize = GetSize(static_cast<SearchMarkType>(i), modelView);
dimension = std::max(dimension, std::max(markSize.x, markSize.y));
}
return dimension;
}
// static
m2::PointD SearchMarkPoint::GetSearchMarkSize(SearchMarkType searchMarkType,
ScreenBase const & modelView)
m2::PointD SearchMarks::GetSize(SearchMarkType searchMarkType, ScreenBase const & modelView) const
{
if (m_searchMarksSizes.empty())
return {};
@ -115,3 +110,20 @@ m2::PointD SearchMarkPoint::GetSearchMarkSize(SearchMarkType searchMarkType,
double const pixelToMercator = modelView.GetScale();
return {pixelToMercator * pixelSize.x, pixelToMercator * pixelSize.y};
}
void SearchMarks::SetPreparingState(std::vector<FeatureID> const & features, bool isPreparing)
{
if (m_bmManager == nullptr)
return;
ASSERT(std::is_sorted(features.begin(), features.end()), ());
UserMarkNotificationGuard guard(*m_bmManager, UserMark::Type::SEARCH);
size_t const count = guard.m_controller.GetUserMarkCount();
for (size_t i = 0; i < count; ++i)
{
auto mark = static_cast<SearchMarkPoint *>(guard.m_controller.GetUserMarkForEdit(i));
if (std::binary_search(features.begin(), features.end(), mark->GetFeatureID()))
mark->SetPreparing(isPreparing);
}
}

View file

@ -2,6 +2,8 @@
#include "map/user_mark.hpp"
#include "drape_frontend/drape_engine_safe_ptr.hpp"
#include "indexer/feature_decl.hpp"
#include "geometry/point2d.hpp"
@ -21,6 +23,8 @@ enum class SearchMarkType
Count
};
class BookmarkManager;
class SearchMarkPoint : public UserMark
{
public:
@ -39,19 +43,41 @@ public:
void SetPreparing(bool isPreparing);
static std::vector<std::string> const & GetAllSymbolsNames();
static void SetSearchMarksSizes(std::vector<m2::PointF> const & sizes);
static double GetMaxSearchMarkDimension(ScreenBase const & modelView);
protected:
static m2::PointD GetSearchMarkSize(SearchMarkType searchMarkType,
ScreenBase const & modelView);
template<typename T> void SetAttributeValue(T & dst, T const & src)
{
if (dst == src)
return;
SetDirty();
dst = src;
}
SearchMarkType m_type = SearchMarkType::Default;
FeatureID m_featureID;
// Used to pass exact search result matched string into a place page.
std::string m_matchedName;
bool m_isPreparing = false;
static std::vector<m2::PointF> m_searchMarksSizes;
};
class SearchMarks
{
public:
SearchMarks();
void SetDrapeEngine(ref_ptr<df::DrapeEngine> engine);
void SetBookmarkManager(BookmarkManager * bmManager);
double GetMaxDimension(ScreenBase const & modelView) const;
// NOTE: Vector of features must be sorted.
void SetPreparingState(std::vector<FeatureID> const & features, bool isPreparing);
private:
m2::PointD GetSize(SearchMarkType searchMarkType, ScreenBase const & modelView) const;
BookmarkManager * m_bmManager;
df::DrapeEngineSafePtr m_drapeEngine;
std::vector<m2::PointF> m_searchMarksSizes;
};

View file

@ -19,7 +19,7 @@ m2::PointD const & UserMark::GetPivot() const
m2::PointD UserMark::GetPixelOffset() const
{
return m2::PointD(0.0, 0.0);
return {};
}
dp::Anchor UserMark::GetAnchor() const
@ -48,34 +48,28 @@ ms::LatLon UserMark::GetLatLon() const
return MercatorBounds::ToLatLon(m_ptOrg);
}
PoiMarkPoint::PoiMarkPoint(UserMarkContainer * container)
: UserMark(m2::PointD::Zero(), container)
StaticMarkPoint::StaticMarkPoint(UserMarkContainer * container)
: UserMark(m2::PointD{}, container)
{}
UserMark::Type PoiMarkPoint::GetMarkType() const
UserMark::Type StaticMarkPoint::GetMarkType() const
{
return UserMark::Type::POI;
return UserMark::Type::STATIC;
}
void PoiMarkPoint::SetPtOrg(m2::PointD const & ptOrg)
void StaticMarkPoint::SetPtOrg(m2::PointD const & ptOrg)
{
SetDirty();
m_ptOrg = ptOrg;
}
MyPositionMarkPoint::MyPositionMarkPoint(UserMarkContainer * container)
: PoiMarkPoint(container)
: StaticMarkPoint(container)
{}
UserMark::Type MyPositionMarkPoint::GetMarkType() const
{
return UserMark::Type::MY_POSITION;
}
DebugMarkPoint::DebugMarkPoint(const m2::PointD & ptOrg, UserMarkContainer * container)
: UserMark(ptOrg, container)
{
}
{}
string DebugMarkPoint::GetSymbolName() const
{
@ -88,9 +82,8 @@ string DebugPrint(UserMark::Type type)
{
case UserMark::Type::API: return "API";
case UserMark::Type::SEARCH: return "SEARCH";
case UserMark::Type::POI: return "POI";
case UserMark::Type::STATIC: return "STATIC";
case UserMark::Type::BOOKMARK: return "BOOKMARK";
case UserMark::Type::MY_POSITION: return "MY_POSITION";
case UserMark::Type::DEBUG_MARK: return "DEBUG_MARK";
case UserMark::Type::ROUTING: return "ROUTING";
case UserMark::Type::LOCAL_ADS: return "LOCAL_ADS";

View file

@ -24,9 +24,8 @@ public:
{
API,
SEARCH,
POI,
STATIC,
BOOKMARK,
MY_POSITION,
ROUTING,
LOCAL_ADS,
DEBUG_MARK
@ -68,10 +67,10 @@ private:
DISALLOW_COPY_AND_MOVE(UserMark);
};
class PoiMarkPoint : public UserMark
class StaticMarkPoint : public UserMark
{
public:
explicit PoiMarkPoint(UserMarkContainer * container);
explicit StaticMarkPoint(UserMarkContainer * container);
string GetSymbolName() const override { return {}; }
UserMark::Type GetMarkType() const override;
@ -79,13 +78,11 @@ public:
void SetPtOrg(m2::PointD const & ptOrg);
};
class MyPositionMarkPoint : public PoiMarkPoint
class MyPositionMarkPoint : public StaticMarkPoint
{
public:
explicit MyPositionMarkPoint(UserMarkContainer * container);
UserMark::Type GetMarkType() const override;
void SetUserPosition(m2::PointD const & pt, bool hasPosition)
{
SetPtOrg(pt);

View file

@ -1,12 +1,12 @@
#include "map/framework.hpp"
#include "map/user_mark_container.hpp"
#include "map/framework.hpp"
#include "map/search_mark.hpp"
#include "drape_frontend/drape_engine.hpp"
#include "drape_frontend/tile_key.hpp"
#include "base/scope_guard.hpp"
#include "base/macros.hpp"
#include "base/scope_guard.hpp"
#include "base/stl_add.hpp"
#include "std/algorithm.hpp"
@ -53,7 +53,7 @@ df::MarkGroupID GenerateMarkGroupId(UserMarkContainer const * cont)
}
} // namespace
UserMarkContainer::UserMarkContainer(double layerDepth, UserMarkType type, Framework & fm)
UserMarkContainer::UserMarkContainer(double layerDepth, UserMark::Type type, Framework & fm)
: m_framework(fm)
, m_layerDepth(layerDepth)
, m_type(type)
@ -84,22 +84,21 @@ UserMark const * UserMarkContainer::FindMarkInRect(m2::AnyRectD const & rect, do
namespace
{
unique_ptr<PoiMarkPoint> g_selectionUserMark;
// TODO: refactor it, get rid of global pointers.
unique_ptr<StaticMarkPoint> g_selectionUserMark;
unique_ptr<MyPositionMarkPoint> g_myPosition;
} // namespace
} // namespace
void UserMarkContainer::InitStaticMarks(UserMarkContainer * container)
{
if (g_selectionUserMark == NULL)
g_selectionUserMark.reset(new PoiMarkPoint(container));
g_selectionUserMark.reset(new StaticMarkPoint(container));
if (g_myPosition == NULL)
g_myPosition.reset(new MyPositionMarkPoint(container));
}
PoiMarkPoint * UserMarkContainer::UserMarkForPoi()
StaticMarkPoint * UserMarkContainer::UserMarkForPoi()
{
ASSERT(g_selectionUserMark != NULL, ());
return g_selectionUserMark.get();
@ -193,7 +192,7 @@ UserMark const * UserMarkContainer::GetUserMark(size_t index) const
return m_userMarks[index].get();
}
UserMarkType UserMarkContainer::GetType() const
UserMark::Type UserMarkContainer::GetType() const
{
return m_type;
}
@ -271,33 +270,3 @@ void UserMarkContainer::AcceptChanges(df::MarkIDCollection & createdMarks,
m_isDirty = false;
}
SearchUserMarkContainer::SearchUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, UserMarkType::SEARCH_MARK, framework)
{
}
UserMark * SearchUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
{
return new SearchMarkPoint(ptOrg, this);
}
DebugUserMarkContainer::DebugUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, UserMarkType::DEBUG_MARK, framework)
{
}
UserMark * DebugUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
{
return new DebugMarkPoint(ptOrg, this);
}
ApiUserMarkContainer::ApiUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, UserMarkType::API_MARK, framework)
{
}
UserMark * ApiUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
{
return new ApiMarkPoint(ptOrg, this);
}

View file

@ -16,21 +16,11 @@
class Framework;
enum class UserMarkType
{
SEARCH_MARK,
API_MARK,
DEBUG_MARK,
BOOKMARK_MARK,
ROUTING_MARK,
LOCAL_ADS_MARK
};
class UserMarksController
{
public:
virtual size_t GetUserMarkCount() const = 0;
virtual UserMarkType GetType() const = 0;
virtual UserMark::Type GetType() const = 0;
virtual void SetIsDrawable(bool isDrawable) = 0;
virtual void SetIsVisible(bool isVisible) = 0;
@ -50,7 +40,7 @@ class UserMarkContainer : public df::UserMarksProvider
public:
using TUserMarksList = deque<unique_ptr<UserMark>>;
UserMarkContainer(double layerDepth, UserMarkType type, Framework & fm);
UserMarkContainer(double layerDepth, UserMark::Type type, Framework & fm);
virtual ~UserMarkContainer();
// If not found mark on rect result is nullptr.
@ -59,7 +49,7 @@ public:
UserMark const * FindMarkInRect(m2::AnyRectD const & rect, double & d) const;
static void InitStaticMarks(UserMarkContainer * container);
static PoiMarkPoint * UserMarkForPoi();
static StaticMarkPoint * UserMarkForPoi();
static MyPositionMarkPoint * UserMarkForMyPostion();
// UserMarksProvider implementation.
@ -81,7 +71,7 @@ public:
bool IsDrawable() const override;
size_t GetUserMarkCount() const override;
UserMark const * GetUserMark(size_t index) const override;
UserMarkType GetType() const override final;
UserMark::Type GetType() const override final;
// UserMarksController implementation.
UserMark * CreateUserMark(m2::PointD const & ptOrg) override;
@ -104,35 +94,23 @@ private:
bitset<4> m_flags;
double m_layerDepth;
TUserMarksList m_userMarks;
UserMarkType m_type;
UserMark::Type m_type;
df::MarkIDCollection m_createdMarks;
df::MarkIDCollection m_removedMarks;
bool m_isDirty = false;
};
class SearchUserMarkContainer : public UserMarkContainer
template<typename MarkPointClassType, UserMark::Type UserMarkType>
class SpecifiedUserMarkContainer : public UserMarkContainer
{
public:
SearchUserMarkContainer(double layerDepth, Framework & framework);
explicit SpecifiedUserMarkContainer(Framework & framework)
: UserMarkContainer(0.0 /* layer depth */, UserMarkType, framework)
{}
protected:
UserMark * AllocateUserMark(m2::PointD const & ptOrg) override;
};
class DebugUserMarkContainer : public UserMarkContainer
{
public:
DebugUserMarkContainer(double layerDepth, Framework & framework);
protected:
UserMark * AllocateUserMark(m2::PointD const & ptOrg) override;
};
class ApiUserMarkContainer : public UserMarkContainer
{
public:
ApiUserMarkContainer(double layerDepth, Framework & framework);
protected:
UserMark * AllocateUserMark(m2::PointD const & ptOrg) override;
UserMark * AllocateUserMark(m2::PointD const & ptOrg) override
{
return new MarkPointClassType(ptOrg, this);
}
};

View file

@ -95,7 +95,7 @@ public:
void VisualizePoints(std::vector<m2::PointD> const & points) override
{
UserMarkNotificationGuard g(m_bm, UserMarkType::DEBUG_MARK);
UserMarkNotificationGuard g(m_bm, UserMark::Type::DEBUG_MARK);
g.m_controller.SetIsVisible(true);
g.m_controller.SetIsDrawable(true);
for (auto const & p : points)
@ -104,7 +104,7 @@ public:
void ClearAllVisualizedPoints() override
{
UserMarkNotificationGuard g(m_bm, UserMarkType::DEBUG_MARK);
UserMarkNotificationGuard g(m_bm, UserMark::Type::DEBUG_MARK);
g.m_controller.Clear();
}

View file

@ -222,7 +222,7 @@ void SampleView::ShowNonFoundResults(std::vector<search::Sample::Result> const &
{
CHECK_EQUAL(results.size(), entries.size(), ());
auto & controller = m_framework.GetBookmarkManager().GetUserMarksController(UserMarkType::SEARCH_MARK);
auto & controller = m_framework.GetBookmarkManager().GetUserMarksController(UserMark::Type::SEARCH);
controller.SetIsVisible(true);
controller.SetIsDrawable(true);
controller.NotifyChanges();
@ -251,7 +251,7 @@ void SampleView::ShowNonFoundResultsMarks(std::vector<search::Sample::Result> co
{
CHECK_EQUAL(results.size(), entries.size(), ());
auto & controller = m_framework.GetBookmarkManager().GetUserMarksController(UserMarkType::SEARCH_MARK);
auto & controller = m_framework.GetBookmarkManager().GetUserMarksController(UserMark::Type::SEARCH);
controller.SetIsVisible(true);
controller.SetIsDrawable(true);

View file

@ -30,6 +30,8 @@
454649F21F2728CE00EF4064 /* local_ads_mark.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 454649F01F2728CE00EF4064 /* local_ads_mark.hpp */; };
45580ABE1E2CBD5E00CD535D /* benchmark_tools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45580ABC1E2CBD5E00CD535D /* benchmark_tools.cpp */; };
45580ABF1E2CBD5E00CD535D /* benchmark_tools.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45580ABD1E2CBD5E00CD535D /* benchmark_tools.hpp */; };
456E1B3A1F9A3C2A009C32E1 /* search_mark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 456E1B381F9A3C29009C32E1 /* search_mark.cpp */; };
456E1B3B1F9A3C2A009C32E1 /* search_mark.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 456E1B391F9A3C2A009C32E1 /* search_mark.hpp */; };
45A2D9D51F7556EB003310A0 /* user.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45A2D9D31F7556EB003310A0 /* user.cpp */; };
45A2D9D61F7556EB003310A0 /* user.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45A2D9D41F7556EB003310A0 /* user.hpp */; };
45D287671E966E3400587F05 /* liblocal_ads.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 45D287661E966E3400587F05 /* liblocal_ads.a */; };
@ -160,6 +162,8 @@
454649F01F2728CE00EF4064 /* local_ads_mark.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = local_ads_mark.hpp; sourceTree = "<group>"; };
45580ABC1E2CBD5E00CD535D /* benchmark_tools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = benchmark_tools.cpp; sourceTree = "<group>"; };
45580ABD1E2CBD5E00CD535D /* benchmark_tools.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = benchmark_tools.hpp; sourceTree = "<group>"; };
456E1B381F9A3C29009C32E1 /* search_mark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = search_mark.cpp; sourceTree = "<group>"; };
456E1B391F9A3C2A009C32E1 /* search_mark.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = search_mark.hpp; sourceTree = "<group>"; };
45A2D9D31F7556EB003310A0 /* user.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = user.cpp; sourceTree = "<group>"; };
45A2D9D41F7556EB003310A0 /* user.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = user.hpp; sourceTree = "<group>"; };
45D287661E966E3400587F05 /* liblocal_ads.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblocal_ads.a; path = "../../../omim-build/xcode/Debug-iphonesimulator/liblocal_ads.a"; sourceTree = "<group>"; };
@ -435,6 +439,8 @@
675345BD1A4054AD00A0A8C3 /* map */ = {
isa = PBXGroup;
children = (
456E1B381F9A3C29009C32E1 /* search_mark.cpp */,
456E1B391F9A3C2A009C32E1 /* search_mark.hpp */,
45A2D9D31F7556EB003310A0 /* user.cpp */,
45A2D9D41F7556EB003310A0 /* user.hpp */,
675345CB1A4054E800A0A8C3 /* address_finder.cpp */,
@ -535,6 +541,7 @@
F6D2CE7F1EDEB7F500636DFD /* routing_manager.hpp in Headers */,
670E39411C46C5C700E9C0A6 /* gps_tracker.hpp in Headers */,
45580ABF1E2CBD5E00CD535D /* benchmark_tools.hpp in Headers */,
456E1B3B1F9A3C2A009C32E1 /* search_mark.hpp in Headers */,
BBD9E2C71EE9D01900DF189A /* routing_mark.hpp in Headers */,
342D833B1D5233E8000D8AEA /* displacement_mode_manager.hpp in Headers */,
F6B283041C1B03320081957A /* gps_track_collection.hpp in Headers */,
@ -639,6 +646,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
456E1B3A1F9A3C2A009C32E1 /* search_mark.cpp in Sources */,
F6B283051C1B03320081957A /* gps_track_filter.cpp in Sources */,
675346481A4054E800A0A8C3 /* bookmark_manager.cpp in Sources */,
3D47B2931F054BC5000828D2 /* taxi_delegate.cpp in Sources */,

View file

@ -60,10 +60,6 @@
347F33301C4540A8009758CC /* suggest.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 347F33151C4540A8009758CC /* suggest.hpp */; };
349B65891D4F21E5001798E2 /* lazy_centers_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349B65871D4F21E5001798E2 /* lazy_centers_table.cpp */; };
349B658A1D4F21E5001798E2 /* lazy_centers_table.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 349B65881D4F21E5001798E2 /* lazy_centers_table.hpp */; };
34CC72521F9DE028002E931E /* cities_boundaries_table.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34CC72501F9DE027002E931E /* cities_boundaries_table.hpp */; };
34CC72531F9DE028002E931E /* cities_boundaries_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34CC72511F9DE028002E931E /* cities_boundaries_table.cpp */; };
34CC72561F9DE078002E931E /* localities_source.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34CC72541F9DE077002E931E /* localities_source.hpp */; };
34CC72571F9DE078002E931E /* localities_source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34CC72551F9DE077002E931E /* localities_source.cpp */; };
34EEAD701E55AE4300E95575 /* token_range.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34EEAD6F1E55AE4300E95575 /* token_range.hpp */; };
34EEAD721E55AE5C00E95575 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34EEAD711E55AE5C00E95575 /* utils.cpp */; };
34F5583B1DBF2E0E00A4FC11 /* libalohalitics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34F5583A1DBF2E0E00A4FC11 /* libalohalitics.a */; };
@ -79,6 +75,10 @@
3DF37FAA1EA11B380012CB31 /* everywhere_search_callback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DF37FA81EA11B380012CB31 /* everywhere_search_callback.cpp */; };
3DF37FAB1EA11B380012CB31 /* everywhere_search_callback.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3DF37FA91EA11B380012CB31 /* everywhere_search_callback.hpp */; };
3DFEBF761EF2D55800317D5C /* city_finder.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3DFEBF751EF2D55800317D5C /* city_finder.hpp */; };
456E1B3E1F9A3C8E009C32E1 /* cities_boundaries_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 456E1B3C1F9A3C8D009C32E1 /* cities_boundaries_table.cpp */; };
456E1B3F1F9A3C8E009C32E1 /* cities_boundaries_table.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 456E1B3D1F9A3C8E009C32E1 /* cities_boundaries_table.hpp */; };
456E1B421F9A3CF6009C32E1 /* localities_source.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 456E1B401F9A3CF5009C32E1 /* localities_source.hpp */; };
456E1B431F9A3CF6009C32E1 /* localities_source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 456E1B411F9A3CF5009C32E1 /* localities_source.cpp */; };
56D5456E1C74A48C00E3719C /* mode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56D5456C1C74A48C00E3719C /* mode.cpp */; };
56D5456F1C74A48C00E3719C /* mode.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 56D5456D1C74A48C00E3719C /* mode.hpp */; };
670F88741CE4C032003F68BA /* types_skipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F88721CE4C032003F68BA /* types_skipper.cpp */; };
@ -245,10 +245,6 @@
347F33151C4540A8009758CC /* suggest.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = suggest.hpp; sourceTree = "<group>"; };
349B65871D4F21E5001798E2 /* lazy_centers_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lazy_centers_table.cpp; sourceTree = "<group>"; };
349B65881D4F21E5001798E2 /* lazy_centers_table.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lazy_centers_table.hpp; sourceTree = "<group>"; };
34CC72501F9DE027002E931E /* cities_boundaries_table.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cities_boundaries_table.hpp; sourceTree = "<group>"; };
34CC72511F9DE028002E931E /* cities_boundaries_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cities_boundaries_table.cpp; sourceTree = "<group>"; };
34CC72541F9DE077002E931E /* localities_source.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = localities_source.hpp; sourceTree = "<group>"; };
34CC72551F9DE077002E931E /* localities_source.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = localities_source.cpp; sourceTree = "<group>"; };
34EEAD6F1E55AE4300E95575 /* token_range.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = token_range.hpp; sourceTree = "<group>"; };
34EEAD711E55AE5C00E95575 /* utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = utils.cpp; sourceTree = "<group>"; };
34F558371DBF2C8B00A4FC11 /* common-debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "common-debug.xcconfig"; path = "../common-debug.xcconfig"; sourceTree = "<group>"; };
@ -266,6 +262,10 @@
3DF37FA81EA11B380012CB31 /* everywhere_search_callback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = everywhere_search_callback.cpp; sourceTree = "<group>"; };
3DF37FA91EA11B380012CB31 /* everywhere_search_callback.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = everywhere_search_callback.hpp; sourceTree = "<group>"; };
3DFEBF751EF2D55800317D5C /* city_finder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = city_finder.hpp; sourceTree = "<group>"; };
456E1B3C1F9A3C8D009C32E1 /* cities_boundaries_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cities_boundaries_table.cpp; sourceTree = "<group>"; };
456E1B3D1F9A3C8E009C32E1 /* cities_boundaries_table.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cities_boundaries_table.hpp; sourceTree = "<group>"; };
456E1B401F9A3CF5009C32E1 /* localities_source.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = localities_source.hpp; sourceTree = "<group>"; };
456E1B411F9A3CF5009C32E1 /* localities_source.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = localities_source.cpp; sourceTree = "<group>"; };
56D5456C1C74A48C00E3719C /* mode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mode.cpp; sourceTree = "<group>"; };
56D5456D1C74A48C00E3719C /* mode.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = mode.hpp; sourceTree = "<group>"; };
670F88721CE4C032003F68BA /* types_skipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = types_skipper.cpp; sourceTree = "<group>"; };
@ -495,6 +495,10 @@
675346B21A4055CF00A0A8C3 /* search */ = {
isa = PBXGroup;
children = (
456E1B411F9A3CF5009C32E1 /* localities_source.cpp */,
456E1B401F9A3CF5009C32E1 /* localities_source.hpp */,
456E1B3C1F9A3C8D009C32E1 /* cities_boundaries_table.cpp */,
456E1B3D1F9A3C8E009C32E1 /* cities_boundaries_table.hpp */,
675346BE1A40560D00A0A8C3 /* algos.hpp */,
675346BF1A40560D00A0A8C3 /* approximate_string_match.cpp */,
675346C01A40560D00A0A8C3 /* approximate_string_match.hpp */,
@ -504,8 +508,6 @@
3461C99E1D79949600E6E6F5 /* categories_set.hpp */,
345C8DA91D2D15A50037E3A6 /* cbv.cpp */,
345C8DAA1D2D15A50037E3A6 /* cbv.hpp */,
34CC72511F9DE028002E931E /* cities_boundaries_table.cpp */,
34CC72501F9DE027002E931E /* cities_boundaries_table.hpp */,
3DFEBF751EF2D55800317D5C /* city_finder.hpp */,
F652D8BA1CFDE1E800FC29A0 /* common.hpp */,
0810EC341D6D9D2E00ABFEE7 /* displayed_categories.cpp */,
@ -564,8 +566,6 @@
675346CE1A40560D00A0A8C3 /* latlon_match.hpp */,
349B65871D4F21E5001798E2 /* lazy_centers_table.cpp */,
349B65881D4F21E5001798E2 /* lazy_centers_table.hpp */,
34CC72551F9DE077002E931E /* localities_source.cpp */,
34CC72541F9DE077002E931E /* localities_source.hpp */,
675346CF1A40560D00A0A8C3 /* locality_finder.cpp */,
675346D01A40560D00A0A8C3 /* locality_finder.hpp */,
F652D8D31CFDE21900FC29A0 /* locality_scorer.cpp */,
@ -654,7 +654,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
34CC72521F9DE028002E931E /* cities_boundaries_table.hpp in Headers */,
456E1B3F1F9A3C8E009C32E1 /* cities_boundaries_table.hpp in Headers */,
34EEAD701E55AE4300E95575 /* token_range.hpp in Headers */,
3461C9A51D79949600E6E6F5 /* utils.hpp in Headers */,
345C8DB01D2D15A50037E3A6 /* cbv.hpp in Headers */,
@ -700,7 +700,7 @@
347F33211C4540A8009758CC /* projection_on_street.hpp in Headers */,
F652D8EF1CFDE21900FC29A0 /* features_layer.hpp in Headers */,
F652D8F91CFDE21900FC29A0 /* intersection_result.hpp in Headers */,
34CC72561F9DE078002E931E /* localities_source.hpp in Headers */,
456E1B421F9A3CF6009C32E1 /* localities_source.hpp in Headers */,
F652D8F11CFDE21900FC29A0 /* geocoder.hpp in Headers */,
F652D8F31CFDE21900FC29A0 /* geometry_cache.hpp in Headers */,
67BC92F91D22E45900A4A378 /* ranker.hpp in Headers */,
@ -892,7 +892,7 @@
34586B8D1DCB1E8300CF7FC9 /* locality_selector_test.cpp in Sources */,
344A71381F3DA03200B8DDB8 /* segment_tree.cpp in Sources */,
3441CE501CFC1D7000CF30D4 /* processor.cpp in Sources */,
34CC72571F9DE078002E931E /* localities_source.cpp in Sources */,
456E1B431F9A3CF6009C32E1 /* localities_source.cpp in Sources */,
F652D9041CFDE21900FC29A0 /* rank_table_cache.cpp in Sources */,
F652D8EE1CFDE21900FC29A0 /* features_layer.cpp in Sources */,
675346E21A40560D00A0A8C3 /* house_detector.cpp in Sources */,
@ -920,7 +920,7 @@
675346E71A40560D00A0A8C3 /* keyword_lang_matcher.cpp in Sources */,
3453BD5A1DAF91C100380ECB /* hotels_filter.cpp in Sources */,
345C8DB31D2D15A50037E3A6 /* streets_matcher.cpp in Sources */,
34CC72531F9DE028002E931E /* cities_boundaries_table.cpp in Sources */,
456E1B3E1F9A3C8E009C32E1 /* cities_boundaries_table.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};