diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2018-07-24 13:28:42 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-07-30 12:36:04 +0300 |
commit | ffaf23d30763c1167c9b36290eb62fde67c7291c (patch) | |
tree | e4d5c6f8026cbe65cf43b22c858b294470aeff15 /drape_frontend | |
parent | f771f419b43c67a79d786db0c2740effdbe072c6 (diff) |
[indexer] Convert LoaderBase methods to const, do not store FeatureType * in shared feature loader. Remove mutable from FeatureType. Remove methods which use uninitialized FeatureType * LoaderBase::m_pFt from FeatureBase. Remove FeatureBase because noone else uses it.
Diffstat (limited to 'drape_frontend')
-rw-r--r-- | drape_frontend/map_data_provider.cpp | 3 | ||||
-rw-r--r-- | drape_frontend/map_data_provider.hpp | 7 | ||||
-rw-r--r-- | drape_frontend/read_metaline_task.cpp | 2 | ||||
-rw-r--r-- | drape_frontend/rule_drawer.cpp | 28 | ||||
-rw-r--r-- | drape_frontend/rule_drawer.hpp | 12 | ||||
-rw-r--r-- | drape_frontend/stylist.cpp | 19 | ||||
-rw-r--r-- | drape_frontend/stylist.hpp | 20 | ||||
-rw-r--r-- | drape_frontend/tile_info.cpp | 2 | ||||
-rw-r--r-- | drape_frontend/tile_info.hpp | 2 |
9 files changed, 40 insertions, 55 deletions
diff --git a/drape_frontend/map_data_provider.cpp b/drape_frontend/map_data_provider.cpp index 2993d494b2..3308050cea 100644 --- a/drape_frontend/map_data_provider.cpp +++ b/drape_frontend/map_data_provider.cpp @@ -14,7 +14,8 @@ MapDataProvider::MapDataProvider(TReadIDsFn const & idsReader, { } -void MapDataProvider::ReadFeaturesID(TReadCallback<FeatureID> const & fn, m2::RectD const & r, int scale) const +void MapDataProvider::ReadFeaturesID(TReadCallback<FeatureID const> const & fn, m2::RectD const & r, + int scale) const { m_idsReader(fn, r, scale); } diff --git a/drape_frontend/map_data_provider.hpp b/drape_frontend/map_data_provider.hpp index fe5b08ae9b..2ec8cdd364 100644 --- a/drape_frontend/map_data_provider.hpp +++ b/drape_frontend/map_data_provider.hpp @@ -14,9 +14,9 @@ namespace df class MapDataProvider { public: - template <typename T> using TReadCallback = function<void (T const &)>; + template <typename T> using TReadCallback = function<void(T &)>; using TReadFeaturesFn = function<void (TReadCallback<FeatureType> const & , vector<FeatureID> const &)>; - using TReadIDsFn = function<void (TReadCallback<FeatureID> const & , m2::RectD const &, int)>; + using TReadIDsFn = function<void(TReadCallback<FeatureID const> const &, m2::RectD const &, int)>; using TIsCountryLoadedFn = function<bool (m2::PointD const &)>; using TIsCountryLoadedByNameFn = function<bool (string const &)>; using TUpdateCurrentCountryFn = function<void (m2::PointD const &, int)>; @@ -26,7 +26,8 @@ public: TIsCountryLoadedByNameFn const & isCountryLoadedByNameFn, TUpdateCurrentCountryFn const & updateCurrentCountryFn); - void ReadFeaturesID(TReadCallback<FeatureID> const & fn, m2::RectD const & r, int scale) const; + void ReadFeaturesID(TReadCallback<FeatureID const> const & fn, m2::RectD const & r, + int scale) const; void ReadFeatures(TReadCallback<FeatureType> const & fn, vector<FeatureID> const & ids) const; TUpdateCurrentCountryFn const & UpdateCurrentCountryFn() const; diff --git a/drape_frontend/read_metaline_task.cpp b/drape_frontend/read_metaline_task.cpp index d72e238f97..41be2b15fc 100644 --- a/drape_frontend/read_metaline_task.cpp +++ b/drape_frontend/read_metaline_task.cpp @@ -72,7 +72,7 @@ std::map<FeatureID, std::vector<m2::PointD>> ReadPoints(df::MapDataProvider & mo std::sort(features.begin(), features.end()); std::map<FeatureID, std::vector<m2::PointD>> result; - model.ReadFeatures([&metaline, &failed, &result](FeatureType const & ft) + model.ReadFeatures([&metaline, &failed, &result](FeatureType & ft) { if (failed) return; diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index 16e0bca94c..57493c4e41 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -46,7 +46,7 @@ std::vector<size_t> const kAverageSegmentsCount = 10000, 5000, 10000, 5000, 2500, 5000, 2000, 1000, 500, 500 }; -double GetBuildingHeightInMeters(FeatureType const & f) +double GetBuildingHeightInMeters(FeatureType & f) { double constexpr kDefaultHeightInMeters = 3.0; double constexpr kMetersPerLevel = 3.0; @@ -72,7 +72,7 @@ double GetBuildingHeightInMeters(FeatureType const & f) return heightInMeters; } -double GetBuildingMinHeightInMeters(FeatureType const & f) +double GetBuildingMinHeightInMeters(FeatureType & f) { feature::Metadata const & md = f.GetMetadata(); std::string value = md.Get(feature::Metadata::FMD_MIN_HEIGHT); @@ -86,7 +86,7 @@ double GetBuildingMinHeightInMeters(FeatureType const & f) return minHeightInMeters; } -df::BaseApplyFeature::HotelData ExtractHotelData(FeatureType const & f) +df::BaseApplyFeature::HotelData ExtractHotelData(FeatureType & f) { df::BaseApplyFeature::HotelData result; if (ftypes::IsBookingChecker::Instance()(f)) @@ -162,7 +162,7 @@ void ExtractTrafficGeometry(FeatureType const & f, df::RoadClass const & roadCla } } -bool UsePreciseFeatureCenter(FeatureType const & f) +bool UsePreciseFeatureCenter(FeatureType & f) { // Add here types for which we want to calculate precise feature center (by best geometry). // Warning! Large amount of such objects can reduce performance. @@ -232,7 +232,7 @@ bool RuleDrawer::CheckCancelled() return m_wasCancelled; } -bool RuleDrawer::CheckCoastlines(FeatureType const & f, Stylist const & s) +bool RuleDrawer::CheckCoastlines(FeatureType & f, Stylist const & s) { int const zoomLevel = m_context->GetTileKey().m_zoomLevel; @@ -256,9 +256,8 @@ bool RuleDrawer::CheckCoastlines(FeatureType const & f, Stylist const & s) return true; } -void RuleDrawer::ProcessAreaStyle(FeatureType const & f, Stylist const & s, - TInsertShapeFn const & insertShape, - int & minVisibleScale) +void RuleDrawer::ProcessAreaStyle(FeatureType & f, Stylist const & s, + TInsertShapeFn const & insertShape, int & minVisibleScale) { bool isBuilding = false; bool is3dBuilding = false; @@ -343,9 +342,8 @@ void RuleDrawer::ProcessAreaStyle(FeatureType const & f, Stylist const & s, apply.Finish(m_context->GetTextureManager()); } -void RuleDrawer::ProcessLineStyle(FeatureType const & f, Stylist const & s, - TInsertShapeFn const & insertShape, - int & minVisibleScale) +void RuleDrawer::ProcessLineStyle(FeatureType & f, Stylist const & s, + TInsertShapeFn const & insertShape, int & minVisibleScale) { int const zoomLevel = m_context->GetTileKey().m_zoomLevel; @@ -412,7 +410,7 @@ void RuleDrawer::ProcessLineStyle(FeatureType const & f, Stylist const & s, }; bool const oneWay = ftypes::IsOneWayChecker::Instance()(f); - auto const highwayClass = ftypes::GetHighwayClass(f); + auto const highwayClass = ftypes::GetHighwayClass(feature::TypesHolder(f)); for (size_t i = 0; i < ARRAY_SIZE(checkers); ++i) { auto const & classes = checkers[i].m_highwayClasses; @@ -432,8 +430,8 @@ void RuleDrawer::ProcessLineStyle(FeatureType const & f, Stylist const & s, } } -void RuleDrawer::ProcessPointStyle(FeatureType const & f, Stylist const & s, TInsertShapeFn const & insertShape, - int & minVisibleScale) +void RuleDrawer::ProcessPointStyle(FeatureType & f, Stylist const & s, + TInsertShapeFn const & insertShape, int & minVisibleScale) { if (m_customFeaturesContext && m_customFeaturesContext->NeedDiscardGeometry(f.GetID())) return; @@ -462,7 +460,7 @@ void RuleDrawer::ProcessPointStyle(FeatureType const & f, Stylist const & s, TIn apply.Finish(m_context->GetTextureManager()); } -void RuleDrawer::operator()(FeatureType const & f) +void RuleDrawer::operator()(FeatureType & f) { if (CheckCancelled()) return; diff --git a/drape_frontend/rule_drawer.hpp b/drape_frontend/rule_drawer.hpp index 7fed3f8284..b09b990871 100644 --- a/drape_frontend/rule_drawer.hpp +++ b/drape_frontend/rule_drawer.hpp @@ -29,7 +29,7 @@ class Stylist; class RuleDrawer { public: - using TDrawerCallback = std::function<void(FeatureType const &, Stylist &)>; + using TDrawerCallback = std::function<void(FeatureType &, Stylist &)>; using TCheckCancelledCallback = std::function<bool()>; using TIsCountryLoadedByNameFn = std::function<bool(std::string const &)>; using TInsertShapeFn = function<void(drape_ptr<MapShape> && shape)>; @@ -40,17 +40,17 @@ public: ref_ptr<EngineContext> engineContext); ~RuleDrawer(); - void operator()(FeatureType const & f); + void operator()(FeatureType & f); private: - void ProcessAreaStyle(FeatureType const & f, Stylist const & s, TInsertShapeFn const & insertShape, + void ProcessAreaStyle(FeatureType & f, Stylist const & s, TInsertShapeFn const & insertShape, int & minVisibleScale); - void ProcessLineStyle(FeatureType const & f, Stylist const & s, TInsertShapeFn const & insertShape, + void ProcessLineStyle(FeatureType & f, Stylist const & s, TInsertShapeFn const & insertShape, int & minVisibleScale); - void ProcessPointStyle(FeatureType const & f, Stylist const & s, TInsertShapeFn const & insertShape, + void ProcessPointStyle(FeatureType & f, Stylist const & s, TInsertShapeFn const & insertShape, int & minVisibleScale); - bool CheckCoastlines(FeatureType const & f, Stylist const & s); + bool CheckCoastlines(FeatureType & f, Stylist const & s); #ifdef DRAW_TILE_NET void DrawTileNet(TInsertShapeFn const & insertShape); diff --git a/drape_frontend/stylist.cpp b/drape_frontend/stylist.cpp index 3a89abf6cb..6a507982bd 100644 --- a/drape_frontend/stylist.cpp +++ b/drape_frontend/stylist.cpp @@ -72,9 +72,7 @@ bool IsMiddleTunnel(int const layer, double const depth) class Aggregator { public: - Aggregator(FeatureType const & f, - feature::EGeomType const type, - int const zoomLevel, + Aggregator(FeatureType & f, feature::EGeomType const type, int const zoomLevel, int const keyCount) : m_pointStyleFound(false) , m_lineStyleFound(false) @@ -152,7 +150,7 @@ private: } } - FeatureType const & m_f; + FeatureType & m_f; feature::EGeomType m_geomType; int const m_zoomLevel; double m_priorityModifier; @@ -186,11 +184,8 @@ IsHatchingTerritoryChecker::IsHatchingTerritoryChecker() m_types.push_back(c.GetTypeByPath({p[0], p[1]})); } -void CaptionDescription::Init(FeatureType const & f, - int8_t deviceLang, - int const zoomLevel, - feature::EGeomType const type, - drule::text_type_t const mainTextType, +void CaptionDescription::Init(FeatureType & f, int8_t deviceLang, int const zoomLevel, + feature::EGeomType const type, drule::text_type_t const mainTextType, bool const auxCaptionExists) { if (auxCaptionExists || type == feature::GEOM_LINE) @@ -329,7 +324,7 @@ CaptionDescription & Stylist::GetCaptionDescriptionImpl() return m_captionDescriptor; } -bool InitStylist(FeatureType const & f, int8_t deviceLang, int const zoomLevel, bool buildings3d, Stylist & s) +bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool buildings3d, Stylist & s) { feature::TypesHolder const types(f); @@ -386,10 +381,10 @@ bool InitStylist(FeatureType const & f, int8_t deviceLang, int const zoomLevel, return true; } -double GetFeaturePriority(FeatureType const & f, int const zoomLevel) +double GetFeaturePriority(FeatureType & f, int const zoomLevel) { drule::KeysT keys; - pair<int, bool> const geomType = feature::GetDrawRule(f, zoomLevel, keys); + pair<int, bool> const geomType = feature::GetDrawRule(feature::TypesHolder(f), zoomLevel, keys); feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys); diff --git a/drape_frontend/stylist.hpp b/drape_frontend/stylist.hpp index 2e89218e9f..27009c4e50 100644 --- a/drape_frontend/stylist.hpp +++ b/drape_frontend/stylist.hpp @@ -38,12 +38,8 @@ public: struct CaptionDescription { - void Init(FeatureType const & f, - int8_t deviceLang, - int const zoomLevel, - feature::EGeomType const type, - drule::text_type_t const mainTextType, - bool const auxCaptionExists); + void Init(FeatureType & f, int8_t deviceLang, int const zoomLevel, feature::EGeomType const type, + drule::text_type_t const mainTextType, bool const auxCaptionExists); string const & GetMainText() const; string const & GetAuxText() const; @@ -83,10 +79,7 @@ public: bool IsEmpty() const; private: - friend bool InitStylist(FeatureType const & f, - int8_t deviceLang, - int const zoomLevel, - bool buildings3d, + friend bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool buildings3d, Stylist & s); void RaiseCoastlineFlag(); @@ -104,12 +97,9 @@ private: CaptionDescription m_captionDescriptor; }; -bool InitStylist(FeatureType const & f, - int8_t deviceLang, - int const zoomLevel, - bool buildings3d, +bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool buildings3d, Stylist & s); -double GetFeaturePriority(FeatureType const & f, int const zoomLevel); +double GetFeaturePriority(FeatureType & f, int const zoomLevel); } // namespace df diff --git a/drape_frontend/tile_info.cpp b/drape_frontend/tile_info.cpp index 06745187f0..2836609615 100644 --- a/drape_frontend/tile_info.cpp +++ b/drape_frontend/tile_info.cpp @@ -92,7 +92,7 @@ bool TileInfo::IsCancelled() const return m_isCanceled; } -void TileInfo::InitStylist(int8_t deviceLang, FeatureType const & f, Stylist & s) +void TileInfo::InitStylist(int8_t deviceLang, FeatureType & f, Stylist & s) { CheckCanceled(); df::InitStylist(f, deviceLang, m_context->GetTileKey().m_zoomLevel, diff --git a/drape_frontend/tile_info.hpp b/drape_frontend/tile_info.hpp index 43f245cbc8..5f48a9de10 100644 --- a/drape_frontend/tile_info.hpp +++ b/drape_frontend/tile_info.hpp @@ -37,7 +37,7 @@ public: private: void ReadFeatureIndex(MapDataProvider const & model); - void InitStylist(int8_t deviceLang, FeatureType const & f, Stylist & s); + void InitStylist(int8_t deviceLang, FeatureType & f, Stylist & s); void CheckCanceled() const; bool DoNeedReadIndex() const; |