diff --git a/generator/classif_routine.cpp b/generator/classif_routine.cpp index f666f26a9d..e7aa5f3cbf 100644 --- a/generator/classif_routine.cpp +++ b/generator/classif_routine.cpp @@ -3,6 +3,12 @@ #include "../indexer/classificator.hpp" #include "../indexer/drawing_rules.hpp" +#include "../indexer/file_reader_stream.hpp" +#include "../indexer/scales.hpp" + +#include "../platform/platform.hpp" + +#include "../base/logging.hpp" #include "../base/start_mem_debug.hpp" @@ -23,21 +29,26 @@ namespace classificator void GenerateAndWrite(string const & path) { - // Experimental - add drawing rules in programm. - //string const fullName = path + "drawing_rules.bin"; - //drule::ReadRules(fullName.c_str()); + // Experimental - add drawing rules in program. - //int const color = 0; - //double const pixWidth = 1.5; - //for (int i = 0; i <= scales::GetUpperScale(); ++i) - //{ - // size_t const ind = drule::rules().AddLineRule(i, color, pixWidth); - // LOG_SHORT(LINFO, ("Scale = ", i, "; Index = ", ind)); - //} +// // 1. Read rules. +// string const name = "drawing_rules.bin"; +// ReaderPtrStream rulesS(GetPlatform().GetReader(name)); +// drule::ReadRules(rulesS); - //drule::WriteRules(fullName.c_str()); +// // 2. Append rules. +// //int const color = 0; +// int const color = 0xD3D3D3; +// //double const pixWidth = 1.5; +// for (int i = 0; i <= scales::GetUpperScale(); ++i) +// { +// //size_t const ind = drule::rules().AddLineRule(i, color, pixWidth); +// size_t const ind = drule::rules().AddAreaRule(i, color); +// LOG_SHORT(LINFO, ("Scale = ", i, "; Index = ", ind)); +// } - //return; +// drule::WriteRules((path + name).c_str()); +// return; // 1. generic types parse_osm_types(0, 11, path + "styles/caption-z"); diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp index ab7c85d909..05f028e196 100644 --- a/indexer/drawing_rules.cpp +++ b/indexer/drawing_rules.cpp @@ -994,6 +994,13 @@ size_t RulesHolder::AddLineRule(int32_t scale, int color, double pixWidth) return AddRule(scale, line, p); } +size_t RulesHolder::AddAreaRule(int32_t scale, int color) +{ + AreaRule * p = new AreaRule(); + p->m_params.get<0>() = color_t(color); + return AddRule(scale, area, p); +} + BaseRule const * RulesHolder::Find(Key const & k) const { rules_map_t::const_iterator i = m_rules.find(k.m_scale); diff --git a/indexer/drawing_rules.hpp b/indexer/drawing_rules.hpp index bf710725a8..664d609519 100644 --- a/indexer/drawing_rules.hpp +++ b/indexer/drawing_rules.hpp @@ -130,6 +130,7 @@ namespace drule size_t AddRule(int32_t scale, rule_type_t type, BaseRule * p); size_t AddLineRule(int32_t scale, int color, double pixWidth); + size_t AddAreaRule(int32_t scale, int color); void Clean();