From cb0d4de470477747f347c250f58bc386fd8880a8 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Thu, 16 Mar 2017 14:53:55 +0300 Subject: [PATCH] Added support of custom symbols for specific POI --- .gitignore | 2 + drape_frontend/CMakeLists.txt | 1 + drape_frontend/apply_feature_functors.cpp | 61 +++++++++++-------- drape_frontend/apply_feature_functors.hpp | 5 +- drape_frontend/backend_renderer.cpp | 10 +++ drape_frontend/custom_symbol.hpp | 35 +++++++++++ drape_frontend/drape_engine.cpp | 14 ++--- drape_frontend/drape_engine.hpp | 3 + drape_frontend/drape_frontend.pro | 1 + drape_frontend/frontend_renderer.cpp | 7 +++ drape_frontend/message.hpp | 1 + drape_frontend/message_subclasses.hpp | 16 +++++ drape_frontend/poi_symbol_shape.cpp | 11 +--- drape_frontend/read_manager.cpp | 8 ++- drape_frontend/read_manager.hpp | 5 ++ drape_frontend/rule_drawer.cpp | 18 +++--- drape_frontend/rule_drawer.hpp | 11 +++- drape_frontend/shape_view_params.hpp | 2 +- drape_frontend/tile_info.cpp | 12 ++-- drape_frontend/tile_info.hpp | 5 +- drape_frontend/visual_params.cpp | 10 +-- drape_frontend/visual_params.hpp | 2 +- .../drape_frontend.xcodeproj/project.pbxproj | 4 ++ 23 files changed, 178 insertions(+), 66 deletions(-) create mode 100644 drape_frontend/custom_symbol.hpp diff --git a/.gitignore b/.gitignore index c8b592f9cd..c2a5b6eead 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,5 @@ server *.li *.autosave + +cmake-build-* diff --git a/drape_frontend/CMakeLists.txt b/drape_frontend/CMakeLists.txt index af376b9d8f..693dbe216f 100644 --- a/drape_frontend/CMakeLists.txt +++ b/drape_frontend/CMakeLists.txt @@ -61,6 +61,7 @@ set( color_constants.hpp colored_symbol_shape.cpp colored_symbol_shape.hpp + custom_symbol.hpp drape_api.cpp drape_api.hpp drape_api_builder.cpp diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index 47274d1ee2..5c7cbd4752 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -47,8 +47,6 @@ std::string const kStarSymbol = "★"; std::string const kPriceSymbol = "$"; df::ColorConstant const kPoiHotelTextOutlineColor = "PoiHotelTextOutline"; -df::ColorConstant const kRoadShieldAddTextColor = "RoadShieldAddText"; -df::ColorConstant const kRoadShieldAddTextOutlineColor = "RoadShieldAddTextOutline"; df::ColorConstant const kRoadShieldBlackTextColor = "RoadShieldBlackText"; df::ColorConstant const kRoadShieldWhiteTextColor = "RoadShieldWhiteText"; df::ColorConstant const kRoadShieldUKYellowTextColor = "RoadShieldUKYellowText"; @@ -60,9 +58,9 @@ df::ColorConstant const kRoadShieldOrangeBackgroundColor = "RoadShieldOrangeBack int const kLineSimplifyLevelStart = 10; int const kLineSimplifyLevelEnd = 12; -double const kPathTextBaseTextIndex = 0; -double const kPathTextBaseTextStep = 100; -double const kShieldBaseTextIndex = 1000; +uint32_t const kPathTextBaseTextIndex = 0; +uint32_t const kPathTextBaseTextStep = 100; +uint32_t const kShieldBaseTextIndex = 1000; #ifdef CALC_FILTERED_POINTS class LinesStat @@ -131,7 +129,7 @@ private: void Extract(::LineDefProto const * lineRule, df::LineViewParams & params) { - float const scale = df::VisualParams::Instance().GetVisualScale(); + double const scale = df::VisualParams::Instance().GetVisualScale(); params.m_color = ToDrapeColor(lineRule->color()); params.m_width = max(lineRule->width() * scale, 1.0); @@ -216,12 +214,12 @@ dp::Anchor GetAnchor(CaptionDefProto const * capRule) m2::PointF GetOffset(CaptionDefProto const * capRule) { - float vs = VisualParams::Instance().GetVisualScale(); + double const vs = VisualParams::Instance().GetVisualScale(); m2::PointF result(0, 0); if (capRule != nullptr && capRule->has_offset_x()) - result.x = capRule->offset_x() * vs; + result.x = static_cast(capRule->offset_x() * vs); if (capRule != nullptr && capRule->has_offset_y()) - result.y = capRule->offset_y() * vs; + result.y = static_cast(capRule->offset_y() * vs); return result; } @@ -345,7 +343,7 @@ BaseApplyFeature::BaseApplyFeature(TileKey const & tileKey, TInsertShapeFn const void BaseApplyFeature::ExtractCaptionParams(CaptionDefProto const * primaryProto, CaptionDefProto const * secondaryProto, - double depth, TextViewParams & params) const + float depth, TextViewParams & params) const { dp::FontDecl decl; CaptionDefProtoToFontDecl(primaryProto, decl); @@ -424,7 +422,7 @@ void ApplyPointFeature::ProcessRule(Stylist::TRuleWrapper const & rule) return; drule::BaseRule const * pRule = rule.first; - float const depth = rule.second; + float const depth = static_cast(rule.second); SymbolRuleProto const * symRule = pRule->GetSymbol(); if (symRule != nullptr) @@ -475,22 +473,35 @@ void ApplyPointFeature::ProcessRule(Stylist::TRuleWrapper const & rule) } } -void ApplyPointFeature::Finish() +void ApplyPointFeature::Finish(CustomSymbolsContextPtr const & customSymbolsContext) { if (m_symbolRule == nullptr) return; PoiSymbolViewParams params(m_id); params.m_tileCenter = m_tileRect.Center(); - params.m_depth = m_symbolDepth; + params.m_depth = static_cast(m_symbolDepth); params.m_minVisibleScale = m_minVisibleScale; params.m_rank = m_rank; + params.m_symbolName = m_symbolRule->name(); - float const mainScale = df::VisualParams::Instance().GetVisualScale(); - params.m_extendingSize = m_symbolRule->has_min_distance() ? mainScale * m_symbolRule->min_distance() : 0; + bool prioritized = false; + if (customSymbolsContext) + { + auto customSymbolIt = customSymbolsContext->m_symbols.find(m_id); + if (customSymbolIt != customSymbolsContext->m_symbols.end()) + { + params.m_symbolName = customSymbolIt->second.m_symbolName; + prioritized = customSymbolIt->second.m_prioritized; + } + } + + double const mainScale = df::VisualParams::Instance().GetVisualScale(); + params.m_extendingSize = static_cast(m_symbolRule->has_min_distance() ? + mainScale * m_symbolRule->min_distance() : 0.0); params.m_posZ = m_posZ; params.m_hasArea = m_hasArea; - params.m_createdByEditor = m_createdByEditor; + params.m_prioritized = prioritized || m_createdByEditor; params.m_obsoleteInEditor = m_obsoleteInEditor; m_insertShape(make_unique_dp(m_centerPoint, params, m_tileKey, 0 /* text index */, @@ -728,7 +739,7 @@ void ApplyLineFeature::operator() (m2::PointD const & point) } else { - static float minSegmentLength = math::sqr(4.0 * df::VisualParams::Instance().GetVisualScale()); + static double minSegmentLength = math::sqr(4.0 * df::VisualParams::Instance().GetVisualScale()); if (m_simplify && ((m_spline->GetSize() > 1 && point.SquareLength(m_lastAddedPoint) * m_sqrScale < minSegmentLength) || m_spline->IsPrelonging(point))) @@ -799,7 +810,7 @@ void ApplyLineFeature::ProcessRule(Stylist::TRuleWrapper const & rule) params.m_minVisibleScale = m_minVisibleScale; params.m_rank = m_rank; params.m_symbolName = symRule.name(); - float const mainScale = df::VisualParams::Instance().GetVisualScale(); + double const mainScale = df::VisualParams::Instance().GetVisualScale(); params.m_offset = symRule.offset() * mainScale; params.m_step = symRule.step() * mainScale; params.m_baseGtoPScale = m_currentScaleGtoP; @@ -837,7 +848,7 @@ void ApplyLineFeature::GetRoadShieldsViewParams(ftypes::RoadShield const & shiel ASSERT (m_shieldRule != nullptr, ()); string const & roadNumber = shield.m_name; - float const mainScale = df::VisualParams::Instance().GetVisualScale(); + double const mainScale = df::VisualParams::Instance().GetVisualScale(); double const fontScale = df::VisualParams::Instance().GetFontScale(); // Text properties. @@ -858,7 +869,7 @@ void ApplyLineFeature::GetRoadShieldsViewParams(ftypes::RoadShield const & shiel textParams.m_extendingSize = 0; // Calculate width and height of a shield. - float const shieldWidth = (font.m_size * 0.5 * roadNumber.size() + 10.0f * mainScale) * fontScale; + float const shieldWidth = (font.m_size * 0.5f * roadNumber.size() + 10.0f * mainScale) * fontScale; float const shieldHeight = (font.m_size + 3.0f * mainScale) * fontScale; textParams.m_limitedText = true; textParams.m_limits = m2::PointF(shieldWidth, shieldHeight) * 0.9f; @@ -908,7 +919,7 @@ void ApplyLineFeature::GetRoadShieldsViewParams(ftypes::RoadShield const & shiel poiParams.m_extendingSize = 0; poiParams.m_posZ = 0.0f; poiParams.m_hasArea = false; - poiParams.m_createdByEditor = false; + poiParams.m_prioritized = false; poiParams.m_obsoleteInEditor = false; } } @@ -923,7 +934,7 @@ void ApplyLineFeature::Finish(std::vector && roadShields) return; uint32_t constexpr kDefaultMinDistance = 50; - float const mainScale = df::VisualParams::Instance().GetVisualScale(); + double const mainScale = df::VisualParams::Instance().GetVisualScale(); m2::PointD shieldOffset(0.0, 0.0); for (size_t shieldIndex = 0; shieldIndex < roadShields.size(); shieldIndex++) @@ -934,10 +945,10 @@ void ApplyLineFeature::Finish(std::vector && roadShields) PoiSymbolViewParams poiParams(m_id); GetRoadShieldsViewParams(shield, textParams, symbolParams, poiParams); - uint32_t minDistanceInPixels = mainScale * (m_shieldRule->has_min_distance() ? - m_shieldRule->min_distance() : kDefaultMinDistance); + uint32_t minDistanceInPixels = static_cast(mainScale * (m_shieldRule->has_min_distance() ? + m_shieldRule->min_distance() : kDefaultMinDistance)); if (minDistanceInPixels == 0) - minDistanceInPixels = mainScale * kDefaultMinDistance; + minDistanceInPixels = static_cast(mainScale * kDefaultMinDistance); uint32_t textIndex = kShieldBaseTextIndex * (shieldIndex + 1); for (auto const & spline : m_clippedSplines) diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp index 7807c47857..927795e3f4 100644 --- a/drape_frontend/apply_feature_functors.hpp +++ b/drape_frontend/apply_feature_functors.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape_frontend/custom_symbol.hpp" #include "drape_frontend/stylist.hpp" #include "drape_frontend/tile_key.hpp" #include "drape_frontend/shape_view_params.hpp" @@ -56,7 +57,7 @@ public: protected: void ExtractCaptionParams(CaptionDefProto const * primaryProto, CaptionDefProto const * secondaryProto, - double depth, TextViewParams & params) const; + float depth, TextViewParams & params) const; string ExtractHotelInfo() const; TInsertShapeFn m_insertShape; @@ -81,7 +82,7 @@ public: void operator()(m2::PointD const & point, bool hasArea); void ProcessRule(Stylist::TRuleWrapper const & rule); - void Finish(); + void Finish(CustomSymbolsContextPtr const & customSymbolsContext); protected: float const m_posZ; diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp index ce75b4cd96..253b28fd6b 100644 --- a/drape_frontend/backend_renderer.cpp +++ b/drape_frontend/backend_renderer.cpp @@ -428,6 +428,16 @@ void BackendRenderer::AcceptMessage(ref_ptr message) break; } + case Message::SetCustomSymbols: + { + ref_ptr msg = message; + m_readManager->UpdateCustomSymbols(msg->AcceptSymbols()); + m_commutator->PostMessage(ThreadsCommutator::RenderThread, + make_unique_dp(CustomSymbols()), + MessagePriority::Normal); + break; + } + default: ASSERT(false, ()); break; diff --git a/drape_frontend/custom_symbol.hpp b/drape_frontend/custom_symbol.hpp new file mode 100644 index 0000000000..9344eba715 --- /dev/null +++ b/drape_frontend/custom_symbol.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include "indexer/feature_decl.hpp" + +#include +#include +#include + +namespace df +{ +struct CustomSymbol +{ + std::string m_symbolName; + bool m_prioritized = false; + + CustomSymbol() = default; + CustomSymbol(std::string const & name, bool prioritized) + : m_symbolName(name), m_prioritized(prioritized) + {} +}; + +using CustomSymbols = std::map; + +struct CustomSymbolsContext +{ + CustomSymbols m_symbols; + + explicit CustomSymbolsContext(CustomSymbols && symbols) + : m_symbols(std::move(symbols)) + {} +}; + +using CustomSymbolsContextPtr = std::shared_ptr; +using CustomSymbolsContextWeakPtr = std::weak_ptr; +} // namespace df diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index d39a1c0851..2f5e4d6e90 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -4,15 +4,8 @@ #include "drape_frontend/gui/drape_gui.hpp" -#include "storage/index.hpp" - -#include "drape/texture_manager.hpp" - #include "platform/settings.hpp" -#include "std/bind.hpp" -#include "std/utility.hpp" - namespace df { DrapeEngine::DrapeEngine(Params && params) @@ -586,4 +579,11 @@ void DrapeEngine::RunScenario(ScenarioManager::ScenarioData && scenarioData, manager->RunScenario(move(scenarioData), onStartFn, onFinishFn); } +void DrapeEngine::SetCustomSymbols(CustomSymbols && symbols) +{ + m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread, + make_unique_dp(std::move(symbols)), + MessagePriority::Normal); +} + } // namespace df diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index 6d70cedd31..28eb82c943 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -2,6 +2,7 @@ #include "drape_frontend/backend_renderer.hpp" #include "drape_frontend/color_constants.hpp" +#include "drape_frontend/custom_symbol.hpp" #include "drape_frontend/frontend_renderer.hpp" #include "drape_frontend/route_shape.hpp" #include "drape_frontend/scenario_manager.hpp" @@ -187,6 +188,8 @@ public: ScenarioManager::ScenarioCallback const & onStartFn, ScenarioManager::ScenarioCallback const & onFinishFn); + void SetCustomSymbols(CustomSymbols && symbols); + private: void AddUserEvent(drape_ptr && e); void ModelViewChanged(ScreenBase const & screen); diff --git a/drape_frontend/drape_frontend.pro b/drape_frontend/drape_frontend.pro index 47ccfd2332..15c1b4572b 100755 --- a/drape_frontend/drape_frontend.pro +++ b/drape_frontend/drape_frontend.pro @@ -146,6 +146,7 @@ HEADERS += \ batch_merge_helper.hpp \ color_constants.hpp \ colored_symbol_shape.hpp \ + custom_symbol.hpp \ drape_api.hpp \ drape_api_builder.hpp \ drape_api_renderer.hpp \ diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index e1b6327c30..6f989572de 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -776,6 +776,13 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) break; } + case Message::SetCustomSymbols: + { + ScreenBase const & screen = m_userEventStream.GetCurrentScreen(); + InvalidateRect(screen.ClipRect()); + break; + } + default: ASSERT(false, ()); } diff --git a/drape_frontend/message.hpp b/drape_frontend/message.hpp index 2b268aab79..ba6b5bde98 100644 --- a/drape_frontend/message.hpp +++ b/drape_frontend/message.hpp @@ -75,6 +75,7 @@ public: DrapeApiAddLines, DrapeApiRemove, DrapeApiFlush, + SetCustomSymbols, }; virtual ~Message() {} diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index ec023666e1..a15245bd88 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -4,6 +4,7 @@ #include "drape_frontend/gui/skin.hpp" #include "drape_frontend/color_constants.hpp" +#include "drape_frontend/custom_symbol.hpp" #include "drape_frontend/drape_api.hpp" #include "drape_frontend/drape_api_builder.hpp" #include "drape_frontend/gps_track_point.hpp" @@ -1150,4 +1151,19 @@ private: TProperties m_properties; }; +class SetCustomSymbolsMessage : public Message +{ +public: + explicit SetCustomSymbolsMessage(CustomSymbols && symbols) + : m_symbols(move(symbols)) + {} + + Type GetType() const override { return Message::SetCustomSymbols; } + + CustomSymbols && AcceptSymbols() { return std::move(m_symbols); } + +private: + CustomSymbols m_symbols; +}; + } // namespace df diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp index 1295b246c8..1907c478f0 100644 --- a/drape_frontend/poi_symbol_shape.cpp +++ b/drape_frontend/poi_symbol_shape.cpp @@ -1,16 +1,11 @@ #include "drape_frontend/poi_symbol_shape.hpp" - #include "drape_frontend/color_constants.hpp" -#include "drape/utils/vertex_decl.hpp" #include "drape/attribute_provider.hpp" #include "drape/batcher.hpp" -#include "drape/glstate.hpp" #include "drape/texture_manager.hpp" - #include "drape/shader_def.hpp" - -#include "indexer/map_style_reader.hpp" +#include "drape/utils/vertex_decl.hpp" namespace { @@ -143,8 +138,8 @@ void PoiSymbolShape::Draw(ref_ptr batcher, ref_ptr texMng) { shared_ptr tileInfo(new TileInfo(make_unique_dp(TileKey(tileKey, m_generationCounter), - m_commutator, texMng))); + m_commutator, texMng), m_customSymbolsContext)); tileInfo->Set3dBuildings(m_have3dBuildings && m_allow3dBuildings); tileInfo->SetTrafficEnabled(m_trafficEnabled); m_tileInfos.insert(tileInfo); @@ -280,4 +280,10 @@ void ReadManager::SetTrafficEnabled(bool trafficEnabled) } } +void ReadManager::UpdateCustomSymbols(CustomSymbols && symbols) +{ + std::atomic_exchange(&m_customSymbolsContext, + std::make_shared(std::move(symbols))); +} + } // namespace df diff --git a/drape_frontend/read_manager.hpp b/drape_frontend/read_manager.hpp index 1f72f82268..360c00ca16 100755 --- a/drape_frontend/read_manager.hpp +++ b/drape_frontend/read_manager.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape_frontend/custom_symbol.hpp" #include "drape_frontend/engine_context.hpp" #include "drape_frontend/read_mwm_task.hpp" #include "drape_frontend/tile_info.hpp" @@ -41,6 +42,8 @@ public: void SetTrafficEnabled(bool trafficEnabled); + void UpdateCustomSymbols(CustomSymbols && symbols); + static uint32_t ReadCount(); private: @@ -82,6 +85,8 @@ private: using TTileInfoCollection = buffer_vector, 8>; TTilesCollection m_activeTiles; + CustomSymbolsContextPtr m_customSymbolsContext; + void CancelTileInfo(shared_ptr const & tileToCancel); void ClearTileInfo(shared_ptr const & tileToClear); void IncreaseCounter(int value); diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index efb3ca4970..0d341e069e 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -112,16 +112,18 @@ void ExtractTrafficGeometry(FeatureType const & f, df::RoadClass const & roadCla namespace df { -RuleDrawer::RuleDrawer(TDrawerCallback const & fn, +RuleDrawer::RuleDrawer(TDrawerCallback const & drawerFn, TCheckCancelledCallback const & checkCancelled, TIsCountryLoadedByNameFn const & isLoadedFn, - ref_ptr context, + ref_ptr engineContext, + CustomSymbolsContextPtr customSymbolsContext, bool is3dBuildings, bool trafficEnabled) - : m_callback(fn) + : m_callback(drawerFn) , m_checkCancelled(checkCancelled) , m_isLoadedFn(isLoadedFn) - , m_context(context) - , m_is3dBuidings(is3dBuildings) + , m_context(engineContext) + , m_customSymbolsContext(customSymbolsContext) + , m_is3dBuildings(is3dBuildings) , m_trafficEnabled(trafficEnabled) , m_wasCancelled(false) { @@ -242,7 +244,7 @@ void RuleDrawer::operator()(FeatureType const & f) !ftypes::IsBridgeChecker::Instance()(f) && !ftypes::IsTunnelChecker::Instance()(f); } - bool const is3dBuilding = m_is3dBuidings && isBuilding; + bool const is3dBuilding = m_is3dBuildings && isBuilding; m2::PointD featureCenter; @@ -310,7 +312,7 @@ void RuleDrawer::operator()(FeatureType const & f) return; s.ForEachRule(bind(&ApplyAreaFeature::ProcessRule, &apply, _1)); - apply.Finish(); + apply.Finish(m_customSymbolsContext); } else if (s.LineStyleExists()) { @@ -378,7 +380,7 @@ void RuleDrawer::operator()(FeatureType const & f) return; s.ForEachRule(bind(&ApplyPointFeature::ProcessRule, &apply, _1)); - apply.Finish(); + apply.Finish(m_customSymbolsContext); } #ifdef DRAW_TILE_NET diff --git a/drape_frontend/rule_drawer.hpp b/drape_frontend/rule_drawer.hpp index c5bcf356b8..a8870db36a 100644 --- a/drape_frontend/rule_drawer.hpp +++ b/drape_frontend/rule_drawer.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape_frontend/custom_symbol.hpp" #include "drape_frontend/map_shape.hpp" #include "drape_frontend/tile_key.hpp" #include "drape_frontend/traffic_generator.hpp" @@ -29,8 +30,11 @@ public: using TCheckCancelledCallback = function; using TIsCountryLoadedByNameFn = function; - RuleDrawer(TDrawerCallback const & drawerFn, TCheckCancelledCallback const & checkCancelled, - TIsCountryLoadedByNameFn const & isLoadedFn, ref_ptr context, + RuleDrawer(TDrawerCallback const & drawerFn, + TCheckCancelledCallback const & checkCancelled, + TIsCountryLoadedByNameFn const & isLoadedFn, + ref_ptr engineContext, + CustomSymbolsContextPtr customSymbolsContext, bool is3dBuildings, bool trafficEnabled); ~RuleDrawer(); @@ -44,11 +48,12 @@ private: TIsCountryLoadedByNameFn m_isLoadedFn; ref_ptr m_context; + CustomSymbolsContextPtr m_customSymbolsContext; m2::RectD m_globalRect; double m_currentScaleGtoP; double m_trafficScalePtoG; - bool const m_is3dBuidings; + bool const m_is3dBuildings; bool const m_trafficEnabled; TrafficSegmentsGeometry m_trafficGeometry; diff --git a/drape_frontend/shape_view_params.hpp b/drape_frontend/shape_view_params.hpp index c3bbf8dd92..4c3816fee8 100644 --- a/drape_frontend/shape_view_params.hpp +++ b/drape_frontend/shape_view_params.hpp @@ -32,7 +32,7 @@ struct PoiSymbolViewParams : CommonViewParams uint32_t m_extendingSize; float m_posZ = 0.0f; bool m_hasArea = false; - bool m_createdByEditor = false; + bool m_prioritized = false; bool m_obsoleteInEditor = false; }; diff --git a/drape_frontend/tile_info.cpp b/drape_frontend/tile_info.cpp index d147e4bb14..06bc0e2d19 100644 --- a/drape_frontend/tile_info.cpp +++ b/drape_frontend/tile_info.cpp @@ -15,13 +15,14 @@ namespace df { -TileInfo::TileInfo(drape_ptr && context) - : m_context(move(context)) +TileInfo::TileInfo(drape_ptr && engineContext, + CustomSymbolsContextWeakPtr customSymbolsContext) + : m_context(move(engineContext)) + , m_customSymbolsContext(customSymbolsContext) , m_is3dBuildings(false) , m_trafficEnabled(false) , m_isCanceled(false) -{ -} +{} m2::RectD TileInfo::GetGlobalRect() const { @@ -74,7 +75,8 @@ void TileInfo::ReadFeatures(MapDataProvider const & model) RuleDrawer drawer(bind(&TileInfo::InitStylist, this, _1, _2), bind(&TileInfo::IsCancelled, this), model.m_isCountryLoadedByName, - make_ref(m_context), m_is3dBuildings, m_trafficEnabled); + make_ref(m_context), m_customSymbolsContext.lock(), + m_is3dBuildings, m_trafficEnabled); model.ReadFeatures(bind(ref(drawer), _1), m_featureInfo); } #if defined(DRAPE_MEASURER) && defined(TILES_STATISTIC) diff --git a/drape_frontend/tile_info.hpp b/drape_frontend/tile_info.hpp index 1c43d6e640..23a5cd015d 100644 --- a/drape_frontend/tile_info.hpp +++ b/drape_frontend/tile_info.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape_frontend/custom_symbol.hpp" #include "drape_frontend/engine_context.hpp" #include "drape_frontend/tile_key.hpp" @@ -25,7 +26,8 @@ class TileInfo : private noncopyable public: DECLARE_EXCEPTION(ReadCanceledException, RootException); - TileInfo(drape_ptr && context); + TileInfo(drape_ptr && engineContext, + CustomSymbolsContextWeakPtr customSymbolsContext); void ReadFeatures(MapDataProvider const & model); void Cancel(); @@ -51,6 +53,7 @@ private: private: drape_ptr m_context; + CustomSymbolsContextWeakPtr m_customSymbolsContext; vector m_featureInfo; bool m_is3dBuildings; bool m_trafficEnabled; diff --git a/drape_frontend/visual_params.cpp b/drape_frontend/visual_params.cpp index f953568af9..e258dadfd9 100644 --- a/drape_frontend/visual_params.cpp +++ b/drape_frontend/visual_params.cpp @@ -226,9 +226,9 @@ m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center) return GetRectForDrawScale(my::rounds(drawScale), center); } -int CalculateTileSize(int screenWidth, int screenHeight) +uint32_t CalculateTileSize(uint32_t screenWidth, uint32_t screenHeight) { - int const maxSz = max(screenWidth, screenHeight); + uint32_t const maxSz = max(screenWidth, screenHeight); // we're calculating the tileSize based on (maxSz > 1024 ? rounded : ceiled) // to the nearest power of two value of the maxSz @@ -237,7 +237,9 @@ int CalculateTileSize(int screenWidth, int screenHeight) int res = 0; if (maxSz < 1024) + { res = ceiledSz; + } else { int const flooredSz = ceiledSz / 2; @@ -249,9 +251,9 @@ int CalculateTileSize(int screenWidth, int screenHeight) } #ifndef OMIM_OS_DESKTOP - return my::clamp(res / 2, 256, 1024); + return static_cast(my::clamp(res / 2, 256, 1024)); #else - return my::clamp(res / 2, 512, 1024); + return static_cast(my::clamp(res / 2, 512, 1024)); #endif } diff --git a/drape_frontend/visual_params.hpp b/drape_frontend/visual_params.hpp index 493fd452c8..7f2320b3a5 100644 --- a/drape_frontend/visual_params.hpp +++ b/drape_frontend/visual_params.hpp @@ -82,7 +82,7 @@ m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center, uint3 m2::RectD GetRectForDrawScale(int drawScale, m2::PointD const & center); m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center); -int CalculateTileSize(int screenWidth, int screenHeight); +uint32_t CalculateTileSize(uint32_t screenWidth, uint32_t screenHeight); double GetZoomLevel(double scale); double GetNormalizedZoomLevel(double scale, int minZoom = 1); diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj index 06d4746cf9..83acfb2b86 100644 --- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj +++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 454C19BD1CCE3EC0002A2C86 /* animation_system.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 454C19BA1CCE3EC0002A2C86 /* animation_system.hpp */; }; 45580ABA1E28DB2600CD535D /* scenario_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45580AB81E28DB2600CD535D /* scenario_manager.cpp */; }; 45580ABB1E28DB2600CD535D /* scenario_manager.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45580AB91E28DB2600CD535D /* scenario_manager.hpp */; }; + 457D89251E7AE89500049500 /* custom_symbol.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 457D89241E7AE89500049500 /* custom_symbol.hpp */; }; 45B4B8CB1CF5C16B00A54761 /* screen_animations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */; }; 45B4B8CC1CF5C16B00A54761 /* screen_animations.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */; }; 45B4B8CD1CF5C16B00A54761 /* screen_operations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */; }; @@ -256,6 +257,7 @@ 454C19BA1CCE3EC0002A2C86 /* animation_system.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = animation_system.hpp; sourceTree = ""; }; 45580AB81E28DB2600CD535D /* scenario_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scenario_manager.cpp; sourceTree = ""; }; 45580AB91E28DB2600CD535D /* scenario_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = scenario_manager.hpp; sourceTree = ""; }; + 457D89241E7AE89500049500 /* custom_symbol.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = custom_symbol.hpp; sourceTree = ""; }; 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen_animations.cpp; sourceTree = ""; }; 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = screen_animations.hpp; sourceTree = ""; }; 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen_operations.cpp; sourceTree = ""; }; @@ -466,6 +468,7 @@ 670947411BDF9B99005014C0 /* drape_frontend */ = { isa = PBXGroup; children = ( + 457D89241E7AE89500049500 /* custom_symbol.hpp */, 453EEA6B1E3A28F400505E09 /* colored_symbol_shape.cpp */, 453EEA6C1E3A28F400505E09 /* colored_symbol_shape.hpp */, 347F52071DC2334A0064B273 /* drape_api_builder.cpp */, @@ -749,6 +752,7 @@ 670947AA1BDF9BE1005014C0 /* path_symbol_shape.hpp in Headers */, 6709483E1BDF9C48005014C0 /* copyright_label.hpp in Headers */, 675D21921BFB871D00717E4F /* text_engine.h in Headers */, + 457D89251E7AE89500049500 /* custom_symbol.hpp in Headers */, 675D218D1BFB871D00717E4F /* proto_to_styles.hpp in Headers */, 670947951BDF9BE1005014C0 /* line_shape_helper.hpp in Headers */, 670948501BDF9C48005014C0 /* skin.hpp in Headers */,