diff options
author | kshalnev <k.shalnev@gmail.com> | 2015-06-05 21:18:41 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:51:03 +0300 |
commit | 68275d8f949a6c70475339df0923a9a70322389f (patch) | |
tree | f24dde2aea95a0c7ed3fcd134ab39f37831668ff /indexer/drawing_rules.cpp | |
parent | 61b0af91c4e4cbcaf2777c95df66e245a6f8b4b4 (diff) |
Added style reader to encapculate access to style files
Diffstat (limited to 'indexer/drawing_rules.cpp')
-rw-r--r-- | indexer/drawing_rules.cpp | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp index 64a3b7a8a8..0385c77ef5 100644 --- a/indexer/drawing_rules.cpp +++ b/indexer/drawing_rules.cpp @@ -4,6 +4,7 @@ #include "indexer/scales.hpp" #include "indexer/classificator.hpp" #include "indexer/drules_include.hpp" +#include "indexer/map_style_reader.hpp" #include "defines.hpp" @@ -11,7 +12,6 @@ #include "std/iterator_facade.hpp" #include "platform/platform.hpp" -#include "platform/settings.hpp" #include "base/logging.hpp" @@ -20,8 +20,6 @@ namespace { uint32_t const DEFAULT_BG_COLOR = 0xEEEEDD; - - char const * const MAP_STYLE_KEY = "MapStyleKey"; } namespace drule { @@ -396,20 +394,6 @@ namespace return backgroundColor; } - - string GetRulesFile(MapStyle mapStyle) - { - switch (mapStyle) - { - case MapStyleLight: - return DRAWING_RULES_LIGHT_BIN_FILE; - case MapStyleDark: - return DRAWING_RULES_DARK_BIN_FILE; - default: - LOG(LWARNING, ("Unknown map style, use light instead")); - return DRAWING_RULES_LIGHT_BIN_FILE; - } - } } void RulesHolder::LoadFromBinaryProto(string const & s) @@ -427,25 +411,10 @@ void RulesHolder::LoadFromBinaryProto(string const & s) void LoadRules() { - string const rulesFile = GetRulesFile(GetCurrentMapStyle()); - string buffer; - ModelReaderPtr(GetPlatform().GetReader(rulesFile)).ReadAsString(buffer); + GetStyleReader().GetDrawingRulesReader().ReadAsString(buffer); rules().LoadFromBinaryProto(buffer); } -MapStyle GetCurrentMapStyle() -{ - int mapStyle; - if (!Settings::Get(MAP_STYLE_KEY, mapStyle)) - mapStyle = MapStyleLight; - return static_cast<MapStyle>(mapStyle); -} - -void SetCurrentMapStyle(MapStyle mapStyle) -{ - Settings::Set(MAP_STYLE_KEY, static_cast<int>(mapStyle)); -} - } |