diff --git a/data/classificator.txt b/data/classificator.txt index f57dc76a0b..fb24dc48ee 100644 --- a/data/classificator.txt +++ b/data/classificator.txt @@ -43,7 +43,7 @@ world + {} natural + land 6|1|0|0 7|1|0|0 8|1|0|0 9|1|0|0 10|1|0|0 11|1|0|0 12|1|0|0 13|1|4|7 14|1|5|9 15|1|5|9 16|1|5|9 17|1|5|9 - - coastline 6|1|2|7 7|1|2|7 8|1|2|7 9|1|2|7 10|1|2|7 11|1|2|7 12|1|1|1 13|1|3|5 14|1|4|7 15|1|4|7 16|1|4|7 17|1|4|7 - + coastline 0|0|1|100 1|0|1|100 2|0|1|100 3|0|1|100 4|0|1|100 5|0|1|100 6|0|63|100 6|1|2|7 7|0|64|100 7|1|2|7 8|0|23|100 8|1|2|7 9|0|19|100 9|1|2|7 10|0|61|100, 10|1|2|7 11|0|61|100 11|1|2|7 12|0|184|100 12|1|1|1 13|0|191|100 13|1|3|5 14|0|226|100 14|1|4|7 15|0|237|100 15|1|4|7 16|0|366|100 16|1|4|7 17|0|388|100 17|1|4|7 - forest 6|1|3|10 7|1|3|11 8|1|3|11 9|1|3|11 10|1|3|11 11|1|3|11 12|1|2|6 13|1|5|11 14|1|10|29 15|1|10|29 15|3|2|2841 15|3|3|2869 16|1|10|29 17|1|10|29 + [wood] - coniferous 14|1|7|11 15|1|7|11 16|1|7|11 17|1|7|11 - diff --git a/data/drawing_rules.bin b/data/drawing_rules.bin index 7f03f2a4ce..f6b9d59287 100644 Binary files a/data/drawing_rules.bin and b/data/drawing_rules.bin differ diff --git a/data/visibility.txt b/data/visibility.txt index e9bbd782fd..ac0aa773b8 100644 --- a/data/visibility.txt +++ b/data/visibility.txt @@ -768,7 +768,7 @@ world 000000000000000000 + brownfield 000000000000000100 - cave_entrance 000000000000001111 - cemetery 000000000000000100 - - coastline 000000111111111111 - + coastline 111111111111111111 - commercial 000000000000000100 - construction 000000000000000100 - farm 000000000000000100 - diff --git a/indexer/classif_routine.cpp b/indexer/classif_routine.cpp index ee6c0356ac..5b5397912d 100644 --- a/indexer/classif_routine.cpp +++ b/indexer/classif_routine.cpp @@ -3,9 +3,12 @@ #include "drawing_rules.hpp" #include "../indexer/osm2type.hpp" +#include "../indexer/scales.hpp" #include "../coding/reader.hpp" +#include "../base/logging.hpp" + #include "../std/stdio.hpp" #include "../base/start_mem_debug.hpp" @@ -36,6 +39,22 @@ 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()); + + //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)); + //} + + //drule::WriteRules(fullName.c_str()); + + //return; + // 1. generic types parse_osm_types(0, 11, path + "styles/caption-z"); parse_osm_types(6, 17, path + "styles/osm-map-features-z"); diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp index 270693ce3d..f7a7c72793 100644 --- a/indexer/drawing_rules.cpp +++ b/indexer/drawing_rules.cpp @@ -4,6 +4,7 @@ #include "file_reader_stream.hpp" #include "file_writer_stream.hpp" #include "std_serialization.hpp" +#include "scales.hpp" #include "../coding/file_reader.hpp" #include "../coding/file_writer.hpp" @@ -959,6 +960,29 @@ Key RulesHolder::CreateRuleImpl2(string const & name, } } +size_t RulesHolder::AddRule(int32_t scale, rule_type_t type, BaseRule * p) +{ + ASSERT ( 0 <= scale && scale <= scales::GetUpperScale(), (scale) ); + ASSERT ( 0 <= type && type < count_of_rules, () ); + + m_container[type].push_back(p); + + vector & v = m_rules[scale][type]; + v.push_back(m_container[type].size()-1); + + size_t const ret = v.size() - 1; + ASSERT ( Find(Key(scale, type, ret)) == p, (ret) ); + return ret; +} + +size_t RulesHolder::AddLineRule(int32_t scale, int color, double pixWidth) +{ + LineRule * p = new LineRule(); + p->m_params.get<4>() = color_t(color); + p->m_params.get<5>() = pixWidth / scales::GetM2PFactor(scale); + return AddRule(scale, line, 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 aa962b245b..6a6a190f52 100644 --- a/indexer/drawing_rules.hpp +++ b/indexer/drawing_rules.hpp @@ -84,6 +84,9 @@ namespace drule public: ~RulesHolder(); + size_t AddRule(int32_t scale, rule_type_t type, BaseRule * p); + size_t AddLineRule(int32_t scale, int color, double pixWidth); + void Clean(); void SetParseFile(char const * fPath, int scale);