From 048e100b0edb5ed45f4e5596ba1fadc9b0f4b51e Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Mon, 28 Mar 2016 12:34:44 +0300 Subject: [PATCH] Added maximum priority for overlays which created by the editor --- drape_frontend/apply_feature_functors.cpp | 6 ++++++ drape_frontend/apply_feature_functors.hpp | 1 + drape_frontend/circle_shape.cpp | 4 ++++ drape_frontend/poi_symbol_shape.cpp | 4 ++++ drape_frontend/shape_view_params.hpp | 3 +++ drape_frontend/text_shape.cpp | 3 ++- indexer/osm_editor.cpp | 6 +++++- indexer/osm_editor.hpp | 2 ++ 8 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index c02af0ab79..e85d0b46dc 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -12,6 +12,7 @@ #include "indexer/drawing_rules.hpp" #include "indexer/drules_include.hpp" +#include "indexer/osm_editor.hpp" #include "geometry/clipping.hpp" @@ -243,6 +244,7 @@ ApplyPointFeature::ApplyPointFeature(TInsertShapeFn const & insertShape, Feature , m_posZ(posZ) , m_hasPoint(false) , m_hasArea(false) + , m_createdByEditor(false) , m_symbolDepth(dp::minDepth) , m_circleDepth(dp::minDepth) , m_symbolRule(NULL) @@ -254,6 +256,7 @@ void ApplyPointFeature::operator()(m2::PointD const & point, bool hasArea) { m_hasPoint = true; m_hasArea = hasArea; + m_createdByEditor = osm::Editor::IsCreatedFeature(m_id); m_centerPoint = point; } @@ -290,6 +293,7 @@ void ApplyPointFeature::ProcessRule(Stylist::TRuleWrapper const & rule) params.m_rank = m_rank; params.m_posZ = m_posZ; params.m_hasArea = m_hasArea; + params.m_createdByEditor = m_createdByEditor; if(!params.m_primaryText.empty() || !params.m_secondaryText.empty()) { m_insertShape(make_unique_dp(m_centerPoint, params, hasPOI, 0 /* textIndex */, @@ -313,6 +317,7 @@ void ApplyPointFeature::Finish() params.m_color = ToDrapeColor(m_circleRule->color()); params.m_radius = m_circleRule->radius(); params.m_hasArea = m_hasArea; + params.m_createdByEditor = m_createdByEditor; m_insertShape(make_unique_dp(m_centerPoint, params)); } else if (m_symbolRule) @@ -326,6 +331,7 @@ void ApplyPointFeature::Finish() params.m_extendingSize = m_symbolRule->has_min_distance() ? mainScale * m_symbolRule->min_distance() : 0; params.m_posZ = m_posZ; params.m_hasArea = m_hasArea; + params.m_createdByEditor = m_createdByEditor; m_insertShape(make_unique_dp(m_centerPoint, params)); } } diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp index 8db6978ed1..8667f68d03 100644 --- a/drape_frontend/apply_feature_functors.hpp +++ b/drape_frontend/apply_feature_functors.hpp @@ -67,6 +67,7 @@ protected: private: bool m_hasPoint; bool m_hasArea; + bool m_createdByEditor; double m_symbolDepth; double m_circleDepth; SymbolRuleProto const * m_symbolRule; diff --git a/drape_frontend/circle_shape.cpp b/drape_frontend/circle_shape.cpp index 138f450d4b..38603d0935 100644 --- a/drape_frontend/circle_shape.cpp +++ b/drape_frontend/circle_shape.cpp @@ -64,6 +64,10 @@ void CircleShape::Draw(ref_ptr batcher, ref_ptr uint64_t CircleShape::GetOverlayPriority() const { + // Set up maximum priority for shapes which created by user in the editor. + if (m_params.m_createdByEditor) + return dp::kPriorityMaskAll; + // Set up minimal priority for shapes which belong to areas. if (m_params.m_hasArea) return 0; diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp index 7698544ae9..0ab6abfd49 100644 --- a/drape_frontend/poi_symbol_shape.cpp +++ b/drape_frontend/poi_symbol_shape.cpp @@ -64,6 +64,10 @@ void PoiSymbolShape::Draw(ref_ptr batcher, ref_ptr::max() - 0xfffff; -bool IsCreatedFeature(FeatureID const & fid) { return fid.m_index >= kStartIndexForCreatedFeatures; } } // namespace + +bool Editor::IsCreatedFeature(FeatureID const & fid) +{ + return fid.m_index >= kStartIndexForCreatedFeatures; +} Editor::SaveResult Editor::SaveEditedFeature(EditableMapObject const & emo) { diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index c41e2e1f7e..1cd83ae71d 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -127,6 +127,8 @@ public: time_t m_lastUploadTimestamp = my::INVALID_TIME_STAMP; }; Stats GetStats() const; + + static bool IsCreatedFeature(FeatureID const & fid); private: // TODO(AlexZ): Synchronize Save call/make it on a separate thread.