diff options
author | vng <viktor.govako@gmail.com> | 2010-12-10 01:30:29 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:08:23 +0300 |
commit | 0f6dc10b27567dd5e7f638d36f4875c9440b2a88 (patch) | |
tree | 06c94f9b04c4e7821b38236841bad4edc3fa862a /indexer/drawing_rules.cpp | |
parent | 057597e385d0db34f681a0098dbeed62e636922e (diff) |
Add program routine for adding drawing rules. Add default line style for coastlines.
Diffstat (limited to 'indexer/drawing_rules.cpp')
-rw-r--r-- | indexer/drawing_rules.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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<uint32_t> & 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); |