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:
-rw-r--r--drape/overlay_handle.cpp12
-rw-r--r--drape/overlay_handle.hpp10
-rw-r--r--drape_frontend/apply_feature_functors.cpp7
-rw-r--r--drape_frontend/circle_shape.cpp7
-rw-r--r--drape_frontend/poi_symbol_shape.cpp16
-rw-r--r--drape_frontend/poi_symbol_shape.hpp6
-rw-r--r--generator/booking_dataset.cpp10
-rw-r--r--indexer/ftypes_matcher.cpp20
-rw-r--r--indexer/ftypes_matcher.hpp9
-rw-r--r--map/framework.cpp4
-rw-r--r--map/place_page_info.cpp2
-rw-r--r--map/place_page_info.hpp3
12 files changed, 71 insertions, 35 deletions
diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp
index fd1179453a..8b6ecf8832 100644
--- a/drape/overlay_handle.cpp
+++ b/drape/overlay_handle.cpp
@@ -199,16 +199,13 @@ uint64_t OverlayHandle::GetPriorityInFollowingMode() const
{
return GetPriority();
}
-
-
-SquareHandle::SquareHandle(FeatureID const & id, dp::Anchor anchor,
- m2::PointD const & gbPivot, m2::PointD const & pxSize,
- uint64_t priority,
- string const & debugStr,
- bool isBillboard)
+SquareHandle::SquareHandle(FeatureID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
+ m2::PointD const & pxSize, uint64_t priority, bool isBound,
+ string const & debugStr, bool isBillboard)
: TBase(id, anchor, priority, isBillboard)
, m_gbPivot(gbPivot)
, m_pxHalfSize(pxSize.x / 2.0, pxSize.y / 2.0)
+ , m_isBound(isBound)
#ifdef DEBUG_OVERLAYS_OUTPUT
, m_debugStr(debugStr)
#endif
@@ -242,6 +239,7 @@ void SquareHandle::GetPixelShape(ScreenBase const & screen, bool perspective, Re
rects.emplace_back(GetPixelRect(screen, perspective));
}
+bool SquareHandle::IsBound() const { return m_isBound; }
#ifdef DEBUG_OVERLAYS_OUTPUT
string SquareHandle::GetOverlayDebugInfo()
{
diff --git a/drape/overlay_handle.hpp b/drape/overlay_handle.hpp
index ab16ab166c..8706f6ddc8 100644
--- a/drape/overlay_handle.hpp
+++ b/drape/overlay_handle.hpp
@@ -141,16 +141,13 @@ class SquareHandle : public OverlayHandle
using TBase = OverlayHandle;
public:
- SquareHandle(FeatureID const & id,
- dp::Anchor anchor,
- m2::PointD const & gbPivot,
- m2::PointD const & pxSize,
- uint64_t priority,
- string const & debugStr,
+ SquareHandle(FeatureID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
+ m2::PointD const & pxSize, uint64_t priority, bool isBound, string const & debugStr,
bool isBillboard = false);
m2::RectD GetPixelRect(ScreenBase const & screen, bool perspective) const override;
void GetPixelShape(ScreenBase const & screen, bool perspective, Rects & rects) const override;
+ bool IsBound() const override;
#ifdef DEBUG_OVERLAYS_OUTPUT
virtual string GetOverlayDebugInfo() override;
@@ -159,6 +156,7 @@ public:
private:
m2::PointD m_gbPivot;
m2::PointD m_pxHalfSize;
+ bool m_isBound;
#ifdef DEBUG_OVERLAYS_OUTPUT
string m_debugStr;
diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp
index 43d4f8f1f4..575fdb7bd7 100644
--- a/drape_frontend/apply_feature_functors.cpp
+++ b/drape_frontend/apply_feature_functors.cpp
@@ -384,7 +384,12 @@ void ApplyPointFeature::Finish()
params.m_hasArea = m_hasArea;
params.m_createdByEditor = m_createdByEditor;
params.m_obsoleteInEditor = m_obsoleteInEditor;
- m_insertShape(make_unique_dp<PoiSymbolShape>(m_centerPoint, params));
+
+ m_insertShape(make_unique_dp<PoiSymbolShape>(m_centerPoint, params,
+ m_hotelData.m_isHotel ? dp::displacement::kDefaultMode :
+ dp::displacement::kAllModes));
+ if (m_hotelData.m_isHotel)
+ m_insertShape(make_unique_dp<PoiSymbolShape>(m_centerPoint, params, dp::displacement::kHotelMode));
}
}
diff --git a/drape_frontend/circle_shape.cpp b/drape_frontend/circle_shape.cpp
index 38603d0935..3fd8fba4aa 100644
--- a/drape_frontend/circle_shape.cpp
+++ b/drape_frontend/circle_shape.cpp
@@ -50,12 +50,11 @@ void CircleShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager>
dp::GLState state(gpu::TEXTURING_PROGRAM, dp::GLState::OverlayLayer);
state.SetColorTexture(region.GetTexture());
- double handleSize = 2 * m_params.m_radius;
+ double const handleSize = 2 * m_params.m_radius;
- drape_ptr<dp::OverlayHandle> overlay = make_unique_dp<dp::SquareHandle>(m_params.m_id,
- dp::Center, m_pt,
+ drape_ptr<dp::OverlayHandle> overlay = make_unique_dp<dp::SquareHandle>(m_params.m_id, dp::Center, m_pt,
m2::PointD(handleSize, handleSize),
- GetOverlayPriority(), "");
+ GetOverlayPriority(), false /* isBound */, "");
dp::AttributeProvider provider(1, TriangleCount + 2);
provider.InitStream(0, gpu::SolidTexturingVertex::GetBindingInfo(), make_ref(vertexes.data()));
diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp
index 4e796950bb..5b20fe1226 100644
--- a/drape_frontend/poi_symbol_shape.cpp
+++ b/drape_frontend/poi_symbol_shape.cpp
@@ -95,10 +95,9 @@ void Batch<MV>(ref_ptr<dp::Batcher> batcher, drape_ptr<dp::OverlayHandle> && han
namespace df
{
-
-PoiSymbolShape::PoiSymbolShape(m2::PointF const & mercatorPt, PoiSymbolViewParams const & params)
- : m_pt(mercatorPt)
- , m_params(params)
+PoiSymbolShape::PoiSymbolShape(m2::PointF const & mercatorPt, PoiSymbolViewParams const & params,
+ int displacementMode)
+ : m_pt(mercatorPt), m_params(params), m_displacementMode(displacementMode)
{}
void PoiSymbolShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const
@@ -108,12 +107,14 @@ void PoiSymbolShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManag
glsl::vec4 const position = glsl::vec4(glsl::ToVec2(m_pt), m_params.m_depth, -m_params.m_posZ);
m2::PointU const pixelSize = region.GetPixelSize();
+
drape_ptr<dp::OverlayHandle> handle = make_unique_dp<dp::SquareHandle>(m_params.m_id,
dp::Center,
m_pt, pixelSize,
GetOverlayPriority(),
+ true /* isBound */,
m_params.m_symbolName,
- true);
+ true /* isBillboard */);
handle->SetPivotZ(m_params.m_posZ);
handle->SetExtendingSize(m_params.m_extendingSize);
@@ -131,8 +132,9 @@ void PoiSymbolShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManag
uint64_t PoiSymbolShape::GetOverlayPriority() const
{
- // Set up maximum priority for shapes which created by user in the editor.
- if (m_params.m_createdByEditor)
+ // Set up maximum priority for shapes which created by user in the editor
+ // and in case of a special displacement mode.
+ if (m_params.m_createdByEditor || (m_displacementMode & dp::displacement::kDefaultMode) == 0)
return dp::kPriorityMaskAll;
// Set up minimal priority for shapes which belong to areas.
diff --git a/drape_frontend/poi_symbol_shape.hpp b/drape_frontend/poi_symbol_shape.hpp
index 57230ca8e6..503055c712 100644
--- a/drape_frontend/poi_symbol_shape.hpp
+++ b/drape_frontend/poi_symbol_shape.hpp
@@ -3,13 +3,16 @@
#include "drape_frontend/map_shape.hpp"
#include "drape_frontend/shape_view_params.hpp"
+#include "drape/constants.hpp"
+
namespace df
{
class PoiSymbolShape : public MapShape
{
public:
- PoiSymbolShape(m2::PointF const & mercatorPt, PoiSymbolViewParams const & params);
+ PoiSymbolShape(m2::PointF const & mercatorPt, PoiSymbolViewParams const & params,
+ int displacementMode = dp::displacement::kAllModes);
void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const override;
MapShapeType GetType() const override { return MapShapeType::OverlayType; }
@@ -19,6 +22,7 @@ private:
m2::PointF const m_pt;
PoiSymbolViewParams const m_params;
+ int const m_displacementMode;
};
} // namespace df
diff --git a/generator/booking_dataset.cpp b/generator/booking_dataset.cpp
index 8455dba225..e8c103ee07 100644
--- a/generator/booking_dataset.cpp
+++ b/generator/booking_dataset.cpp
@@ -3,6 +3,7 @@
#include "platform/local_country_file_utils.hpp"
#include "platform/platform.hpp"
+#include "indexer/ftypes_matcher.hpp"
#include "indexer/search_delimiters.hpp"
#include "indexer/search_string_utils.hpp"
@@ -21,13 +22,8 @@ namespace
{
bool CheckForValues(string const & value)
{
- for (char const * val :
- {"hotel", "apartment", "camp_site", "chalet", "guest_house", "hostel", "motel", "resort"})
- {
- if (value == val)
- return true;
- }
- return false;
+ auto const & tags = ftypes::IsHotelChecker::GetHotelTags();
+ return find(tags.begin(), tags.end(), value) != tags.end();
}
string EscapeTabs(string const & str)
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index 7b1328e18f..20d03af41e 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -425,6 +425,26 @@ IsBookingChecker const & IsBookingChecker::Instance()
return inst;
}
+IsHotelChecker::IsHotelChecker()
+{
+ Classificator const & c = classif();
+ for (auto const & tag : GetHotelTags())
+ m_types.push_back(c.GetTypeByPath({"tourism", tag}));
+}
+
+IsHotelChecker const & IsHotelChecker::Instance()
+{
+ static const IsHotelChecker inst;
+ return inst;
+}
+
+vector<string> const & IsHotelChecker::GetHotelTags()
+{
+ static vector<string> hotelTags = {"hotel", "apartment", "camp_site", "chalet",
+ "guest_house", "hostel", "motel", "resort"};
+ return hotelTags;
+}
+
uint32_t GetPopulation(FeatureType const & ft)
{
uint32_t population = ft.GetPopulation();
diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp
index 7f6dc48e30..16e80b813f 100644
--- a/indexer/ftypes_matcher.hpp
+++ b/indexer/ftypes_matcher.hpp
@@ -164,6 +164,15 @@ public:
static IsBookingChecker const & Instance();
};
+class IsHotelChecker : public BaseChecker
+{
+ IsHotelChecker();
+
+public:
+ static IsHotelChecker const & Instance();
+ static vector<string> const & GetHotelTags();
+};
+
/// Type of locality (do not change values and order - they have detalization order)
/// COUNTRY < STATE < CITY < ...
enum Type { NONE = -1, COUNTRY = 0, STATE, CITY, TOWN, VILLAGE, LOCALITY_COUNT };
diff --git a/map/framework.cpp b/map/framework.cpp
index dc6c25fa10..2f5fdf7978 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -757,6 +757,7 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
if (ftypes::IsAddressObjectChecker::Instance()(ft))
info.m_address = GetAddressInfoAtPoint(feature::GetCenter(ft)).FormatHouseAndStreet();
+ info.m_isHotel = ftypes::IsHotelChecker::Instance()(ft);
if (ftypes::IsBookingChecker::Instance()(ft))
{
info.m_isSponsoredHotel = true;
@@ -1941,7 +1942,8 @@ void Framework::ActivateMapSelection(bool needAnimation, df::SelectionShape::ESe
CallDrapeFunction(bind(&df::DrapeEngine::SelectObject, _1, selectionType, info.GetMercator(), info.GetID(),
needAnimation));
- SetDisplacementMode(info.m_isSponsoredHotel ? dp::displacement::kHotelMode : dp::displacement::kDefaultMode);
+ SetDisplacementMode(info.IsHotel() ? dp::displacement::kHotelMode
+ : dp::displacement::kDefaultMode);
if (m_activateMapSelectionFn)
m_activateMapSelectionFn(info);
diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp
index 52edfff5c8..706f0447b1 100644
--- a/map/place_page_info.cpp
+++ b/map/place_page_info.cpp
@@ -16,7 +16,7 @@ bool Info::IsFeature() const { return m_featureID.IsValid(); }
bool Info::IsBookmark() const { return m_bac != MakeEmptyBookmarkAndCategory(); }
bool Info::IsMyPosition() const { return m_isMyPosition; }
bool Info::IsSponsoredHotel() const { return m_isSponsoredHotel; }
-
+bool Info::IsHotel() const { return m_isHotel; }
bool Info::ShouldShowAddPlace() const
{
auto const isPointOrBuilding = IsPointType() || IsBuilding();
diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp
index cd308c2c8d..ece891102e 100644
--- a/map/place_page_info.hpp
+++ b/map/place_page_info.hpp
@@ -29,6 +29,7 @@ public:
bool IsBookmark() const;
bool IsMyPosition() const;
bool IsSponsoredHotel() const;
+ bool IsHotel() const;
bool ShouldShowAddPlace() const;
bool ShouldShowAddBusiness() const;
@@ -80,6 +81,8 @@ public:
string m_apiUrl;
/// Formatted feature address.
string m_address;
+ /// Feature is a hotel.
+ bool m_isHotel = false;
/// Feature is a sponsored hotel.
bool m_isSponsoredHotel = false;
/// Sponsored feature urls.