forked from organicmaps/organicmaps
Added sponsored hotels visualization
This commit is contained in:
parent
5bd8eeb6f3
commit
2ccdec2fe0
5 changed files with 22 additions and 12 deletions
|
@ -26,6 +26,8 @@
|
|||
#include "drape_frontend/watch/cpu_drawer.hpp"
|
||||
#include "drape_frontend/watch/feature_processor.hpp"
|
||||
|
||||
#include "drape/constants.hpp"
|
||||
|
||||
#include "indexer/categories_holder.hpp"
|
||||
#include "indexer/classificator.hpp"
|
||||
#include "indexer/classificator_loader.hpp"
|
||||
|
@ -287,7 +289,6 @@ Framework::Framework()
|
|||
, m_storage(platform::migrate::NeedMigrate() ? COUNTRIES_OBSOLETE_FILE : COUNTRIES_FILE)
|
||||
, m_bmManager(*this)
|
||||
, m_isRenderingEnabled(true)
|
||||
, m_fixedSearchResults(0)
|
||||
, m_lastReportedCountry(kInvalidCountryId)
|
||||
{
|
||||
m_startBackgroundTime = my::Timer::LocalTime();
|
||||
|
@ -723,6 +724,9 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
|
|||
|
||||
if (ftypes::IsAddressObjectChecker::Instance()(ft))
|
||||
info.m_address = GetAddressInfoAtPoint(feature::GetCenter(ft)).FormatHouseAndStreet();
|
||||
|
||||
if (ftypes::IsBookingChecker::Instance()(ft))
|
||||
info.m_isSponsoredHotel = true;
|
||||
}
|
||||
|
||||
void Framework::FillApiMarkInfo(ApiMarkPoint const & api, place_page::Info & info) const
|
||||
|
@ -1358,9 +1362,7 @@ size_t Framework::ShowSearchResults(search::Results const & results)
|
|||
return count;
|
||||
}
|
||||
|
||||
m_fixedSearchResults = 0;
|
||||
FillSearchResultsMarks(results);
|
||||
m_fixedSearchResults = count;
|
||||
|
||||
// Setup viewport according to results.
|
||||
m2::AnyRectD viewport = m_currentModelView.GlobalRect();
|
||||
|
@ -1411,7 +1413,7 @@ void Framework::FillSearchResultsMarks(search::Results const & results)
|
|||
UserMarkControllerGuard guard(m_bmManager, UserMarkType::SEARCH_MARK);
|
||||
guard.m_controller.SetIsVisible(true);
|
||||
guard.m_controller.SetIsDrawable(true);
|
||||
guard.m_controller.Clear(m_fixedSearchResults);
|
||||
guard.m_controller.Clear();
|
||||
|
||||
size_t const count = results.GetCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
|
@ -1424,9 +1426,9 @@ void Framework::FillSearchResultsMarks(search::Results const & results)
|
|||
if (r.GetResultType() == search::Result::RESULT_FEATURE)
|
||||
mark->SetFoundFeature(r.GetFeatureID());
|
||||
mark->SetMatchedName(r.GetString());
|
||||
|
||||
//TODO: extract from search::Result data for choosing custom symbol.
|
||||
//mark->SetCustomSymbol("booking-search-result");
|
||||
|
||||
if (r.m_metadata.m_isSponsoredHotel)
|
||||
mark->SetCustomSymbol("current-position"); //TODO: change icon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1439,8 +1441,6 @@ void Framework::CancelInteractiveSearch()
|
|||
m_lastInteractiveSearchParams.Clear();
|
||||
CancelQuery(m_lastQueryHandle);
|
||||
}
|
||||
|
||||
m_fixedSearchResults = 0;
|
||||
}
|
||||
|
||||
bool Framework::GetDistanceAndAzimut(m2::PointD const & point,
|
||||
|
@ -1881,12 +1881,15 @@ void Framework::SetMapSelectionListeners(TActivateMapSelectionFn const & activat
|
|||
}
|
||||
|
||||
void Framework::ActivateMapSelection(bool needAnimation, df::SelectionShape::ESelectedObject selectionType,
|
||||
place_page::Info const & info) const
|
||||
place_page::Info const & info)
|
||||
{
|
||||
ASSERT_NOT_EQUAL(selectionType, df::SelectionShape::OBJECT_EMPTY, ("Empty selections are impossible."));
|
||||
m_selectedFeature = info.GetID();
|
||||
CallDrapeFunction(bind(&df::DrapeEngine::SelectObject, _1, selectionType, info.GetMercator(),
|
||||
needAnimation));
|
||||
|
||||
SetDisplacementMode(info.m_isSponsoredHotel ? dp::displacement::kHotelMode : dp::displacement::kDefaultMode);
|
||||
|
||||
if (m_activateMapSelectionFn)
|
||||
m_activateMapSelectionFn(info);
|
||||
else
|
||||
|
@ -1903,6 +1906,8 @@ void Framework::DeactivateMapSelection(bool notifyUI)
|
|||
|
||||
if (somethingWasAlreadySelected)
|
||||
CallDrapeFunction(bind(&df::DrapeEngine::DeselectObject, _1));
|
||||
|
||||
SetDisplacementMode(dp::displacement::kDefaultMode);
|
||||
}
|
||||
|
||||
void Framework::UpdatePlacePageInfoForCurrentSelection()
|
||||
|
|
|
@ -259,7 +259,7 @@ public:
|
|||
private:
|
||||
void ActivateMapSelection(bool needAnimation,
|
||||
df::SelectionShape::ESelectedObject selectionType,
|
||||
place_page::Info const & info) const;
|
||||
place_page::Info const & info);
|
||||
void InvalidateUserMarks();
|
||||
public:
|
||||
void DeactivateMapSelection(bool notifyUI);
|
||||
|
@ -375,7 +375,6 @@ private:
|
|||
|
||||
// Last search query params for the interactive search.
|
||||
search::SearchParams m_lastInteractiveSearchParams;
|
||||
uint8_t m_fixedSearchResults;
|
||||
|
||||
bool m_connectToGpsTrack; // need to connect to tracker when Drape is being constructed
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ public:
|
|||
string m_apiUrl;
|
||||
/// Formatted feature address.
|
||||
string m_address;
|
||||
/// Feature is a sponsored hotel.
|
||||
bool m_isSponsoredHotel = false;
|
||||
|
||||
/// Which country this MapObject is in.
|
||||
/// For a country point it will be set to topmost node for country.
|
||||
|
|
|
@ -52,6 +52,9 @@ void ProcessMetadata(FeatureType const & ft, Result::Metadata & meta)
|
|||
meta.m_stars = my::clamp(meta.m_stars, 0, 5);
|
||||
else
|
||||
meta.m_stars = 0;
|
||||
|
||||
meta.m_isSponsoredHotel = ftypes::IsBookingChecker::Instance()(ft);
|
||||
|
||||
meta.m_isInitialized = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
{
|
||||
string m_cuisine; // Valid only if not empty. Used for restaurants.
|
||||
int m_stars = 0; // Valid only if not 0. Used for hotels.
|
||||
bool m_isSponsoredHotel = false; // Used for hotels.
|
||||
osm::YesNoUnknown m_isOpenNow = osm::Unknown; // Valid for any result.
|
||||
|
||||
/// True if the struct is already assigned or need to be calculated otherwise.
|
||||
|
|
Loading…
Add table
Reference in a new issue