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/glstate.hpp1
-rw-r--r--drape/overlay_handle.cpp31
-rw-r--r--drape/overlay_handle.hpp25
-rw-r--r--drape/overlay_tree.cpp22
-rw-r--r--drape/overlay_tree.hpp2
-rw-r--r--drape/render_bucket.cpp5
-rw-r--r--drape/render_bucket.hpp1
-rw-r--r--drape_frontend/apply_feature_functors.cpp106
-rw-r--r--drape_frontend/apply_feature_functors.hpp3
-rw-r--r--drape_frontend/colored_symbol_shape.cpp11
-rw-r--r--drape_frontend/colored_symbol_shape.hpp5
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp38
-rwxr-xr-xdrape_frontend/frontend_renderer.hpp2
-rw-r--r--drape_frontend/line_shape.cpp1
-rw-r--r--drape_frontend/path_text_shape.cpp38
-rw-r--r--drape_frontend/path_text_shape.hpp3
-rw-r--r--drape_frontend/poi_symbol_shape.cpp13
-rw-r--r--drape_frontend/poi_symbol_shape.hpp5
-rwxr-xr-xdrape_frontend/render_group.cpp46
-rwxr-xr-xdrape_frontend/render_group.hpp25
-rw-r--r--drape_frontend/rule_drawer.cpp13
-rw-r--r--drape_frontend/shape_view_params.hpp34
-rw-r--r--drape_frontend/text_layout.cpp24
-rw-r--r--drape_frontend/text_layout.hpp4
-rw-r--r--drape_frontend/text_shape.cpp41
-rw-r--r--drape_frontend/text_shape.hpp8
-rw-r--r--drape_frontend/user_mark_shapes.cpp4
-rw-r--r--indexer/map_style_reader.cpp14
-rw-r--r--indexer/map_style_reader.hpp9
-rw-r--r--local_ads/config.hpp2
-rw-r--r--qt/draw_widget.cpp27
31 files changed, 318 insertions, 245 deletions
diff --git a/drape/glstate.hpp b/drape/glstate.hpp
index 33e06bc0fb..9800b9c91e 100644
--- a/drape/glstate.hpp
+++ b/drape/glstate.hpp
@@ -40,6 +40,7 @@ public:
GeometryLayer,
OverlayLayer,
UserMarkLayer,
+ NavigationLayer,
Gui
};
diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp
index 8ca15e7591..83874428d1 100644
--- a/drape/overlay_handle.cpp
+++ b/drape/overlay_handle.cpp
@@ -7,9 +7,11 @@
#include "base/internal/message.hpp"
#include "base/logging.hpp"
+#include <algorithm>
+#include <sstream>
+
namespace dp
{
-
struct OverlayHandle::OffsetNodeFinder
{
public:
@@ -89,10 +91,13 @@ bool OverlayHandle::IsIntersect(ScreenBase const & screen, ref_ptr<OverlayHandle
Rects const & ar2 = h->GetExtendedPixelShape(screen);
for (size_t i = 0; i < ar1.size(); ++i)
+ {
for (size_t j = 0; j < ar2.size(); ++j)
+ {
if (ar1[i].IsIntersect(ar2[j]))
return true;
-
+ }
+ }
return false;
}
@@ -121,8 +126,9 @@ bool OverlayHandle::HasDynamicAttributes() const
void OverlayHandle::AddDynamicAttribute(BindingInfo const & binding, uint32_t offset, uint32_t count)
{
ASSERT(binding.IsDynamic(), ());
- ASSERT(find_if(m_offsets.begin(), m_offsets.end(), OffsetNodeFinder(binding.GetID())) == m_offsets.end(), ());
- m_offsets.insert(make_pair(binding, MutateRegion(offset, count)));
+ ASSERT(std::find_if(m_offsets.begin(), m_offsets.end(),
+ OffsetNodeFinder(binding.GetID())) == m_offsets.end(), ());
+ m_offsets.insert(std::make_pair(binding, MutateRegion(offset, count)));
}
OverlayID const & OverlayHandle::GetOverlayID() const
@@ -137,7 +143,7 @@ uint64_t const & OverlayHandle::GetPriority() const
OverlayHandle::TOffsetNode const & OverlayHandle::GetOffsetNode(uint8_t bufferID) const
{
- set<TOffsetNode>::const_iterator it = find_if(m_offsets.begin(), m_offsets.end(), OffsetNodeFinder(bufferID));
+ auto const it = std::find_if(m_offsets.begin(), m_offsets.end(), OffsetNodeFinder(bufferID));
ASSERT(it != m_offsets.end(), ());
return *it;
}
@@ -194,13 +200,9 @@ m2::RectD OverlayHandle::GetPixelRectPerspective(ScreenBase const & screen) cons
return GetPerspectiveRect(GetPixelRect(screen, false), screen);
}
-uint64_t OverlayHandle::GetPriorityInFollowingMode() const
-{
- return GetPriority();
-}
SquareHandle::SquareHandle(OverlayID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
m2::PointD const & pxSize, m2::PointD const & pxOffset,
- uint64_t priority, bool isBound, string const & debugStr,
+ uint64_t priority, bool isBound, std::string const & debugStr,
bool isBillboard)
: TBase(id, anchor, priority, isBillboard)
, m_gbPivot(gbPivot)
@@ -242,9 +244,9 @@ void SquareHandle::GetPixelShape(ScreenBase const & screen, bool perspective, Re
bool SquareHandle::IsBound() const { return m_isBound; }
#ifdef DEBUG_OVERLAYS_OUTPUT
-string SquareHandle::GetOverlayDebugInfo()
+std::string SquareHandle::GetOverlayDebugInfo()
{
- ostringstream out;
+ std::ostringstream out;
out << "POI Priority(" << GetPriority() << ") "
<< GetOverlayID().m_featureId.m_index << "-" << GetOverlayID().m_index << " "
<< m_debugStr;
@@ -259,7 +261,7 @@ uint64_t CalculateOverlayPriority(int minZoomLevel, uint8_t rank, float depth)
// - Manual priority from styles (equals to the depth);
// - Rank of the feature (the more the better);
// [1 byte - zoom][4 bytes - priority][1 byte - rank][1 byte - reserved][1 byte - reserved].
- uint8_t const minZoom = 0xFF - static_cast<uint8_t>(max(minZoomLevel, 0));
+ uint8_t const minZoom = 0xFF - static_cast<uint8_t>(std::max(minZoomLevel, 0));
float const kMinDepth = -100000.0f;
float const kMaxDepth = 100000.0f;
@@ -280,5 +282,4 @@ uint64_t CalculateSpecialModePriority(int specialPriority)
priority |= specialPriority;
return priority;
}
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/overlay_handle.hpp b/drape/overlay_handle.hpp
index 17f5b604a7..bc0a9fb573 100644
--- a/drape/overlay_handle.hpp
+++ b/drape/overlay_handle.hpp
@@ -15,11 +15,13 @@
#include "base/buffer_vector.hpp"
-#include "std/set.hpp"
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
namespace dp
{
-
enum OverlayRank
{
OverlayRank0 = 0,
@@ -35,7 +37,6 @@ uint64_t constexpr kPriorityMaskRank = 0x0000000000FFFFFF;
uint64_t constexpr kPriorityMaskAll = kPriorityMaskZoomLevel |
kPriorityMaskManual |
kPriorityMaskRank;
-
struct OverlayID
{
FeatureID m_featureId;
@@ -88,7 +89,7 @@ struct OverlayID
class OverlayHandle
{
public:
- typedef vector<m2::RectF> Rects;
+ using Rects = std::vector<m2::RectF>;
OverlayHandle(OverlayID const & id, dp::Anchor anchor,
uint64_t priority, bool isBillboard);
@@ -129,7 +130,6 @@ public:
uint64_t const & GetPriority() const;
virtual uint64_t GetPriorityMask() const { return kPriorityMaskAll; }
- virtual uint64_t GetPriorityInFollowingMode() const;
virtual bool IsBound() const { return false; }
virtual bool HasLinearFeatureShape() const { return false; }
@@ -145,7 +145,7 @@ public:
bool IsReady() const { return m_isReady; }
#ifdef DEBUG_OVERLAYS_OUTPUT
- virtual string GetOverlayDebugInfo() { return ""; }
+ virtual std::string GetOverlayDebugInfo() { return ""; }
#endif
protected:
@@ -157,7 +157,7 @@ protected:
double m_extendingSize;
double m_pivotZ;
- typedef pair<BindingInfo, MutateRegion> TOffsetNode;
+ using TOffsetNode = std::pair<BindingInfo, MutateRegion>;
TOffsetNode const & GetOffsetNode(uint8_t bufferID) const;
m2::RectD GetPerspectiveRect(m2::RectD const & pixelRect, ScreenBase const & screen) const;
@@ -178,7 +178,7 @@ private:
struct OffsetNodeFinder;
- set<TOffsetNode, LessOffsetNode> m_offsets;
+ std::set<TOffsetNode, LessOffsetNode> m_offsets;
bool m_enableCaching;
mutable Rects m_extendedShapeCache;
@@ -196,7 +196,7 @@ class SquareHandle : public OverlayHandle
public:
SquareHandle(OverlayID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
m2::PointD const & pxSize, m2::PointD const & pxOffset,
- uint64_t priority, bool isBound, string const & debugStr,
+ uint64_t priority, bool isBound, std::string const & debugStr,
bool isBillboard = false);
m2::RectD GetPixelRect(ScreenBase const & screen, bool perspective) const override;
@@ -204,7 +204,7 @@ public:
bool IsBound() const override;
#ifdef DEBUG_OVERLAYS_OUTPUT
- virtual string GetOverlayDebugInfo() override;
+ virtual std::string GetOverlayDebugInfo() override;
#endif
private:
@@ -214,11 +214,10 @@ private:
bool m_isBound;
#ifdef DEBUG_OVERLAYS_OUTPUT
- string m_debugStr;
+ std::string m_debugStr;
#endif
};
uint64_t CalculateOverlayPriority(int minZoomLevel, uint8_t rank, float depth);
uint64_t CalculateSpecialModePriority(int specialPriority);
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/overlay_tree.cpp b/drape/overlay_tree.cpp
index ff822bf11c..d4f791b2b4 100644
--- a/drape/overlay_tree.cpp
+++ b/drape/overlay_tree.cpp
@@ -17,9 +17,8 @@ namespace
class HandleComparator
{
public:
- HandleComparator(bool enableMask, bool followingMode)
- : m_followingMode(followingMode)
- , m_enableMask(enableMask)
+ HandleComparator(bool enableMask)
+ : m_enableMask(enableMask)
{}
bool operator()(ref_ptr<OverlayHandle> const & l, ref_ptr<OverlayHandle> const & r) const
@@ -31,10 +30,8 @@ public:
{
uint64_t const mask = m_enableMask ? l->GetPriorityMask() & r->GetPriorityMask() :
dp::kPriorityMaskAll;
- uint64_t const priorityLeft = (m_followingMode ? l->GetPriorityInFollowingMode() :
- l->GetPriority()) & mask;
- uint64_t const priorityRight = (m_followingMode ? r->GetPriorityInFollowingMode() :
- r->GetPriority()) & mask;
+ uint64_t const priorityLeft = l->GetPriority() & mask;
+ uint64_t const priorityRight = r->GetPriority() & mask;
if (priorityLeft > priorityRight)
return true;
@@ -54,7 +51,6 @@ public:
}
private:
- bool m_followingMode;
bool m_enableMask;
};
@@ -80,7 +76,6 @@ void StoreDisplacementInfo(ScreenBase const & modelView, int caseIndex,
OverlayTree::OverlayTree()
: m_frameCounter(kInvalidFrame)
- , m_followingMode(false)
, m_isDisplacementEnabled(true)
{
for (size_t i = 0; i < m_handles.size(); i++)
@@ -206,7 +201,7 @@ void OverlayTree::InsertHandle(ref_ptr<OverlayHandle> handle, int currentRank,
}
TOverlayContainer rivals;
- HandleComparator comparator(true /* enableMask */, m_followingMode);
+ HandleComparator comparator(true /* enableMask */);
// Find elements that already on OverlayTree and it's pixel rect
// intersect with handle pixel rect ("Intersected elements").
@@ -300,7 +295,7 @@ void OverlayTree::EndOverlayPlacing()
LOG(LINFO, ("- BEGIN OVERLAYS PLACING"));
#endif
- HandleComparator comparator(false /* enableMask */, m_followingMode);
+ HandleComparator comparator(false /* enableMask */);
for (int rank = 0; rank < dp::OverlayRanksCount; rank++)
{
@@ -427,11 +422,6 @@ void OverlayTree::Select(m2::RectD const & rect, TOverlayContainer & result) con
});
}
-void OverlayTree::SetFollowingMode(bool mode)
-{
- m_followingMode = mode;
-}
-
void OverlayTree::SetDisplacementEnabled(bool enabled)
{
m_isDisplacementEnabled = enabled;
diff --git a/drape/overlay_tree.hpp b/drape/overlay_tree.hpp
index 209774beae..42348a491c 100644
--- a/drape/overlay_tree.hpp
+++ b/drape/overlay_tree.hpp
@@ -62,7 +62,6 @@ public:
void Select(m2::RectD const & rect, TOverlayContainer & result) const;
void Select(m2::PointD const & glbPoint, TOverlayContainer & result) const;
- void SetFollowingMode(bool mode);
void SetDisplacementEnabled(bool enabled);
void SetSelectedFeature(FeatureID const & featureID);
@@ -95,7 +94,6 @@ private:
int m_frameCounter;
array<vector<ref_ptr<OverlayHandle>>, dp::OverlayRanksCount> m_handles;
HandlesCache m_handlesCache;
- bool m_followingMode;
bool m_isDisplacementEnabled;
diff --git a/drape/render_bucket.cpp b/drape/render_bucket.cpp
index fbcf3c1df2..fb6a70f7d0 100644
--- a/drape/render_bucket.cpp
+++ b/drape/render_bucket.cpp
@@ -71,6 +71,11 @@ void RenderBucket::CollectOverlayHandles(ref_ptr<OverlayTree> tree)
tree->Add(make_ref(overlayHandle));
}
+bool RenderBucket::HasOverlayHandles() const
+{
+ return !m_overlay.empty();
+}
+
void RenderBucket::RemoveOverlayHandles(ref_ptr<OverlayTree> tree)
{
for (drape_ptr<OverlayHandle> const & overlayHandle : m_overlay)
diff --git a/drape/render_bucket.hpp b/drape/render_bucket.hpp
index 6253a8c9db..05efe6ef3f 100644
--- a/drape/render_bucket.hpp
+++ b/drape/render_bucket.hpp
@@ -37,6 +37,7 @@ public:
void Update(ScreenBase const & modelView);
void CollectOverlayHandles(ref_ptr<OverlayTree> tree);
+ bool HasOverlayHandles() const;
void RemoveOverlayHandles(ref_ptr<OverlayTree> tree);
void Render(bool drawAsLine);
diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp
index 21ea452406..60cb86a236 100644
--- a/drape_frontend/apply_feature_functors.cpp
+++ b/drape_frontend/apply_feature_functors.cpp
@@ -28,6 +28,7 @@
#include "base/stl_helpers.hpp"
#include <algorithm>
+#include <limits>
#include <mutex>
#include <sstream>
#include <unordered_map>
@@ -60,9 +61,8 @@ df::ColorConstant const kRoadShieldOrangeBackgroundColor = "RoadShieldOrangeBack
int const kLineSimplifyLevelStart = 10;
int const kLineSimplifyLevelEnd = 12;
-uint32_t const kPathTextBaseTextIndex = 0;
-uint32_t const kPathTextBaseTextStep = 100;
-uint32_t const kShieldBaseTextIndex = 1000;
+uint32_t const kPathTextBaseTextIndex = 128;
+uint32_t const kShieldBaseTextIndex = 0;
#ifdef CALC_FILTERED_POINTS
class LinesStat
@@ -245,6 +245,34 @@ uint16_t CalculateHotelOverlayPriority(BaseApplyFeature::HotelData const & data)
return 0;
}
+uint16_t CalculateNavigationPoiPriority()
+{
+ // All navigation POI have maximum priority in navigation mode.
+ return std::numeric_limits<uint16_t>::max();
+}
+
+uint16_t CalculateNavigationRoadShieldPriority()
+{
+ // Road shields have less priority than navigation POI.
+ static uint16_t constexpr kMask = ~static_cast<uint16_t>(0xFF);
+ uint16_t priority = CalculateNavigationPoiPriority();
+ return priority & kMask;
+}
+
+uint16_t CalculateNavigationPathTextPriority(uint32_t textIndex)
+{
+ // Path texts have more priority than road shields in navigation mode.
+ static uint16_t constexpr kMask = ~static_cast<uint16_t>(0xFF);
+ uint16_t priority = CalculateNavigationPoiPriority();
+ priority &= kMask;
+
+ uint8_t constexpr kMaxTextIndex = std::numeric_limits<uint8_t>::max() - 1;
+ if (textIndex > kMaxTextIndex)
+ textIndex = kMaxTextIndex;
+ priority |= static_cast<uint8_t>(textIndex);
+ return priority;
+}
+
bool IsSymbolRoadShield(ftypes::RoadShield const & shield)
{
return shield.m_type == ftypes::RoadShieldType::US_Interstate ||
@@ -452,13 +480,14 @@ void BaseApplyFeature::SetHotelData(HotelData && hotelData)
ApplyPointFeature::ApplyPointFeature(TileKey const & tileKey, TInsertShapeFn const & insertShape,
FeatureID const & id, int minVisibleScale, uint8_t rank,
CaptionDescription const & captions, float posZ,
- int displacementMode)
+ int displacementMode, dp::GLState::DepthLayer depthLayer)
: TBase(tileKey, insertShape, id, minVisibleScale, rank, captions)
, m_posZ(posZ)
, m_hasPoint(false)
, m_hasArea(false)
, m_createdByEditor(false)
, m_obsoleteInEditor(false)
+ , m_depthLayer(depthLayer)
, m_symbolDepth(dp::minDepth)
, m_symbolRule(nullptr)
, m_displacementMode(displacementMode)
@@ -497,27 +526,22 @@ void ApplyPointFeature::ProcessPointRule(Stylist::TRuleWrapper const & rule)
TextViewParams params;
params.m_tileCenter = m_tileRect.Center();
ExtractCaptionParams(capRule, pRule->GetCaption(1), depth, params);
+ params.m_depthLayer = m_depthLayer;
params.m_minVisibleScale = m_minVisibleScale;
params.m_rank = m_rank;
params.m_posZ = m_posZ;
params.m_hasArea = m_hasArea;
params.m_createdByEditor = m_createdByEditor;
- bool specialDisplacementMode = false;
- uint16_t specialModePriority = 0;
if (m_displacementMode == dp::displacement::kHotelMode &&
m_hotelData.m_isHotel && !params.m_primaryText.empty())
{
- specialDisplacementMode = true;
- specialModePriority = CalculateHotelOverlayPriority(m_hotelData);
-
params.m_primaryOptional = false;
params.m_primaryTextFont.m_size *= 1.2;
params.m_primaryTextFont.m_outlineColor = df::GetColorConstant(df::kPoiHotelTextOutlineColor);
params.m_secondaryTextFont = params.m_primaryTextFont;
params.m_secondaryText = ExtractHotelInfo();
params.m_secondaryOptional = false;
-
}
if (!params.m_primaryText.empty() || !params.m_secondaryText.empty())
@@ -537,6 +561,11 @@ void ApplyPointFeature::Finish(ref_ptr<dp::TextureManager> texMng,
specialDisplacementMode = true;
specialModePriority = CalculateHotelOverlayPriority(m_hotelData);
}
+ else if (m_depthLayer == dp::GLState::NavigationLayer && GetStyleReader().IsCarNavigationStyle())
+ {
+ specialDisplacementMode = true;
+ specialModePriority = CalculateNavigationPoiPriority();
+ }
bool const hasPOI = m_symbolRule != nullptr;
@@ -545,6 +574,7 @@ void ApplyPointFeature::Finish(ref_ptr<dp::TextureManager> texMng,
PoiSymbolViewParams params(m_id);
params.m_tileCenter = m_tileRect.Center();
params.m_depth = static_cast<float>(m_symbolDepth);
+ params.m_depthLayer = m_depthLayer;
params.m_minVisibleScale = m_minVisibleScale;
params.m_rank = m_rank;
@@ -567,21 +597,22 @@ void ApplyPointFeature::Finish(ref_ptr<dp::TextureManager> texMng,
params.m_hasArea = m_hasArea;
params.m_prioritized = prioritized || m_createdByEditor;
params.m_obsoleteInEditor = m_obsoleteInEditor;
+ params.m_specialDisplacementMode = specialDisplacementMode;
+ params.m_specialModePriority = specialModePriority;
- m_insertShape(make_unique_dp<PoiSymbolShape>(m_centerPoint, params, m_tileKey, 0 /* text index */,
- specialDisplacementMode, specialModePriority));
+ m_insertShape(make_unique_dp<PoiSymbolShape>(m_centerPoint, params, m_tileKey, 0 /* text index */));
dp::TextureManager::SymbolRegion region;
texMng->GetSymbolRegion(params.m_symbolName, region);
symbolSize = region.GetPixelSize();
}
- for (auto const & textParams : m_textParams)
+ for (auto textParams : m_textParams)
{
+ textParams.m_specialDisplacementMode = specialDisplacementMode;
+ textParams.m_specialModePriority = specialModePriority;
m_insertShape(make_unique_dp<TextShape>(m_centerPoint, textParams, m_tileKey,
- hasPOI, symbolSize, 0 /* textIndex */,
- true /* affectedByZoomPriority */,
- specialDisplacementMode, specialModePriority));
+ hasPOI, symbolSize, 0 /* textIndex */));
}
}
@@ -589,7 +620,8 @@ ApplyAreaFeature::ApplyAreaFeature(TileKey const & tileKey, TInsertShapeFn const
FeatureID const & id, double currentScaleGtoP, bool isBuilding,
bool skipAreaGeometry, float minPosZ, float posZ, int minVisibleScale,
uint8_t rank, CaptionDescription const & captions, bool hatchingArea)
- : TBase(tileKey, insertShape, id, minVisibleScale, rank, captions, posZ, dp::displacement::kDefaultMode)
+ : TBase(tileKey, insertShape, id, minVisibleScale, rank, captions, posZ,
+ dp::displacement::kDefaultMode, dp::GLState::GeometryLayer)
, m_minPosZ(minPosZ)
, m_isBuilding(isBuilding)
, m_skipAreaGeometry(skipAreaGeometry)
@@ -953,6 +985,7 @@ void ApplyLineFeatureAdditional::GetRoadShieldsViewParams(ref_ptr<dp::TextureMan
dp::FontDecl font = GetRoadShieldTextFont(baseFont, shield);
textParams.m_tileCenter = m_tileRect.Center();
textParams.m_depth = m_depth;
+ textParams.m_depthLayer = dp::GLState::OverlayLayer;
textParams.m_minVisibleScale = m_minVisibleScale;
textParams.m_rank = m_rank;
textParams.m_anchor = anchor;
@@ -981,6 +1014,7 @@ void ApplyLineFeatureAdditional::GetRoadShieldsViewParams(ref_ptr<dp::TextureMan
symbolParams.m_featureID = m_id;
symbolParams.m_tileCenter = m_tileRect.Center();
symbolParams.m_depth = m_depth;
+ symbolParams.m_depthLayer = dp::GLState::OverlayLayer;
symbolParams.m_minVisibleScale = m_minVisibleScale;
symbolParams.m_rank = m_rank;
symbolParams.m_anchor = anchor;
@@ -1007,6 +1041,7 @@ void ApplyLineFeatureAdditional::GetRoadShieldsViewParams(ref_ptr<dp::TextureMan
std::string symbolName = GetRoadShieldSymbolName(shield, fontScale);
poiParams.m_tileCenter = m_tileRect.Center();
poiParams.m_depth = m_depth;
+ poiParams.m_depthLayer = dp::GLState::OverlayLayer;
poiParams.m_minVisibleScale = m_minVisibleScale;
poiParams.m_rank = m_rank;
poiParams.m_symbolName = symbolName;
@@ -1038,6 +1073,15 @@ void ApplyLineFeatureAdditional::GetRoadShieldsViewParams(ref_ptr<dp::TextureMan
textParams.m_secondaryTextFont.m_size *= 0.9f;
textParams.m_secondaryOffset = m2::PointD(0.0f, 3.0 * mainScale);
}
+
+ // Special priority for road shields in navigation style.
+ if (GetStyleReader().IsCarNavigationStyle())
+ {
+ textParams.m_specialDisplacementMode = poiParams.m_specialDisplacementMode
+ = symbolParams.m_specialDisplacementMode = true;
+ textParams.m_specialModePriority = poiParams.m_specialModePriority
+ = symbolParams.m_specialModePriority = CalculateNavigationRoadShieldPriority();
+ }
}
bool ApplyLineFeatureAdditional::CheckShieldsNearby(m2::PointD const & shieldPos,
@@ -1086,11 +1130,17 @@ void ApplyLineFeatureAdditional::Finish(ref_ptr<dp::TextureManager> texMng,
params.m_auxText = m_captions.GetAuxText();
params.m_textFont = fontDecl;
params.m_baseGtoPScale = m_currentScaleGtoP;
+ bool const navigationEnabled = GetStyleReader().IsCarNavigationStyle();
+ if (navigationEnabled)
+ params.m_specialDisplacementMode = true;
- uint32_t baseTextIndex = kPathTextBaseTextIndex;
+ uint32_t textIndex = kPathTextBaseTextIndex;
for (auto const & spline : m_clippedSplines)
{
- auto shape = make_unique_dp<PathTextShape>(spline, params, m_tileKey, baseTextIndex);
+ PathTextViewParams p = params;
+ if (navigationEnabled)
+ p.m_specialModePriority = CalculateNavigationPathTextPriority(textIndex);
+ auto shape = make_unique_dp<PathTextShape>(spline, p, m_tileKey, textIndex);
if (!shape->CalculateLayout(texMng))
continue;
@@ -1099,7 +1149,7 @@ void ApplyLineFeatureAdditional::Finish(ref_ptr<dp::TextureManager> texMng,
CalculateRoadShieldPositions(shape->GetOffsets(), spline, shieldPositions);
m_insertShape(std::move(shape));
- baseTextIndex += kPathTextBaseTextStep;
+ textIndex++;
}
}
else if (m_shieldRule != nullptr && !roadShields.empty())
@@ -1127,6 +1177,7 @@ void ApplyLineFeatureAdditional::Finish(ref_ptr<dp::TextureManager> texMng,
uint32_t const scaledMinDistance = static_cast<uint32_t>(vs * minDistance);
uint8_t shieldIndex = 0;
+ uint32_t textIndex = kShieldBaseTextIndex;
for (ftypes::RoadShield const & shield : roadShields)
{
TextViewParams textParams;
@@ -1138,27 +1189,20 @@ void ApplyLineFeatureAdditional::Finish(ref_ptr<dp::TextureManager> texMng,
auto & generatedShieldRects = generatedRoadShields[shield];
generatedShieldRects.reserve(10);
- uint32_t textIndex = kShieldBaseTextIndex * (++shieldIndex);
for (auto const & shieldPos : shieldPositions)
{
if (!CheckShieldsNearby(shieldPos, shieldPixelSize, scaledMinDistance, generatedShieldRects))
continue;
m_insertShape(make_unique_dp<TextShape>(shieldPos, textParams, m_tileKey, true /* hasPOI */,
- m2::PointF(0.0f, 0.0f) /* symbolSize */, textIndex,
- false /* affectedByZoomPriority */));
+ m2::PointF(0.0f, 0.0f) /* symbolSize */, textIndex));
if (IsColoredRoadShield(shield))
- {
- m_insertShape(make_unique_dp<ColoredSymbolShape>(shieldPos, symbolParams,
- m_tileKey, textIndex));
- }
+ m_insertShape(make_unique_dp<ColoredSymbolShape>(shieldPos, symbolParams, m_tileKey, textIndex));
else if (IsSymbolRoadShield(shield))
- {
- m_insertShape(make_unique_dp<PoiSymbolShape>(shieldPos, poiParams,
- m_tileKey, textIndex));
- }
+ m_insertShape(make_unique_dp<PoiSymbolShape>(shieldPos, poiParams, m_tileKey, textIndex));
textIndex++;
}
+ shieldIndex++;
}
}
} // namespace df
diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp
index 9f4a01da76..fd18255833 100644
--- a/drape_frontend/apply_feature_functors.hpp
+++ b/drape_frontend/apply_feature_functors.hpp
@@ -82,7 +82,7 @@ public:
ApplyPointFeature(TileKey const & tileKey, TInsertShapeFn const & insertShape,
FeatureID const & id, int minVisibleScale, uint8_t rank,
CaptionDescription const & captions, float posZ,
- int displacementMode);
+ int displacementMode, dp::GLState::DepthLayer depthLayer);
void operator()(m2::PointD const & point, bool hasArea);
void ProcessPointRule(Stylist::TRuleWrapper const & rule);
@@ -97,6 +97,7 @@ private:
bool m_hasArea;
bool m_createdByEditor;
bool m_obsoleteInEditor;
+ dp::GLState::DepthLayer m_depthLayer;
double m_symbolDepth;
SymbolRuleProto const * m_symbolRule;
m2::PointF m_centerPoint;
diff --git a/drape_frontend/colored_symbol_shape.cpp b/drape_frontend/colored_symbol_shape.cpp
index c336711acd..6e491fb75f 100644
--- a/drape_frontend/colored_symbol_shape.cpp
+++ b/drape_frontend/colored_symbol_shape.cpp
@@ -39,15 +39,12 @@ glsl::vec2 ShiftNormal(glsl::vec2 const & n, ColoredSymbolViewParams const & par
} // namespace
ColoredSymbolShape::ColoredSymbolShape(m2::PointD const & mercatorPt, ColoredSymbolViewParams const & params,
- TileKey const & tileKey, uint32_t textIndex, bool needOverlay,
- bool specialDisplacementMode, uint16_t specialModePriority)
+ TileKey const & tileKey, uint32_t textIndex, bool needOverlay)
: m_point(mercatorPt)
, m_params(params)
, m_tileCoords(tileKey.GetTileCoords())
, m_textIndex(textIndex)
, m_needOverlay(needOverlay)
- , m_specialDisplacementMode(specialDisplacementMode)
- , m_specialModePriority(specialModePriority)
{}
void ColoredSymbolShape::Draw(ref_ptr<dp::Batcher> batcher,
@@ -238,7 +235,7 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::Batcher> batcher,
m_params.m_offset, GetOverlayPriority(), true /* isBound */,
debugName, true /* isBillboard */) : nullptr;
- dp::GLState state(gpu::COLORED_SYMBOL_PROGRAM, dp::GLState::OverlayLayer);
+ dp::GLState state(gpu::COLORED_SYMBOL_PROGRAM, m_params.m_depthLayer);
state.SetProgram3dIndex(gpu::COLORED_SYMBOL_BILLBOARD_PROGRAM);
state.SetColorTexture(colorRegion.GetTexture());
state.SetDepthFunction(gl_const::GLLess);
@@ -251,8 +248,8 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::Batcher> batcher,
uint64_t ColoredSymbolShape::GetOverlayPriority() const
{
// Special displacement mode.
- if (m_specialDisplacementMode)
- return dp::CalculateSpecialModePriority(m_specialModePriority);
+ if (m_params.m_specialDisplacementMode)
+ return dp::CalculateSpecialModePriority(m_params.m_specialModePriority);
return dp::CalculateOverlayPriority(m_params.m_minVisibleScale, m_params.m_rank, m_params.m_depth);
}
diff --git a/drape_frontend/colored_symbol_shape.hpp b/drape_frontend/colored_symbol_shape.hpp
index f6e76718f9..4a3a91b892 100644
--- a/drape_frontend/colored_symbol_shape.hpp
+++ b/drape_frontend/colored_symbol_shape.hpp
@@ -11,8 +11,7 @@ class ColoredSymbolShape : public MapShape
{
public:
ColoredSymbolShape(m2::PointD const & mercatorPt, ColoredSymbolViewParams const & params,
- TileKey const & tileKey, uint32_t textIndex, bool needOverlay = true,
- bool specialDisplacementMode = false, uint16_t specialModePriority = 0xFFFF);
+ TileKey const & tileKey, uint32_t textIndex, bool needOverlay = true);
void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const override;
MapShapeType GetType() const override { return MapShapeType::OverlayType; }
@@ -24,7 +23,5 @@ private:
m2::PointI const m_tileCoords;
uint32_t const m_textIndex;
bool const m_needOverlay;
- bool const m_specialDisplacementMode;
- uint16_t const m_specialModePriority;
};
} // namespace df
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index 963263f772..4a41aa5e2c 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -22,8 +22,9 @@
#include "drape/utils/projection.hpp"
#include "indexer/classificator_loader.hpp"
-#include "indexer/scales.hpp"
#include "indexer/drawing_rules.hpp"
+#include "indexer/map_style_reader.hpp"
+#include "indexer/scales.hpp"
#include "geometry/any_rect2d.hpp"
@@ -495,7 +496,6 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
m_routeRenderer->Clear();
++m_lastRecacheRouteId;
m_myPositionController->DeactivateRouting();
- m_overlayTree->SetFollowingMode(false);
if (m_enablePerspectiveInNavigation)
DisablePerspective();
}
@@ -527,7 +527,6 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
case Message::DeactivateRouteFollowing:
{
m_myPositionController->DeactivateRouting();
- m_overlayTree->SetFollowingMode(false);
if (m_enablePerspectiveInNavigation)
DisablePerspective();
break;
@@ -866,8 +865,6 @@ void FrontendRenderer::FollowRoute(int preferredZoomLevel, int preferredZoomLeve
if (m_enablePerspectiveInNavigation)
AddUserEvent(make_unique_dp<SetAutoPerspectiveEvent>(true /* isAutoPerspective */));
- m_overlayTree->SetFollowingMode(true);
-
m_routeRenderer->SetFollowingEnabled(true);
}
@@ -1253,6 +1250,19 @@ void FrontendRenderer::RenderOverlayLayer(ScreenBase const & modelView)
BuildOverlayTree(modelView);
for (drape_ptr<RenderGroup> & group : overlay.m_renderGroups)
RenderSingleGroup(modelView, make_ref(group));
+
+ if (GetStyleReader().IsCarNavigationStyle())
+ RenderNavigationOverlayLayer(modelView);
+}
+
+void FrontendRenderer::RenderNavigationOverlayLayer(ScreenBase const & modelView)
+{
+ RenderLayer & navOverlayLayer = m_layers[RenderLayer::NavigationID];
+ for (auto & group : navOverlayLayer.m_renderGroups)
+ {
+ if (group->HasOverlayHandles())
+ RenderSingleGroup(modelView, make_ref(group));
+ }
}
void FrontendRenderer::RenderTrafficAndRouteLayer(ScreenBase const & modelView)
@@ -1281,11 +1291,16 @@ void FrontendRenderer::RenderUserMarksLayer(ScreenBase const & modelView)
void FrontendRenderer::BuildOverlayTree(ScreenBase const & modelView)
{
- RenderLayer & overlay = m_layers[RenderLayer::OverlayID];
- overlay.Sort(make_ref(m_overlayTree));
+ static std::vector<RenderLayer::RenderLayerID> layers = {RenderLayer::OverlayID,
+ RenderLayer::NavigationID};
BeginUpdateOverlayTree(modelView);
- for (drape_ptr<RenderGroup> & group : overlay.m_renderGroups)
- UpdateOverlayTree(modelView, group);
+ for (auto const & layerId : layers)
+ {
+ RenderLayer & overlay = m_layers[layerId];
+ overlay.Sort(make_ref(m_overlayTree));
+ for (drape_ptr<RenderGroup> & group : overlay.m_renderGroups)
+ UpdateOverlayTree(modelView, group);
+ }
EndUpdateOverlayTree();
}
@@ -2013,9 +2028,10 @@ FrontendRenderer::RenderLayer::RenderLayerID FrontendRenderer::RenderLayer::GetL
{
if (state.GetDepthLayer() == dp::GLState::OverlayLayer)
return OverlayID;
-
- if (state.GetDepthLayer() == dp::GLState::UserMarkLayer)
+ else if (state.GetDepthLayer() == dp::GLState::UserMarkLayer)
return UserMarkID;
+ else if (state.GetDepthLayer() == dp::GLState::NavigationLayer)
+ return NavigationID;
if (state.GetProgram3dIndex() == gpu::AREA_3D_PROGRAM ||
state.GetProgram3dIndex() == gpu::AREA_3D_OUTLINE_PROGRAM)
diff --git a/drape_frontend/frontend_renderer.hpp b/drape_frontend/frontend_renderer.hpp
index 0483e89a00..81c1bf6554 100755
--- a/drape_frontend/frontend_renderer.hpp
+++ b/drape_frontend/frontend_renderer.hpp
@@ -149,6 +149,7 @@ private:
void Render2dLayer(ScreenBase const & modelView);
void Render3dLayer(ScreenBase const & modelView, bool useFramebuffer);
void RenderOverlayLayer(ScreenBase const & modelView);
+ void RenderNavigationOverlayLayer(ScreenBase const & modelView);
void RenderUserMarksLayer(ScreenBase const & modelView);
void RenderTrafficAndRouteLayer(ScreenBase const & modelView);
@@ -241,6 +242,7 @@ private:
OverlayID,
Geometry3dID,
UserMarkID,
+ NavigationID,
LayerCountID
};
diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp
index 37c0168fd8..a63a10790d 100644
--- a/drape_frontend/line_shape.cpp
+++ b/drape_frontend/line_shape.cpp
@@ -2,7 +2,6 @@
#include "drape_frontend/line_shape_helper.hpp"
#include "drape_frontend/shader_def.hpp"
-#include "drape_frontend/visual_params.hpp"
#include "drape/attribute_provider.hpp"
#include "drape/batcher.hpp"
diff --git a/drape_frontend/path_text_shape.cpp b/drape_frontend/path_text_shape.cpp
index 6e12d27470..baf1701939 100644
--- a/drape_frontend/path_text_shape.cpp
+++ b/drape_frontend/path_text_shape.cpp
@@ -27,7 +27,7 @@ public:
PathTextHandle(dp::OverlayID const & id, m2::SharedSpline const & spl,
df::SharedTextLayout const & layout,
float mercatorOffset, float depth, uint32_t textIndex,
- uint64_t priority, uint64_t priorityFollowingMode, int fixedHeight,
+ uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
bool isBillboard)
: TextHandle(id, layout->GetText(), dp::Center, priority, fixedHeight,
@@ -37,7 +37,6 @@ public:
, m_textIndex(textIndex)
, m_globalOffset(mercatorOffset)
, m_depth(depth)
- , m_priorityFollowingMode(priorityFollowingMode)
{
m2::Spline::iterator centerPointIter = m_spline.CreateIterator();
@@ -68,7 +67,7 @@ public:
pos = screen.GtoP(pos);
if (!screen.PixelRect().IsPointInside(pos))
{
- if ((foundOffset = CalculatePerspectiveOffsets(pixelSpline, pixelOffset)))
+ if ((foundOffset = CalculatePerspectiveOffsets(pixelSpline, m_textIndex, pixelOffset)))
break;
pixelSpline = m2::Spline(m_spline->GetSize());
@@ -78,7 +77,7 @@ public:
}
// We aren't able to place the only label anywhere.
- if (!foundOffset && !CalculatePerspectiveOffsets(pixelSpline, pixelOffset))
+ if (!foundOffset && !CalculatePerspectiveOffsets(pixelSpline, m_textIndex, pixelOffset))
return false;
centerPointIter.Attach(pixelSpline);
@@ -175,25 +174,21 @@ public:
return false;
}
- uint64_t GetPriorityInFollowingMode() const override
- {
- return m_priorityFollowingMode;
- }
-
bool HasLinearFeatureShape() const override
{
return true;
}
private:
- bool CalculatePerspectiveOffsets(const m2::Spline & pixelSpline, float & pixelOffset) const
+ bool CalculatePerspectiveOffsets(m2::Spline const & pixelSpline, uint32_t textIndex,
+ float & pixelOffset) const
{
if (pixelSpline.GetSize() < 2)
return false;
float offset = 0.0f;
if (!df::PathTextLayout::CalculatePerspectivePosition(static_cast<float>(pixelSpline.GetLength()),
- m_layout->GetPixelLength(), offset))
+ m_layout->GetPixelLength(), textIndex, offset))
{
return false;
}
@@ -209,7 +204,6 @@ private:
m2::PointD m_globalPivot;
float const m_globalOffset;
float const m_depth;
- uint64_t const m_priorityFollowingMode;
};
} // namespace
@@ -245,16 +239,19 @@ bool PathTextShape::CalculateLayout(ref_ptr<dp::TextureManager> textures)
return !m_offsets.empty();
}
-uint64_t PathTextShape::GetOverlayPriority(uint32_t textIndex, size_t textLength,
- bool followingMode) const
+uint64_t PathTextShape::GetOverlayPriority(uint32_t textIndex, size_t textLength) const
{
// Overlay priority for path text shapes considers length of the text and index of text.
// Greater text length has more priority, because smaller texts have more chances to be shown along the road.
// [6 bytes - standard overlay priority][1 byte - length][1 byte - path text index].
+
+ // Special displacement mode.
+ if (m_params.m_specialDisplacementMode)
+ return dp::CalculateSpecialModePriority(m_params.m_specialModePriority);
+
static uint64_t constexpr kMask = ~static_cast<uint64_t>(0xFFFF);
- uint64_t priority = dp::kPriorityMaskAll;
- if (!followingMode)
- priority = dp::CalculateOverlayPriority(m_params.m_minVisibleScale, m_params.m_rank, m_params.m_depth);
+ uint64_t priority = dp::CalculateOverlayPriority(m_params.m_minVisibleScale, m_params.m_rank,
+ m_params.m_depth);
priority &= kMask;
priority |= (static_cast<uint8_t>(textLength) << 8);
priority |= static_cast<uint8_t>(textIndex);
@@ -343,12 +340,9 @@ drape_ptr<dp::OverlayHandle> PathTextShape::CreateOverlayHandle(SharedTextLayout
{
dp::OverlayID const overlayId = dp::OverlayID(m_params.m_featureID, m_tileCoords,
m_baseTextIndex + textIndex);
- auto const priority = GetOverlayPriority(textIndex, layoutPtr->GetText().size(),
- false /* followingMode */);
- auto const followPriority = GetOverlayPriority(textIndex, layoutPtr->GetText().size(),
- true /* followingMode */);
+ auto const priority = GetOverlayPriority(textIndex, layoutPtr->GetText().size());
return make_unique_dp<PathTextHandle>(overlayId, m_spline, layoutPtr, offset, m_params.m_depth,
- textIndex, priority, followPriority, layoutPtr->GetFixedHeight(),
+ textIndex, priority, layoutPtr->GetFixedHeight(),
textures, true /* isBillboard */);
}
diff --git a/drape_frontend/path_text_shape.hpp b/drape_frontend/path_text_shape.hpp
index c61d2a86df..93e588f7f7 100644
--- a/drape_frontend/path_text_shape.hpp
+++ b/drape_frontend/path_text_shape.hpp
@@ -29,8 +29,7 @@ public:
MapShapeType GetType() const override { return MapShapeType::OverlayType; }
private:
- uint64_t GetOverlayPriority(uint32_t textIndex, size_t textLength,
- bool followingMode) const;
+ uint64_t GetOverlayPriority(uint32_t textIndex, size_t textLength) const;
void DrawPathTextPlain(ref_ptr<dp::TextureManager> textures,
ref_ptr<dp::Batcher> batcher) const;
diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp
index 12f50b748c..7aaee945e2 100644
--- a/drape_frontend/poi_symbol_shape.cpp
+++ b/drape_frontend/poi_symbol_shape.cpp
@@ -66,7 +66,7 @@ void Batch<SV>(ref_ptr<dp::Batcher> batcher, drape_ptr<dp::OverlayHandle> && han
glsl::vec2(texRect.maxX(), texRect.minY()) },
};
- dp::GLState state(gpu::TEXTURING_PROGRAM, dp::GLState::OverlayLayer);
+ dp::GLState state(gpu::TEXTURING_PROGRAM, params.m_depthLayer);
state.SetProgram3dIndex(gpu::TEXTURING_BILLBOARD_PROGRAM);
state.SetColorTexture(symbolRegion.GetTexture());
state.SetTextureFilter(gl_const::GLNearest);
@@ -99,7 +99,7 @@ void Batch<MV>(ref_ptr<dp::Batcher> batcher, drape_ptr<dp::OverlayHandle> && han
glsl::vec2(texRect.maxX(), texRect.minY()), maskColorCoords },
};
- dp::GLState state(gpu::MASKED_TEXTURING_PROGRAM, dp::GLState::OverlayLayer);
+ dp::GLState state(gpu::MASKED_TEXTURING_PROGRAM, params.m_depthLayer);
state.SetProgram3dIndex(gpu::MASKED_TEXTURING_BILLBOARD_PROGRAM);
state.SetColorTexture(symbolRegion.GetTexture());
state.SetMaskTexture(colorRegion.GetTexture()); // Here mask is a color.
@@ -114,12 +114,9 @@ void Batch<MV>(ref_ptr<dp::Batcher> batcher, drape_ptr<dp::OverlayHandle> && han
namespace df
{
PoiSymbolShape::PoiSymbolShape(m2::PointD const & mercatorPt, PoiSymbolViewParams const & params,
- TileKey const & tileKey, uint32_t textIndex,
- bool specialDisplacementMode, uint16_t specialModePriority)
+ TileKey const & tileKey, uint32_t textIndex)
: m_pt(mercatorPt)
, m_params(params)
- , m_specialDisplacementMode(specialDisplacementMode)
- , m_specialModePriority(specialModePriority)
, m_tileCoords(tileKey.GetTileCoords())
, m_textIndex(textIndex)
{}
@@ -168,8 +165,8 @@ uint64_t PoiSymbolShape::GetOverlayPriority() const
return dp::kPriorityMaskAll;
// Special displacement mode.
- if (m_specialDisplacementMode)
- return dp::CalculateSpecialModePriority(m_specialModePriority);
+ if (m_params.m_specialDisplacementMode)
+ return dp::CalculateSpecialModePriority(m_params.m_specialModePriority);
// Set up minimal priority for shapes which belong to areas.
if (m_params.m_hasArea)
diff --git a/drape_frontend/poi_symbol_shape.hpp b/drape_frontend/poi_symbol_shape.hpp
index 32c7c693c8..75f0a03118 100644
--- a/drape_frontend/poi_symbol_shape.hpp
+++ b/drape_frontend/poi_symbol_shape.hpp
@@ -16,8 +16,7 @@ class PoiSymbolShape : public MapShape
{
public:
PoiSymbolShape(m2::PointD const & mercatorPt, PoiSymbolViewParams const & params,
- TileKey const & tileKey, uint32_t textIndex,
- bool specialDisplacementMode = false, uint16_t specialModePriority = 0xFFFF);
+ TileKey const & tileKey, uint32_t textIndex);
void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const override;
MapShapeType GetType() const override { return MapShapeType::OverlayType; }
@@ -28,8 +27,6 @@ private:
m2::PointD const m_pt;
PoiSymbolViewParams const m_params;
- bool const m_specialDisplacementMode;
- uint16_t const m_specialModePriority;
m2::PointI const m_tileCoords;
uint32_t const m_textIndex;
};
diff --git a/drape_frontend/render_group.cpp b/drape_frontend/render_group.cpp
index 40de7e3c73..827de705b3 100755
--- a/drape_frontend/render_group.cpp
+++ b/drape_frontend/render_group.cpp
@@ -9,11 +9,11 @@
#include "base/stl_add.hpp"
-#include "std/bind.hpp"
+#include <sstream>
+#include <utility>
namespace df
{
-
void BaseRenderGroup::SetRenderParams(ref_ptr<dp::GpuProgram> shader, ref_ptr<dp::GpuProgram> shader3d,
ref_ptr<dp::UniformValuesStorage> generalUniforms)
{
@@ -38,17 +38,11 @@ void BaseRenderGroup::Render(const ScreenBase & screen)
dp::ApplyUniforms(*(m_generalUniforms.get()), shader);
}
-bool BaseRenderGroup::IsOverlay() const
-{
- return m_state.GetDepthLayer() == dp::GLState::OverlayLayer;
-}
-
RenderGroup::RenderGroup(dp::GLState const & state, df::TileKey const & tileKey)
: TBase(state, tileKey)
, m_pendingOnDelete(false)
, m_canBeDeleted(false)
-{
-}
+{}
RenderGroup::~RenderGroup()
{
@@ -74,6 +68,16 @@ void RenderGroup::CollectOverlay(ref_ptr<dp::OverlayTree> tree)
renderBucket->CollectOverlayHandles(tree);
}
+bool RenderGroup::HasOverlayHandles() const
+{
+ for (auto & renderBucket : m_renderBuckets)
+ {
+ if (renderBucket->HasOverlayHandles())
+ return true;
+ }
+ return false;
+}
+
void RenderGroup::RemoveOverlay(ref_ptr<dp::OverlayTree> tree)
{
for (auto & renderBucket : m_renderBuckets)
@@ -97,7 +101,7 @@ void RenderGroup::Render(ScreenBase const & screen)
int const programIndex = m_state.GetProgramIndex();
int const program3dIndex = m_state.GetProgram3dIndex();
- if (m_state.GetDepthLayer() == dp::GLState::OverlayLayer)
+ if (IsOverlay())
{
if (programIndex == gpu::COLORED_SYMBOL_PROGRAM ||
programIndex == gpu::COLORED_SYMBOL_BILLBOARD_PROGRAM)
@@ -145,12 +149,13 @@ void RenderGroup::Render(ScreenBase const & screen)
void RenderGroup::AddBucket(drape_ptr<dp::RenderBucket> && bucket)
{
- m_renderBuckets.push_back(move(bucket));
+ m_renderBuckets.push_back(std::move(bucket));
}
-bool RenderGroup::IsLess(RenderGroup const & other) const
+bool RenderGroup::IsOverlay() const
{
- return m_state < other.m_state;
+ return (m_state.GetDepthLayer() == dp::GLState::OverlayLayer) ||
+ (m_state.GetDepthLayer() == dp::GLState::NavigationLayer && HasOverlayHandles());
}
bool RenderGroup::UpdateCanBeDeletedStatus(bool canBeDeleted, int currentZoom, ref_ptr<dp::OverlayTree> tree)
@@ -193,11 +198,7 @@ bool RenderGroupComparator::operator()(drape_ptr<RenderGroup> const & l, drape_p
return lState < rState;
}
-
- if (rCanBeDeleted)
- return true;
-
- return false;
+ return rCanBeDeleted;
}
UserMarkRenderGroup::UserMarkRenderGroup(dp::GLState const & state, TileKey const & tileKey)
@@ -218,7 +219,7 @@ void UserMarkRenderGroup::UpdateAnimation()
BaseRenderGroup::UpdateAnimation();
float t = 1.0;
if (m_animation)
- t = m_animation->GetOpacity();
+ t = static_cast<float>(m_animation->GetOpacity());
m_uniforms.SetFloatValue("u_interpolationT", m_mapping.GetValue(t));
}
@@ -228,11 +229,10 @@ bool UserMarkRenderGroup::IsUserPoint() const
return m_state.GetProgramIndex() != gpu::LINE_PROGRAM;
}
-string DebugPrint(RenderGroup const & group)
+std::string DebugPrint(RenderGroup const & group)
{
- ostringstream out;
+ std::ostringstream out;
out << DebugPrint(group.GetTileKey());
return out.str();
}
-
-} // namespace df
+} // namespace df
diff --git a/drape_frontend/render_group.hpp b/drape_frontend/render_group.hpp
index 6ec6102120..de89ec815a 100755
--- a/drape_frontend/render_group.hpp
+++ b/drape_frontend/render_group.hpp
@@ -4,14 +4,13 @@
#include "drape_frontend/animation/value_mapping.hpp"
#include "drape_frontend/tile_utils.hpp"
-#include "drape/pointers.hpp"
#include "drape/glstate.hpp"
+#include "drape/pointers.hpp"
#include "drape/render_bucket.hpp"
-#include "std/deque.hpp"
-#include "std/vector.hpp"
-#include "std/set.hpp"
-#include "std/unique_ptr.hpp"
+#include <memory>
+#include <vector>
+#include <string>
class ScreenBase;
namespace dp { class OverlayTree; }
@@ -24,7 +23,8 @@ class BaseRenderGroup
public:
BaseRenderGroup(dp::GLState const & state, TileKey const & tileKey)
: m_state(state)
- , m_tileKey(tileKey) {}
+ , m_tileKey(tileKey)
+ {}
virtual ~BaseRenderGroup() {}
@@ -34,7 +34,6 @@ public:
dp::GLState const & GetState() const { return m_state; }
TileKey const & GetTileKey() const { return m_tileKey; }
dp::UniformValuesStorage const & GetUniforms() const { return m_uniforms; }
- bool IsOverlay() const;
virtual void UpdateAnimation();
virtual void Render(ScreenBase const & screen);
@@ -60,6 +59,7 @@ public:
void Update(ScreenBase const & modelView);
void CollectOverlay(ref_ptr<dp::OverlayTree> tree);
+ bool HasOverlayHandles() const;
void RemoveOverlay(ref_ptr<dp::OverlayTree> tree);
void Render(ScreenBase const & screen) override;
@@ -73,15 +73,15 @@ public:
bool UpdateCanBeDeletedStatus(bool canBeDeleted, int currentZoom, ref_ptr<dp::OverlayTree> tree);
- bool IsLess(RenderGroup const & other) const;
+ bool IsOverlay() const;
private:
- vector<drape_ptr<dp::RenderBucket> > m_renderBuckets;
+ std::vector<drape_ptr<dp::RenderBucket>> m_renderBuckets;
mutable bool m_pendingOnDelete;
mutable bool m_canBeDeleted;
private:
- friend string DebugPrint(RenderGroup const & group);
+ friend std::string DebugPrint(RenderGroup const & group);
};
class RenderGroupComparator
@@ -104,8 +104,7 @@ public:
bool IsUserPoint() const;
private:
- unique_ptr<OpacityAnimation> m_animation;
+ std::unique_ptr<OpacityAnimation> m_animation;
ValueMapping<float> m_mapping;
};
-
-} // namespace df
+} // namespace df
diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp
index 740980bb83..5f2850ce5a 100644
--- a/drape_frontend/rule_drawer.cpp
+++ b/drape_frontend/rule_drawer.cpp
@@ -12,6 +12,7 @@
#include "indexer/feature_algo.hpp"
#include "indexer/feature_visibility.hpp"
#include "indexer/ftypes_matcher.hpp"
+#include "indexer/map_style_reader.hpp"
#include "indexer/road_shields_parser.hpp"
#include "indexer/scales.hpp"
@@ -417,10 +418,18 @@ void RuleDrawer::ProcessPointStyle(FeatureType const & f, Stylist const & s, TIn
int & minVisibleScale)
{
int const zoomLevel = m_context->GetTileKey().m_zoomLevel;
+ bool const isSpeedCamera = ftypes::IsSpeedCamChecker::Instance()(f);
+ if (isSpeedCamera && !GetStyleReader().IsCarNavigationStyle())
+ return;
+
+ dp::GLState::DepthLayer depthLayer = dp::GLState::OverlayLayer;
+ if (isSpeedCamera)
+ depthLayer = dp::GLState::NavigationLayer;
minVisibleScale = feature::GetMinDrawableScale(f);
ApplyPointFeature apply(m_context->GetTileKey(), insertShape, f.GetID(), minVisibleScale, f.GetRank(),
- s.GetCaptionDescription(), 0.0f /* posZ */, m_context->GetDisplacementMode());
+ s.GetCaptionDescription(), 0.0f /* posZ */, m_context->GetDisplacementMode(),
+ depthLayer);
apply.SetHotelData(ExtractHotelData(f));
f.ForEachPoint([&apply](m2::PointD const & pt) { apply(pt, false /* hasArea */); }, zoomLevel);
@@ -524,6 +533,7 @@ void RuleDrawer::DrawTileNet(TInsertShapeFn const & insertShape)
p.m_cap = dp::ButtCap;
p.m_color = dp::Color::Red();
p.m_depth = 20000;
+ p.m_depthLayer = dp::GLState::GeometryLayer;
p.m_width = 5;
p.m_join = dp::RoundJoin;
@@ -533,6 +543,7 @@ void RuleDrawer::DrawTileNet(TInsertShapeFn const & insertShape)
tp.m_tileCenter = m_globalRect.Center();
tp.m_anchor = dp::Center;
tp.m_depth = 20000;
+ tp.m_depthLayer = dp::GLState::OverlayLayer;
tp.m_primaryText = strings::to_string(key.m_x) + " " +
strings::to_string(key.m_y) + " " +
strings::to_string(key.m_zoomLevel);
diff --git a/drape_frontend/shape_view_params.hpp b/drape_frontend/shape_view_params.hpp
index fde5123bf8..93d8e662d1 100644
--- a/drape_frontend/shape_view_params.hpp
+++ b/drape_frontend/shape_view_params.hpp
@@ -1,34 +1,43 @@
#pragma once
-#include "drape/drape_global.hpp"
#include "drape/color.hpp"
+#include "drape/drape_global.hpp"
+#include "drape/glstate.hpp"
#include "drape/stipple_pen_resource.hpp"
#include "indexer/feature_decl.hpp"
#include "geometry/point2d.hpp"
-#include "std/string.hpp"
+#include <cstdint>
+#include <limits>
+#include <string>
namespace df
{
-
double const kShapeCoordScalar = 1000;
int constexpr kBuildingOutlineSize = 16;
struct CommonViewParams
{
+ dp::GLState::DepthLayer m_depthLayer = dp::GLState::GeometryLayer;
float m_depth = 0.0f;
int m_minVisibleScale = 0;
uint8_t m_rank = 0;
m2::PointD m_tileCenter;
};
-struct PoiSymbolViewParams : CommonViewParams
+struct CommonOverlayViewParams : public CommonViewParams
+{
+ bool m_specialDisplacementMode = false;
+ uint16_t m_specialModePriority = std::numeric_limits<uint16_t>::max();;
+};
+
+struct PoiSymbolViewParams : CommonOverlayViewParams
{
PoiSymbolViewParams(FeatureID const & id) : m_id(id) {}
FeatureID m_id;
- string m_symbolName;
+ std::string m_symbolName;
uint32_t m_extendingSize;
float m_posZ = 0.0f;
bool m_hasArea = false;
@@ -60,15 +69,15 @@ struct LineViewParams : CommonViewParams
int m_zoomLevel = -1;
};
-struct TextViewParams : CommonViewParams
+struct TextViewParams : CommonOverlayViewParams
{
TextViewParams() {}
FeatureID m_featureID;
dp::FontDecl m_primaryTextFont;
- string m_primaryText;
+ std::string m_primaryText;
dp::FontDecl m_secondaryTextFont;
- string m_secondaryText;
+ std::string m_secondaryText;
dp::Anchor m_anchor;
m2::PointF m_primaryOffset = m2::PointF(0.0f, 0.0f);
m2::PointF m_secondaryOffset = m2::PointF(0.0f, 0.0f);
@@ -82,7 +91,7 @@ struct TextViewParams : CommonViewParams
m2::PointF m_limits = m2::PointF(0.0f, 0.0f);
};
-struct PathTextViewParams : CommonViewParams
+struct PathTextViewParams : CommonOverlayViewParams
{
FeatureID m_featureID;
dp::FontDecl m_textFont;
@@ -94,13 +103,13 @@ struct PathTextViewParams : CommonViewParams
struct PathSymbolViewParams : CommonViewParams
{
FeatureID m_featureID;
- string m_symbolName;
+ std::string m_symbolName;
float m_offset = 0.0f;
float m_step = 0.0f;
float m_baseGtoPScale = 1.0f;
};
-struct ColoredSymbolViewParams : CommonViewParams
+struct ColoredSymbolViewParams : CommonOverlayViewParams
{
enum class Shape
{
@@ -117,5 +126,4 @@ struct ColoredSymbolViewParams : CommonViewParams
float m_outlineWidth = 0.0f;
m2::PointF m_offset = m2::PointF(0.0f, 0.0f);
};
-
-} // namespace df
+} // namespace df
diff --git a/drape_frontend/text_layout.cpp b/drape_frontend/text_layout.cpp
index d91cd9eb73..eb4d22ac36 100644
--- a/drape_frontend/text_layout.cpp
+++ b/drape_frontend/text_layout.cpp
@@ -278,6 +278,13 @@ void CalculateOffsets(dp::Anchor anchor, float textRatio,
pixelSize = m2::PointF(maxLength, summaryHeight);
}
+
+float GetTextMinPeriod(float pixelTextLength)
+{
+ float const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
+ float const etalonEmpty = std::max(300.0f * vs, pixelTextLength);
+ return etalonEmpty + pixelTextLength;
+}
} // namespace
void TextLayout::Init(strings::UniString const & text, float fontSize, bool isSdf,
@@ -479,14 +486,14 @@ float PathTextLayout::CalculateTextLength(float textPixelLength)
return kTextBorder + textPixelLength;
}
-bool PathTextLayout::CalculatePerspectivePosition(float splineLength, float textPixelLength,
- float & offset)
+bool PathTextLayout::CalculatePerspectivePosition(float pixelSplineLength, float textPixelLength,
+ uint32_t textIndex, float & offset)
{
+ UNUSED_VALUE(textIndex);
float const textLength = CalculateTextLength(textPixelLength);
- if (textLength > splineLength * 2.0f)
+ if (textLength > pixelSplineLength * 2.0f)
return false;
-
- offset = splineLength * 0.5f;
+ offset = pixelSplineLength * 0.5f;
return true;
}
@@ -501,10 +508,7 @@ void PathTextLayout::CalculatePositions(float splineLength, float splineScaleToP
float const kPathLengthScalar = 0.75;
float const pathLength = kPathLengthScalar * splineScaleToPixel * splineLength;
-
- float const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
- float const etalonEmpty = std::max(300.0f * vs, textLength);
- float const minPeriodSize = etalonEmpty + textLength;
+ float const minPeriodSize = GetTextMinPeriod(textLength);
float const twoTextsAndEmpty = minPeriodSize + textLength;
if (pathLength < twoTextsAndEmpty)
@@ -515,7 +519,7 @@ void PathTextLayout::CalculatePositions(float splineLength, float splineScaleToP
}
else
{
- double const textCount = max(floor(static_cast<double>(pathLength / minPeriodSize)), 1.0);
+ double const textCount = std::max(floor(static_cast<double>(pathLength / minPeriodSize)), 1.0);
double const glbTextLen = splineLength / textCount;
for (double offset = 0.5 * glbTextLen; offset < splineLength; offset += glbTextLen)
offsets.push_back(static_cast<float>(offset));
diff --git a/drape_frontend/text_layout.hpp b/drape_frontend/text_layout.hpp
index 87b261bb19..2a82ba1cab 100644
--- a/drape_frontend/text_layout.hpp
+++ b/drape_frontend/text_layout.hpp
@@ -95,8 +95,8 @@ public:
m2::PointD const & globalPivot,
gpu::TTextDynamicVertexBuffer & buffer) const;
- static bool CalculatePerspectivePosition(float splineLength, float textPixelLength,
- float & offset);
+ static bool CalculatePerspectivePosition(float pixelSplineLength, float textPixelLength,
+ uint32_t textIndex, float & offset);
static void CalculatePositions(float splineLength, float splineScaleToPixel,
float textPixelLength, std::vector<float> & offsets);
diff --git a/drape_frontend/text_shape.cpp b/drape_frontend/text_shape.cpp
index 96db75cdef..56b041a642 100644
--- a/drape_frontend/text_shape.cpp
+++ b/drape_frontend/text_shape.cpp
@@ -12,6 +12,8 @@
#include "base/string_utils.hpp"
+#include <utility>
+
namespace df
{
namespace
@@ -25,15 +27,13 @@ public:
dp::Anchor anchor, glsl::vec2 const & pivot,
glsl::vec2 const & pxSize, glsl::vec2 const & offset,
uint64_t priority, int fixedHeight,
- ref_ptr<dp::TextureManager> textureManager,
- bool isOptional, bool affectedByZoomPriority,
+ ref_ptr<dp::TextureManager> textureManager, bool isOptional,
gpu::TTextDynamicVertexBuffer && normals, bool isBillboard = false)
- : TextHandle(id, text, anchor, priority, fixedHeight, textureManager, move(normals), isBillboard)
+ : TextHandle(id, text, anchor, priority, fixedHeight, textureManager, std::move(normals), isBillboard)
, m_pivot(glsl::ToPoint(pivot))
, m_offset(glsl::ToPoint(offset))
, m_size(glsl::ToPoint(pxSize))
, m_isOptional(isOptional)
- , m_affectedByZoomPriority(affectedByZoomPriority)
{}
m2::PointD GetPivot(ScreenBase const & screen, bool perspective) const override
@@ -96,14 +96,6 @@ public:
rects.emplace_back(GetPixelRect(screen, perspective));
}
- uint64_t GetPriorityMask() const override
- {
- if (!m_affectedByZoomPriority)
- return dp::kPriorityMaskManual | dp::kPriorityMaskRank;
-
- return dp::kPriorityMaskAll;
- }
-
bool IsBound() const override
{
return !m_isOptional;
@@ -114,23 +106,18 @@ private:
m2::PointF m_offset;
m2::PointF m_size;
bool m_isOptional;
- bool m_affectedByZoomPriority;
};
} // namespace
TextShape::TextShape(m2::PointD const & basePoint, TextViewParams const & params,
TileKey const & tileKey, bool hasPOI, m2::PointF const & symbolSize,
- uint32_t textIndex, bool affectedByZoomPriority,
- bool specialDisplacementMode, uint16_t specialModePriority)
+ uint32_t textIndex)
: m_basePoint(basePoint)
, m_params(params)
, m_tileCoords(tileKey.GetTileCoords())
, m_hasPOI(hasPOI)
, m_symbolSize(symbolSize)
- , m_affectedByZoomPriority(affectedByZoomPriority)
, m_textIndex(textIndex)
- , m_specialDisplacementMode(specialDisplacementMode)
- , m_specialModePriority(specialModePriority)
{}
void TextShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const
@@ -252,7 +239,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe
baseOffset, color, staticBuffer, dynamicBuffer);
bool const isNonSdfText = layout.GetFixedHeight() > 0;
- dp::GLState state(isNonSdfText ? gpu::TEXT_FIXED_PROGRAM : gpu::TEXT_PROGRAM, dp::GLState::OverlayLayer);
+ dp::GLState state(isNonSdfText ? gpu::TEXT_FIXED_PROGRAM : gpu::TEXT_PROGRAM, m_params.m_depthLayer);
state.SetProgram3dIndex(isNonSdfText ? gpu::TEXT_FIXED_BILLBOARD_PROGRAM : gpu::TEXT_BILLBOARD_PROGRAM);
ASSERT(color.GetTexture() == outline.GetTexture(), ());
@@ -277,8 +264,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe
layout.GetFixedHeight(),
textures,
isOptional,
- m_affectedByZoomPriority,
- move(dynamicBuffer),
+ std::move(dynamicBuffer),
true);
handle->SetPivotZ(m_params.m_posZ);
handle->SetOverlayRank(m_hasPOI ? (isPrimary ? dp::OverlayRank1 : dp::OverlayRank2)
@@ -288,7 +274,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe
dp::AttributeProvider provider(2, static_cast<uint32_t>(staticBuffer.size()));
provider.InitStream(0, gpu::TextStaticVertex::GetBindingInfo(), make_ref(staticBuffer.data()));
provider.InitStream(1, gpu::TextDynamicVertex::GetBindingInfo(), make_ref(initialDynBuffer.data()));
- batcher->InsertListOfStrip(state, make_ref(&provider), move(handle), 4);
+ batcher->InsertListOfStrip(state, make_ref(&provider), std::move(handle), 4);
}
void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::FontDecl const & font,
@@ -306,7 +292,7 @@ void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::Fon
layout.Cache(glsl::vec4(pt, m_params.m_depth, -m_params.m_posZ),
baseOffset, color, outline, staticBuffer, dynamicBuffer);
- dp::GLState state(gpu::TEXT_OUTLINED_PROGRAM, dp::GLState::OverlayLayer);
+ dp::GLState state(gpu::TEXT_OUTLINED_PROGRAM, m_params.m_depthLayer);
state.SetProgram3dIndex(gpu::TEXT_OUTLINED_BILLBOARD_PROGRAM);
ASSERT(color.GetTexture() == outline.GetTexture(), ());
state.SetColorTexture(color.GetTexture());
@@ -327,8 +313,7 @@ void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::Fon
layout.GetFixedHeight(),
textures,
isOptional,
- m_affectedByZoomPriority,
- move(dynamicBuffer),
+ std::move(dynamicBuffer),
true);
handle->SetPivotZ(m_params.m_posZ);
handle->SetOverlayRank(m_hasPOI ? (isPrimary ? dp::OverlayRank1 : dp::OverlayRank2)
@@ -338,7 +323,7 @@ void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::Fon
dp::AttributeProvider provider(2, static_cast<uint32_t>(staticBuffer.size()));
provider.InitStream(0, gpu::TextOutlinedStaticVertex::GetBindingInfo(), make_ref(staticBuffer.data()));
provider.InitStream(1, gpu::TextDynamicVertex::GetBindingInfo(), make_ref(initialDynBuffer.data()));
- batcher->InsertListOfStrip(state, make_ref(&provider), move(handle), 4);
+ batcher->InsertListOfStrip(state, make_ref(&provider), std::move(handle), 4);
}
uint64_t TextShape::GetOverlayPriority() const
@@ -349,8 +334,8 @@ uint64_t TextShape::GetOverlayPriority() const
return dp::kPriorityMaskAll;
// Special displacement mode.
- if (m_specialDisplacementMode)
- return dp::CalculateSpecialModePriority(m_specialModePriority);
+ if (m_params.m_specialDisplacementMode)
+ return dp::CalculateSpecialModePriority(m_params.m_specialModePriority);
// Set up minimal priority for shapes which belong to areas
if (m_params.m_hasArea)
diff --git a/drape_frontend/text_shape.hpp b/drape_frontend/text_shape.hpp
index 2ea100fd07..e5176e5e3d 100644
--- a/drape_frontend/text_shape.hpp
+++ b/drape_frontend/text_shape.hpp
@@ -16,9 +16,7 @@ class TextShape : public MapShape
{
public:
TextShape(m2::PointD const & basePoint, TextViewParams const & params,
- TileKey const & tileKey, bool hasPOI, m2::PointF const & symbolSize,
- uint32_t textIndex, bool affectedByZoomPriority,
- bool specialDisplacementMode = false, uint16_t specialModePriority = 0xFFFF);
+ TileKey const & tileKey, bool hasPOI, m2::PointF const & symbolSize, uint32_t textIndex);
void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const override;
MapShapeType GetType() const override { return MapShapeType::OverlayType; }
@@ -45,12 +43,8 @@ private:
m2::PointI m_tileCoords;
bool m_hasPOI;
m2::PointF m_symbolSize;
- bool m_affectedByZoomPriority;
uint32_t m_textIndex;
- bool m_specialDisplacementMode;
- uint16_t m_specialModePriority;
-
bool m_disableDisplacing = false;
};
} // namespace df
diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp
index 4bed0fa666..58674280fe 100644
--- a/drape_frontend/user_mark_shapes.cpp
+++ b/drape_frontend/user_mark_shapes.cpp
@@ -5,6 +5,7 @@
#include "drape_frontend/shader_def.hpp"
#include "drape_frontend/shape_view_params.hpp"
#include "drape_frontend/tile_utils.hpp"
+#include "drape_frontend/visual_params.hpp"
#include "drape/utils/vertex_decl.hpp"
#include "drape/attribute_provider.hpp"
@@ -130,6 +131,7 @@ void CacheUserLines(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
UserLinesRenderCollection const & renderParams, LineIndexesCollection const & indexes,
dp::Batcher & batcher)
{
+ float const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale());
for (auto lineIndex : indexes)
{
UserLineRenderParams const & renderInfo = renderParams[lineIndex];
@@ -146,7 +148,7 @@ void CacheUserLines(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
params.m_join = dp::RoundJoin;
params.m_color = layer.m_color;
params.m_depth = layer.m_depth;
- params.m_width = layer.m_width;
+ params.m_width = layer.m_width * vs;
params.m_minVisibleScale = 1;
params.m_rank = 0;
diff --git a/indexer/map_style_reader.cpp b/indexer/map_style_reader.cpp
index 1ebedfaccb..1c9646901d 100644
--- a/indexer/map_style_reader.cpp
+++ b/indexer/map_style_reader.cpp
@@ -69,12 +69,18 @@ void StyleReader::SetCurrentStyle(MapStyle mapStyle)
m_mapStyle = mapStyle;
}
-MapStyle StyleReader::GetCurrentStyle()
+MapStyle StyleReader::GetCurrentStyle() const
{
return m_mapStyle;
}
-ReaderPtr<Reader> StyleReader::GetDrawingRulesReader()
+bool StyleReader::IsCarNavigationStyle() const
+{
+ return m_mapStyle == MapStyle::MapStyleVehicleClear ||
+ m_mapStyle == MapStyle::MapStyleVehicleDark;
+}
+
+ReaderPtr<Reader> StyleReader::GetDrawingRulesReader() const
{
std::string rulesFile =
std::string("drules_proto") + GetStyleRulesSuffix(GetCurrentStyle()) + ".bin";
@@ -88,7 +94,7 @@ ReaderPtr<Reader> StyleReader::GetDrawingRulesReader()
}
ReaderPtr<Reader> StyleReader::GetResourceReader(std::string const & file,
- std::string const & density)
+ std::string const & density) const
{
std::string const resourceDir =
std::string("resources-") + density + GetStyleResourcesSuffix(GetCurrentStyle());
@@ -102,7 +108,7 @@ ReaderPtr<Reader> StyleReader::GetResourceReader(std::string const & file,
return GetPlatform().GetReader(resFile);
}
-ReaderPtr<Reader> StyleReader::GetDefaultResourceReader(std::string const & file)
+ReaderPtr<Reader> StyleReader::GetDefaultResourceReader(std::string const & file) const
{
return GetPlatform().GetReader(my::JoinFoldersToPath("resources-default", file));
}
diff --git a/indexer/map_style_reader.hpp b/indexer/map_style_reader.hpp
index 5c488614d3..498f370d1e 100644
--- a/indexer/map_style_reader.hpp
+++ b/indexer/map_style_reader.hpp
@@ -12,12 +12,13 @@ public:
StyleReader();
void SetCurrentStyle(MapStyle mapStyle);
- MapStyle GetCurrentStyle();
+ MapStyle GetCurrentStyle() const;
+ bool IsCarNavigationStyle() const;
- ReaderPtr<Reader> GetDrawingRulesReader();
+ ReaderPtr<Reader> GetDrawingRulesReader() const;
- ReaderPtr<Reader> GetResourceReader(std::string const & file, std::string const & density);
- ReaderPtr<Reader> GetDefaultResourceReader(std::string const & file);
+ ReaderPtr<Reader> GetResourceReader(std::string const & file, std::string const & density) const;
+ ReaderPtr<Reader> GetDefaultResourceReader(std::string const & file) const;
private:
MapStyle m_mapStyle;
diff --git a/local_ads/config.hpp b/local_ads/config.hpp
index 3329ad4472..a781d3f311 100644
--- a/local_ads/config.hpp
+++ b/local_ads/config.hpp
@@ -4,4 +4,4 @@
//#define DEV_LOCAL_ADS_SERVER
// Use stage local ads servers.
-#define STAGE_LOCAL_ADS_SERVER
+//#define STAGE_LOCAL_ADS_SERVER
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp
index 2c1bbb964a..9cff26240b 100644
--- a/qt/draw_widget.cpp
+++ b/qt/draw_widget.cpp
@@ -355,13 +355,38 @@ void DrawWidget::SubmitRoutingPoint(m2::PointD const & pt)
void DrawWidget::FollowRoute()
{
auto & routingManager = m_framework.GetRoutingManager();
+
+ auto const points = routingManager.GetRoutePoints();
+ if (points.size() < 2)
+ return;
+ if (!points.front().m_isMyPosition && !points.back().m_isMyPosition)
+ return;
if (routingManager.IsRoutingActive() && !routingManager.IsRoutingFollowing())
+ {
routingManager.FollowRoute();
+ auto style = m_framework.GetMapStyle();
+ if (style == MapStyle::MapStyleClear)
+ SetMapStyle(MapStyle::MapStyleVehicleClear);
+ else if (style == MapStyle::MapStyleDark)
+ SetMapStyle(MapStyle::MapStyleVehicleDark);
+ }
}
void DrawWidget::ClearRoute()
{
- m_framework.GetRoutingManager().CloseRouting(true /* remove route points */);
+ auto & routingManager = m_framework.GetRoutingManager();
+
+ bool const wasActive = routingManager.IsRoutingActive() && routingManager.IsRoutingFollowing();
+ routingManager.CloseRouting(true /* remove route points */);
+
+ if (wasActive)
+ {
+ auto style = m_framework.GetMapStyle();
+ if (style == MapStyle::MapStyleVehicleClear)
+ SetMapStyle(MapStyle::MapStyleClear);
+ else if (style == MapStyle::MapStyleVehicleDark)
+ SetMapStyle(MapStyle::MapStyleDark);
+ }
}
void DrawWidget::ShowPlacePage(place_page::Info const & info)